Skip to content

feat(tests): port EXTCODEHASH new account static test#2326

Merged
LouisTsai-Csie merged 2 commits intoethereum:forks/amsterdamfrom
chfast:extcodehash5
Feb 27, 2026
Merged

feat(tests): port EXTCODEHASH new account static test#2326
LouisTsai-Csie merged 2 commits intoethereum:forks/amsterdamfrom
chfast:extcodehash5

Conversation

@chfast
Copy link
Copy Markdown
Member

@chfast chfast commented Feb 25, 2026

🗒️ Description

Port extCodeHashNewAccountFiller.json and createEmptyThenExtcodehashFiller.json: EXTCODEHASH/EXTCODESIZE of a contract created via CREATE/CREATE2 within the same transaction reflects the newly deployed code. Parametrized over empty and non-empty deployed code.

🔗 Related Issues or PRs

N/A.

✅ 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 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-->

Port extCodeHashNewAccountFiller.json and createEmptyThenExtcodehashFiller.json:
EXTCODEHASH/EXTCODESIZE of a contract created via CREATE2 within the same
transaction reflects the newly deployed code. Parametrized over empty and
non-empty deployed code.
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.85%. Comparing base (03d6943) to head (13c33c2).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #2326   +/-   ##
================================================
  Coverage            85.85%   85.85%           
================================================
  Files                  599      599           
  Lines                39428    39428           
  Branches              3776     3776           
================================================
  Hits                 33851    33851           
  Misses                4946     4946           
  Partials               631      631           
Flag Coverage Δ
unittests 85.85% <ø> (ø)

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.

@LouisTsai-Csie LouisTsai-Csie self-requested a review February 26, 2026 03:39
Copy link
Copy Markdown
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.

Thanks! Leave some comment

Comment on lines +608 to +612
def test_extcodehash_new_account(
state_test: StateTestFiller,
pre: Alloc,
deployed_code: bytes,
) -> None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we add CREATE as parametrization here:

Suggested change
def test_extcodehash_new_account(
state_test: StateTestFiller,
pre: Alloc,
deployed_code: bytes,
) -> None:
@pytest.mark.parametrize("opcode", [Op.CREATE, Op.CREATE2])
def test_extcodehash_new_account(
state_test: StateTestFiller,
pre: Alloc,
deployed_code: bytes,
opcode: Op,
) -> None:

More changes needed, comment below:

Comment thread tests/constantinople/eip1052_extcodehash/test_extcodehash.py Outdated
Comment on lines +641 to +645
created_address = compute_create2_address(
address=code_address,
salt=0x10,
initcode=initcode,
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
created_address = compute_create2_address(
address=code_address,
salt=0x10,
initcode=initcode,
)
created_address = compute_create_address(
address=code_address,
nonce=1,
salt=0,
initcode=initcode,
opcode=opcode,
)

now it handles both cases - CREATE2 and CREATE

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do we really need to know this address at python side?

Comment thread tests/constantinople/eip1052_extcodehash/test_extcodehash.py Outdated
Copy link
Copy Markdown
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.

LGTM, thanks!

@LouisTsai-Csie LouisTsai-Csie added A-tests Area: Consensus tests. C-test Category: test labels Feb 27, 2026
@LouisTsai-Csie LouisTsai-Csie merged commit c68a266 into ethereum:forks/amsterdam Feb 27, 2026
14 checks passed
@chfast chfast deleted the extcodehash5 branch February 27, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tests Area: Consensus tests. C-test Category: test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants