Skip to content

Conversation

@fselmo
Copy link
Contributor

@fselmo fselmo commented Dec 29, 2025

🗒️ Description

Added comprehensive SELFDESTRUCT tests covering beneficiaries as EOA, contract, precompiles, and self. All tests consolidated in TangerineWhistle with fork-aware parametrization

  • is_success (exact_gas / exact_gas_minus_1) - tests success boundary
  • warm param uses pytest.param(..., marks=valid_from("Berlin")) so warm tests only run on >=Berlin
  • State access boundary tests (consensus check: beneficiary accessed before G_NEW_ACCOUNT evaluated)
  • same_tx vs pre-deployed contracts
  • originator_balance (0/1) - EIP-161 behavior difference
  • beneficiary_initial_balance (0/1) - dead/alive for G_NEW_ACCOUNT

Precompile coverage was sparse - some static tests hit 0x01, others 0x01-0x03. Now using @pytest.mark.with_all_precompiles for full coverage across all fork precompiles.

TangerineWhistle (EIP-150): All tests live here since this is when gas costs for SELFDESTRUCT were introduced. Fork-aware parametrization handles Berlin+ warm/cold distinction.

SpuriousDragon (EIP-161, EIP-155): Tests correctly handle the originator_balance > 0 requirement for G_NEW_ACCOUNT. Also updated old tests to use >= SpuriousDragon for protected transactions since this is when EIP-155 was introduced, not Byzantium as other tests have been using in our codebase. [This was then refactored as fork.supports_protected_txs, returning True beginning at SpuriousDragon].

Berlin (EIP-2929): Warm/cold coverage integrated via warm param with valid_from("Berlin") mark - no separate Berlin test file needed.

🔗 Related Issues or PRs

  • Related to a Nethermind bug in BAL devnet 1, relevant PR here

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

Cute Animal Picture

Screenshot 2025-12-29 at 14 19 44

@fselmo fselmo marked this pull request as ready for review December 29, 2025 23:01
@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (eips/amsterdam/eip-7928@c5db5ae). Learn more about missing BASE report.

Additional details and impacted files
@@                    Coverage Diff                     @@
##             eips/amsterdam/eip-7928    #1954   +/-   ##
==========================================================
  Coverage                           ?   86.25%           
==========================================================
  Files                              ?      538           
  Lines                              ?    34561           
  Branches                           ?     3224           
==========================================================
  Hits                               ?    29809           
  Misses                             ?     4165           
  Partials                           ?      587           
Flag Coverage Δ
unittests 86.25% <ø> (?)

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.

@fselmo
Copy link
Contributor Author

fselmo commented Dec 30, 2025

I think we should move these to an earlier fork as it looks like we may not have coverage for this. I see some coverage in the static tests but not for all opcodes. It would be good to have this in python either way and use the pytest.mark.with_all_precompiles to test every added precompile for every fork as they are added.

I'll work on porting this to an earlier fork.

@jochem-brouwer
Copy link
Member

Does this initialize the precompiles as empty and does it attempt to create the accounts via SELFDESTRUCT?

This is definitely a case which should be added, but just wanted to note here that due to this bug:

image

(from the yellow paper) there is this weird behavior with precompiles, creating the account, the precompile going out-of-gas and then the account cleanup either cleaning up the account (or not).

This bug caused that later devnets and all live chains just funded the addresses with 1 wei, such that the account is always there (and not the "0 balance, 0 nonce, no code, no storage", but still in trie case, which now is not possible anymore since it has a balance)

I wanted to share this because this might be the reason why the coverage report is low. I think (although this should be an EIP in that case) that the general consensus is to "just fund the precompiles" with 1 wei at genesis to get rid of this behavior, and that it is thus either unspecified or untested behavior.

@fselmo fselmo force-pushed the feat/additional-bal-selfdestruct-tests branch from 250a01c to a4faa41 Compare December 30, 2025 21:04
@fselmo
Copy link
Contributor Author

fselmo commented Dec 30, 2025

Does this initialize the precompiles as empty and does it attempt to create the accounts via SELFDESTRUCT?

pytest.mark.with_all_precompiles will parametrize for all precompile addresses that are mapped for the fork you are filling for, but it doesn't add anything to the pre. All the EVM knows is that this is the beneficiary for the self-destruct. Is there a missing case? 🤔

@jochem-brouwer
Copy link
Member

pytest.mark.with_all_precompiles will parametrize for all precompile addresses that are mapped for the fork you are filling for, but it doesn't add anything to the pre. All the EVM knows is that this is the beneficiary for the self-destruct. Is there a missing case? 🤔

Ah sorry, I think my comment is confusing. The YP case is, IIRC, a case which is only possible if a precompile account is empty (no balance, 0 nonce, no code, no storage). I am not sure but I thought some tests pre-fill precompiles with a balance to make them non-empty, and wanted to explicitly mention this here. But I think this is already the case. So no missing cases found here.

Copy link
Member

@jochem-brouwer jochem-brouwer left a comment

Choose a reason for hiding this comment

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

Not a review of the tests, just a small point regarding fork names and docs 😄 👍

fselmo added a commit to fselmo/execution-specs that referenced this pull request Dec 30, 2025
@fselmo fselmo force-pushed the feat/additional-bal-selfdestruct-tests branch from e89a230 to 88cb64f Compare December 30, 2025 23:40
fselmo added a commit to fselmo/execution-specs that referenced this pull request Dec 30, 2025
@fselmo fselmo added this to the amsterdam milestone Jan 5, 2026
@fselmo fselmo added A-test-tests Area: tests for packages/testing C-feat Category: an improvement or new feature labels Jan 5, 2026
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 6, 2026
@fselmo fselmo force-pushed the feat/additional-bal-selfdestruct-tests branch from dfac8a9 to 41d351d Compare January 6, 2026 06:01
@fselmo fselmo changed the title feat(test): OOG and success selfdestruct tests to all precompiles feat(test): OOG and success selfdestruct tests Jan 6, 2026
@fselmo fselmo marked this pull request as draft January 6, 2026 15:25
Carsons-Eels pushed a commit to Carsons-Eels/execution-specs that referenced this pull request Jan 6, 2026
* chore(ci|clis): updates for full release.

temp

* chore(ci): tweaks.

* chore(ci): filter benchmark tests.
@fselmo fselmo force-pushed the feat/additional-bal-selfdestruct-tests branch 3 times, most recently from f63364f to 6c298a9 Compare January 6, 2026 20:50
@danceratopz danceratopz self-assigned this Jan 7, 2026
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 8, 2026
@fselmo fselmo force-pushed the feat/additional-bal-selfdestruct-tests branch from 4011d69 to 0f19de7 Compare January 8, 2026 04:33
@fselmo fselmo marked this pull request as ready for review January 8, 2026 05:07
@fselmo
Copy link
Contributor Author

fselmo commented Jan 8, 2026

@danceratopz this is ready for review now! Note that json_infra and optimized CI runs won't pass until the next bal test release is out and we point to it in the CI (blob params from the last release are at Osaka but the repo is now at BPO2).

fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 8, 2026
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 12, 2026
@fselmo fselmo force-pushed the feat/additional-bal-selfdestruct-tests branch from 6cb7712 to 930a8dc Compare January 12, 2026 17:10
@fselmo fselmo force-pushed the feat/additional-bal-selfdestruct-tests branch from 930a8dc to 31937e3 Compare January 12, 2026 17:12
Comment on lines +1141 to +1142
Note: Gas boundary testing not possible for initcode since CREATE
doesn't accept a gas parameter - it uses all available gas.
Copy link
Member

Choose a reason for hiding this comment

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

See example in this PR: https://github.com/ethereum/execution-specs/pull/2002/files#diff-095178dc2c6d121067cadab23cb09943682751281a0489a73f90906e26855a6a

Basically we limit the gas passed to the factory contract, taking into account the 63/64 rule.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Really nice use 😄. I created #2010 to track this 👍🏼

Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

Approving based on:

  • Tracking issue #2010 will fix outstanding comment.
  • CI failures require new BAL release.

@fselmo fselmo merged commit f8f52d9 into ethereum:eips/amsterdam/eip-7928 Jan 12, 2026
14 of 16 checks passed
fselmo added a commit that referenced this pull request Jan 12, 2026
Bonus:

- fix(test): remove unnecessary isolation for enginex
fselmo added a commit that referenced this pull request Jan 12, 2026
@fselmo fselmo deleted the feat/additional-bal-selfdestruct-tests branch January 12, 2026 19:29
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 12, 2026
…ereum#1954

Bonus:

- fix(test): remove unnecessary isolation for enginex
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 12, 2026
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 12, 2026
…ereum#1954

Bonus:

- fix(test): remove unnecessary isolation for enginex
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 12, 2026
fselmo added a commit that referenced this pull request Jan 12, 2026
Bonus:

- fix(test): remove unnecessary isolation for enginex
fselmo added a commit that referenced this pull request Jan 12, 2026
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 15, 2026
…ereum#1954

Bonus:

- fix(test): remove unnecessary isolation for enginex
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 15, 2026
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 15, 2026
…ereum#1954

Bonus:

- fix(test): remove unnecessary isolation for enginex
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 15, 2026
fselmo added a commit that referenced this pull request Jan 16, 2026
Bonus:

- fix(test): remove unnecessary isolation for enginex
fselmo added a commit that referenced this pull request Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-test-commands Area: execution_testing.cli.eest.commands A-test-tests Area: tests for packages/testing C-feat Category: an improvement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants