Skip to content

Conversation

@turuslan
Copy link
Contributor

@turuslan turuslan commented Oct 2, 2025

- partial prefix for attached value was not appended
- support for child trie root prefix
Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide some test for these changes.

- decode compact proof to prefixed db, trie read failed
@turuslan turuslan requested a review from bkchr October 2, 2025 16:44
) {
// Reconstruct the partial DB from the compact encoding.
let mut db = MemoryDB::<L>::default();
let mut db = PrefixedMemoryDB::<L>::default();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can not just change an existing test if you introduce new code. We for sure want to ensure that both still work.

Also you don't use your newly introduced function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made new function decode_compact_from_iter_with_prefix to avoid breaking interface (new root_prefix arg).
Old decode_compact_from_iter just calls decode_compact_from_iter_with_prefix with empty prefix.

This test with PrefixedMemoryDB panics on master, so this branch fixes existing functionality.

- test both MemoryDB and PrefixedMemoryDB
@turuslan turuslan requested a review from bkchr October 3, 2025 05:59
encoded.push(Vec::new()); // Add an extra item to ensure it is not read.
test_decode_compact::<T>(&encoded, items, root, encoded.len() - 1);
test_decode_compact::<T>(MemoryDB::<T>::default(), &encoded, &items, root, encoded.len() - 1);
test_decode_compact::<T>(PrefixedMemoryDB::<T>::default(), &encoded, &items, root, encoded.len() - 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are still not testing the function that you introduced.

Copy link
Contributor Author

@turuslan turuslan Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, removed new function.
Running this test on master (before this PR) will panic, keeping it as regression test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay perfect.

@turuslan turuslan requested a review from bkchr October 14, 2025 04:19
@bkchr bkchr merged commit 69bfa68 into paritytech:master Dec 9, 2025
1 check passed
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.

4 participants