Skip to content

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

@cchudant

Description

@cchudant

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions