Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using an empty slice as a tree identifier results in tree root mismatches #35

Open
cchudant opened this issue Aug 23, 2024 · 0 comments

Comments

@cchudant
Copy link
Member

In madara, we only use tree identifiers for the contract storage. The other contract and class tries, as well as the ephemeral in-memory (hashmapdb) tries needed to compute transaction, receipt and event commitments in a block.

Currently, we use a junk identifier for storing these trees inside a BonsaiStorage, like this https://github.com/madara-alliance/madara/blob/8ece8dd21c957e5cad13ce9ee891483b77322387/crates/client/block_import/src/pre_validate.rs#L308

We do that because we have hit a case where when just giving the empty slice as identifier, the state root ends up mismatching during sync. We did not investigate what was going on, but some of the code of the crate probably works under the assumption of the identifier always being 16 bytes or at least non empty

I'd be cool if the bonsai-trie supported arbitrary trie identifiers

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

No branches or pull requests

1 participant