diff --git a/bin/reth-bench/src/bench/new_payload_fcu.rs b/bin/reth-bench/src/bench/new_payload_fcu.rs index e3d388b37ece..2866cf8fb45c 100644 --- a/bin/reth-bench/src/bench/new_payload_fcu.rs +++ b/bin/reth-bench/src/bench/new_payload_fcu.rs @@ -75,7 +75,7 @@ impl Command { while let Some((block, head, safe, finalized)) = receiver.recv().await { // just put gas used here let gas_used = block.gas_used; - let block_number = block.header.number; + let block_number = block.number; let versioned_hashes: Vec = block.body().blob_versioned_hashes_iter().copied().collect(); diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index 3964ea53b7e2..ee73eb34f529 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -1199,7 +1199,8 @@ where durations_recorder.record_relative(MakeCanonicalAction::ClearTrieUpdatesForOtherChildren); // Send notification about new canonical chain and return outcome of canonicalization. - let outcome = CanonicalOutcome::Committed { head: chain_notification.tip().header.clone() }; + let outcome = + CanonicalOutcome::Committed { head: chain_notification.tip().sealed_header().clone() }; let _ = self.canon_state_notification_sender.send(chain_notification); Ok(outcome) } @@ -1434,8 +1435,8 @@ mod tests { ) { // insert genesis to db. - genesis.header.set_block_number(10); - genesis.header.set_state_root(EMPTY_ROOT_HASH); + genesis.set_block_number(10); + genesis.set_state_root(EMPTY_ROOT_HASH); let provider = factory.provider_rw().unwrap(); provider @@ -1669,7 +1670,7 @@ mod tests { assert_eq!( tree.make_canonical(fork_block.hash()).unwrap(), - CanonicalOutcome::Committed { head: fork_block.header.clone() } + CanonicalOutcome::Committed { head: fork_block.sealed_header().clone() } ); assert_eq!( @@ -1679,7 +1680,7 @@ mod tests { assert_eq!( tree.make_canonical(canonical_block_1.hash()).unwrap(), - CanonicalOutcome::Committed { head: canonical_block_1.header.clone() } + CanonicalOutcome::Committed { head: canonical_block_1.sealed_header().clone() } ); assert_eq!( @@ -1694,12 +1695,12 @@ mod tests { assert_eq!( tree.make_canonical(sidechain_block_1.hash()).unwrap(), - CanonicalOutcome::Committed { head: sidechain_block_1.header.clone() } + CanonicalOutcome::Committed { head: sidechain_block_1.sealed_header().clone() } ); assert_eq!( tree.make_canonical(canonical_block_1.hash()).unwrap(), - CanonicalOutcome::Committed { head: canonical_block_1.header.clone() } + CanonicalOutcome::Committed { head: canonical_block_1.sealed_header().clone() } ); assert_eq!( @@ -1709,7 +1710,7 @@ mod tests { assert_eq!( tree.make_canonical(sidechain_block_2.hash()).unwrap(), - CanonicalOutcome::Committed { head: sidechain_block_2.header.clone() } + CanonicalOutcome::Committed { head: sidechain_block_2.sealed_header().clone() } ); assert_eq!( @@ -1719,7 +1720,7 @@ mod tests { assert_eq!( tree.make_canonical(canonical_block_3.hash()).unwrap(), - CanonicalOutcome::Committed { head: canonical_block_3.header.clone() } + CanonicalOutcome::Committed { head: canonical_block_3.sealed_header().clone() } ); } @@ -1841,7 +1842,7 @@ mod tests { assert_eq!( tree.make_canonical(block2.hash()).unwrap(), - CanonicalOutcome::Committed { head: block2.header.clone() } + CanonicalOutcome::Committed { head: block2.sealed_header().clone() } ); assert_eq!( @@ -1854,7 +1855,7 @@ mod tests { assert_eq!( tree.make_canonical(block3.hash()).unwrap(), - CanonicalOutcome::Committed { head: block3.header.clone() } + CanonicalOutcome::Committed { head: block3.sealed_header().clone() } ); assert_eq!( @@ -1876,7 +1877,7 @@ mod tests { assert_eq!( tree.make_canonical(block5.hash()).unwrap(), - CanonicalOutcome::Committed { head: block5.header.clone() } + CanonicalOutcome::Committed { head: block5.sealed_header().clone() } ); let provider = tree.externals.provider_factory.provider().unwrap(); @@ -2337,7 +2338,7 @@ mod tests { assert_eq!( tree.insert_block(block2b.clone(), BlockValidationKind::Exhaustive).unwrap(), InsertPayloadOk::Inserted(BlockStatus::Disconnected { - head: block2.header.num_hash(), + head: block2.num_hash(), missing_ancestor: block2b.parent_num_hash() }) ); diff --git a/crates/blockchain-tree/src/shareable.rs b/crates/blockchain-tree/src/shareable.rs index e668f4e2dac0..6cb36cfab7cc 100644 --- a/crates/blockchain-tree/src/shareable.rs +++ b/crates/blockchain-tree/src/shareable.rs @@ -114,7 +114,7 @@ where { fn header_by_hash(&self, hash: BlockHash) -> Option { trace!(target: "blockchain_tree", ?hash, "Returning header by hash"); - self.tree.read().sidechain_block_by_hash(hash).map(|b| b.header.clone()) + self.tree.read().sidechain_block_by_hash(hash).map(|b| b.sealed_header().clone()) } fn block_by_hash(&self, block_hash: BlockHash) -> Option { @@ -128,7 +128,7 @@ where } fn buffered_header_by_hash(&self, block_hash: BlockHash) -> Option { - self.tree.read().get_buffered_block(&block_hash).map(|b| b.header.clone()) + self.tree.read().get_buffered_block(&block_hash).map(|b| b.sealed_header().clone()) } fn is_canonical(&self, hash: BlockHash) -> Result { diff --git a/crates/blockchain-tree/src/state.rs b/crates/blockchain-tree/src/state.rs index 2d01293e20f8..762ced6bf486 100644 --- a/crates/blockchain-tree/src/state.rs +++ b/crates/blockchain-tree/src/state.rs @@ -191,10 +191,10 @@ mod tests { let mut block1 = block.clone(); let mut block2 = block; - block1.block.header.set_hash(block1_hash); - block1.block.header.set_block_number(9); - block2.block.header.set_hash(block2_hash); - block2.block.header.set_block_number(10); + block1.block.set_hash(block1_hash); + block1.block.set_block_number(9); + block2.block.set_hash(block2_hash); + block2.block.set_block_number(10); let chain = AppendableChain::new(Chain::new( [block1, block2], @@ -257,10 +257,10 @@ mod tests { let mut block1: SealedBlockWithSenders = Default::default(); let mut block2: SealedBlockWithSenders = Default::default(); - block1.block.header.set_hash(block1_hash); - block1.block.header.set_block_number(9); - block2.block.header.set_hash(block2_hash); - block2.block.header.set_block_number(10); + block1.block.set_hash(block1_hash); + block1.block.set_block_number(9); + block2.block.set_hash(block2_hash); + block2.block.set_block_number(10); // Create an chain with these blocks let chain = AppendableChain::new(Chain::new( @@ -299,10 +299,10 @@ mod tests { let mut block1: SealedBlockWithSenders = Default::default(); let mut block2: SealedBlockWithSenders = Default::default(); - block1.block.header.set_hash(block1_hash); - block1.block.header.set_block_number(9); - block2.block.header.set_hash(block2_hash); - block2.block.header.set_block_number(10); + block1.block.set_hash(block1_hash); + block1.block.set_block_number(9); + block2.block.set_hash(block2_hash); + block2.block.set_block_number(10); // Create a chain with these blocks let chain = AppendableChain::new(Chain::new( @@ -337,7 +337,7 @@ mod tests { // Create a block with a random hash and add it to the buffer let block_hash = B256::random(); let mut block: SealedBlockWithSenders = Default::default(); - block.block.header.set_hash(block_hash); + block.block.set_hash(block_hash); // Add the block to the buffered blocks in the TreeState tree_state.buffered_blocks.insert_block(block.clone()); @@ -366,9 +366,9 @@ mod tests { let mut ancestor_block: SealedBlockWithSenders = Default::default(); let mut descendant_block: SealedBlockWithSenders = Default::default(); - ancestor_block.block.header.set_hash(ancestor_hash); - descendant_block.block.header.set_hash(descendant_hash); - descendant_block.block.header.set_parent_hash(ancestor_hash); + ancestor_block.block.set_hash(ancestor_hash); + descendant_block.block.set_hash(descendant_hash); + descendant_block.block.set_parent_hash(ancestor_hash); // Insert the blocks into the buffer tree_state.buffered_blocks.insert_block(ancestor_block.clone()); @@ -398,7 +398,7 @@ mod tests { let receipt2 = Receipt::default(); let mut block: SealedBlockWithSenders = Default::default(); - block.block.header.set_hash(block_hash); + block.block.set_hash(block_hash); let receipts = vec![receipt1, receipt2]; diff --git a/crates/chain-state/src/in_memory.rs b/crates/chain-state/src/in_memory.rs index 06d228a8f82e..49c20bacdc2b 100644 --- a/crates/chain-state/src/in_memory.rs +++ b/crates/chain-state/src/in_memory.rs @@ -18,7 +18,7 @@ use reth_primitives::{ use reth_primitives_traits::{Block, BlockBody as _, SignedTransaction}; use reth_storage_api::StateProviderBox; use reth_trie::{updates::TrieUpdates, HashedPostState}; -use std::{collections::BTreeMap, ops::Deref, sync::Arc, time::Instant}; +use std::{collections::BTreeMap, sync::Arc, time::Instant}; use tokio::sync::{broadcast, watch}; /// Size of the broadcast channel used to notify canonical state events. @@ -181,9 +181,9 @@ impl CanonicalInMemoryState { safe: Option>, ) -> Self { let in_memory_state = InMemoryState::new(blocks, numbers, pending); - let header = in_memory_state - .head_state() - .map_or_else(SealedHeader::default, |state| state.block_ref().block().deref().clone()); + let header = in_memory_state.head_state().map_or_else(SealedHeader::default, |state| { + state.block_ref().block().sealed_header().clone() + }); let chain_info_tracker = ChainInfoTracker::new(header, finalized, safe); let (canon_state_notification_sender, _) = broadcast::channel(CANON_STATE_NOTIFICATION_CHANNEL_SIZE); @@ -229,7 +229,7 @@ impl CanonicalInMemoryState { /// Returns the header corresponding to the given hash. pub fn header_by_hash(&self, hash: B256) -> Option> { - self.state_by_hash(hash).map(|block| block.block_ref().block.header.clone()) + self.state_by_hash(hash).map(|block| block.block_ref().block.sealed_header().clone()) } /// Clears all entries in the in memory state. @@ -462,7 +462,7 @@ impl CanonicalInMemoryState { /// Returns the `SealedHeader` corresponding to the pending state. pub fn pending_sealed_header(&self) -> Option> { - self.pending_state().map(|h| h.block_ref().block().deref().clone()) + self.pending_state().map(|h| h.block_ref().block().sealed_header().clone()) } /// Returns the `Header` corresponding to the pending state. @@ -1321,7 +1321,7 @@ mod tests { assert_eq!(state.pending_header().unwrap(), block2.block().header().clone()); // Check the pending sealed header - assert_eq!(state.pending_sealed_header().unwrap(), block2.block().header.clone()); + assert_eq!(state.pending_sealed_header().unwrap(), block2.block().sealed_header().clone()); // Check the pending block with senders assert_eq!( diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 2dc139acedb4..9c1adb2bd783 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -1670,7 +1670,7 @@ where self.latest_valid_hash_for_invalid_payload(block.parent_hash)? }; // keep track of the invalid header - self.invalid_headers.insert(block.header.block_with_parent()); + self.invalid_headers.insert(block.sealed_header().block_with_parent()); PayloadStatus::new( PayloadStatusEnum::Invalid { validation_error: error.to_string() }, latest_valid_hash, @@ -1779,7 +1779,7 @@ where let (block, err) = err.split(); warn!(target: "consensus::engine", invalid_number=?block.number, invalid_hash=?block.hash(), %err, "Marking block as invalid"); - self.invalid_headers.insert(block.header.block_with_parent()); + self.invalid_headers.insert(block.sealed_header().block_with_parent()); } } } @@ -2485,7 +2485,7 @@ mod tests { ..Default::default() }, ); - block1.header.set_difficulty(U256::from(1)); + block1.set_difficulty(U256::from(1)); // a second pre-merge block let mut block2 = random_block( @@ -2497,7 +2497,7 @@ mod tests { ..Default::default() }, ); - block2.header.set_difficulty(U256::from(1)); + block2.set_difficulty(U256::from(1)); // a transition block let mut block3 = random_block( @@ -2509,7 +2509,7 @@ mod tests { ..Default::default() }, ); - block3.header.set_difficulty(U256::from(1)); + block3.set_difficulty(U256::from(1)); let (_static_dir, static_dir_path) = create_test_static_files_dir(); insert_blocks( @@ -2883,7 +2883,7 @@ mod tests { async fn payload_pre_merge() { let data = BlockchainTestData::default(); let mut block1 = data.blocks[0].0.block.clone(); - block1.header.set_difficulty( + block1.set_difficulty( MAINNET.fork(EthereumHardfork::Paris).ttd().unwrap() - U256::from(1), ); block1 = block1.unseal::().seal_slow(); diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index fea93c8a5348..17128de83bc9 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -936,7 +936,7 @@ where while current_canonical_number > current_number { if let Some(block) = self.executed_block_by_hash(old_hash)? { old_chain.push(block.clone()); - old_hash = block.block.header.parent_hash(); + old_hash = block.block.parent_hash(); current_canonical_number -= 1; } else { // This shouldn't happen as we're walking back the canonical chain @@ -952,7 +952,7 @@ where // a common ancestor (fork block) is reached. while old_hash != current_hash { if let Some(block) = self.executed_block_by_hash(old_hash)? { - old_hash = block.block.header.parent_hash(); + old_hash = block.block.parent_hash(); old_chain.push(block); } else { // This shouldn't happen as we're walking back the canonical chain @@ -1082,7 +1082,7 @@ where // 2. ensure we can apply a new chain update for the head block if let Some(chain_update) = self.on_new_head(state.head_block_hash)? { - let tip = chain_update.tip().header.clone(); + let tip = chain_update.tip().sealed_header().clone(); self.on_canonical_chain_update(chain_update); // update the safe and finalized blocks and ensure their values are valid @@ -1617,8 +1617,11 @@ where hash: B256, ) -> ProviderResult>> { // check memory first - let block = - self.state.tree_state.block_by_hash(hash).map(|block| block.as_ref().clone().header); + let block = self + .state + .tree_state + .block_by_hash(hash) + .map(|block| block.as_ref().sealed_header().clone()); if block.is_some() { Ok(block) @@ -2031,7 +2034,7 @@ where // update the tracked canonical head self.state.tree_state.set_canonical_head(chain_update.tip().num_hash()); - let tip = chain_update.tip().header.clone(); + let tip = chain_update.tip().sealed_header().clone(); let notification = chain_update.to_chain_notification(); // reinsert any missing reorged blocks @@ -2543,7 +2546,7 @@ where }; // keep track of the invalid header - self.state.invalid_headers.insert(block.header.block_with_parent()); + self.state.invalid_headers.insert(block.block_with_parent()); Ok(PayloadStatus::new( PayloadStatusEnum::Invalid { validation_error: validation_err.to_string() }, latest_valid_hash, diff --git a/crates/ethereum/payload/src/lib.rs b/crates/ethereum/payload/src/lib.rs index 66ca1662b97e..a4a02c3ef768 100644 --- a/crates/ethereum/payload/src/lib.rs +++ b/crates/ethereum/payload/src/lib.rs @@ -490,7 +490,7 @@ where }; let sealed_block = Arc::new(block.seal_slow()); - debug!(target: "payload_builder", id=%attributes.id, sealed_block_header = ?sealed_block.header, "sealed built block"); + debug!(target: "payload_builder", id=%attributes.id, sealed_block_header = ?sealed_block.sealed_header(), "sealed built block"); // create the executed block data let executed = ExecutedBlock { diff --git a/crates/evm/execution-types/src/chain.rs b/crates/evm/execution-types/src/chain.rs index 91badacc187c..7e6ba2046043 100644 --- a/crates/evm/execution-types/src/chain.rs +++ b/crates/evm/execution-types/src/chain.rs @@ -91,7 +91,7 @@ impl Chain { /// Returns an iterator over all headers in the block with increasing block numbers. pub fn headers(&self) -> impl Iterator> + '_ { - self.blocks.values().map(|block| block.header.clone()) + self.blocks.values().map(|block| block.sealed_header().clone()) } /// Get cached trie updates for this chain. @@ -858,8 +858,8 @@ mod tests { let mut block2 = block; // Set the hashes of block1 and block2 - block1.block.header.set_hash(block1_hash); - block2.block.header.set_hash(block2_hash); + block1.block.set_hash(block1_hash); + block2.block.set_hash(block2_hash); // Create a random receipt object, receipt1 let receipt1 = Receipt { diff --git a/crates/exex/exex/src/manager.rs b/crates/exex/exex/src/manager.rs index 16a930526141..32944bd2805f 100644 --- a/crates/exex/exex/src/manager.rs +++ b/crates/exex/exex/src/manager.rs @@ -767,8 +767,8 @@ mod tests { // Define the notification for testing let mut block1: SealedBlockWithSenders = Default::default(); - block1.block.header.set_hash(B256::new([0x01; 32])); - block1.block.header.set_block_number(10); + block1.block.set_hash(B256::new([0x01; 32])); + block1.block.set_block_number(10); let notification1 = ExExNotification::ChainCommitted { new: Arc::new(Chain::new(vec![block1.clone()], Default::default(), Default::default())), @@ -785,8 +785,8 @@ mod tests { // Push another notification let mut block2: SealedBlockWithSenders = Default::default(); - block2.block.header.set_hash(B256::new([0x02; 32])); - block2.block.header.set_block_number(20); + block2.block.set_hash(B256::new([0x02; 32])); + block2.block.set_block_number(20); let notification2 = ExExNotification::ChainCommitted { new: Arc::new(Chain::new(vec![block2.clone()], Default::default(), Default::default())), @@ -828,8 +828,8 @@ mod tests { // Push some notifications to fill part of the buffer let mut block1: SealedBlockWithSenders = Default::default(); - block1.block.header.set_hash(B256::new([0x01; 32])); - block1.block.header.set_block_number(10); + block1.set_hash(B256::new([0x01; 32])); + block1.set_block_number(10); let notification1 = ExExNotification::ChainCommitted { new: Arc::new(Chain::new(vec![block1.clone()], Default::default(), Default::default())), @@ -1117,12 +1117,12 @@ mod tests { // Setup two blocks for the chain commit notification let mut block1: SealedBlockWithSenders = Default::default(); - block1.block.header.set_hash(B256::new([0x01; 32])); - block1.block.header.set_block_number(10); + block1.block.set_hash(B256::new([0x01; 32])); + block1.block.set_block_number(10); let mut block2: SealedBlockWithSenders = Default::default(); - block2.block.header.set_hash(B256::new([0x02; 32])); - block2.block.header.set_block_number(11); + block2.block.set_hash(B256::new([0x02; 32])); + block2.block.set_block_number(11); // Setup a notification let notification = ExExNotification::ChainCommitted { @@ -1170,8 +1170,8 @@ mod tests { exex_handle.finished_height = Some(BlockNumHash::new(15, B256::random())); let mut block1: SealedBlockWithSenders = Default::default(); - block1.block.header.set_hash(B256::new([0x01; 32])); - block1.block.header.set_block_number(10); + block1.block.set_hash(B256::new([0x01; 32])); + block1.block.set_block_number(10); let notification = ExExNotification::ChainCommitted { new: Arc::new(Chain::new(vec![block1.clone()], Default::default(), Default::default())), @@ -1327,7 +1327,7 @@ mod tests { }; let (finalized_headers_tx, rx) = watch::channel(None); - finalized_headers_tx.send(Some(genesis_block.header.clone()))?; + finalized_headers_tx.send(Some(genesis_block.sealed_header().clone()))?; let finalized_header_stream = ForkChoiceStream::new(rx); let mut exex_manager = std::pin::pin!(ExExManager::new( @@ -1361,7 +1361,7 @@ mod tests { [notification.clone()] ); - finalized_headers_tx.send(Some(block.header.clone()))?; + finalized_headers_tx.send(Some(block.sealed_header().clone()))?; assert!(exex_manager.as_mut().poll(&mut cx).is_pending()); // WAL isn't finalized because the ExEx didn't emit the `FinishedHeight` event assert_eq!( @@ -1374,7 +1374,7 @@ mod tests { .send(ExExEvent::FinishedHeight((rng.gen::(), rng.gen::()).into())) .unwrap(); - finalized_headers_tx.send(Some(block.header.clone()))?; + finalized_headers_tx.send(Some(block.sealed_header().clone()))?; assert!(exex_manager.as_mut().poll(&mut cx).is_pending()); // WAL isn't finalized because the ExEx emitted a `FinishedHeight` event with a // non-canonical block @@ -1386,7 +1386,7 @@ mod tests { // Send a `FinishedHeight` event with a canonical block events_tx.send(ExExEvent::FinishedHeight(block.num_hash())).unwrap(); - finalized_headers_tx.send(Some(block.header.clone()))?; + finalized_headers_tx.send(Some(block.sealed_header().clone()))?; assert!(exex_manager.as_mut().poll(&mut cx).is_pending()); // WAL is finalized assert_eq!(exex_manager.wal.iter_notifications()?.next().transpose()?, None); diff --git a/crates/net/downloaders/src/bodies/bodies.rs b/crates/net/downloaders/src/bodies/bodies.rs index 47a816f4ce6b..e8be8da033dc 100644 --- a/crates/net/downloaders/src/bodies/bodies.rs +++ b/crates/net/downloaders/src/bodies/bodies.rs @@ -677,7 +677,7 @@ mod tests { BlockRangeParams { parent: Some(B256::ZERO), tx_count: 1..2, ..Default::default() }, ); - let headers = blocks.iter().map(|block| block.header.clone()).collect::>(); + let headers = blocks.iter().map(|block| block.sealed_header().clone()).collect::>(); let bodies = blocks .into_iter() .map(|block| (block.hash(), block.into_body())) diff --git a/crates/net/downloaders/src/bodies/request.rs b/crates/net/downloaders/src/bodies/request.rs index a3ad1f3b9dc2..ea690f0806ce 100644 --- a/crates/net/downloaders/src/bodies/request.rs +++ b/crates/net/downloaders/src/bodies/request.rs @@ -194,7 +194,7 @@ where // Body is invalid, put the header back and return an error let hash = block.hash(); let number = block.number(); - self.pending_headers.push_front(block.header); + self.pending_headers.push_front(block.into_sealed_header()); return Err(DownloadError::BodyValidation { hash, number, diff --git a/crates/net/downloaders/src/test_utils/mod.rs b/crates/net/downloaders/src/test_utils/mod.rs index 0529b78a2b20..2e8d5365c0db 100644 --- a/crates/net/downloaders/src/test_utils/mod.rs +++ b/crates/net/downloaders/src/test_utils/mod.rs @@ -28,7 +28,7 @@ pub(crate) fn generate_bodies( BlockRangeParams { parent: Some(B256::ZERO), tx_count: 0..2, ..Default::default() }, ); - let headers = blocks.iter().map(|block| block.header.clone()).collect(); + let headers = blocks.iter().map(|block| block.sealed_header().clone()).collect(); let bodies = blocks.into_iter().map(|block| (block.hash(), block.into_body())).collect(); (headers, bodies) diff --git a/crates/net/p2p/src/bodies/response.rs b/crates/net/p2p/src/bodies/response.rs index 956057d98bff..517c5b879835 100644 --- a/crates/net/p2p/src/bodies/response.rs +++ b/crates/net/p2p/src/bodies/response.rs @@ -2,7 +2,6 @@ use alloy_consensus::BlockHeader; use alloy_primitives::{BlockNumber, U256}; use reth_primitives::{BlockBody, SealedBlock, SealedHeader}; use reth_primitives_traits::InMemorySize; - /// The block response #[derive(PartialEq, Eq, Debug, Clone)] pub enum BlockResponse { @@ -19,7 +18,7 @@ where /// Return the reference to the response header pub const fn header(&self) -> &SealedHeader { match self { - Self::Full(block) => &block.header, + Self::Full(block) => block.sealed_header(), Self::Empty(header) => header, } } diff --git a/crates/node/events/src/node.rs b/crates/node/events/src/node.rs index 129fe20ea785..4b38b4050bb4 100644 --- a/crates/node/events/src/node.rs +++ b/crates/node/events/src/node.rs @@ -255,12 +255,12 @@ impl NodeState { hash=?block.hash(), peers=self.num_connected_peers(), txs=block.body().transactions().len(), - gas=%format_gas(block.header.gas_used()), - gas_throughput=%format_gas_throughput(block.header.gas_used(), elapsed), - full=%format!("{:.1}%", block.header.gas_used() as f64 * 100.0 / block.header.gas_limit() as f64), - base_fee=%format!("{:.2}gwei", block.header.base_fee_per_gas().unwrap_or(0) as f64 / GWEI_TO_WEI as f64), - blobs=block.header.blob_gas_used().unwrap_or(0) / alloy_eips::eip4844::DATA_GAS_PER_BLOB, - excess_blobs=block.header.excess_blob_gas().unwrap_or(0) / alloy_eips::eip4844::DATA_GAS_PER_BLOB, + gas=%format_gas(block.gas_used()), + gas_throughput=%format_gas_throughput(block.gas_used(), elapsed), + full=%format!("{:.1}%", block.gas_used() as f64 * 100.0 / block.gas_limit() as f64), + base_fee=%format!("{:.2}gwei", block.base_fee_per_gas().unwrap_or(0) as f64 / GWEI_TO_WEI as f64), + blobs=block.blob_gas_used().unwrap_or(0) / alloy_eips::eip4844::DATA_GAS_PER_BLOB, + excess_blobs=block.excess_blob_gas().unwrap_or(0) / alloy_eips::eip4844::DATA_GAS_PER_BLOB, ?elapsed, "Block added to canonical chain" ); diff --git a/crates/optimism/payload/src/builder.rs b/crates/optimism/payload/src/builder.rs index b87b01b37b2b..7bf3f8015b71 100644 --- a/crates/optimism/payload/src/builder.rs +++ b/crates/optimism/payload/src/builder.rs @@ -434,7 +434,7 @@ where }; let sealed_block = Arc::new(block.seal_slow()); - debug!(target: "payload_builder", id=%ctx.attributes().payload_id(), sealed_block_header = ?sealed_block.header, "sealed built block"); + debug!(target: "payload_builder", id=%ctx.attributes().payload_id(), sealed_block_header = ?sealed_block.header(), "sealed built block"); // create the executed block data let executed: ExecutedBlock = ExecutedBlock { diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index 3cff1646e435..bcf5ad71abed 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -167,7 +167,7 @@ pub struct SealedBlock { /// Locked block header. #[deref] #[deref_mut] - pub header: SealedHeader, + header: SealedHeader, /// Block body. body: B, } @@ -190,6 +190,16 @@ impl SealedBlock { &self.body } + /// Returns the Sealed header. + pub const fn sealed_header(&self) -> &SealedHeader { + &self.header + } + + /// Consumes the block and returns the sealed header. + pub fn into_sealed_header(self) -> SealedHeader { + self.header + } + /// Consumes the block and returns the header. pub fn into_header(self) -> H { self.header.unseal() diff --git a/crates/rpc/rpc-eth-api/src/helpers/call.rs b/crates/rpc/rpc-eth-api/src/helpers/call.rs index 2aecb500dd5e..91bedbeb532e 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/call.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/call.rs @@ -126,10 +126,7 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA base_fee_params, ) } else { - base_block - .header - .next_block_base_fee(base_fee_params) - .unwrap_or_default() + base_block.next_block_base_fee(base_fee_params).unwrap_or_default() }; block_env.basefee = U256::from(base_fee); } else { diff --git a/crates/rpc/rpc-eth-api/src/helpers/trace.rs b/crates/rpc/rpc-eth-api/src/helpers/trace.rs index 66c6b5a27a92..bb4c9c5ebf58 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/trace.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/trace.rs @@ -496,12 +496,12 @@ pub trait Trace: db, cfg, block_env, - block.header.parent_beacon_block_root(), + block.parent_beacon_block_root(), ) .map_err(|_| EthApiError::EvmCustom("failed to apply 4788 system call".to_string()))?; system_caller - .pre_block_blockhashes_contract_call(db, cfg, block_env, block.header.parent_hash()) + .pre_block_blockhashes_contract_call(db, cfg, block_env, block.parent_hash()) .map_err(|_| { EthApiError::EvmCustom("failed to apply blockhashes system call".to_string()) })?; diff --git a/crates/rpc/rpc/src/trace.rs b/crates/rpc/rpc/src/trace.rs index 33e32aec0281..d906419021b9 100644 --- a/crates/rpc/rpc/src/trace.rs +++ b/crates/rpc/rpc/src/trace.rs @@ -314,7 +314,7 @@ where if let Some(base_block_reward) = self.calculate_base_block_reward(block.header())? { all_traces.extend( self.extract_reward_traces( - block.header.header(), + block.header(), block.body().ommers(), base_block_reward, ) @@ -391,11 +391,9 @@ where maybe_traces.map(|traces| traces.into_iter().flatten().collect::>()); if let (Some(block), Some(traces)) = (maybe_block, maybe_traces.as_mut()) { - if let Some(base_block_reward) = - self.calculate_base_block_reward(block.header.header())? - { + if let Some(base_block_reward) = self.calculate_base_block_reward(block.header())? { traces.extend(self.extract_reward_traces( - block.block.header(), + block.header(), block.body().ommers(), base_block_reward, )); @@ -490,7 +488,7 @@ where Ok(Some(BlockOpcodeGas { block_hash: block.hash(), - block_number: block.header.number(), + block_number: block.number(), transactions, })) } diff --git a/crates/rpc/rpc/src/validation.rs b/crates/rpc/rpc/src/validation.rs index cb3ab4f296cf..dcddd793836d 100644 --- a/crates/rpc/rpc/src/validation.rs +++ b/crates/rpc/rpc/src/validation.rs @@ -102,10 +102,10 @@ where message: BidTrace, registered_gas_limit: u64, ) -> Result<(), ValidationApiError> { - self.validate_message_against_header(&block.header, &message)?; + self.validate_message_against_header(block.sealed_header(), &message)?; - self.consensus.validate_header_with_total_difficulty(&block.header, U256::MAX)?; - self.consensus.validate_header(&block.header)?; + self.consensus.validate_header_with_total_difficulty(block.sealed_header(), U256::MAX)?; + self.consensus.validate_header(block.sealed_header())?; self.consensus.validate_block_pre_execution(&block)?; if !self.disallow.is_empty() { @@ -130,15 +130,14 @@ where let latest_header = self.provider.latest_header()?.ok_or_else(|| ValidationApiError::MissingLatestBlock)?; - if latest_header.hash() != block.header.parent_hash() { + if latest_header.hash() != block.parent_hash() { return Err(ConsensusError::ParentHashMismatch( - GotExpected { got: block.header.parent_hash(), expected: latest_header.hash() } - .into(), + GotExpected { got: block.parent_hash(), expected: latest_header.hash() }.into(), ) .into()) } - self.consensus.validate_header_against_parent(&block.header, &latest_header)?; - self.validate_gas_limit(registered_gas_limit, &latest_header, &block.header)?; + self.consensus.validate_header_against_parent(block.sealed_header(), &latest_header)?; + self.validate_gas_limit(registered_gas_limit, &latest_header, block.sealed_header())?; let latest_header_hash = latest_header.hash(); let state_provider = self.provider.state_by_block_hash(latest_header_hash)?; diff --git a/crates/stages/stages/benches/setup/mod.rs b/crates/stages/stages/benches/setup/mod.rs index 2c1174d63292..d6bf4414450f 100644 --- a/crates/stages/stages/benches/setup/mod.rs +++ b/crates/stages/stages/benches/setup/mod.rs @@ -151,7 +151,7 @@ pub(crate) fn txs_testdata(num_blocks: u64) -> TestStageDB { .unwrap(); let second_block = blocks.get_mut(1).unwrap(); let cloned_second = second_block.clone(); - let mut updated_header = cloned_second.header.clone().unseal(); + let mut updated_header = cloned_second.header().clone(); updated_header.state_root = root; *second_block = SealedBlock::new(SealedHeader::seal(updated_header), cloned_second.into_body()); @@ -185,7 +185,7 @@ pub(crate) fn txs_testdata(num_blocks: u64) -> TestStageDB { let last_block = blocks.last_mut().unwrap(); let cloned_last = last_block.clone(); - let mut updated_header = cloned_last.header.clone().unseal(); + let mut updated_header = cloned_last.header().clone(); updated_header.state_root = root; *last_block = SealedBlock::new(SealedHeader::seal(updated_header), cloned_last.into_body()); diff --git a/crates/stages/stages/src/stages/bodies.rs b/crates/stages/stages/src/stages/bodies.rs index b17ad3562a09..51941183953e 100644 --- a/crates/stages/stages/src/stages/bodies.rs +++ b/crates/stages/stages/src/stages/bodies.rs @@ -582,7 +582,7 @@ mod tests { ..Default::default() }, ); - self.db.insert_headers_with_td(blocks.iter().map(|block| &block.header))?; + self.db.insert_headers_with_td(blocks.iter().map(|block| block.sealed_header()))?; if let Some(progress) = blocks.get(start as usize) { // Insert last progress data { diff --git a/crates/stages/stages/src/stages/hashing_storage.rs b/crates/stages/stages/src/stages/hashing_storage.rs index 6075e62158fd..78d55ddfc9e3 100644 --- a/crates/stages/stages/src/stages/hashing_storage.rs +++ b/crates/stages/stages/src/stages/hashing_storage.rs @@ -344,7 +344,7 @@ mod tests { BlockRangeParams { parent: Some(B256::ZERO), tx_count: 0..3, ..Default::default() }, ); - self.db.insert_headers(blocks.iter().map(|block| &block.header))?; + self.db.insert_headers(blocks.iter().map(|block| block.sealed_header()))?; let iter = blocks.iter(); let mut next_tx_num = 0; @@ -373,7 +373,7 @@ mod tests { tx, (block_number, *addr).into(), new_entry, - progress.header.number == stage_progress, + progress.number == stage_progress, )?; } @@ -392,7 +392,7 @@ mod tests { key: keccak256("mining"), value: U256::from(rng.gen::()), }, - progress.header.number == stage_progress, + progress.number == stage_progress, )?; } diff --git a/crates/stages/stages/src/test_utils/test_db.rs b/crates/stages/stages/src/test_utils/test_db.rs index 5e4c61b6fd36..5db57da54a4c 100644 --- a/crates/stages/stages/src/test_utils/test_db.rs +++ b/crates/stages/stages/src/test_utils/test_db.rs @@ -235,7 +235,7 @@ impl TestStageDB { .then(|| provider.latest_writer(StaticFileSegment::Headers).unwrap()); blocks.iter().try_for_each(|block| { - Self::insert_header(headers_writer.as_mut(), &tx, &block.header, U256::ZERO) + Self::insert_header(headers_writer.as_mut(), &tx, block.sealed_header(), U256::ZERO) })?; if let Some(mut writer) = headers_writer { diff --git a/crates/static-file/static-file/src/static_file_producer.rs b/crates/static-file/static-file/src/static_file_producer.rs index 7653d0d5af3d..fcbbb9e3b0a3 100644 --- a/crates/static-file/static-file/src/static_file_producer.rs +++ b/crates/static-file/static-file/src/static_file_producer.rs @@ -292,7 +292,7 @@ mod tests { let tx = db.factory.db_ref().tx_mut().expect("init tx"); for block in &blocks { - TestStageDB::insert_header(None, &tx, &block.header, U256::ZERO) + TestStageDB::insert_header(None, &tx, block.sealed_header(), U256::ZERO) .expect("insert block header"); } tx.commit().expect("commit tx"); diff --git a/crates/storage/provider/src/providers/blockchain_provider.rs b/crates/storage/provider/src/providers/blockchain_provider.rs index 20c371cdf1c5..85f4b7e77279 100644 --- a/crates/storage/provider/src/providers/blockchain_provider.rs +++ b/crates/storage/provider/src/providers/blockchain_provider.rs @@ -810,7 +810,7 @@ mod tests { }; use revm::db::BundleState; use std::{ - ops::{Bound, Range, RangeBounds}, + ops::{Bound, Deref, Range, RangeBounds}, sync::Arc, time::Instant, }; @@ -948,9 +948,9 @@ mod tests { let finalized_block = blocks.get(block_count - 3).unwrap(); // Set the canonical head, safe, and finalized blocks - provider.set_canonical_head(canonical_block.header.clone()); - provider.set_safe(safe_block.header.clone()); - provider.set_finalized(finalized_block.header.clone()); + provider.set_canonical_head(canonical_block.sealed_header().clone()); + provider.set_safe(safe_block.sealed_header().clone()); + provider.set_finalized(finalized_block.sealed_header().clone()); Ok((provider, database_blocks.clone(), in_memory_blocks.clone(), receipts)) } @@ -1357,7 +1357,7 @@ mod tests { let in_memory_block = in_memory_blocks.last().unwrap().clone(); // make sure that the finalized block is on db let finalized_block = database_blocks.get(database_blocks.len() - 3).unwrap(); - provider.set_finalized(finalized_block.header.clone()); + provider.set_finalized(finalized_block.sealed_header().clone()); let blocks = [database_blocks, in_memory_blocks].concat(); @@ -1376,7 +1376,7 @@ mod tests { blocks .iter() .take_while(|header| header.number <= 8) - .map(|b| b.header.clone()) + .map(|b| b.sealed_header().clone()) .collect::>() ); @@ -1548,38 +1548,38 @@ mod tests { let block_number = database_block.number; assert_eq!( provider.header_by_number_or_tag(block_number.into()).unwrap(), - Some(database_block.header.clone().unseal()) + Some(database_block.header().clone()) ); assert_eq!( - provider.sealed_header_by_number_or_tag(block_number.into()).unwrap(), - Some(database_block.header) + provider.sealed_header_by_number_or_tag(block_number.into())?, + Some(database_block.sealed_header().clone()) ); assert_eq!( provider.header_by_number_or_tag(BlockNumberOrTag::Latest).unwrap(), - Some(canonical_block.header.clone().unseal()) + Some(canonical_block.header().clone()) ); assert_eq!( provider.sealed_header_by_number_or_tag(BlockNumberOrTag::Latest).unwrap(), - Some(canonical_block.header) + Some(canonical_block.sealed_header().clone()) ); assert_eq!( provider.header_by_number_or_tag(BlockNumberOrTag::Safe).unwrap(), - Some(safe_block.header.clone().unseal()) + Some(safe_block.header().clone()) ); assert_eq!( provider.sealed_header_by_number_or_tag(BlockNumberOrTag::Safe).unwrap(), - Some(safe_block.header) + Some(safe_block.sealed_header().clone()) ); assert_eq!( provider.header_by_number_or_tag(BlockNumberOrTag::Finalized).unwrap(), - Some(finalized_block.header.clone().unseal()) + Some(finalized_block.header().clone()) ); assert_eq!( provider.sealed_header_by_number_or_tag(BlockNumberOrTag::Finalized).unwrap(), - Some(finalized_block.header) + Some(finalized_block.sealed_header().clone()) ); Ok(()) @@ -1603,20 +1603,20 @@ mod tests { assert_eq!( provider.header_by_id(block_number.into()).unwrap(), - Some(database_block.header.clone().unseal()) + Some(database_block.header().clone()) ); assert_eq!( provider.sealed_header_by_id(block_number.into()).unwrap(), - Some(database_block.header.clone()) + Some(database_block.sealed_header().clone()) ); assert_eq!( provider.header_by_id(block_hash.into()).unwrap(), - Some(database_block.header.clone().unseal()) + Some(database_block.header().clone()) ); assert_eq!( provider.sealed_header_by_id(block_hash.into()).unwrap(), - Some(database_block.header) + Some(database_block.sealed_header().clone()) ); let block_number = in_memory_block.number; @@ -1624,20 +1624,20 @@ mod tests { assert_eq!( provider.header_by_id(block_number.into()).unwrap(), - Some(in_memory_block.header.clone().unseal()) + Some(in_memory_block.header().clone()) ); assert_eq!( provider.sealed_header_by_id(block_number.into()).unwrap(), - Some(in_memory_block.header.clone()) + Some(in_memory_block.sealed_header().clone()) ); assert_eq!( provider.header_by_id(block_hash.into()).unwrap(), - Some(in_memory_block.header.clone().unseal()) + Some(in_memory_block.header().clone()) ); assert_eq!( provider.sealed_header_by_id(block_hash.into()).unwrap(), - Some(in_memory_block.header) + Some(in_memory_block.sealed_header().clone()) ); Ok(()) @@ -2023,7 +2023,7 @@ mod tests { ); // test state by block tag for safe block let safe_block = in_memory_blocks[in_memory_blocks.len() - 2].clone(); - in_memory_provider.canonical_in_memory_state.set_safe(safe_block.header.clone()); + in_memory_provider.canonical_in_memory_state.set_safe(safe_block.sealed_header().clone()); assert_eq!( safe_block.hash(), in_memory_provider @@ -2033,7 +2033,9 @@ mod tests { ); // test state by block tag for finalized block let finalized_block = in_memory_blocks[in_memory_blocks.len() - 3].clone(); - in_memory_provider.canonical_in_memory_state.set_finalized(finalized_block.header.clone()); + in_memory_provider + .canonical_in_memory_state + .set_finalized(finalized_block.sealed_header().clone()); assert_eq!( finalized_block.hash(), in_memory_provider @@ -2106,11 +2108,11 @@ mod tests { // Set the safe block in memory let safe_block = in_memory_blocks[in_memory_blocks.len() - 2].clone(); - provider.canonical_in_memory_state.set_safe(safe_block.header.clone()); + provider.canonical_in_memory_state.set_safe(safe_block.sealed_header().clone()); // Set the finalized block in memory let finalized_block = in_memory_blocks[in_memory_blocks.len() - 3].clone(); - provider.canonical_in_memory_state.set_finalized(finalized_block.header.clone()); + provider.canonical_in_memory_state.set_finalized(finalized_block.sealed_header().clone()); // Verify the pending block number and hash assert_eq!( @@ -2325,7 +2327,7 @@ mod tests { // instead start end test_by_block_range!([ (headers_range, |block: &SealedBlock| block.header().clone()), - (sealed_headers_range, |block: &SealedBlock| block.header.clone()), + (sealed_headers_range, |block: &SealedBlock| block.sealed_header().clone()), (block_range, |block: &SealedBlock| block.clone().unseal()), (block_with_senders_range, |block: &SealedBlock| block .clone() @@ -2458,7 +2460,7 @@ mod tests { header_by_number, |block: &SealedBlock, _: TxNumber, _: B256, _: &Vec>| ( block.number, - Some(block.header.header().clone()) + Some(block.header().clone()) ), u64::MAX ), @@ -2467,7 +2469,7 @@ mod tests { sealed_header, |block: &SealedBlock, _: TxNumber, _: B256, _: &Vec>| ( block.number, - Some(block.header.clone()) + Some(block.sealed_header().clone()) ), u64::MAX ), diff --git a/crates/storage/provider/src/providers/consistent.rs b/crates/storage/provider/src/providers/consistent.rs index f2872352b8f3..02ad7549439e 100644 --- a/crates/storage/provider/src/providers/consistent.rs +++ b/crates/storage/provider/src/providers/consistent.rs @@ -631,7 +631,7 @@ impl HeaderProvider for ConsistentProvider { self.get_in_memory_or_storage_by_block( (*block_hash).into(), |db_provider| db_provider.header(block_hash), - |block_state| Ok(Some(block_state.block_ref().block().header.header().clone())), + |block_state| Ok(Some(block_state.block_ref().block().header().clone())), ) } @@ -639,7 +639,7 @@ impl HeaderProvider for ConsistentProvider { self.get_in_memory_or_storage_by_block( num.into(), |db_provider| db_provider.header_by_number(num), - |block_state| Ok(Some(block_state.block_ref().block().header.header().clone())), + |block_state| Ok(Some(block_state.block_ref().block().header().clone())), ) } @@ -681,7 +681,7 @@ impl HeaderProvider for ConsistentProvider { self.get_in_memory_or_storage_by_block_range_while( range, |db_provider, range, _| db_provider.headers_range(range), - |block_state, _| Some(block_state.block_ref().block().header.header().clone()), + |block_state, _| Some(block_state.block_ref().block().header().clone()), |_| true, ) } @@ -693,7 +693,7 @@ impl HeaderProvider for ConsistentProvider { self.get_in_memory_or_storage_by_block( number.into(), |db_provider| db_provider.sealed_header(number), - |block_state| Ok(Some(block_state.block_ref().block().header.clone())), + |block_state| Ok(Some(block_state.block_ref().block().sealed_header().clone())), ) } @@ -704,7 +704,7 @@ impl HeaderProvider for ConsistentProvider { self.get_in_memory_or_storage_by_block_range_while( range, |db_provider, range, _| db_provider.sealed_headers_range(range), - |block_state, _| Some(block_state.block_ref().block().header.clone()), + |block_state, _| Some(block_state.block_ref().block().sealed_header().clone()), |_| true, ) } @@ -718,7 +718,7 @@ impl HeaderProvider for ConsistentProvider { range, |db_provider, range, predicate| db_provider.sealed_headers_while(range, predicate), |block_state, predicate| { - let header = &block_state.block_ref().block().header; + let header = block_state.block_ref().block().sealed_header(); predicate(header).then(|| header.clone()) }, predicate, diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index 89b2ae5b6001..2c0427d787bd 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -426,12 +426,12 @@ impl< &self, block: SealedBlockWithSenders<::Block>, ) -> ProviderResult { - let ttd = if block.number == 0 { - block.difficulty + let ttd = if block.number() == 0 { + block.difficulty() } else { - let parent_block_number = block.number - 1; + let parent_block_number = block.number() - 1; let parent_ttd = self.header_td_by_number(parent_block_number)?.unwrap_or_default(); - parent_ttd + block.difficulty + parent_ttd + block.difficulty() }; let mut writer = self.static_file_provider.latest_writer(StaticFileSegment::Headers)?; @@ -439,14 +439,14 @@ impl< // Backfill: some tests start at a forward block number, but static files require no gaps. let segment_header = writer.user_header(); if segment_header.block_end().is_none() && segment_header.expected_block_start() == 0 { - for block_number in 0..block.number { - let mut prev = block.header.clone().unseal(); + for block_number in 0..block.number() { + let mut prev = block.sealed_header().clone().unseal(); prev.number = block_number; writer.append_header(&prev, U256::ZERO, &B256::ZERO)?; } } - writer.append_header(block.header.as_ref(), ttd, &block.hash())?; + writer.append_header(block.header(), ttd, &block.hash())?; self.insert_block(block, StorageLocation::Database) } @@ -2769,8 +2769,7 @@ impl BlockWrite durations_recorder.record_relative(metrics::Action::InsertCanonicalHeaders); // Put header with canonical hashes. - self.tx - .put::>>(block_number, block.header.as_ref().clone())?; + self.tx.put::>>(block_number, block.header().clone())?; durations_recorder.record_relative(metrics::Action::InsertHeaders); self.tx.put::(block_number, ttd.into())?; @@ -2780,7 +2779,7 @@ impl BlockWrite if write_to.static_files() { let mut writer = self.static_file_provider.get_writer(block_number, StaticFileSegment::Headers)?; - writer.append_header(&block.header, ttd, &block.hash())?; + writer.append_header(block.header(), ttd, &block.hash())?; } self.tx.put::(block.hash(), block_number)?; diff --git a/crates/storage/provider/src/test_utils/blocks.rs b/crates/storage/provider/src/test_utils/blocks.rs index 5ed8b09ee0b8..2f46ef5c1e70 100644 --- a/crates/storage/provider/src/test_utils/blocks.rs +++ b/crates/storage/provider/src/test_utils/blocks.rs @@ -29,7 +29,7 @@ pub fn assert_genesis_block( let tx = provider; // check if all tables are empty - assert_eq!(tx.table::().unwrap(), vec![(g.number, g.header.clone().unseal())]); + assert_eq!(tx.table::().unwrap(), vec![(g.number, g.header().clone())]); assert_eq!(tx.table::().unwrap(), vec![(h, n)]); assert_eq!(tx.table::().unwrap(), vec![(n, h)]);