Repository navigation
feat(execution): record the message output and the gas before refund of each transaction - #2519
Merged
Merged
Conversation
…each transaction A block body now keeps, for each transaction, the data that its message returned and the gas that it used before its refund. No rule of the block reads them; eth_simulateV1 reports them in its call results. Part of ethereum#2109. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A block body now keeps, for each transaction, the output of its message and the gas that it used before its refund.
No rule of the block reads them;
eth_simulateV1needs them for thereturnData, the revertdataand themaxUsedGasof its call results.Part of #2109.
The problem
Each call result of
eth_simulateV1has areturnDataand amaxUsedGas, "Maximum gas used during execution before refunds" in the schema, and a reverted call carries its revert data in its error.The body of a block threw these away: a transaction's run kept its state, its gas used after the refund, its block gas, its logs and its error, and the body kept only receipts and logs.
The simulation runs its calls through the one body of a real block, so it could not report them without a second run.
The idea
Record the two values where they exist, and carry them out of the body.
TransactionOutput, what a transaction's run leaves, getsmessageOutput, the output of its message, andgasBeforeRefund, the gas used with a refund of 0.The second comes from the one formula of the gas used, so from Pectra it is at least the call data floor of EIP-7623, as the fixtures show.
BodyOutput, what a body gives, getsresults: oneTransactionResultper transaction, with those two values, oldest first.Nothing reads the new fields, so every other value that a block computes is unchanged.
New theorems:
gasUsed_le_gasUsed_zeroandrunTransaction_gasUsed_le: a refund never raises the gas used, so a run's gas used is at most its gas before the refund, with any precompiles and lifted rules.applyTransaction_results: a transaction that enters the body, with or without the overrides of a simulation, adds one receipt and one result, the result of its run.applyTransactions_results_length: a body has as many results as receipts.Example
ethSimulate-precompile-is-sending-transaction.iocalls SHA-256 with the input0x1234, from Glamsterdam.gasBeforeRefundis 15,128 =0x3b18, themaxUsedGasof the fixture, equal to itsgasUsed.For reviewers
runTransaction_eq_transactionStart, the initial body output in the statements ofProofs/Blocks/Transition.leanandProofs/Blocks/Burn.lean, and a proof witness inNoninterferenceRun.lean.messageOutputholds the revert data on a revert and, from Byzantium, is empty after any other error; the call results will move the revert data to the error, as the fixtures do.Checks
lake build --wfail EthLib.Execution.Proofs EthLib.Engine.Proofs Exports: passes (6087 jobs).lake env leancheckeron the changed proof modules (Proofs.Blocks.Transition,Proofs.Transactions.Process,Proofs.Transactions.NoninterferenceRun,Proofs.Rpc.Call,Proofs.Blocks.Burn): passes.scripts/soundness_facts.py --check,scripts/check_lean_layout.py,scripts/check_layers.py,lake exe check-accessors,lake exe gen-bindings --check: pass.maxUsedGasand the doc of the message output were fixed after them, and a fresh audit found no CRITICAL finding and one MAJOR doc finding, now fixed.🤖 Generated with Claude Code