v1.3.5 — Deterministic epoch-boundary gas limit
Deterministic epoch-boundary gas limit
Follow-up from v1.3.3, which temporarily froze the block gas limit at the
parent's value because nt.dynamicScaler.GetCurrentGasLimit() was
producing divergent headers across validators.
Gas limit can now grow and shrink under load — but only at epoch boundaries,
and only via a pure function of parent header fields (block number, parent
gas limit, parent gas used). The computation is identical on every validator
because every validator shares the same parent.
Rule
blockNumber % EpochLength == 0 (epoch boundary):
if parent.GasUsed * 2 > parent.GasLimit: raise by parent.GasLimit / 1024
if parent.GasUsed * 2 < parent.GasLimit: lower by parent.GasLimit / 1024
(clamped to [MinBlockGas, MaxBlockGas])
otherwise:
inherit parent.GasLimit verbatim
This is EIP-1559-style elasticity, restricted to epoch boundaries
(default: every 100 blocks). Under sustained load the gas limit climbs
~0.1%/epoch until it hits the ceiling; under light load it drops similarly
until the floor.
Regression tests
TestComputeDeterministicGasLimit_NonEpochInheritsParentTestComputeDeterministicGasLimit_EpochBoundaryRaisesTestComputeDeterministicGasLimit_EpochBoundaryLowersTestComputeDeterministicGasLimit_ClampsTestComputeDeterministicGasLimit_DeterministicAcrossNodesTestComputeDeterministicGasLimit_NilParent
Upgrade notes
Drop-in upgrade. No chain data wipe needed. The new formula uses only
parent fields so existing chains continue seamlessly.