Skip to content

Commit

Permalink
reverted unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Nov 28, 2024
1 parent 9e043ad commit 14fe494
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions crates/engine/tree/src/tree/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,10 @@ mod tests {
providers::ConsistentDbView, test_utils::create_test_provider_factory, HashingWriter,
};
use reth_testing_utils::generators::{self, Rng};
use reth_trie::{test_utils::state_root, TrieInput};
use reth_trie::{test_utils::state_root, HashedStorage, TrieInput};
use revm_primitives::{
Account as RevmAccount, AccountInfo, AccountStatus, Address, EvmState, EvmStorageSlot,
HashMap, B256, KECCAK_EMPTY, U256,
keccak256, Account as RevmAccount, AccountInfo, AccountStatus, Address, EvmState,
EvmStorageSlot, HashMap, B256, KECCAK_EMPTY, U256,
};
use std::sync::Arc;

Expand Down Expand Up @@ -633,11 +633,32 @@ mod tests {
}

for update in &state_updates {
let hashed_state_update = transform_state_update(update.clone());

hashed_state.extend(hashed_state_update);

for (address, account) in update {
let hashed_address = keccak256(*address);

if account.is_touched() {
let destroyed = account.is_selfdestructed();
hashed_state.accounts.insert(
hashed_address,
if destroyed || account.is_empty() {
None
} else {
Some(account.info.clone().into())
},
);
if destroyed || !account.storage.is_empty() {
let storage = account
.storage
.iter()
.filter(|&(_slot, value)| (!destroyed && value.is_changed()))
.map(|(slot, value)| {
(keccak256(B256::from(*slot)), value.present_value)
});
hashed_state
.storages
.insert(hashed_address, HashedStorage::from_iter(destroyed, storage));
}
}
let storage: HashMap<B256, U256> = account
.storage
.iter()
Expand Down

0 comments on commit 14fe494

Please sign in to comment.