Skip to main content

Module budget

Module budget 

Source
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ยง

PayloadBudgetDecision ๐Ÿ”’

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 ๐Ÿ”’