EIP-8455 The RESERVOIR opcode (RESERVOIR Opcode)

No call decision · EVM & execution · EIP status Draft · created 2026-10-23

A new opcode, RESERVOIR, reads the state gas reserve that is invisible to the GAS opcode, letting a contract accurately measure its own total gas budget and the amount a call has consumed.

Why it is needed

EIP-8037 splits transaction gas into gas_left for execution and a reserve gas (state_gas_reservoir) dedicated to state creation. But the GAS opcode shows only gas_left, not the reserve gas. A bundler like the ERC-4337 EntryPoint, which measures a call's gas consumption by comparing two readings of gasleft(), misses costs covered instead by the reserve gas, such as creating a new storage slot, and measures 97,920 gas less than the actual amount. Nor does the caller have any way to notice if the callee has used up all of its own reserve gas. EIP-8141's TXPARAM (TXPARAM_STATE_GAS_LEFT) shows a similar value, but that instruction halts under the reserve-gas-model transaction, so library code that does not know which of the two transaction models it is running under cannot use it.

What changes

Today

After EIP-8455

Who is affected

In depth

Opcode definition and behavior

RESERVOIR is assigned to 0x4d and pushes a single state_budget with no stack input. On execution it deducts RESERVOIR_GAS_COST (2) from the current frame's gas_left as execution gas; this deduction is not drawn from any state gas pool and does not alter any state gas counter. If gas_left is less than 2, it halts exceptionally for insufficient gas, and if the stack already has 1024 entries, it halts exceptionally for stack overflow. It can be executed even in a static context (STATICCALL), and cannot be activated on forks where EIP-8037 is not active.

What state_budget refers to

state_budget is defined in three ways depending on the execution context. In a transaction using EIP-8037's reserve gas model, it is the state_gas_reservoir of the currently executing call frame. In an EIP-8141 frame transaction, it is the state_gas_left of the currently executing frame, the same value that TXPARAM (TXPARAM_STATE_GAS_LEFT) returns. In a system call, it is the state_gas_reservoir that EIP-8037 placed in that system call's budget. This EIP does not change any accounting rule of EIP-8037 or EIP-8141; the values in the table simply follow from the existing rules.

Value changes under the reserve gas model

At transaction start, G0 (the initial gas_left) and R0 (the initial reserve gas) are computed, and in EIP-2780's pre-execution phase, the state gas P for account creation or EIP-7702 authorization is deducted from the reserve gas first. At the top-level frame's first instruction, it returns max(0, R0 - P), and at the first instruction of a child frame entered via CALL/CREATE etc., it returns the caller's entire reserve gas at that point (without applying the 63/64 rule). If the child succeeds, it returns the value after the merge step; if it reverts or halts exceptionally, it returns the value restored by rollback; and after a state gas top-up, it decreases by the portion of that top-up borne by the reserve gas.

Values in frame transactions

Inside a frame transaction, all call frames belonging to one frame share the state_gas_left pool, so a child call frame reads the same value as its caller. State gas top-ups are paid only from this pool, so a top-up of amount c succeeds only if RESERVOIR is at least c. A refund for a top-up paid by an earlier frame is reflected only in that frame's receipt and does not affect the current pool, so the value does not change. If a call frame reverts or halts exceptionally, it returns the value restored under EIP-8141's journaling rules.

Relationship to GAS and how to measure

In both models, GAS + RESERVOIR is the entire budget remaining in a call frame. Under the reserve gas model, when a child succeeds, the merge step moves value between the reserve gas and gas_left, so reading only one of the two can misreport the gas a call actually consumed; the sum of the two values must always be compared. GAS and RESERVOIR are separate instructions and are not read atomically at once, and the spec notes that measuring by reading a GAS/RESERVOIR pair at each end adds a fixed overhead of 4 execution gas.

Why the opcode bytes and gas cost were chosen this way

The 0x40-0x4f range holds block and transaction environment values, and among these 0x4a (BLOBBASEFEE) and 0x4b (SLOTNUM) are already used while 0x4d is free, so that slot was chosen. There is no free slot next to GAS (0x5a). The cost is 2, the base cost of environment-value opcodes like GAS, and the deduction only touches gas_left, not state_gas_left, so executing RESERVOIR does not change the value it reads. If GAS were redefined to include the reservoir, it would break the existing behavior where CALL's gas argument references only gas_left under the 63/64 rule, so GAS was left unchanged.

The measured value is a delta, not an attribution of responsibility

The difference between GAS + RESERVOIR is only the net change in the frame's budget; it does not tell you who within a bundle should be charged for the cost. If one operation creates a storage slot and the next operation clears that slot, the later operation receives a refund and its measured value can turn negative. Summing the two measured values equals the gas the transaction actually spent before the refund counter is applied. Whether this refund is charged directly to each operation, or only max(0, measured value) is charged while the bundler keeps the refund, is left as a policy decision for protocols such as the ERC-4337 EntryPoint.

Security considerations and current status

Like GAS, the RESERVOIR value can be controlled by the caller, so it must not be used as a trusted input, and because the measured value can be negative it must be handled as signed arithmetic. A value that has not decreased does not mean the call used no state gas at all. Because CALL's gas argument only limits gas_left, limiting the reservoir requires the caller to use a wrapper frame that checks the RESERVOIR difference before and after the call and reverts if it is exceeded. RESERVOIR should be added to ERC-7562's OP-011 banned opcode list alongside SLOTNUM, and this change should be timed to the activation. The source's status is Draft, so the name or details may still change.

Original EIP · ← EIPs