Skip to content

Commit

Permalink
chore(state): consistent selfdestruct status transition (bluealloy#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrasiuk authored Oct 29, 2023
1 parent 8779d23 commit 5aff2f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions crates/revm/src/db/states/account_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ impl AccountStatus {
/// Returns the next account status on selfdestruct.
pub fn on_selfdestructed(&self) -> AccountStatus {
match self {
// Non existing account can't be destroyed.
AccountStatus::LoadedNotExisting => AccountStatus::LoadedNotExisting,
// If account is created and selfdestructed in the same block, mark it as destroyed again.
// Note: there is no big difference between Destroyed and DestroyedAgain in this case,
// but was added for clarity.
Expand Down
2 changes: 0 additions & 2 deletions crates/revm/src/db/states/cache_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ impl CacheAccount {
self.status = self.status.on_selfdestructed();

if previous_status == AccountStatus::LoadedNotExisting {
// transitions for account loaded as not existing.
self.status = AccountStatus::LoadedNotExisting;
None
} else {
Some(TransitionAccount {
Expand Down

0 comments on commit 5aff2f1

Please sign in to comment.