fix(eip-8141): account block execution gas before refund - #3443
fix(eip-8141): account block execution gas before refund#3443chugarchugarr wants to merge 3 commits into
Conversation
8adc4c8 to
6798542
Compare
9f0f995 to
9f2e228
Compare
chugarchugarr
left a comment
There was a problem hiding this comment.
@spencer-tb @gurukamath @LouisTsai-Csie — this catches an EIP-8141 × EIP-7778 accounting interaction where storage refunds were also reducing block execution gas.
The payer/receipt remain post-refund; block execution gas remains pre-refund. Regression coverage is included, and the PR is currently waiting on fork-workflow approval before upstream CI can run.
Would one of you mind approving the workflows / taking a look at the accounting boundary?
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## eips/amsterdam/eip-8141 #3443 +/- ##
==========================================================
Coverage ? 93.41%
==========================================================
Files ? 576
Lines ? 33091
Branches ? 2911
==========================================================
Hits ? 30911
Misses ? 1533
Partials ? 647
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Status update: I closed my unrelated open execution-specs contributions, so this is now my sole active upstream PR here. Head @spencer-tb @gurukamath @LouisTsai-Csie — requesting one narrow human review of the accounting boundary: payer/receipt gas remains post-refund while block execution gas remains pre-refund under EIP-7778. A direct rejection or narrowing is as useful as approval; I am making no acceptance claim before that review. |
gurukamath
left a comment
There was a problem hiding this comment.
This is an implementation of the spec update that was recently merged. See PR
We need to bump the spec commit hash under tests/amsterdam/eip8141_frame_transactions/spec.py to 7d1c8bfb945cbb53479217df3bf1da67b3aa445b
| settlement.state_gas_used | ||
| ) | ||
|
|
||
| # EIP-7778 keeps storage refunds out of block gas accounting. The |
There was a problem hiding this comment.
Could we just add gas_used to the FrameTransactionGasSettlement and derive these within settle_frame_transaction_gas rather than inline here?
| # state dimension is already net; only execution is reconstructed | ||
| # from pre-refund usage and held to the calldata floor. | ||
| gas_used_before_refund = frame_context.standard_gas_limit - tx_unused_gas | ||
| block_execution_gas_used = ExecutionGas( |
There was a problem hiding this comment.
Might be worth a test here. With the frame declaring no state gas, as test_storage_refund_settlement does, both clamps compare directly against the floor and split into three cases:
gas_used_after_refund > floor— payer settles atgas_used_after_refund, block atgas_used_before_refund. Already covered bytest_storage_refund_settlementgas_used_before_refund > floor > gas_used_after_refund— payer settles atfloor, block atgas_used_before_refund. Not covered.floor > gas_used_before_refund— both settle atfloor. Not covered.
|
@gurukamath — pinned The fork workflows were reset by the new commit and are awaiting approval again. I’m keeping the two inline suggestions (move the derivation into |
00f2cf1 to
ce7e32f
Compare
Description
Fix EIP-8141 frame-transaction block gas accounting so storage refunds reduce payer-facing gas without reducing block execution gas, as required by EIP-7778.
The payer and receipt remain post-refund. At the block-processing boundary, the execution dimension is reconstructed from
gas_used_before_refund, reduced only by the transaction's net state-gas dimension, and held to the calldata floor:The storage-clear regression now pins the split through both the expected receipt and block header.
Verification
uv run fill -q tests/amsterdam/eip8141_frame_transactions/test_gas_settlement.py --fork Bogota --clean -n 0— 9 passedgit diff --check— passedBase
eips/amsterdam/eip-8141at6798542ebd017b683b688489d770bf206c8bd3ba.