feat(spec-specs, tests): EIP-8037 tx created contracts destroyed in same tx#2828
Merged
spencer-tb merged 2 commits intoMay 10, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devnets/bal/7 #2828 +/- ##
================================================
Coverage ? 87.64%
================================================
Files ? 531
Lines ? 32378
Branches ? 3127
================================================
Hits ? 28378
Misses ? 3515
Partials ? 485
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0601713 to
df8d6c1
Compare
…d contracts destroyed in same tx
…tracts destroyed in same tx
df8d6c1 to
6544240
Compare
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description
A create tx charges
STATE_BYTES_PER_NEW_ACCOUNT * COST_PER_STATE_BYTEof instrinsic state gas at the start of tx processing for contract creation. If the contract is then destroyed in the same tx via a selfdestruct, the existing refund mechanism clamps to the state gas used which does not include the intrinsic state gas charge from the start of tx processing. This means the intrinsic state gas charge for account creating stays billed even though no contract persists at end of the tx. TLDR; the user pays for state that was never written.This PR aims to fix the inconsistency by routing the destroyed contract state gas charge by refunding then moment when the destroyed account is the create tx target.
@benaadams and Iván (ethrex) flagged this scenario class during the Soldogn interop on
bal-devnet-6. The specific case Iván mentioned: "creation tx, initcode selfdestructs to an empty beneficiary withvalue > 0" was already correctly accounted for by accident. There was however a bug from many other scenarios:value✅ Checklist
just statictype(scope):.