Skip to content

Fix panic in RLP trie node decoding on empty partial key - #856

Open
Tyagiquamar wants to merge 1 commit into
availproject:mainfrom
Tyagiquamar:fix/trie-decode-empty-partial-key
Open

Tyagiquamar wants to merge 1 commit into
availproject:mainfrom
Tyagiquamar:fix/trie-decode-empty-partial-key

Conversation

@Tyagiquamar

Copy link
Copy Markdown

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.

@Tyagiquamar

Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant