Class DeepMerkleSubTree<V>

DeepMerkleSubTree is a deep merkle subtree for working on only a few leafs.

DeepMerkleSubTree

Type Parameters

  • V

Constructors

  • Creates an instance of DeepMerkleSubTree.

    Type Parameters

    • V

    Parameters

    • root: Field
    • height: number
    • valueType: Provable<V>
    • Optional options: {
          hashValue: boolean;
          hasher: Hasher;
      } = ...

      hasher: The hash function to use, defaults to PoseidonHasherFunc; hashValue: whether to hash the value, the default is true.

      • hashValue: boolean
      • hasher: Hasher

    Returns DeepMerkleSubTree<V>

    Memberof

    DeepMerkleSubTree

Properties

hashValue: boolean
hasher: Hasher
height: number
nodeStore: Map<string, Field[]>
root: Field
valueStore: Map<string, Field>
valueType: Provable<V>

Methods

  • Add a branch to the tree, a branch is generated by smt.prove.

    Parameters

    • proof: BaseMerkleProof
    • index: bigint
    • Optional value: V
    • Optional ignoreInvalidProof: boolean = false

    Returns void

    Memberof

    DeepMerkleSubTree

  • Check whether there is a corresponding key and value in the tree

    Parameters

    • index: bigint
    • value: V

    Returns boolean

    {boolean}

    Memberof

    DeepMerkleSubTree

  • Update a new value for a key in the tree and return the new root of the tree.

    Parameters

    • index: bigint
    • Optional value: V

    Returns Field

    {Field}

    Memberof

    DeepMerkleSubTree