-
Notifications
You must be signed in to change notification settings - Fork 986
p2p: log message sizes; warn on >1x; demote Ping/Pong to debug (#2825) also fixes PIBD Sync bug #3811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
I will test this when I have time. |
This removes changes introducd by mimblewimble#3810 (AI-generated slop), keeping only my own message size logging modifications.
I tested this PR by syncing the node on main-net three times. The node synced just fine. One time I encountered a database error, but I think that was coinciding with me running out of HD space and after cleanup it did not reoccur. I did a 4th test run where I revert to the 365 Header size to confirm that I will indeed get Header messages that exceed the previous 365 threshold and indeed most headers messages are to large in size with the old threshold. Surprising that this was not caught earlier. I did not measure any speed up, but most importantly I did not encounter any stalling/freezing of the node, so it appears that either A) this PR fixes the syncing stalled error or B) An attacker has stopped spamming the node network with messages that caused nodes to freeze up. What was bothering me about the Header messaging as a whole. The threshold |
Summary
Adds logging to surface P2P message sizes versus configured limits, so we can validate the 1x limits before changing enforcement (ref #2825). Also raises the stale Header size cap to 420 B (was 365 B) since headers on mainnet are consistently ~415 B.
What changed
• Inserted size logging in p2p/src/codec.rs after header decode:
• info! (or debug! for Ping/Pong) line: p2p(codec): size= (1x=, 4x=)
• warn! when msg_len > 1x (still under the existing 4× cap).
• Demoted Ping/Pong logs to debug! to avoid info-level spam in normal operation.
• Bumped Header 1× limit from 365 B → 420 B, and updated Headers batch accordingly.
• No wire format, consensus, or API changes; logging + cap maintenance only.
Why
Historically we allowed up to 4× the nominal limits for flexibility. With this patch we surface real sizes so limits can be tuned. Logs revealed that all headers today are ~415 B, making the old 365 B limit stale. Raising it to 420 B removes noisy warnings while keeping 4× safety margin unchanged.
How I tested
p2p(codec): Ping size=16 (1x=16, 4x=64)
(at DEBUG)p2p(codec): CompactBlock size=1268 (1x=134803, 4x=539212)
(at INFO)p2p(codec): Header exceeds 1x limit (415 > 365)
(at WARN)warn!
only triggers when >1x, and that Ping/Pong no longer spam INFO.Risks / Perf
Notes