Conversation
pamla9
marked this pull request as ready for review
August 25, 2026 04:02
Contributor
|
PR author is not in the allowed authors list. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1270 +/- ##
=======================================
Coverage 67.45% 67.46%
=======================================
Files 320 320
Lines 23457 23463 +6
=======================================
+ Hits 15823 15829 +6
Misses 6455 6455
Partials 1179 1179
🚀 New features to boost your workflow:
|
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
This addresses the empty-runtime edge case reported in #1269.
StateDB already tracks whether an account became a contract in the current transaction through
newContract. The commit path now uses that fact when deleting a self-destructed account. Newly created contracts use a dedicated keeper method that does not require runtime code to have been persisted first. ExistingDeleteAccountcallers continue to require the persisted-contract check.This replaces the existing persist-before-delete path with an explicit deletion path for contracts created in the current transaction. Code presence is no longer used as a proxy for same-transaction creation.
The integration test pre-funds the sender's next CREATE address, deploys init code that immediately executes
SELFDESTRUCT, and checks that:The
statedb.Keeperinterface and the expected keeper interfaces gainDeleteNewContractAccount. The existingDeleteAccountsignature and behavior are unchanged.This is a source-level breaking change for downstream applications that implement the affected keeper interfaces. They need to add
DeleteNewContractAccount. The method is intended to be called only after StateDB has established that the account became a contract in the current transaction.Review
The main behavior change is in:
x/vm/statedb/statedb.go, wherenewContractselects the deletion path;x/vm/keeper/statedb.go, where both deletion paths share the same cleanup but only an already-persisted contract requires the code check; andtests/integration/x/vm/test_state_transition.go, which exercises the full transaction and block-commit path.Focused verification:
Closes: #1269