From 457439ea2b31dc1927a67172a407f5b4cfb64e1c Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Wed, 21 Aug 2024 02:36:54 -0700 Subject: [PATCH] fix(trie): clear all deleted storage nodes on extend (#10411) --- crates/trie/trie/src/updates.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/trie/trie/src/updates.rs b/crates/trie/trie/src/updates.rs index b24eae2bd31d..2b53ddfd7bcc 100644 --- a/crates/trie/trie/src/updates.rs +++ b/crates/trie/trie/src/updates.rs @@ -152,6 +152,10 @@ impl StorageTrieUpdates { /// Extends storage trie updates. pub fn extend(&mut self, other: Self) { + if other.is_deleted { + self.storage_nodes.clear(); + self.removed_nodes.clear(); + } self.is_deleted |= other.is_deleted; self.storage_nodes.extend(ExcludeEmptyFromPair::from_iter(other.storage_nodes)); self.removed_nodes.extend(ExcludeEmpty::from_iter(other.removed_nodes));