EIP-4396 Time-based base fee calculation (Time-Aware Base Fee Calculation)
No call decision · Fees & gas · EIP status Stagnant · created 2021-10-28
A proposal to factor block production time into the base fee calculation, which currently only looks at the gas a block used, so that the gas target is adjusted to keep throughput stable per unit of time rather than per block.
Why it is needed
Currently, EIP-1559's base fee judges demand solely by the gas a block used and does not consider block production time. Under PoW, block times are irregular, which by itself causes the base fee to fluctuate. Under PoS, missing a single slot stretches the block time to 24 or 36 seconds, which makes the next block appear full and creates a false signal of a demand surge, triggering an unnecessary fee spike while the block space corresponding to the missed slot is permanently lost. This amplifies the effectiveness of denial-of-service (DoS) attacks targeting proposers. More severely, if a fork or outage prevents many proposers from producing blocks for a while, the average block time increases and throughput drops by the same proportion; while PoW recovers quickly through difficulty adjustment, PoS has no such automatic recovery mechanism, so if a third of slots are missed, normalization can take weeks to months.
What changes
Today
- The base fee is adjusted by looking only at the gas a block used, and the gas target is fixed per block
- When a missed slot lengthens block time, the next block appears full and is mistaken for a demand surge
- The block space of a missed slot is permanently lost as is
- When many proposers fail, the resulting throughput drop does not recover automatically under PoS
After EIP-4396
- The gas target grows in proportion to the parent block's actual production time (based on BLOCK_TIME_TARGET = 12 seconds)
- Even after a single missed slot, the adjusted target for the next block grows, reducing the false demand signal
- The adjusted target is capped at 95% (MAX_GAS_TARGET_PERCENT) of the block gas limit
- Consecutive missed slots are not fully corrected for, only partially mitigated
Who is affected
- Validators / proposers: Since the gas target when producing a block depends on the parent block's actual production time, block production logic changes.
- Client teams: The base fee calculation code and existing tooling that uses it must be updated for the new formula.
- Wallet & app developers: Logic that estimates the next block's base fee must additionally account for the block time variable.
- Ordinary users: Unnecessary fee spikes during slot misses or temporary outages may be somewhat reduced.
In depth
Formula for scaling the gas target with block time
Defined as parent_adjusted_gas_target = min(parent_base_gas_target * parent_block_time // BLOCK_TIME_TARGET, parent_gas_limit * MAX_GAS_TARGET_PERCENT // 100). parent_base_gas_target is parent_gas_limit // ELASTICITY_MULTIPLIER, and parent_block_time is the timestamp difference between the parent block and its parent. The subsequent base fee increase/decrease calculation (expected_base_fee_per_gas) uses the same structure as EIP-1559, but compares parent_gas_used against this adjusted target.
Newly introduced constants
BLOCK_TIME_TARGET = 12 (seconds) is the normal slot time under PoS. MAX_GAS_TARGET_PERCENT = 95 is the upper bound, as a percentage of the block gas limit, on how large the adjusted gas target can grow. BASE_FEE_MAX_CHANGE_DENOMINATOR = 8 is kept the same as in EIP-1559.
Base fee volatility under Proof-of-Work
Under PoW, block times are stochastically irregular. This variability by itself causes the base fee to oscillate around its equilibrium value even when demand is perfectly stable.
The problem of missed slots under PoS
Under PoS, block time is ideally always 12 seconds, but missing a slot stretches an individual block's time to 24 or 36 seconds. Such a block makes the next block appear full, which the existing formula reads as a false demand surge signal, triggering an unnecessary base fee spike. More importantly, chain-wide throughput is permanently lost in proportion to the missed slot; even if a 'delayed' transaction is included in the next block, the resulting fee spike empties out several subsequent blocks, so that block space ends up permanently lost. This is flagged as a problem because DoS attacks targeting proposers can exploit exactly this point.
Throughput degradation when consensus failures stop many proposers
If a significant number of proposers fail to produce blocks due to consensus issues such as forking or failing to follow the chain head, average block time increases and chain throughput drops by the same proportion. Under PoW, the automatic recovery mechanism of difficulty adjustment kicks in relatively quickly to restore normal block times, but PoS has no such mechanism, so if more than a third of slots are missed, normalization can take weeks or even months.
Limitation: full correction is not possible
MAX_GAS_TARGET_PERCENT exists for two reasons. First, if the target exceeded the gas limit, the base fee would always decrease, making it meaningless as a signal. Second, room must be left for the base fee to respond even if there is genuine demand growth while many proposers are offline. However, because of this cap, even a single missed slot is not fully corrected for, and from the second consecutive miss onward the target is already at the cap and is not corrected for at all. This effect becomes more pronounced as the proportion of offline validators grows.
Possible extensions: buffers and raising elasticity
Two directions are suggested to address the limitations arising from the minimal-change principle. One is introducing a persistent buffer (with a cumulative cap) that carries gas beyond the block's elasticity over to subsequent blocks, which complicates implementation since it requires adding a new field to the block header. The other is increasing the block elasticity itself, which costs more in peak networking, computation, and disk access load. As long as elasticity stays at 2, neither approach ultimately prevents a throughput collapse once the offline ratio exceeds 50%.
Security considerations and current status
Under PoW, miners can manipulate timestamps to some degree, and the source itself states that the effect of this on this EIP has not yet been determined. Under PoS, each slot is assigned a fixed timestamp, making manipulation by proposers impossible. It also explains that the higher MAX_GAS_TARGET_PERCENT is, the smaller the genuine demand growth signal becomes during periods with many offline proposers, which could increase the incentive for proposers to suppress base fee increases and shift back to priority fee auctions instead; even so, once proposers return, the system gradually returns to a normal EIP-1559 equilibrium. Test Cases and Reference Implementation are left as 'tbd' in the source and the status is marked Stagnant, indicating further progress has stalled.