From 1f0463e9db8b6ff70f35f1710346a5a08d115865 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com> Date: Thu, 19 Dec 2024 19:23:11 +0200 Subject: [PATCH 1/4] fix(tree): destroyed accounts should not have storage in state root task --- crates/engine/tree/src/tree/root.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/engine/tree/src/tree/root.rs b/crates/engine/tree/src/tree/root.rs index dd931a8e40b8..642e65c667c4 100644 --- a/crates/engine/tree/src/tree/root.rs +++ b/crates/engine/tree/src/tree/root.rs @@ -243,7 +243,9 @@ fn evm_state_to_hashed_post_state(update: EvmState) -> HashedPostState { }) .peekable(); - if destroyed || changed_storage_iter.peek().is_some() { + if destroyed { + hashed_state.storages.insert(hashed_address, HashedStorage::new(destroyed)); + } else if changed_storage_iter.peek().is_some() { hashed_state.storages.insert( hashed_address, HashedStorage::from_iter(destroyed, changed_storage_iter), From de5dc554425020d87ff677a4d3883259c3981206 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:14:06 +0200 Subject: [PATCH 2/4] Update root.rs Co-authored-by: Federico Gimenez --- crates/engine/tree/src/tree/root.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/tree/src/tree/root.rs b/crates/engine/tree/src/tree/root.rs index 642e65c667c4..ef98dced7454 100644 --- a/crates/engine/tree/src/tree/root.rs +++ b/crates/engine/tree/src/tree/root.rs @@ -244,7 +244,7 @@ fn evm_state_to_hashed_post_state(update: EvmState) -> HashedPostState { .peekable(); if destroyed { - hashed_state.storages.insert(hashed_address, HashedStorage::new(destroyed)); + hashed_state.storages.insert(hashed_address, HashedStorage::new(true)); } else if changed_storage_iter.peek().is_some() { hashed_state.storages.insert( hashed_address, From 7f842514da43505f02cdcde454b04d1c32f5f3df Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:14:13 +0200 Subject: [PATCH 3/4] Update root.rs Co-authored-by: Federico Gimenez --- crates/engine/tree/src/tree/root.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/tree/src/tree/root.rs b/crates/engine/tree/src/tree/root.rs index ef98dced7454..f1315eadec5e 100644 --- a/crates/engine/tree/src/tree/root.rs +++ b/crates/engine/tree/src/tree/root.rs @@ -248,7 +248,7 @@ fn evm_state_to_hashed_post_state(update: EvmState) -> HashedPostState { } else if changed_storage_iter.peek().is_some() { hashed_state.storages.insert( hashed_address, - HashedStorage::from_iter(destroyed, changed_storage_iter), + HashedStorage::from_iter(false, changed_storage_iter), ); } } From 05ba74ac752c847cc40109caba6e1d2f9a183860 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:06:15 +0200 Subject: [PATCH 4/4] fmt --- crates/engine/tree/src/tree/root.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/engine/tree/src/tree/root.rs b/crates/engine/tree/src/tree/root.rs index f1315eadec5e..6ebb509da85b 100644 --- a/crates/engine/tree/src/tree/root.rs +++ b/crates/engine/tree/src/tree/root.rs @@ -246,10 +246,9 @@ fn evm_state_to_hashed_post_state(update: EvmState) -> HashedPostState { if destroyed { hashed_state.storages.insert(hashed_address, HashedStorage::new(true)); } else if changed_storage_iter.peek().is_some() { - hashed_state.storages.insert( - hashed_address, - HashedStorage::from_iter(false, changed_storage_iter), - ); + hashed_state + .storages + .insert(hashed_address, HashedStorage::from_iter(false, changed_storage_iter)); } } }