Skip to content

Commit

Permalink
Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane committed Dec 17, 2024
1 parent d79b827 commit 82f4474
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions crates/optimism/consensus/src/validation/isthmus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ mod test {
providers::BlockchainProvider2, test_utils::create_test_provider_factory_with_chain_spec,
StateWriter,
};
use reth_trie::{
test_utils::storage_root_prehashed, HashedPostState, HashedStorage, StorageRoot,
};
use reth_trie_db::DatabaseStorageRoot;
use reth_trie::{test_utils::storage_root_prehashed, HashedPostState, HashedStorage};

use super::*;

Expand All @@ -71,7 +68,7 @@ mod test {

// init test db
// note: must be empty (default) chain spec to ensure storage is empty after init genesis,
// otherwise can't use `storage_root_prehashed` to verify storage root later
// otherwise can't use `storage_root_prehashed` to determine storage root later
let provider_factory =
create_test_provider_factory_with_chain_spec(Arc::new(OpChainSpec::default()));
let _ = init_genesis(&provider_factory).unwrap();
Expand All @@ -81,18 +78,13 @@ mod test {
provider_rw.write_hashed_state(&state.clone().into_sorted()).unwrap();
provider_rw.commit().unwrap();

// verify db write by loading database storage root
let provider_rw = provider_factory.provider_rw().unwrap();
let tx = provider_rw.tx_ref();
let (storage_root, _, _) =
StorageRoot::from_tx_hashed(tx, hashed_address).calculate(true).unwrap();
assert_eq!(storage_root, storage_root_prehashed(init_storage.storage));

// create block header with withdrawals root set to storage root of l2tol1-msg-passer
let header = Header { withdrawals_root: Some(storage_root), ..Default::default() };
let header = Header {
withdrawals_root: Some(storage_root_prehashed(init_storage.storage)),
..Default::default()
};

// create state provider factory
drop(provider_rw);
let state_provider_factory = BlockchainProvider2::new(provider_factory).unwrap();

// validate block
Expand Down

0 comments on commit 82f4474

Please sign in to comment.