DocsReference@proto-kit/protocolClassesWitnessedRootHashList

@proto-kit/protocolDocs


Documentation / @proto-kit/protocol / WitnessedRootHashList

Class: WitnessedRootHashList

Accumulator as of section “Intermediary state roots” of the STProver v2 spec

Extends

Constructors

new WitnessedRootHashList()

new WitnessedRootHashList(commitment, preimage): WitnessedRootHashList

Parameters

commitment: Field = ...

preimage: Field = ...

Returns

WitnessedRootHashList

Overrides

DefaultProvableHashList.constructor

Defined in

packages/protocol/src/prover/accumulators/WitnessedRootHashList.ts:23

Properties

commitment

commitment: Field

Inherited from

DefaultProvableHashList.commitment

Defined in

packages/protocol/src/utils/ProvableHashList.ts:26


preimage

preimage: Field

Defined in

packages/protocol/src/prover/accumulators/WitnessedRootHashList.ts:25


valueType

protected readonly valueType: ProvablePure<WitnessedRoot>

Inherited from

DefaultProvableHashList.valueType

Defined in

packages/protocol/src/utils/ProvableHashList.ts:29

Methods

empty()

empty(): Field

Returns

Field

Inherited from

DefaultProvableHashList.empty

Defined in

packages/protocol/src/utils/ProvableHashList.ts:152


fastForward()

fastForward(transition, message): void

Fast-forwards the state of the hashlist to a specified new tip. This assumes the transition (from -> to) to be already verified somewhere else that is outside this scope.

Parameters

transition: VerifiedTransition<Field>

message: string = "some hashlist"

Returns

void

Inherited from

DefaultProvableHashList.fastForward

Defined in

packages/protocol/src/utils/ProvableHashList.ts:62


fastForwardIf()

fastForwardIf(transition, condition, message): void

Parameters

transition: VerifiedTransition<Field>

condition: Bool

message: string = "some hashlist"

Returns

void

Inherited from

DefaultProvableHashList.fastForwardIf

Defined in

packages/protocol/src/utils/ProvableHashList.ts:75


getUnconstrainedValues()

getUnconstrainedValues(): Unconstrained<ProvableHashListData<WitnessedRoot>[]>

Returns

Unconstrained<ProvableHashListData<WitnessedRoot>[]>

Inherited from

DefaultProvableHashList.getUnconstrainedValues

Defined in

packages/protocol/src/utils/ProvableHashList.ts:140


hash()

hash(elements): Field

Parameters

elements: Field[]

Returns

Field

Inherited from

DefaultProvableHashList.hash

Defined in

packages/protocol/src/utils/ProvableHashList.ts:148


isEmpty()

isEmpty(): Bool

Returns

Bool

Inherited from

DefaultProvableHashList.isEmpty

Defined in

packages/protocol/src/utils/ProvableHashList.ts:136


push()

push(value): WitnessedRootHashList

Converts the provided value to Field[] and appends it to the current hashlist.

Parameters

value: WitnessedRoot

Value to be appended to the hash list

Returns

WitnessedRootHashList

Current hash list.

Inherited from

DefaultProvableHashList.push

Defined in

packages/protocol/src/utils/ProvableHashList.ts:106


pushIf()

pushIf(value, condition): WitnessedRootHashList

Parameters

value: WitnessedRoot

condition: Bool

Returns

WitnessedRootHashList

Inherited from

DefaultProvableHashList.pushIf

Defined in

packages/protocol/src/utils/ProvableHashList.ts:117


toField()

toField(): Field

Returns

Field

Traling hash of the current hashlist.

Inherited from

DefaultProvableHashList.toField

Defined in

packages/protocol/src/utils/ProvableHashList.ts:132


witnessRoot()

witnessRoot(witnessedRoot, condition): void

To be used by the BlockProver or for tracing

The main purpose of this method compared to the simple push methods is for deduplicating witnessed roots. We need to do this because the STProver can only witness once per batch, therefore if multiple witness points fall back to the same ST (because any batches in between were empty), this has to be detected and compensated for. This function does this using the preimage of the current list state.

Parameters

witnessedRoot: WitnessedRoot

condition: Bool

Returns

void

Defined in

packages/protocol/src/prover/accumulators/WitnessedRootHashList.ts:40


witnessTip()

witnessTip(preimage, value): Bool

Parameters

preimage: Field

value: WitnessedRoot

Returns

Bool

Inherited from

DefaultProvableHashList.witnessTip

Defined in

packages/protocol/src/utils/ProvableHashList.ts:93