execution, p2p: fix ssTxs encoding / add missing HF blocks#130
Merged
Conversation
kamuikatsurgi
approved these changes
Mar 3, 2026
pratikspatil024
approved these changes
Mar 4, 2026
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.
While debugging the sensors, Minh found some failures to rlp decode blocks, coming from erigon nodes.
The error is
error: rlp: value size exceeds available input lengthApparently, blocks containing
PIP-74state sync txs were being encoded with an inflated RLP list prefix, causing peers to fail decoding it.The root cause has been identified in
StateSyncTx.EncodingSize()returningrlp.StringLen(data), which includes the outer RLP string prefix in its return value. All other typed transactions (e.g.,AccessListTx,DynamicFeeTx, etc...) return the envelope size without the outer prefix, because the functionEncodingSizeGenericListadds that prefix itself viarlp.ListPrefixLen(size) + size. The double-counted prefix inflated the len by some bites perStateSyncTx, which propagated up to the block's outer RLP list prefix, declaring more bytes than were actually written.The function
EncodingSize()has been changed to to return1 + b.Len()(type byte + encoded payload). This is equivalent to the1 + rlp.ListPrefixLen(payloadSize) + payloadSizepattern used by other typed transactions. The difference is thatStateSyncTxdelegates inner encoding torlp.Encode()which already includes the list prefix inb.Len(), whereas other types computepayloadSizeas raw field sums and add the list prefix explicitly. Ofc, this only affects blocks after theMadhugirifork that contained state sync events.Furthermore, there were some missing Bor fork IDs in
GatherForks(), which only registeredAgra,Napoli, andBhilaifor Bor chains. All post-Bhilai forks were missing, so the fork ID checksum didn't potentially change at those boundaries and incompatible peers weren't filtered during the eth handshake. To serve this purpose, I also addedIsDandeli/GetDandeliBlockto theBorConfiginterface (was the only fork missing a getter) and registered all forks inGatherForks().All changes are provided with tests.