diff --git a/bin/reth/src/test_eth_chain/runner.rs b/bin/reth/src/test_eth_chain/runner.rs index 5f50f1aa4..22f88736b 100644 --- a/bin/reth/src/test_eth_chain/runner.rs +++ b/bin/reth/src/test_eth_chain/runner.rs @@ -8,7 +8,7 @@ use reth_db::{ }; use reth_executor::SpecUpgrades; use reth_primitives::{ - keccak256, Account as RethAccount, BigEndianHash, BlockLocked, SealedHeader, StorageEntry, H256, + keccak256, Account as RethAccount, BigEndianHash, SealedBlock, SealedHeader, StorageEntry, H256, }; use reth_rlp::Decodable; use reth_stages::{stages::execution::ExecutionStage, ExecInput, Stage, Transaction}; @@ -102,11 +102,11 @@ pub async fn run_test(path: PathBuf) -> eyre::Result<()> { // insert genesis let header: SealedHeader = suite.genesis_block_header.into(); - let genesis_block = BlockLocked { header, body: vec![], ommers: vec![] }; + let genesis_block = SealedBlock { header, body: vec![], ommers: vec![] }; reth_provider::insert_canonical_block(&tx, &genesis_block, has_block_reward)?; suite.blocks.iter().try_for_each(|block| -> eyre::Result<()> { - let decoded = BlockLocked::decode(&mut block.rlp.as_ref())?; + let decoded = SealedBlock::decode(&mut block.rlp.as_ref())?; reth_provider::insert_canonical_block(&tx, &decoded, has_block_reward)?; Ok(()) })?; diff --git a/book/stages/README.md b/book/stages/README.md index 08c49b5d1..c03deae36 100644 --- a/book/stages/README.md +++ b/book/stages/README.md @@ -43,9 +43,9 @@ The transactions root is a value that is calculated based on the transactions in When the `BodyStage` is looking at the headers to determine which block to download, it will skip the blocks where the `header.ommers_hash` and the `header.transaction_root` are empty, denoting that the block is empty as well. -Once the `BodyStage` determines which block bodies to fetch, a new `bodies_stream` is created which downloads all of the bodies from the `starting_block`, up until the `target_block` specified. Each time the `bodies_stream` yields a value, a `BlockLocked` is created using the block header, the ommers hash and the newly downloaded block body. +Once the `BodyStage` determines which block bodies to fetch, a new `bodies_stream` is created which downloads all of the bodies from the `starting_block`, up until the `target_block` specified. Each time the `bodies_stream` yields a value, a `SealedBlock` is created using the block header, the ommers hash and the newly downloaded block body. -{{#template ../templates/source_and_github.md path_to_root=../../ path=crates/primitives/src/block.rs anchor=struct-BlockLocked}} +{{#template ../templates/source_and_github.md path_to_root=../../ path=crates/primitives/src/block.rs anchor=struct-SealedBlock}} The new block is then pre-validated, checking that the ommers hash and transactions root in the block header are the same in the block body. Following a successful pre-validation, the `BodyStage` loops through each transaction in the `block.body`, adding the transaction to the database. This process is repeated for every downloaded block body, with the `BodyStage` returning `Ok(ExecOutput { stage_progress: highest_block, reached_tip: true, done })` signaling it successfully completed. diff --git a/crates/consensus/src/consensus.rs b/crates/consensus/src/consensus.rs index ca1611f71..da164f779 100644 --- a/crates/consensus/src/consensus.rs +++ b/crates/consensus/src/consensus.rs @@ -1,7 +1,7 @@ //! Consensus for ethereum network use crate::{verification, Config}; use reth_interfaces::consensus::{Consensus, Error, ForkchoiceState}; -use reth_primitives::{BlockLocked, BlockNumber, SealedHeader, H256}; +use reth_primitives::{BlockNumber, SealedBlock, SealedHeader, H256}; use tokio::sync::{watch, watch::error::SendError}; /// Ethereum beacon consensus @@ -54,7 +54,7 @@ impl Consensus for BeaconConsensus { Ok(()) } - fn pre_validate_block(&self, block: &BlockLocked) -> Result<(), Error> { + fn pre_validate_block(&self, block: &SealedBlock) -> Result<(), Error> { verification::validate_block_standalone(block) } diff --git a/crates/consensus/src/verification.rs b/crates/consensus/src/verification.rs index c5c4e93b6..06ce8cc1e 100644 --- a/crates/consensus/src/verification.rs +++ b/crates/consensus/src/verification.rs @@ -2,7 +2,7 @@ use crate::{config, Config}; use reth_interfaces::{consensus::Error, Result as RethResult}; use reth_primitives::{ - BlockLocked, BlockNumber, Header, SealedHeader, Transaction, TransactionSignedEcRecovered, + BlockNumber, Header, SealedBlock, SealedHeader, Transaction, TransactionSignedEcRecovered, TxEip1559, TxEip2930, TxLegacy, EMPTY_OMMER_ROOT, H256, U256, }; use reth_provider::{AccountProvider, HeaderProvider}; @@ -182,7 +182,7 @@ pub fn validate_all_transaction_regarding_block_and_nonces< /// - Compares the transactions root in the block header to the block body /// - Pre-execution transaction validation /// - (Optionally) Compares the receipts root in the block header to the block body -pub fn validate_block_standalone(block: &BlockLocked) -> Result<(), Error> { +pub fn validate_block_standalone(block: &SealedBlock) -> Result<(), Error> { // Check ommers hash // TODO(onbjerg): This should probably be accessible directly on [Block] let ommers_hash = @@ -313,7 +313,7 @@ pub fn validate_header_regarding_parent( /// /// Returns parent block header pub fn validate_block_regarding_chain( - block: &BlockLocked, + block: &SealedBlock, provider: &PROV, ) -> RethResult { let hash = block.header.hash(); @@ -334,7 +334,7 @@ pub fn validate_block_regarding_chain( /// Full validation of block before execution. pub fn full_validation( - block: &BlockLocked, + block: &SealedBlock, provider: Provider, config: &Config, ) -> RethResult<()> { @@ -456,7 +456,7 @@ mod tests { TransactionSignedEcRecovered::from_signed_transaction(tx, signer) } /// got test block - fn mock_block() -> (BlockLocked, Header) { + fn mock_block() -> (SealedBlock, Header) { // https://etherscan.io/block/15867168 where transaction root and receipts root are cleared // empty merkle tree: 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 @@ -489,7 +489,7 @@ mod tests { let ommers = Vec::new(); let body = Vec::new(); - (BlockLocked { header: header.seal(), body, ommers }, parent) + (SealedBlock { header: header.seal(), body, ommers }, parent) } #[test] diff --git a/crates/executor/src/executor.rs b/crates/executor/src/executor.rs index ed895b8ae..a0a91c506 100644 --- a/crates/executor/src/executor.rs +++ b/crates/executor/src/executor.rs @@ -418,7 +418,7 @@ mod tests { transaction::DbTx, }; use reth_primitives::{ - hex_literal::hex, keccak256, Account, Address, BlockLocked, Bytes, StorageKey, H160, H256, + hex_literal::hex, keccak256, Account, Address, Bytes, SealedBlock, StorageKey, H160, H256, U256, }; use reth_provider::{AccountProvider, StateProvider}; @@ -484,7 +484,7 @@ mod tests { // Got rlp block from: src/GeneralStateTestsFiller/stChainId/chainIdGasCostFiller.json let mut block_rlp = hex!("f90262f901f9a075c371ba45999d87f4542326910a11af515897aebce5265d3f6acd1f1161f82fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa098f2dcd87c8ae4083e7017a05456c14eea4b1db2032126e27b3b1563d57d7cc0a08151d548273f6683169524b66ca9fe338b9ce42bc3540046c828fd939ae23bcba03f4e5c2ec5b2170b711d97ee755c160457bb58d8daa338e835ec02ae6860bbabb901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018502540be40082a8798203e800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f863f861800a8405f5e10094100000000000000000000000000000000000000080801ba07e09e26678ed4fac08a249ebe8ed680bf9051a5e14ad223e4b2b9d26e0208f37a05f6e3f188e3e6eab7d7d3b6568f5eac7d687b08d307d3154ccd8c87b4630509bc0").as_slice(); - let block = BlockLocked::decode(&mut block_rlp).unwrap(); + let block = SealedBlock::decode(&mut block_rlp).unwrap(); let mut db = StateProviderTest::default(); diff --git a/crates/interfaces/src/consensus.rs b/crates/interfaces/src/consensus.rs index fc6973180..afb75766b 100644 --- a/crates/interfaces/src/consensus.rs +++ b/crates/interfaces/src/consensus.rs @@ -1,5 +1,5 @@ use async_trait::async_trait; -use reth_primitives::{BlockHash, BlockLocked, BlockNumber, SealedHeader, H256}; +use reth_primitives::{BlockHash, BlockNumber, SealedBlock, SealedHeader, H256}; use tokio::sync::watch::Receiver; /// Re-export forkchoice state @@ -24,7 +24,7 @@ pub trait Consensus: Send + Sync { /// 11.1 "Ommer Validation". /// /// **This should not be called for the genesis block**. - fn pre_validate_block(&self, block: &BlockLocked) -> Result<(), Error>; + fn pre_validate_block(&self, block: &SealedBlock) -> Result<(), Error>; /// After the Merge (aka Paris) block rewards became obsolete. /// This flag is needed as reth change set is indexed of transaction granularity diff --git a/crates/interfaces/src/p2p/bodies/downloader.rs b/crates/interfaces/src/p2p/bodies/downloader.rs index 86c42ea38..c7309e558 100644 --- a/crates/interfaces/src/p2p/bodies/downloader.rs +++ b/crates/interfaces/src/p2p/bodies/downloader.rs @@ -1,11 +1,11 @@ use crate::p2p::downloader::{DownloadStream, Downloader}; -use reth_primitives::{BlockLocked, SealedHeader}; +use reth_primitives::{SealedBlock, SealedHeader}; /// The block response #[derive(PartialEq, Eq, Debug)] pub enum BlockResponse { /// Full block response (with transactions or ommers) - Full(BlockLocked), + Full(SealedBlock), /// The empty block response Empty(SealedHeader), } diff --git a/crates/interfaces/src/test_utils/generators.rs b/crates/interfaces/src/test_utils/generators.rs index 1830d1837..f27fe88a0 100644 --- a/crates/interfaces/src/test_utils/generators.rs +++ b/crates/interfaces/src/test_utils/generators.rs @@ -1,6 +1,6 @@ use rand::{distributions::uniform::SampleRange, thread_rng, Rng}; use reth_primitives::{ - proofs, Address, BlockLocked, Bytes, Header, SealedHeader, Signature, Transaction, + proofs, Address, Bytes, Header, SealedBlock, SealedHeader, Signature, Transaction, TransactionKind, TransactionSigned, TxLegacy, H256, U256, }; use secp256k1::{KeyPair, Message as SecpMessage, Secp256k1, SecretKey}; @@ -100,7 +100,7 @@ pub fn sign_message(secret: H256, message: H256) -> Result, tx_count: Option) -> BlockLocked { +pub fn random_block(number: u64, parent: Option, tx_count: Option) -> SealedBlock { let mut rng = thread_rng(); // Generate transactions @@ -119,7 +119,7 @@ pub fn random_block(number: u64, parent: Option, tx_count: Option) -> let transactions_root = proofs::calculate_transaction_root(transactions.iter()); let ommers_hash = proofs::calculate_ommers_root(ommers.iter()); - BlockLocked { + SealedBlock { header: Header { parent_hash: parent.unwrap_or_default(), number, @@ -145,14 +145,14 @@ pub fn random_block_range( block_numbers: std::ops::Range, head: H256, tx_count: std::ops::Range, -) -> Vec { +) -> Vec { let mut rng = rand::thread_rng(); let mut blocks = Vec::with_capacity(block_numbers.end.saturating_sub(block_numbers.start) as usize); for idx in block_numbers { blocks.push(random_block( idx, - Some(blocks.last().map(|block: &BlockLocked| block.header.hash()).unwrap_or(head)), + Some(blocks.last().map(|block: &SealedBlock| block.header.hash()).unwrap_or(head)), Some(tx_count.clone().sample_single(&mut rng)), )); } diff --git a/crates/interfaces/src/test_utils/headers.rs b/crates/interfaces/src/test_utils/headers.rs index 089b00edf..e07658e8a 100644 --- a/crates/interfaces/src/test_utils/headers.rs +++ b/crates/interfaces/src/test_utils/headers.rs @@ -13,7 +13,7 @@ use crate::{ use futures::{Future, FutureExt, Stream}; use reth_eth_wire::BlockHeaders; use reth_primitives::{ - BlockLocked, BlockNumber, Header, HeadersDirection, PeerId, SealedHeader, H256, + BlockNumber, Header, HeadersDirection, PeerId, SealedBlock, SealedHeader, H256, }; use reth_rpc_types::engine::ForkchoiceState; use std::{ @@ -260,7 +260,7 @@ impl Consensus for TestConsensus { } } - fn pre_validate_block(&self, _block: &BlockLocked) -> Result<(), consensus::Error> { + fn pre_validate_block(&self, _block: &SealedBlock) -> Result<(), consensus::Error> { if self.fail_validation() { Err(consensus::Error::BaseFeeMissing) } else { diff --git a/crates/net/downloaders/src/bodies/concurrent.rs b/crates/net/downloaders/src/bodies/concurrent.rs index 1f43c411b..10110ab50 100644 --- a/crates/net/downloaders/src/bodies/concurrent.rs +++ b/crates/net/downloaders/src/bodies/concurrent.rs @@ -11,7 +11,7 @@ use reth_interfaces::{ error::{DownloadError, DownloadResult, RequestError}, }, }; -use reth_primitives::{BlockLocked, SealedHeader}; +use reth_primitives::{SealedBlock, SealedHeader}; use std::{borrow::Borrow, sync::Arc}; /// Downloads bodies in batches. @@ -158,7 +158,7 @@ where } }; - let block = BlockLocked { + let block = SealedBlock { header: header.clone(), body: body.transactions, ommers: body.ommers.into_iter().map(|header| header.seal()).collect(), @@ -247,7 +247,7 @@ mod tests { if header.is_empty() { BlockResponse::Empty(header) } else { - BlockResponse::Full(BlockLocked { + BlockResponse::Full(SealedBlock { header, body: body.transactions, ommers: body.ommers.into_iter().map(|o| o.seal()).collect(), diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index 88a1a191f..3f1e1bd48 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -22,9 +22,9 @@ impl Deref for Block { } /// Sealed Ethereum full block. -// ANCHOR: struct-BlockLocked +// ANCHOR: struct-SealedBlock #[derive(Debug, Clone, PartialEq, Eq, Default, RlpEncodable, RlpDecodable)] -pub struct BlockLocked { +pub struct SealedBlock { /// Locked block header. pub header: SealedHeader, /// Transactions with signatures. @@ -32,16 +32,16 @@ pub struct BlockLocked { /// Ommer/uncle headers pub ommers: Vec, } -// ANCHOR_END: struct-BlockLocked +// ANCHOR_END: struct-SealedBlock -impl BlockLocked { +impl SealedBlock { /// Header hash. pub fn hash(&self) -> H256 { self.header.hash() } } -impl Deref for BlockLocked { +impl Deref for SealedBlock { type Target = Header; fn deref(&self) -> &Self::Target { self.header.as_ref() diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 70d0f8b8d..72fa81a3b 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -31,7 +31,7 @@ mod transaction; pub mod proofs; pub use account::Account; -pub use block::{Block, BlockHashOrNumber, BlockLocked}; +pub use block::{Block, BlockHashOrNumber, SealedBlock}; pub use chain::Chain; pub use constants::{EMPTY_OMMER_ROOT, KECCAK_EMPTY, MAINNET_GENESIS}; pub use ethbloom::Bloom; diff --git a/crates/stages/src/stages/bodies.rs b/crates/stages/src/stages/bodies.rs index 6befeb12f..4003dd08a 100644 --- a/crates/stages/src/stages/bodies.rs +++ b/crates/stages/src/stages/bodies.rs @@ -557,14 +557,14 @@ mod tests { TestConsensus, }, }; - use reth_primitives::{BlockLocked, BlockNumber, SealedHeader, TxNumber, H256}; + use reth_primitives::{BlockNumber, SealedBlock, SealedHeader, TxNumber, H256}; use std::{collections::HashMap, sync::Arc}; /// The block hash of the genesis block. pub(crate) const GENESIS_HASH: H256 = H256::zero(); /// A helper to create a collection of resulted-wrapped block bodies keyed by their hash. - pub(crate) fn body_by_hash(block: &BlockLocked) -> (H256, DownloadResult) { + pub(crate) fn body_by_hash(block: &SealedBlock) -> (H256, DownloadResult) { ( block.hash(), Ok(BlockBody { @@ -624,7 +624,7 @@ mod tests { #[async_trait::async_trait] impl ExecuteStageTestRunner for BodyTestRunner { - type Seed = Vec; + type Seed = Vec; fn seed_execution(&mut self, input: ExecInput) -> Result { let start = input.stage_progress.unwrap_or_default(); @@ -841,7 +841,7 @@ mod tests { .get(&header.hash()) .expect("Stage tried downloading a block we do not have.") .clone()?; - Ok(BlockResponse::Full(BlockLocked { + Ok(BlockResponse::Full(SealedBlock { header: header.clone(), body: result.transactions, ommers: result.ommers.into_iter().map(|header| header.seal()).collect(), diff --git a/crates/stages/src/stages/execution.rs b/crates/stages/src/stages/execution.rs index 47cdf6e3d..87eb2e152 100644 --- a/crates/stages/src/stages/execution.rs +++ b/crates/stages/src/stages/execution.rs @@ -375,7 +375,7 @@ mod tests { use super::*; use reth_db::mdbx::{test_utils::create_test_db, EnvKind, WriteMap}; - use reth_primitives::{hex_literal::hex, keccak256, Account, BlockLocked, H160, U256}; + use reth_primitives::{hex_literal::hex, keccak256, Account, SealedBlock, H160, U256}; use reth_provider::insert_canonical_block; use reth_rlp::Decodable; @@ -391,9 +391,9 @@ mod tests { stage_progress: None, }; let mut genesis_rlp = hex!("f901faf901f5a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa045571b40ae66ca7480791bbb2887286e4e4c4b1b298b191c889d6959023a32eda056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000808502540be400808000a00000000000000000000000000000000000000000000000000000000000000000880000000000000000c0c0").as_slice(); - let genesis = BlockLocked::decode(&mut genesis_rlp).unwrap(); + let genesis = SealedBlock::decode(&mut genesis_rlp).unwrap(); let mut block_rlp = hex!("f90262f901f9a075c371ba45999d87f4542326910a11af515897aebce5265d3f6acd1f1161f82fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa098f2dcd87c8ae4083e7017a05456c14eea4b1db2032126e27b3b1563d57d7cc0a08151d548273f6683169524b66ca9fe338b9ce42bc3540046c828fd939ae23bcba03f4e5c2ec5b2170b711d97ee755c160457bb58d8daa338e835ec02ae6860bbabb901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018502540be40082a8798203e800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f863f861800a8405f5e10094100000000000000000000000000000000000000080801ba07e09e26678ed4fac08a249ebe8ed680bf9051a5e14ad223e4b2b9d26e0208f37a05f6e3f188e3e6eab7d7d3b6568f5eac7d687b08d307d3154ccd8c87b4630509bc0").as_slice(); - let block = BlockLocked::decode(&mut block_rlp).unwrap(); + let block = SealedBlock::decode(&mut block_rlp).unwrap(); insert_canonical_block(tx.deref_mut(), &genesis, true).unwrap(); insert_canonical_block(tx.deref_mut(), &block, true).unwrap(); tx.commit().unwrap(); @@ -476,9 +476,9 @@ mod tests { stage_progress: None, }; let mut genesis_rlp = hex!("f901faf901f5a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa045571b40ae66ca7480791bbb2887286e4e4c4b1b298b191c889d6959023a32eda056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000808502540be400808000a00000000000000000000000000000000000000000000000000000000000000000880000000000000000c0c0").as_slice(); - let genesis = BlockLocked::decode(&mut genesis_rlp).unwrap(); + let genesis = SealedBlock::decode(&mut genesis_rlp).unwrap(); let mut block_rlp = hex!("f90262f901f9a075c371ba45999d87f4542326910a11af515897aebce5265d3f6acd1f1161f82fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa098f2dcd87c8ae4083e7017a05456c14eea4b1db2032126e27b3b1563d57d7cc0a08151d548273f6683169524b66ca9fe338b9ce42bc3540046c828fd939ae23bcba03f4e5c2ec5b2170b711d97ee755c160457bb58d8daa338e835ec02ae6860bbabb901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018502540be40082a8798203e800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f863f861800a8405f5e10094100000000000000000000000000000000000000080801ba07e09e26678ed4fac08a249ebe8ed680bf9051a5e14ad223e4b2b9d26e0208f37a05f6e3f188e3e6eab7d7d3b6568f5eac7d687b08d307d3154ccd8c87b4630509bc0").as_slice(); - let block = BlockLocked::decode(&mut block_rlp).unwrap(); + let block = SealedBlock::decode(&mut block_rlp).unwrap(); insert_canonical_block(tx.deref_mut(), &genesis, true).unwrap(); insert_canonical_block(tx.deref_mut(), &block, true).unwrap(); tx.commit().unwrap(); diff --git a/crates/stages/src/stages/sender_recovery.rs b/crates/stages/src/stages/sender_recovery.rs index b159634a1..1526a350b 100644 --- a/crates/stages/src/stages/sender_recovery.rs +++ b/crates/stages/src/stages/sender_recovery.rs @@ -133,7 +133,7 @@ mod tests { use assert_matches::assert_matches; use reth_db::models::StoredBlockBody; use reth_interfaces::test_utils::generators::{random_block, random_block_range}; - use reth_primitives::{BlockLocked, BlockNumber, H256}; + use reth_primitives::{BlockNumber, SealedBlock, H256}; use super::*; use crate::test_utils::{ @@ -159,7 +159,7 @@ mod tests { let stage_progress = input.stage_progress.unwrap_or_default(); // Insert blocks with a single transaction at block `stage_progress + 10` (stage_progress..input.previous_stage_progress() + 1) - .map(|number| -> Result { + .map(|number| -> Result { let tx_count = Some((number == stage_progress + 10) as u8); let block = random_block(number, None, tx_count); current_tx_id = runner.insert_block(current_tx_id, &block, false)?; @@ -251,7 +251,7 @@ mod tests { } impl ExecuteStageTestRunner for SenderRecoveryTestRunner { - type Seed = Vec; + type Seed = Vec; fn seed_execution(&mut self, input: ExecInput) -> Result { let stage_progress = input.stage_progress.unwrap_or_default(); @@ -332,7 +332,7 @@ mod tests { fn insert_block( &self, tx_offset: u64, - block: &BlockLocked, + block: &SealedBlock, insert_senders: bool, ) -> Result { let mut current_tx_id = tx_offset; diff --git a/crates/storage/provider/src/block.rs b/crates/storage/provider/src/block.rs index aad4a6aa6..dc0b20ca6 100644 --- a/crates/storage/provider/src/block.rs +++ b/crates/storage/provider/src/block.rs @@ -7,7 +7,7 @@ use reth_db::{ use reth_interfaces::{provider::Error as ProviderError, Result}; use reth_primitives::{ rpc::{BlockId, BlockNumber}, - Block, BlockHash, BlockHashOrNumber, BlockLocked, Header, H256, U256, + Block, BlockHash, BlockHashOrNumber, Header, SealedBlock, H256, U256, }; /// Client trait for fetching `Header` related data. @@ -115,7 +115,7 @@ pub struct ChainInfo { /// [tables::CumulativeTxCount] and [tables::BlockBodies] pub fn insert_canonical_block<'a, TX: DbTxMut<'a> + DbTx<'a>>( tx: &TX, - block: &BlockLocked, + block: &SealedBlock, has_block_reward: bool, ) -> Result<()> { let block_num_hash = BlockNumHash((block.number, block.hash()));