Expand description
Budget helpers for deciding when to stop executing pool transactions.
The builder can stop transaction execution, but it still has to finish non-interruptible finalization work like state hashing, state root updates, block assembly, and marshal persistence. These helpers learn the relation between tx execution cutoff time, total replayable build work, validation latency feedback, and the size-dependent cost of persisting large blocks through consensus.
The decision model is:
leader_idle + predicted_builder_work + predicted_validator_work + 2 * marshal_persist >= budget.
Idle waiting only happens on the proposer. Builder work is projected from the
current build, while validator work uses feedback from previously validated
blocks when available and otherwise falls back to the builder projection.
Structsยง
Constantsยง
- BUILD_
TIME_ ๐MULTIPLIER_ DECAY - How quickly the multiplier decays when observed builds get cheaper.
- BUILD_
TIME_ ๐MULTIPLIER_ SCALE - Fixed-point scale for build time multipliers.
- DEFAULT_
BUILD_ TIME_ MULTIPLIER - Initial estimate of total replayable build work divided by work at tx cutoff.
- MAX_
BUILD_ ๐TIME_ MULTIPLIER
Functionsยง
- decay_
build_ ๐time_ multiplier - Updates the multiplier, immediately rising but slowly decaying.
- observed_
build_ ๐time_ multiplier - Computes the observed total-work to tx-cutoff-work multiplier.
- payload_
budget_ ๐decision - Builds the shared proposer/validator budget decision for the current payload.
- scaled_
build_ ๐time_ multiplier - Converts a human-readable build-work multiplier into the fixed-point representation.
- scaled_
duration ๐