Class CompactSparseMerkleProof

Proof for compact sparse merkle tree

CompactSparseMerkleProof

Hierarchy

  • {
        nonMembershipLeafData: Field[];
        root: Field;
        siblingData: Field[];
        sideNodes: Field[];
    }
    • CompactSparseMerkleProof

Constructors

  • Parameters

    • value: {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }
      • nonMembershipLeafData: Field[]
      • root: Field
      • siblingData: Field[]
      • sideNodes: Field[]

    Returns CompactSparseMerkleProof

Properties

nonMembershipLeafData: Field[] = ...
root: Field = Field
siblingData: Field[] = ...
sideNodes: Field[] = ...
_isStruct: true
check: ((value) => void)

Add assertions to the proof to check if value is a valid member of type T. This function does not return anything, instead it creates any number of assertions to prove that value is a valid member of the type T.

For instance, calling check function on the type Bool asserts that the value of the element is either 1 or 0.

Type declaration

    • (value): void
    • Parameters

      • value: {
            nonMembershipLeafData: Field[];
            root: Field;
            siblingData: Field[];
            sideNodes: Field[];
        }

        the element of type T to put assertions on.

        • nonMembershipLeafData: Field[]
        • root: Field
        • siblingData: Field[]
        • sideNodes: Field[]

      Returns void

empty: (() => {
    nonMembershipLeafData: Field[];
    root: Field;
    siblingData: Field[];
    sideNodes: Field[];
})

Type declaration

    • (): {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }
    • Returns {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }

      • nonMembershipLeafData: Field[]
      • root: Field
      • siblingData: Field[]
      • sideNodes: Field[]
fromFields: ((fields) => {
    nonMembershipLeafData: Field[];
    root: Field;
    siblingData: Field[];
    sideNodes: Field[];
})

Type declaration

    • (fields): {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }
    • Parameters

      • fields: Field[]

      Returns {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }

      • nonMembershipLeafData: Field[]
      • root: Field
      • siblingData: Field[]
      • sideNodes: Field[]
fromJSON: ((x) => {
    nonMembershipLeafData: Field[];
    root: Field;
    siblingData: Field[];
    sideNodes: Field[];
})

Type declaration

    • (x): {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }
    • Parameters

      • x: {
            nonMembershipLeafData: string[];
            root: string;
            siblingData: string[];
            sideNodes: string[];
        }
        • nonMembershipLeafData: string[]
        • root: string
        • siblingData: string[]
        • sideNodes: string[]

      Returns {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }

      • nonMembershipLeafData: Field[]
      • root: Field
      • siblingData: Field[]
      • sideNodes: Field[]
fromValue: ((x) => {
    nonMembershipLeafData: Field[];
    root: Field;
    siblingData: Field[];
    sideNodes: Field[];
}) & ((value) => {
    nonMembershipLeafData: Field[];
    root: Field;
    siblingData: Field[];
    sideNodes: Field[];
})

Convert provable type from a normal JS type.

Type declaration

    • (x): {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }
    • Parameters

      • x: {
            nonMembershipLeafData: Field[];
            root: Field;
            siblingData: Field[];
            sideNodes: Field[];
        } | {
            nonMembershipLeafData: bigint[];
            root: bigint;
            siblingData: bigint[];
            sideNodes: bigint[];
        }

      Returns {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }

      • nonMembershipLeafData: Field[]
      • root: Field
      • siblingData: Field[]
      • sideNodes: Field[]

Type declaration

    • (value): {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }
    • Parameters

      • value: {
            nonMembershipLeafData: Field[] | bigint[];
            root: string | number | bigint | Field;
            siblingData: Field[] | bigint[];
            sideNodes: Field[] | bigint[];
        }
        • nonMembershipLeafData: Field[] | bigint[]
        • root: string | number | bigint | Field
        • siblingData: Field[] | bigint[]
        • sideNodes: Field[] | bigint[]

      Returns {
          nonMembershipLeafData: Field[];
          root: Field;
          siblingData: Field[];
          sideNodes: Field[];
      }

      • nonMembershipLeafData: Field[]
      • root: Field
      • siblingData: Field[]
      • sideNodes: Field[]
toAuxiliary: ((value?) => any[])

A function that takes value (optional), an element of type T, as argument and returns an array of any type that make up the "auxiliary" (non-provable) data of value.

Type declaration

    • (value?): any[]
    • Parameters

      • Optional value: {
            nonMembershipLeafData: Field[];
            root: Field;
            siblingData: Field[];
            sideNodes: Field[];
        }

        the element of type T to generate the auxiliary data array from, optional. If not provided, a default value for auxiliary data is returned.

        • nonMembershipLeafData: Field[]
        • root: Field
        • siblingData: Field[]
        • sideNodes: Field[]

      Returns any[]

Returns

An array of any type describing how this T element is made up of "auxiliary" (non-provable) data.

toFields: ((value) => Field[])

A function that takes value, an element of type T, as argument and returns an array of Field elements that make up the provable data of value.

Type declaration

    • (value): Field[]
    • Parameters

      • value: {
            nonMembershipLeafData: Field[];
            root: Field;
            siblingData: Field[];
            sideNodes: Field[];
        }

        the element of type T to generate the Field array from.

        • nonMembershipLeafData: Field[]
        • root: Field
        • siblingData: Field[]
        • sideNodes: Field[]

      Returns Field[]

Returns

A Field array describing how this T element is made up of Field elements.

toInput: ((x) => {
    fields?: Field[];
    packed?: [Field, number][];
})

Type declaration

    • (x): {
          fields?: Field[];
          packed?: [Field, number][];
      }
    • Parameters

      • x: {
            nonMembershipLeafData: Field[];
            root: Field;
            siblingData: Field[];
            sideNodes: Field[];
        }
        • nonMembershipLeafData: Field[]
        • root: Field
        • siblingData: Field[]
        • sideNodes: Field[]

      Returns {
          fields?: Field[];
          packed?: [Field, number][];
      }

      • Optional fields?: Field[]
      • Optional packed?: [Field, number][]
toJSON: ((x) => {
    nonMembershipLeafData: string[];
    root: string;
    siblingData: string[];
    sideNodes: string[];
})

Type declaration

    • (x): {
          nonMembershipLeafData: string[];
          root: string;
          siblingData: string[];
          sideNodes: string[];
      }
    • Parameters

      • x: {
            nonMembershipLeafData: Field[];
            root: Field;
            siblingData: Field[];
            sideNodes: Field[];
        }
        • nonMembershipLeafData: Field[]
        • root: Field
        • siblingData: Field[]
        • sideNodes: Field[]

      Returns {
          nonMembershipLeafData: string[];
          root: string;
          siblingData: string[];
          sideNodes: string[];
      }

      • nonMembershipLeafData: string[]
      • root: string
      • siblingData: string[]
      • sideNodes: string[]
toValue: ((x) => {
    nonMembershipLeafData: bigint[];
    root: bigint;
    siblingData: bigint[];
    sideNodes: bigint[];
})

Convert provable type to a normal JS type.

Type declaration

    • (x): {
          nonMembershipLeafData: bigint[];
          root: bigint;
          siblingData: bigint[];
          sideNodes: bigint[];
      }
    • Parameters

      • x: {
            nonMembershipLeafData: Field[];
            root: Field;
            siblingData: Field[];
            sideNodes: Field[];
        }
        • nonMembershipLeafData: Field[]
        • root: Field
        • siblingData: Field[]
        • sideNodes: Field[]

      Returns {
          nonMembershipLeafData: bigint[];
          root: bigint;
          siblingData: bigint[];
          sideNodes: bigint[];
      }

      • nonMembershipLeafData: bigint[]
      • root: bigint
      • siblingData: bigint[]
      • sideNodes: bigint[]

Methods

  • Return the size of the T type in terms of Field type, as Field is the primitive type.

    Returns number

    A number representing the size of the T type in terms of Field type.