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
p2p: snappy encoding for devp2p (version bump to 5) #15106
Conversation
67e6505
to
7dfe290
Compare
p2p/rlpx.go
Outdated
if err != nil { | ||
return 0, err | ||
if size > int(maxUint24) { | ||
return msg, errors.New("decompressed message size overflows uint24") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, "decompressed message exceeds 16MB" is too user-friendly ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)) The user won't see this. But the existing counterpart in write is "message size exceeds uint24".
Though you made me realize I need a check in write too before I compress.
7dfe290
to
db38c4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* p2p: snappy encoding for devp2p (version bump to 5) * p2p: remove lazy decompression, enforce 16MB limit
* p2p: snappy encoding for devp2p (version bump to 5) * p2p: remove lazy decompression, enforce 16MB limit
* p2p: snappy encoding for devp2p (version bump to 5) * p2p: remove lazy decompression, enforce 16MB limit
Implements ethereum/EIPs#706.
This PR bumps the version number of the devp2p protocol to v5 and implements (mandatory) Snappy compression for the message payload fields. The results are staggering:
Rinkeby fast sync without compression:
Rinkeby fast sync with Snappy encoding:
Mainnet fast sync without compression:
Mainnet fast sync with Snappy encoding: