From 82f4474e0c16b726d0d8fc6279a156dcc8c0c682 Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Tue, 17 Dec 2024 20:47:32 +0100 Subject: [PATCH] Remove redundant code --- .../consensus/src/validation/isthmus.rs | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/crates/optimism/consensus/src/validation/isthmus.rs b/crates/optimism/consensus/src/validation/isthmus.rs index 0e2a03aba783..16e804b271f2 100644 --- a/crates/optimism/consensus/src/validation/isthmus.rs +++ b/crates/optimism/consensus/src/validation/isthmus.rs @@ -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::*; @@ -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(); @@ -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