Conversation
- partial prefix for attached value was not appended - support for child trie root prefix
bkchr
left a comment
There was a problem hiding this comment.
Please provide some test for these changes.
- decode compact proof to prefixed db, trie read failed
trie-db/test/src/trie_codec.rs
Outdated
| ) { | ||
| // Reconstruct the partial DB from the compact encoding. | ||
| let mut db = MemoryDB::<L>::default(); | ||
| let mut db = PrefixedMemoryDB::<L>::default(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
trie-db/test/src/trie_codec.rs
Outdated
| 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); |
There was a problem hiding this comment.
You are still not testing the function that you introduced.
There was a problem hiding this comment.
Thanks, removed new function.
Running this test on master (before this PR) will panic, keeping it as regression test.
use KeySpacedDBMut wrapper
add support for child trie root prefix(use prefixed db wrapper)