Skip to content

fix(test-benchmark): fill benchmark blocks fully under EIP-8037 gas accounting (repricing) - #3269

Draft
jochem-brouwer wants to merge 21 commits into
ethereum:benchmarks/amsterdamfrom
jochem-brouwer:glam-repr-bench-fixes
Draft

fix(test-benchmark): fill benchmark blocks fully under EIP-8037 gas accounting (repricing)#3269
jochem-brouwer wants to merge 21 commits into
ethereum:benchmarks/amsterdamfrom
jochem-brouwer:glam-repr-bench-fixes

Conversation

@jochem-brouwer

Copy link
Copy Markdown
Member

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:

  1. Value-bearing CALL/CALLCODE overcharged by the stipend (blocks 82.9% full). The model charged the full CALL_VALUE (10,300) but never credited the 2,300 stipend the callee returns unconsumed. Adds an opt-in stipend_returned opcode metadata flag that nets the stipend out of the modeled cost, plus a matching IteratingBytecode gas-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 by test_account_access for value_sent > 0.

  2. test_ether_transfers_onchain_receivers packed by the sum of gas dimensions (blocks 89.6% full for diff_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 pay NEW_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

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <title>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

Cute Animal Picture

pexels-indra-lietaviete-646192824-27532234

Meerkat is an Afrikaans word (believed?) to be from "mier" (ant) and "kat" (cat) 😄 👍

flcl42 and others added 21 commits July 29, 2026 08:40
…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
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>
…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>
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…3158)

Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…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

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.49%. Comparing base (0da4387) to head (b39d963).

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           
Flag Coverage Δ
unittests 93.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# execution cost is accounted separately.
base_cost -= gas_costs.CALL_STIPEND
if metadata["account_new"]:
base_cost += gas_costs.NEW_ACCOUNT

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good for debugging and failing fast:

Suggested change
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",
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some Amsterdam cases. First one verifies the EIP-8038 repricing. Second one verifies the EIP-8037 dimension split with a new account.

Suggested change
),
),
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",
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
),
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",
),

@spencer-tb

Copy link
Copy Markdown
Contributor

I think we could add a small unit test for returned_stipend_reserve. Small review, I know its in draft 😅

@jochem-brouwer
jochem-brouwer changed the base branch from forks/amsterdam to benchmarks/amsterdam August 3, 2026 23:25
@jochem-brouwer

Copy link
Copy Markdown
Member Author

(changed target base, need to rebase this one, FYI)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.