Skip to content
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

fix: handle both compressed and uncompressed disconnect reason decoding #6862

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Feb 28, 2024

The following error sometimes shows up on nodes:

error decompressing p2p message err=snappy: corrupt input (header mismatch; expected 577 decompressed bytes but got 0) msg=c104

The message c104 is a disconnect reason, and it is uncompressed. We send compressed disconnect reasons. However, some other clients send uncompressed disconnect reasons. This adds handling for decoding uncompressed disconnect reasons in P2PStream, along with a test.

@Rjected Rjected added C-bug An unexpected or incorrect behavior A-devp2p Related to the Ethereum P2P protocol A-networking Related to networking in general labels Feb 28, 2024
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

nice find, pedantic doc nit

// over the wire, in both snappy compressed and uncompressed forms.
//
// see:
// <https://github.com/paradigmxyz/reth/blob/790bc62e7bd8f940e7b3ff55c98fa6f5a2b197e9/crates/net/eth-wire/src/disconnect.rs#L251-L261>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we reference the function instead of the blob

Comment on lines +429 to +430
// * snappy compressed, AND
// * uncompressed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why??? :D

@@ -472,6 +485,17 @@ where
// if we were waiting for a pong, this will reset the pinger state
this.pinger.on_pong()?
}
_ if id == P2PMessageID::Disconnect as u8 => {
// it's possible we already tried to decode this, but it was snappy compressed,
// so we need to decode it again
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should mention that this is now snappy decoded

@Rjected Rjected added this pull request to the merge queue Feb 29, 2024
Merged via the queue into main with commit 7d36206 Feb 29, 2024
29 checks passed
@Rjected Rjected deleted the dan/decode-disconnect-reasons-uncompressed branch February 29, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devp2p Related to the Ethereum P2P protocol A-networking Related to networking in general C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants