@proto-kit/protocolDocs


Documentation / @proto-kit/protocol / BundleHashList

Class: BundleHashList

This hash list collects an ordered list of Bundle instances. “Pushing” onto this list can mean either appending a new bundle or updating the bundle at the tip of this list, according to the following rules: The validated preimage (via checkLastBundleElement) is:

  • == commitment: A new bundle will be appended
  • something else: The preimage is the actual preimage, therefore as a operation, the old one will be popped (silently) and the updates bundle will be pushed, resulting in an semantic update of the tip.

Extends

Constructors

new BundleHashList()

new BundleHashList(commitment, preimage?): BundleHashList

Parameters

commitment: Field = ...

preimage?: BundlePreimage

Returns

BundleHashList

Overrides

DefaultProvableHashList.constructor

Defined in

packages/protocol/src/prover/accumulators/BlockHashList.ts:44

Properties

commitment

commitment: Field

Inherited from

DefaultProvableHashList.commitment

Defined in

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


preimage?

optional preimage: BundlePreimage

Defined in

packages/protocol/src/prover/accumulators/BlockHashList.ts:47


valueType

protected readonly valueType: ProvablePure<Bundle>

Inherited from

DefaultProvableHashList.valueType

Defined in

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

Methods

addToBundle()

addToBundle(state, networkState): void

This function pushes a new bundle onto this list or updates the bundle at the tip of this list, according to the rules of the preimage algorithms (see class docs)

Parameters

state: TransactionProverState

networkState: NetworkState

Returns

void

Defined in

packages/protocol/src/prover/accumulators/BlockHashList.ts:91


checkLastBundleElement()

checkLastBundleElement(state, networkState): void

Verifies this list’s preimage against the prover’s state The main impact this function has is that it makes the preimage trusted i.e. we can safely use it to add to the bundle/open a new bundle

Parameters

state: TransactionProverState

networkState: NetworkState

Returns

void

Defined in

packages/protocol/src/prover/accumulators/BlockHashList.ts:56


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<Bundle>[]>

Returns

Unconstrained<ProvableHashListData<Bundle>[]>

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): BundleHashList

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

Parameters

value: Bundle

Value to be appended to the hash list

Returns

BundleHashList

Current hash list.

Inherited from

DefaultProvableHashList.push

Defined in

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


pushIf()

pushIf(value, condition): BundleHashList

Parameters

value: Bundle

condition: Bool

Returns

BundleHashList

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


witnessTip()

witnessTip(preimage, value): Bool

Parameters

preimage: Field

value: Bundle

Returns

Bool

Inherited from

DefaultProvableHashList.witnessTip

Defined in

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