Interface StateRootCommitter
public interface StateRootCommitter
Strategy for computing the state root hash during block persistence.
The caller provides a stateRootSupplier that encapsulates the standard (synchronous)
trie computation. Implementations may:
- Simply invoke the supplier (sync mode)
- Ignore it and return a pre-computed root (BAL trusted mode)
- Invoke it, then cross-check against an independently computed root (BAL verification mode)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StateRootCommitterComputes the state root synchronously via the standard trie path. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidcancel()Cancels any ongoing state root computation.org.hyperledger.besu.datatypes.HashcomputeRoot(Supplier<org.hyperledger.besu.datatypes.Hash> stateRootSupplier, MutableWorldState worldState, WorldStateKeyValueStorage.Updater stateUpdater, BlockHeader blockHeader) Compute (or retrieve) the state root and apply any additional side-effects.default StateRootCommittertimed(OperationTimer timer) Wraps this committer with timing instrumentation.
-
Field Details
-
SYNCHRONOUS
Computes the state root synchronously via the standard trie path.
-
-
Method Details
-
computeRoot
org.hyperledger.besu.datatypes.Hash computeRoot(Supplier<org.hyperledger.besu.datatypes.Hash> stateRootSupplier, MutableWorldState worldState, WorldStateKeyValueStorage.Updater stateUpdater, BlockHeader blockHeader) Compute (or retrieve) the state root and apply any additional side-effects.- Parameters:
stateRootSupplier- lazily computes the state root via the standard trie pathworldState- the world state being persisted (used by BAL to import state changes)stateUpdater- the storage updater (used by BAL to merge trie nodes)blockHeader- the block being persisted- Returns:
- the authoritative state root hash
-
cancel
default void cancel()Cancels any ongoing state root computation. -
timed
Wraps this committer with timing instrumentation.- Parameters:
timer- the timer used to measure execution time- Returns:
- a new committer that delegates to this instance while recording timing metrics
-