Skip to content

feat(test-benchmark): add deployment script - #3304

Draft
LouisTsai-Csie wants to merge 3 commits into
ethereum:benchmarks/amsterdamfrom
LouisTsai-Csie:feat-deploy-script
Draft

feat(test-benchmark): add deployment script#3304
LouisTsai-Csie wants to merge 3 commits into
ethereum:benchmarks/amsterdamfrom
LouisTsai-Csie:feat-deploy-script

Conversation

@LouisTsai-Csie

Copy link
Copy Markdown
Contributor

Description

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

Put a link to a cute animal picture inside the parenthesis-->

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.41%. Comparing base (219a9cd) to head (328611c).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           benchmarks/amsterdam    #3304   +/-   ##
=====================================================
  Coverage                 93.41%   93.41%           
=====================================================
  Files                       625      625           
  Lines                     37035    37035           
  Branches                   3386     3386           
=====================================================
  Hits                      34597    34597           
  Misses                     1668     1668           
  Partials                    770      770           
Flag Coverage Δ
unittests 93.41% <ø> (ø)

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.

@jochem-brouwer jochem-brouwer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some comments.

For filling, we have to keep in mind if we are filling under Osaka or under Amsterdam.

I also have the feeling that the gas calculations might be off. Note that we "only" want to deploy prestate here (which we should only do once, because then we take the snapshot) so we do not need to optimize it by for instance minimizing the amount of transactions or blocks.

The test_setup_contracts is not really a test, I think we should move this somewhere out of the tests/ folder (maybe in some helpers folder?)

Comment thread tests/benchmark/helper/account_creator.py Outdated
Comment thread tests/benchmark/helper/account_creator.py Outdated
intrinsic = fork.transaction_intrinsic_cost_calculator()(
calldata=b"\xff" * 32 + initcode
)
create_cost = Op.CREATE2(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: we could take the code of the deterministic deployment factory (EIP-7997) and use that to calculate the actual gas cost

The code is:

https://eips.ethereum.org/EIPS/eip-7997#specification

0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3

(pretty sure we have this as constant in EELS somewhere also)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added in the new commit.

calldata=b"\xff" * 32 + initcode
)
create_cost = Op.CREATE2(
value=0,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not the behavior of the CREATE2 factory, it will forward CALLVALUE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is only for calculating creation cost (test_deploy_existing_contracts), and since there's no value transfer when deploying max code size contracts, it should reflect the exact deployment behavior.

).initcode

base_gas = intrinsic(authorization_list_or_count=0)
per_auth_gas = intrinsic(authorization_list_or_count=1) - base_gas

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn´t this also count the base tx gas again?
Does this include that we are creating a new account? (or are we not creating a new account?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a follow-up commit.

per_auth_gas = intrinsic(authorization_list_or_count=1) - base_gas
gas_buffer = 100_000
auths_per_tx = max(
1, (tx_gas_limit - gas_buffer - base_gas) // per_auth_gas

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that tx_gas_limit is the EIP-7825 limit. If the fork is Amsterdam we can spend state gas on the to-be-created (?) accounts.

We don't have to optimize this situation though (my simple approach was just one delegation per tx 😂 )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fix in a follow-up commit.

jochem-brouwer added a commit to jochem-brouwer/execution-specs that referenced this pull request Aug 6, 2026
Brings test_setup_contracts.py (the CREATE2 receiver + EIP-7702 delegation
deployer), its transaction-packing helper, and fill-stateful's
--no-reset-between-tests flag, which is what lets a prestate persist rather than
being rewound to start_block after each test.

This is the branch PR ethereum#3304 targets, based on
benchmarks/amsterdam. Deliberately NOT feat-bloatnet-deploy-script: that is the
same three commits (patch-id identical) replayed onto an earlier,
forks/amsterdam-based version of this branch, where TransactionWithCost had been
renamed regular_cost -> execution_cost. Filling that combination dies at
construction with a pydantic ValidationError (executionCost missing /
regular_cost extra_forbidden); benchmarks/amsterdam still uses regular_cost,
which is what this test passes.
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.

2 participants