feat(p2p): log publish-side gossip diagnostics before publish#401
Draft
MegaRedHand wants to merge 1 commit into
Draft
feat(p2p): log publish-side gossip diagnostics before publish#401MegaRedHand wants to merge 1 commit into
MegaRedHand wants to merge 1 commit into
Conversation
Emit a diagnostic log line on every gossip publish (block, attestation, aggregation) immediately after snappy encoding and before publish(), so a captured on-wire message can be reconciled against what a peer logs on receipt. This is to debug cross-client snappy/SSZ corruption such as blockblaz/zeam#942. Each line carries topic, slot (plus proposer/block_root for blocks), sha256 of the SSZ and of the compressed payload, compressed_len, a snappy self-decode round-trip check (local-encoder canary), the gossipsub message_id, the client git SHA, and the snappy lib/version. The message_id is computed through a shared gossip_message_id(topic, data) that the gossipsub message_id_fn now also delegates to, so the logged id provably matches the one peers assign. git SHA and the resolved `snap` crate version are surfaced at build time via a new p2p build.rs (vergen for the SHA, Cargo.lock parse for the snappy version); hex moves from a dev-dependency to a regular dependency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Emit a diagnostic log line on every gossip publish (block, attestation, aggregation), immediately after snappy encoding and before
publish(), so a captured on-wire message can be reconciled against what a peer logs on receipt. Built to debug cross-client snappy/SSZ corruption such as blockblaz/zeam#942.Fields logged
topicslotproposer/block_rootvalidatorssz_sha256compressed_sha256compressed_lensnappy_self_decode_okdecompress(compressed) == ssz; local-encoder corruption canarymessage_idgit_shasnappyrust-snap/<ver>)How
gossip_message_id(topic, data); the gossipsubmessage_id_fnnow delegates to it, so the logged id provably matches what peers assign.crates/net/p2p/build.rsto surface build-time values:VERGEN_GIT_SHA(mirrors the bin crate) andSNAP_VERSIONparsed from the workspaceCargo.lock(thesnapcrate exposes no version const, and Cargo surfaces no dep-version env var).hexfrom a dev-dependency to a regular dependency.Verification
Ran a local 4-node devnet (20 slots, finalized to slot 19). Confirmed:
git_sha=abfdd7b,snappy=rust-snap/1.1.1(matchgit rev-parse --short HEAD+Cargo.lock).snappy_self_decode_ok=false: 0; receive-side decompress/decode errors: 0.compressed_len=370444, past snappy's 64 KB block boundary) that the #942 corruption requires.Sample (block):
Notes
info-level on every published message, so attestation subnets are chatty. Easy to drop attestation/aggregation todebugand keep blocks atinfo, or gate behind a flag, if reviewers prefer.