Skip to content

Implement EIP-8246: "Remove SELFDESTRUCT Burn"#1572

Merged
chfast merged 1 commit into
masterfrom
amsterdam/selfdestruct_burn
Jun 26, 2026
Merged

Implement EIP-8246: "Remove SELFDESTRUCT Burn"#1572
chfast merged 1 commit into
masterfrom
amsterdam/selfdestruct_burn

Conversation

@chfast

@chfast chfast commented Jun 25, 2026

Copy link
Copy Markdown
Member

This EIP removes the "burn" feature of SELFDESTRUCT. If a contract tries to burn ETH the balance is preserved.

https://eips.ethereum.org/EIPS/eip-8246

@chfast chfast force-pushed the amsterdam/selfdestruct_burn branch from a36ecb0 to 77f03d5 Compare June 25, 2026 21:51
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.38%. Comparing base (3616ba6) to head (a7d03db).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1572   +/-   ##
=======================================
  Coverage   97.37%   97.38%           
=======================================
  Files         163      163           
  Lines       14572    14622   +50     
  Branches     3393     3395    +2     
=======================================
+ Hits        14190    14240   +50     
  Misses        280      280           
  Partials      102      102           
Flag Coverage Δ
eest-develop 89.62% <57.14%> (-0.05%) ⬇️
eest-develop-gmp 26.16% <7.54%> (-0.09%) ⬇️
eest-legacy 17.56% <7.54%> (-0.06%) ⬇️
eest-libsecp256k1 27.80% <7.54%> (-0.09%) ⬇️
eest-stable 89.71% <57.14%> (-0.05%) ⬇️
evmone-unittests 92.58% <100.00%> (+0.02%) ⬆️

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

Components Coverage Δ
core 95.95% <100.00%> (+<0.01%) ⬆️
tooling 90.21% <ø> (ø)
tests 99.80% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
test/state/host.cpp 100.00% <100.00%> (ø)
test/state/state.cpp 99.68% <100.00%> (+<0.01%) ⬆️
...t/unittests/state_transition_selfdestruct_test.cpp 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Implements EIP-8246 (“Remove SELFDESTRUCT Burn”) in the test-state transition framework by preventing balance burn on SELFDESTRUCT-to-self starting at the EVMC_AMSTERDAM revision, and adds unit coverage for the new semantics.

Changes:

  • Adjust Host::selfdestruct() to skip balance burn when beneficiary == addr from EVMC_AMSTERDAM.
  • Update State::build_diff() to preserve balance for self-destructed accounts (Amsterdam+) instead of deleting them in the no-burn case.
  • Add unit tests covering Amsterdam vs Cancun/Shanghai behavior for initcode + pre-funded/self-burn scenarios.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
test/unittests/state_transition_selfdestruct_test.cpp Adds Amsterdam-focused tests for SELFDESTRUCT burn removal and pre-funded edge cases.
test/state/state.cpp Modifies state diff generation to preserve balance for destructed accounts in Amsterdam+.
test/state/host.cpp Updates SELFDESTRUCT balance-transfer logic to avoid burning on self-to-self in Amsterdam+.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/state/state.cpp
Comment on lines +233 to +237
if (rev >= EVMC_AMSTERDAM && m.balance != 0)
{
// Preserve the balance of the self-destructed account, no burn (EIP-8246).
diff.modified_accounts.emplace_back(StateDiff::Entry{addr, 0, m.balance});
}
Comment thread test/unittests/state_transition_selfdestruct_test.cpp Outdated
@chfast chfast force-pushed the amsterdam/selfdestruct_burn branch 2 times, most recently from 74ff06a to 8a4ccc1 Compare June 26, 2026 05:39
This EIP removes the "burn" feature of SELFDESTRUCT. If a contract
tries to burn ETH the balance is preserved.

https://eips.ethereum.org/EIPS/eip-8246
@chfast chfast force-pushed the amsterdam/selfdestruct_burn branch from 8a4ccc1 to a7d03db Compare June 26, 2026 06:00
@chfast chfast requested a review from Copilot June 26, 2026 06:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@chfast chfast merged commit 1164d38 into master Jun 26, 2026
24 checks passed
@chfast chfast deleted the amsterdam/selfdestruct_burn branch June 26, 2026 06:36
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