Skip to content

Update zktrie Specification  #65

Open
@frisitano

Description

@frisitano

Describe the feature

In #36 we introduced zktrie and included the specification https://github.com/scroll-tech/reth/blob/feat/scroll-bmpt/crates/scroll/trie/assets/zktrie.md. The specification is outdated and does not include mention of domain separation for node hashing. We should update it to include this.

The constants for domain seperation in node hashing can be found here:

/// The hashing domain for leaf nodes.
pub const LEAF_NODE_DOMAIN: Fr = Fr::from_raw([4, 0, 0, 0]);
/// The hashing domain for a branch node with two terminal children.
pub const BRANCH_NODE_LTRT_DOMAIN: Fr = Fr::from_raw([6, 0, 0, 0]);
/// The hashing domain for a branch node with a left terminal child and a right branch child.
pub const BRANCH_NODE_LTRB_DOMAIN: Fr = Fr::from_raw([7, 0, 0, 0]);
/// The hashing domain for a branch node with a left branch child and a right terminal child.
pub const BRANCH_NODE_LBRT_DOMAIN: Fr = Fr::from_raw([8, 0, 0, 0]);
/// The hashing domain for a branch node with two branch children.
pub const BRANCH_NODE_LBRB_DOMAIN: Fr = Fr::from_raw([9, 0, 0, 0]);

We should also update the part which suggests that the keys are truncated to 248 bits. This is not the case, all 254 bits (bn254 field size) are used in the key space.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions