Skip to content

Conversation

@marioevz
Copy link
Member

@marioevz marioevz commented Dec 16, 2025

🗒️ Description

pre.deterministic_deploy_contract

Implements a new function in the pre object called deterministic_deploy_contract, which uses https://github.com/Arachnid/deterministic-deployment-proxy to deploy contracts at deterministic addresses using CREATE2.

The function takes the following parameters:

  • deploy_code: The bytecode to be deployed. Will be deployed at keccak256( 0xff ++ 0x4E59B44847B379578588920CA78FBF26C0B4956C ++ salt ++ keccak256(init_code))[12:]
  • salt: Salt to be passed to the CREATE2 opcode. Defaults to zero.
  • initcode: Initcode that deploys the code. It will not be checked in any way against the value passed in deploy_code until the transactions is sent to the network using execute. Can be skipped and the initcode will be auto-generated.
  • setup_calldata: If specified, a transaction will be sent to the contract after deployment with this calldata. Can be used to reset storage values before the test starts.

EIP-7997

EIP-7997 includes a predeploy that is meant to replace contracts like the one in 0x4E59B44847B379578588920CA78FBF26C0B4956C.
To account for this and to be future compatible with the EIP, all added functions check the new fork.deterministic_factory_predeploy_address() method to check whether the currently active fork already has a deployment factory before deploying/using 0x4E59B44847B379578588920CA78FBF26C0B4956C.

execute deploy-required-contracts

New execute command that deploys all execute pre-requisite contracts to the given chain.

At the moment it only deploys 0x4E59B44847B379578588920CA78FBF26C0B4956C, but we will add more useful contracts in the future.

🔗 Related Issues or PRs

Closes #1933

✅ Checklist

  • All: Ran fast tox checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    uvx tox -e static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered adding an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

Cute Animal Picture

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

@marioevz
Copy link
Member Author

One open question is that, in execute, we will not be able to run two different tests that use the same contract without causing issues.
One potential solution could be to use a lock for these contracts, but it could lead to tests dead-locking themselves.

@marioevz
Copy link
Member Author

Example test: https://github.com/ethereum/execution-specs/blob/dd68f48bd0400d35b0bbaf00fd8be016f523edf2/tests/constantinople/eip1014_create2/test_deterministic_deployment.py

I've verified this locally using fill and kurtosis, the test can be run over and over and the deployment only happens once.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.33%. Comparing base (d618e52) to head (5c86d49).
⚠️ Report is 18 commits behind head on forks/amsterdam.

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #1934   +/-   ##
================================================
  Coverage            86.33%   86.33%           
================================================
  Files                  538      538           
  Lines                34557    34557           
  Branches              3222     3222           
================================================
  Hits                 29835    29835           
  Misses                4148     4148           
  Partials               574      574           
Flag Coverage Δ
unittests 86.33% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@CPerezz CPerezz left a comment

Choose a reason for hiding this comment

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

Important things also:

  • Missing max code size validation in execute mode. The filler implementation checks max_code_size (line 176), but execute mode doesn't. This should be patched.
  • DETERMINISTIC_DEPLOYMENT_CONTRACT_ADDRESS is defined multiple times.

Copy link
Collaborator

@LouisTsai-Csie LouisTsai-Csie left a comment

Choose a reason for hiding this comment

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

Leave some comments! I now have a better understanding of the big picture, will revisit CPerezz' PR to see how to integrate.

@marioevz marioevz force-pushed the deterministic-deploy-contract branch from 7bebfa3 to b488fe8 Compare January 5, 2026 18:31
Copy link
Contributor

@fselmo fselmo left a comment

Choose a reason for hiding this comment

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

This flow is quite elegant, love this. I left some tiny nits (take or leave them) but also some things to think about when it comes to the proxy deployment.

  • We can put the proxy deploy in a parent batch for safety so that at least the first contract that depends on it uses the requires_predecessor flag to start a new batch and to make sure the proxy deploy is confirmed first.
  • We could have an internal flag that only deploys the proxy once, in the case that a test deploys multiple contracts using this API. They can still be in the same batch, whose parent is the proxy deployment and is only triggered to deploy one time.

I still haven't tested this in execute so I will take a pass at that next but it seems like it should work well. Great addition 👍🏼

Copy link
Contributor

@fselmo fselmo left a comment

Choose a reason for hiding this comment

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

Really cool feature! And really elegant implementation 👌🏼

lgtm 🚀!

Copy link
Contributor

@CPerezz CPerezz left a comment

Choose a reason for hiding this comment

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

Thanks for adding this!!

@marioevz marioevz dismissed LouisTsai-Csie’s stale review January 9, 2026 16:46

All comments addressed and other reviewers approved.

@marioevz marioevz merged commit 98db255 into ethereum:forks/amsterdam Jan 9, 2026
18 checks passed
@marioevz marioevz deleted the deterministic-deploy-contract branch January 9, 2026 16:46
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.

feat(test-cli-execute): Allow use of address during pre.deploy_contract

4 participants