Skip to content

nooschain v0.1.0


nooschain / chain/state-root / applyBatchedSparseMerkleStateChanges

Function: applyBatchedSparseMerkleStateChanges()

applyBatchedSparseMerkleStateChanges(database, blockHeight, startPosition, transactionChanges, smtStore, instrumentation?): Promise<{ newRootHash: string; nextPosition: number; }>

Defined in: chain/state-root.ts:245

Applies all successful transaction state changes for a block in one batched audit/SMT pass while preserving canonical SMT mutation order.

Handler writes still happen inside the caller's outer block transaction. Materialized state_leaves are updated per successful transaction before this helper runs, because handlers may read them later in the same block. If the process dies before the outer transaction commits, PostgreSQL rolls back handler rows, audit rows, materialized leaves, SMT writes, and the block root together.

Parameters

database

ChainDatabase

blockHeight

string | number | bigint

startPosition

number

transactionChanges

TransactionStateChanges[]

smtStore

SmtStateStore

instrumentation?

StateApplyInstrumentation

Returns

Promise<{ newRootHash: string; nextPosition: number; }>

Audience-first NOOSChain documentation.