From 35ed3e8bb39327f2b3823945d461b1ef4f7f46a8 Mon Sep 17 00:00:00 2001 From: Longarithm Date: Tue, 5 Nov 2024 14:21:52 +0100 Subject: [PATCH] no record --- core/store/src/trie/mem/mem_trie_update.rs | 6 +--- core/store/src/trie/mod.rs | 33 ++++++---------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/core/store/src/trie/mem/mem_trie_update.rs b/core/store/src/trie/mem/mem_trie_update.rs index ccf1c1cd2ef..345e96edfb1 100644 --- a/core/store/src/trie/mem/mem_trie_update.rs +++ b/core/store/src/trie/mem/mem_trie_update.rs @@ -71,9 +71,6 @@ impl UpdatedMemTrieNodeWithSize { pub struct TrieAccesses { /// Hashes and encoded trie nodes. pub nodes: HashMap>, - /// Hashes of accessed values - because values themselves are not - /// necessarily present in memtrie. - pub values: HashMap, } /// Tracks intermediate trie changes, final version of which is to be committed @@ -181,7 +178,6 @@ impl<'a, M: ArenaMemory> GenericTrieUpdate<'a, MemTrieNodeId, FlatStateValue> fn delete_value(&mut self, value: FlatStateValue) -> Result<(), StorageError> { if let Some(tracked_node_changes) = self.tracked_trie_changes.as_mut() { let hash = value.to_value_ref().hash; - tracked_node_changes.accesses.values.insert(hash, value); tracked_node_changes .refcount_deleted_hashes .entry(hash) @@ -209,7 +205,7 @@ impl<'a, M: ArenaMemory> MemTrieUpdate<'a, M> { Some(TrieChangesTracker { refcount_inserted_values: BTreeMap::new(), refcount_deleted_hashes: BTreeMap::new(), - accesses: TrieAccesses { nodes: HashMap::new(), values: HashMap::new() }, + accesses: TrieAccesses { nodes: HashMap::new() }, }) } else { None diff --git a/core/store/src/trie/mod.rs b/core/store/src/trie/mod.rs index 2f97771af18..e0e1cfb3e60 100644 --- a/core/store/src/trie/mod.rs +++ b/core/store/src/trie/mod.rs @@ -1650,21 +1650,6 @@ impl Trie { } let (trie_changes, trie_accesses) = trie_update.to_trie_changes(); - // Sanity check for tests: all modified trie items must be - // present in ever accessed trie items. - #[cfg(test)] - { - for t in trie_changes.deletions.iter() { - let hash = t.trie_node_or_value_hash; - assert!( - trie_accesses.values.contains_key(&hash) - || trie_accesses.nodes.contains_key(&hash), - "Hash {} is not present in trie accesses", - hash - ); - } - } - // Retroactively record all accessed trie items which are // required to process trie update but were not recorded at // processing lookups. @@ -1675,15 +1660,15 @@ impl Trie { for (node_hash, serialized_node) in trie_accesses.nodes { recorder.borrow_mut().record(&node_hash, serialized_node); } - for (value_hash, value) in trie_accesses.values { - let value = match value { - FlatStateValue::Ref(_) => { - self.storage.retrieve_raw_bytes(&value_hash)? - } - FlatStateValue::Inlined(value) => value.into(), - }; - recorder.borrow_mut().record(&value_hash, value); - } + // for (value_hash, value) in trie_accesses.values { + // let value = match value { + // FlatStateValue::Ref(_) => { + // self.storage.retrieve_raw_bytes(&value_hash)? + // } + // FlatStateValue::Inlined(value) => value.into(), + // }; + // recorder.borrow_mut().record(&value_hash, value); + // } } Ok(trie_changes) }