Draft
Conversation
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
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.
PR description
Snap/eth message zero-copy encoding and memory-safe decoding improvements
Description
Summary
logic
Zero-copy message wrapping
Replaced data-copying implementations of wrapMessageData / unwrapMessageData with zero-copy
splicing using Bytes.wrap() and Bytes.slice():
BytesValueRLPOutput.writeRaw() to wrap and Bytes.concatenate() to unwrap, copying the entire
message payload each time. The new implementation uses Bytes.wrap(header, reqIdBytes, data)
for wrapping and Bytes.slice() for unwrapping — no copies.
hand-rolled rlpListHeader() and inline header-size calculation. Both now delegate to the new
RLP utility methods.
RLP public API additions
Added two utility methods to org.hyperledger.besu.ethereum.rlp.RLP:
Delegates to the existing internal RLPEncodingHelpers.writeListHeader().
inspecting the prefix byte.
These replace duplicated RLP header logic that was previously inlined in
AbstractSnapMessageData.
BlockAccessList message cleanup
Removed the Optional requestId parameter from BlockAccessListsMessageData.encode()
and GetBlockAccessListsMessageData.encode(). These messages now encode without a requestId,
consistent with all other snap messages, and rely on AbstractSnapMessageData.wrapMessageData()
to splice it in when needed.
GetTrieNodes improvements
Added per-path size validation (MAX_PATH_SIZE = 33) and a total path cap (MAX_TOTAL_PATHS =
1024) to GetTrieNodesMessage.paths() decoding.