fix(test-benchmark): fill benchmark blocks fully under EIP-8037 gas accounting (repricing) - #3269
Conversation
…thereum#3239) * Add system-address zero-tip BAL fixture * Update tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py Co-authored-by: Mario Vega <marioevz@gmail.com> * Update tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py Co-authored-by: Mario Vega <marioevz@gmail.com> * Update tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py Co-authored-by: Mario Vega <marioevz@gmail.com> * Update tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py Co-authored-by: Mario Vega <marioevz@gmail.com> * Update tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py Co-authored-by: Mario Vega <marioevz@gmail.com> * Update tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py Co-authored-by: Mario Vega <marioevz@gmail.com> * Update tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py Co-authored-by: Mario Vega <marioevz@gmail.com> * fix(tests): apply ruff format to system-address coinbase BAL test --------- Co-authored-by: Mario Vega <marioevz@gmail.com>
…ransfer cost (ethereum#3214) Align the EIP-2780 implementation with the changes proposed in ethereum/EIPs#11997
…thereum#3215) Co-authored-by: spencer <spencer.tb@ethereum.org>
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
* feat: implement deployed account verification * refactor: add account verification to tests * refactor: update alloc to include the pre method * refactor: verify account flag name * refactor: clean up docstring * refactor: chunk-wise early raise in deployed accounts verification * refactor: move account verification to a helper, session-scope dedup state * refactor(test-execute): verify_full_accounts internal of pre --------- Co-authored-by: marioevz <marioevz@gmail.com>
…UTION_PER_AUTH_BASE_COST (ethereum#3263)
…action) (ethereum#3245) Co-authored-by: LouisTsai <q1030176@gmail.com> Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…ereum#3191) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…thereum#3153) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…3158) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…/ phantom-read entries) (ethereum#3170)
…thereum#3224) Co-authored-by: LouisTsai <q1030176@gmail.com> Co-authored-by: Mario Vega <marioevz@gmail.com>
* feat(ci): backport bot * fix(ci): Review comments * fix(ci): Review comments
* feat: add missing glam eip to benchmark * feat(tests): Add initcode jumpdest analysis in swapn, dupn, exchange --------- Co-authored-by: marioevz <marioevz@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #3269 +/- ##
================================================
Coverage 93.49% 93.49%
================================================
Files 625 625
Lines 37032 37032
Branches 3385 3385
================================================
Hits 34623 34623
Misses 1653 1653
Partials 756 756
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:
|
| # execution cost is accounted separately. | ||
| base_cost -= gas_costs.CALL_STIPEND | ||
| if metadata["account_new"]: | ||
| base_cost += gas_costs.NEW_ACCOUNT |
There was a problem hiding this comment.
Might be good for debugging and failing fast:
| base_cost += gas_costs.NEW_ACCOUNT | |
| base_cost += gas_costs.NEW_ACCOUNT | |
| else: | |
| if metadata["account_new"]: | |
| raise ValueError("Account new requires value transfer") | |
| if metadata.get("stipend_returned"): | |
| raise ValueError( | |
| "Stipend returned requires value transfer" | |
| ) |
| + Osaka.gas_costs().CALL_VALUE | ||
| - Osaka.gas_costs().CALL_STIPEND, | ||
| id="call_cold_with_value_stipend_returned", | ||
| ), |
There was a problem hiding this comment.
Some Amsterdam cases. First one verifies the EIP-8038 repricing. Second one verifies the EIP-8037 dimension split with a new account.
| ), | |
| ), | |
| pytest.param( | |
| Amsterdam, | |
| Op.CALL( | |
| address_warm=False, | |
| value_transfer=True, | |
| stipend_returned=True, | |
| ), | |
| Amsterdam.gas_costs().COLD_ACCOUNT_ACCESS | |
| + Amsterdam.gas_costs().CALL_VALUE | |
| - Amsterdam.gas_costs().CALL_STIPEND, | |
| id="call_cold_with_value_stipend_returned_amsterdam", | |
| ), | |
| pytest.param( | |
| Amsterdam, | |
| Op.CALL( | |
| address_warm=False, | |
| value_transfer=True, | |
| stipend_returned=True, | |
| account_new=True, | |
| ), | |
| Amsterdam.gas_costs().COLD_ACCOUNT_ACCESS | |
| + Amsterdam.gas_costs().CALL_VALUE | |
| - Amsterdam.gas_costs().CALL_STIPEND | |
| + Amsterdam.gas_costs().NEW_ACCOUNT, | |
| id="call_cold_new_account_stipend_returned_amsterdam", | |
| ), |
| Osaka.gas_costs().WARM_ACCESS | ||
| + Osaka.memory_expansion_gas_calculator()(new_bytes=32), | ||
| id="callcode_warm", | ||
| ), |
There was a problem hiding this comment.
| ), | |
| pytest.param( | |
| Osaka, | |
| Op.CALLCODE( | |
| address_warm=False, | |
| value_transfer=True, | |
| stipend_returned=True, | |
| ), | |
| Osaka.gas_costs().COLD_ACCOUNT_ACCESS | |
| + Osaka.gas_costs().CALL_VALUE | |
| - Osaka.gas_costs().CALL_STIPEND, | |
| id="callcode_cold_with_value_stipend_returned", | |
| ), |
|
I think we could add a small unit test for |
|
(changed target base, need to rebase this one, FYI) |
Description
Benchmarkoor runs of the repricing suite showed underfilled blocks (e.g. 82.9% / 89.6% of the block gas limit at 100–300M). Two gas-model gaps, both introduced by the new gas accounting:
Value-bearing
CALL/CALLCODEovercharged by the stipend (blocks 82.9% full). The model charged the fullCALL_VALUE(10,300) but never credited the 2,300 stipend the callee returns unconsumed. Adds an opt-instipend_returnedopcode metadata flag that nets the stipend out of the modeled cost, plus a matchingIteratingBytecodegas-limit reserve: the frame must still momentarily hold the gross charge on the last loop iteration, so each transaction's gas limit (and the block packing budget) includes one stipend of headroom. Used bytest_account_accessforvalue_sent > 0.test_ether_transfers_onchain_receiverspacked by the sum of gas dimensions (blocks 89.6% full fordiff_to_nonexistent). Under EIP-8037 the block header gas is the max of the execution and state dimensions, not their sum. Transfers to nonexistent accounts payNEW_ACCOUNT(183,600) state gas per transaction, so packing by the sum left ~10% of the binding dimension unused. The transaction count is now derived from the binding dimension while each transaction's gas limit still covers both. All other parametrizations produce identical fixtures.Verified against the EELS spec: a CALL-with-value loop fills a block to the exact modeled gas unit, and the old packing formula reproduces the exact underfilled header gas observed on besu (89,596,800 at 100M → 99,878,400 after the fix).
Note: PR + description mostly done with LLM.
TODO: (this is why PR is draft) verify that this does not introduce any fill bugs on state-actor
Related Issues or PRs
N/A.
Checklist
just static<type>(<area>): <title>, where<type>and<area>come from an appropriateC-<type>, respectivelyA-<area>, label. The title should match the target squash commit message.Cute Animal Picture
Meerkat is an Afrikaans word (believed?) to be from "mier" (ant) and "kat" (cat) 😄 👍