From 059e9c9a2941329a2fc18d219eaf14d98f755684 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Fri, 12 May 2023 20:52:13 +0300 Subject: [PATCH] fix(executor): do not destroy empty accounts (#2630) --- crates/revm/src/executor.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/revm/src/executor.rs b/crates/revm/src/executor.rs index 5b8641536c..c7a93a5a8a 100644 --- a/crates/revm/src/executor.rs +++ b/crates/revm/src/executor.rs @@ -393,9 +393,13 @@ pub fn commit_state_changes( panic!("Left panic to critically jumpout if happens, as every account should be hot loaded."); } }; - // Insert into `change` a old account and None for new account - // and mark storage to be mapped - post_state.destroy_account(block_number, address, to_reth_acc(&db_account.info)); + + let old = to_reth_acc(&db_account.info); + if !old.is_empty() { + // Insert into `change` a old account and None for new account + // and mark storage to be wiped + post_state.destroy_account(block_number, address, to_reth_acc(&db_account.info)); + } // clear cached DB and mark account as not existing db_account.storage.clear();