Fix panic in RLP trie node decoding on empty partial key - #856
Open
Tyagiquamar wants to merge 1 commit into
Open
Tyagiquamar wants to merge 1 commit into
Tyagiquamar wants to merge 1 commit into
Conversation
Author
|
Hi, just following up on this when you get a chance. The branch is up to date and checks are green. If it looks good from your side, it should be ready to merge. Happy to make any changes if needed. Thanks! |
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.
Pull Request type - [x] Bugfix ## Description RlpNodeCodec::decode_plan indexed data[0] without checking for an empty first item, so a 2-item RLP node with an empty partial key (e.g. 0xc28080) panicked with index out of bounds instead of returning Err. An empty first item can never be a valid compact-encoded partial key, so decoding now returns DecoderError. This codec backs the vector pallet bridge proof verification (get_storage_root/get_storage_value), where a decoder panic would crash block execution instead of failing the extrinsic gracefully. ## Related Issues No open issue covers this. Triaged all 4 open issues: #750 needs a full avail-node build to verify (out of scope for a leaf-crate fix), #820 is docs, #821 needs a release Docker build, #822 is a new node feature. No competing PR touches patricia-merkle-trie. ## Testing Performed - cargo test -p patricia-merkle-trie: 2 passed, 0 failed (new regression test failed unpatched with the reported panic, passes patched; existing EIP-1186 proof test still passes) - cargo fmt -p patricia-merkle-trie -- --check: clean - cargo clippy -p patricia-merkle-trie --all-targets -- -D warnings: no warnings ## Checklist - [x] I have performed a self-review of my own code. - [x] The tests pass successfully with cargo test. - [x] The code was formatted with cargo fmt. - [x] The code has no new warnings when using cargo clippy.