pub const fn handle_reservoir_remaining_gas(
instruction_result: InstructionResult,
parent_gas: &mut Gas,
child_gas: &mut Gas,
)Expand description
Settles a returning child frame’s gas and merges it into the parent (EIP-8037 reservoir model).
First the child settles its own gas: a failing frame (revert or halt) rolls
its state-gas charges back in last-in-first-out order
([Gas::rollback_state_gas]) — crediting the spilled portion back to its
remaining and restoring the reservoir to the value it inherited — and drops
its execution refund counter; an exceptional halt additionally consumes the
child’s regular gas.
Then the parent merges the settled child:
- unused regular gas (
remaining, including any spill returned on revert) flows back to the parent on success or revert; a halt consumes it. - the reservoir, a shared state-gas pool the child inherited at call time, is always adopted from the child (restored to the inherited value on revert/halt).
- net state gas, its spilled portion, and the refund counter persist only on success; on revert/halt the child’s state changes roll back and contribute nothing.