Conversation
TallinN (proto_024) changed the wire encoding for refused, outdated, branch_refused, and branch_delayed operations to use a dyn-prefixed Branch field (4-byte big-endian uint32 length + 32 bytes) instead of the raw 32-byte Branch used by validated ops. PendingOperationsListWithError was embedding PendingOperationsList which uses raw Branch encoding, causing the 4-byte dyn prefix to be misinterpreted as part of the Branch hash. The subsequent 4 bytes were then read as the Contents dyn length, producing enormous values like 3,681,343,224 and the "buffer is too short" error. Fix by inlining the fields from PendingOperationsList and adding tz:"dyn" to the Branch field. PendingOperationsList itself is unchanged since validated ops still use raw Branch encoding. UnprocessedPendingOperationsList already had tz:"dyn" on Branch and is unaffected.
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.
Problem
TallinN (proto_024
PtTALLiNtPec7mE7yY4m3k26J8Qukef3E3ehzhfXgFZKGtDdAXu) changed the wire encoding forrefused,outdated,branch_refused, andbranch_delayedoperations: theBranchfield is now dyn-prefixed (4-byte big-endian uint32 length0x00000020= 32, then 32 bytes) instead of the raw 32-byte encoding used in earlier protocols.validatedops still use raw 32-byte Branch — only the error bucket types changed.Impact
PendingOperationsListWithErrorembedsPendingOperationsListwhich uses raw Branch. When decoding TallinN refused/outdated ops:0x00000020is read as the last 4 bytes of the Branch hashContentsdyn length3,681,343,224) →"buffer is too short, at least 3681343224 byte(s) were expected"The sidecar doesn't crash — ops that fail to parse are skipped — but mempool counts are under-reported for all non-validated operations.
Fix
Inline the fields from
PendingOperationsListintoPendingOperationsListWithErrorand addtz:"dyn"to theBranchfield.PendingOperationsListitself is unchanged — validated ops still use raw Branch encoding.UnprocessedPendingOperationsListalready hastz:"dyn"on Branch and is unaffected.Verification
go test ./...passes, includingclientv2/mempoolandproto_024_PtTALLiN0x00000020at offset 0 of the Branch field; validated ops use raw 32-byte Branch