diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index 25a6136bb..b45cd934c 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -1675,7 +1675,8 @@ mod tests { ommers: Vec::new(), withdrawals: Some(Withdrawals::default()), sidecars: None, - requests: None,}, + requests: None, + }, }, body.iter().map(|tx| tx.signer()).collect(), ) diff --git a/crates/blockchain-tree/src/chain.rs b/crates/blockchain-tree/src/chain.rs index a9e2f2604..5c6449e69 100644 --- a/crates/blockchain-tree/src/chain.rs +++ b/crates/blockchain-tree/src/chain.rs @@ -15,7 +15,9 @@ use reth_consensus::{Consensus, ConsensusError, PostExecutionInput}; use reth_evm::execute::{BlockExecutorProvider, Executor}; use reth_execution_errors::BlockExecutionError; use reth_execution_types::{Chain, ExecutionOutcome}; -use reth_primitives::{revm_primitives::EvmState, GotExpected, Header, SealedBlockWithSenders, SealedHeader}; +use reth_primitives::{ + revm_primitives::EvmState, GotExpected, Header, SealedBlockWithSenders, SealedHeader, +}; use reth_provider::{ providers::{BundleStateProvider, ConsistentDbView, ProviderNodeTypes}, FullExecutionDataProvider, ProviderError, StateRootProvider, TryIntoHistoricalStateProvider, diff --git a/crates/bsc/chainspec/src/bsc.rs b/crates/bsc/chainspec/src/bsc.rs index 89ffd5ff3..4b8e4938f 100644 --- a/crates/bsc/chainspec/src/bsc.rs +++ b/crates/bsc/chainspec/src/bsc.rs @@ -8,8 +8,8 @@ use std::sync::Arc; use alloy_chains::{Chain, NamedChain}; use alloy_primitives::{b256, U256}; use once_cell::sync::Lazy; -use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec}; use reth_bsc_forks::BscHardfork; +use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec}; use crate::BscChainSpec; diff --git a/crates/bsc/chainspec/src/bsc_chapel.rs b/crates/bsc/chainspec/src/bsc_chapel.rs index 8544b455a..b56a22094 100644 --- a/crates/bsc/chainspec/src/bsc_chapel.rs +++ b/crates/bsc/chainspec/src/bsc_chapel.rs @@ -8,8 +8,8 @@ use std::sync::Arc; use alloy_chains::{Chain, NamedChain}; use alloy_primitives::{b256, U256}; use once_cell::sync::Lazy; -use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec}; use reth_bsc_forks::BscHardfork; +use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec}; use crate::BscChainSpec; diff --git a/crates/bsc/chainspec/src/bsc_rialto.rs b/crates/bsc/chainspec/src/bsc_rialto.rs index df19b7981..37e0a5fd8 100644 --- a/crates/bsc/chainspec/src/bsc_rialto.rs +++ b/crates/bsc/chainspec/src/bsc_rialto.rs @@ -8,8 +8,8 @@ use std::sync::Arc; use alloy_chains::Chain; use alloy_primitives::{b256, U256}; use once_cell::sync::Lazy; -use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec}; use reth_bsc_forks::BscHardfork; +use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec}; use crate::BscChainSpec; diff --git a/crates/bsc/chainspec/src/dev.rs b/crates/bsc/chainspec/src/dev.rs index 5ab321ae6..e8f2d5a2f 100644 --- a/crates/bsc/chainspec/src/dev.rs +++ b/crates/bsc/chainspec/src/dev.rs @@ -8,8 +8,8 @@ use std::sync::Arc; use alloy_chains::Chain; use alloy_primitives::U256; use once_cell::sync::Lazy; -use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec}; use reth_bsc_forks::DEV_HARDFORKS; +use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec}; use reth_primitives_traits::constants::DEV_GENESIS_HASH; use crate::BscChainSpec; diff --git a/crates/bsc/consensus/src/abi.rs b/crates/bsc/consensus/src/abi.rs index a91025e26..3fb4b37ae 100644 --- a/crates/bsc/consensus/src/abi.rs +++ b/crates/bsc/consensus/src/abi.rs @@ -3,9 +3,7 @@ use alloy_dyn_abi::{DynSolValue, FunctionExt, JsonAbiExt}; use alloy_primitives::{Address, BlockNumber, Bytes, U256}; use lazy_static::lazy_static; use reth_bsc_forks::BscHardforks; -use reth_primitives::{ - system_contracts::{STAKE_HUB_CONTRACT, VALIDATOR_CONTRACT}, -}; +use reth_primitives::system_contracts::{STAKE_HUB_CONTRACT, VALIDATOR_CONTRACT}; lazy_static! { pub static ref VALIDATOR_SET_ABI: &'static str = r#" diff --git a/crates/bsc/consensus/src/lib.rs b/crates/bsc/consensus/src/lib.rs index 1a2b73834..c21a2dfbf 100644 --- a/crates/bsc/consensus/src/lib.rs +++ b/crates/bsc/consensus/src/lib.rs @@ -12,8 +12,8 @@ use alloy_rlp::Decodable; use lazy_static::lazy_static; use lru::LruCache; use parking_lot::RwLock; -use reth_chainspec::{ChainSpec, EthereumHardforks}; use reth_bsc_forks::BscHardforks; +use reth_chainspec::{ChainSpec, EthereumHardforks}; use reth_consensus::{Consensus, ConsensusError, PostExecutionInput}; use reth_primitives::{ constants::EMPTY_MIX_HASH, diff --git a/crates/bsc/consensus/src/system_tx.rs b/crates/bsc/consensus/src/system_tx.rs index 20fa4862a..4e4363b48 100644 --- a/crates/bsc/consensus/src/system_tx.rs +++ b/crates/bsc/consensus/src/system_tx.rs @@ -1,7 +1,7 @@ use crate::Parlia; use alloy_consensus::TxLegacy; -use alloy_primitives::{Address, Bytes, TxKind, U256}; use alloy_dyn_abi::{DynSolValue, JsonAbiExt}; +use alloy_primitives::{Address, Bytes, TxKind, U256}; use reth_primitives::{ system_contracts::{ CROSS_CHAIN_CONTRACT, GOVERNOR_CONTRACT, GOV_TOKEN_CONTRACT, LIGHT_CLIENT_CONTRACT, diff --git a/crates/bsc/consensus/src/util.rs b/crates/bsc/consensus/src/util.rs index ba0352b78..6208cf9d5 100644 --- a/crates/bsc/consensus/src/util.rs +++ b/crates/bsc/consensus/src/util.rs @@ -1,5 +1,8 @@ use crate::EXTRA_SEAL_LEN; -use alloy_primitives::{keccak256, bytes::{BufMut, BytesMut}, B256, B64, U256}; +use alloy_primitives::{ + bytes::{BufMut, BytesMut}, + keccak256, B256, B64, U256, +}; use alloy_rlp::Encodable; use reth_primitives::Header; use std::env; diff --git a/crates/bsc/engine/src/lib.rs b/crates/bsc/engine/src/lib.rs index 2d419c6f2..836c0c80f 100644 --- a/crates/bsc/engine/src/lib.rs +++ b/crates/bsc/engine/src/lib.rs @@ -13,9 +13,7 @@ use reth_engine_primitives::EngineTypes; use reth_evm_bsc::SnapshotReader; use reth_network_api::events::EngineMessage; use reth_network_p2p::BlockClient; -use reth_primitives::{ - parlia::ParliaConfig, BlockBody, BlockHashOrNumber, SealedHeader, -}; +use reth_primitives::{parlia::ParliaConfig, BlockBody, BlockHashOrNumber, SealedHeader}; use reth_provider::{BlockReaderIdExt, CanonChainTracker, ParliaProvider}; use std::{ clone::Clone, @@ -283,8 +281,8 @@ where #[cfg(test)] mod tests { - use alloy_primitives::Sealable; use super::*; + use alloy_primitives::Sealable; use reth_primitives::SealedHeader; #[test] @@ -356,7 +354,7 @@ mod tests { #[test] fn test_clean_cache() { - let default_block =SealedHeader::default(); + let default_block = SealedHeader::default(); let mut storage = StorageInner { best_hash: default_block.hash_slow(), best_block: default_block.number, diff --git a/crates/bsc/evm/src/config.rs b/crates/bsc/evm/src/config.rs index 09695d039..dd998a7d1 100644 --- a/crates/bsc/evm/src/config.rs +++ b/crates/bsc/evm/src/config.rs @@ -1,5 +1,5 @@ -use reth_chainspec::ChainSpec; use reth_bsc_forks::BscHardfork; +use reth_chainspec::ChainSpec; use reth_ethereum_forks::{EthereumHardfork, Head}; /// Returns the spec id at the given timestamp. diff --git a/crates/bsc/evm/src/execute.rs b/crates/bsc/evm/src/execute.rs index f02b5e0e1..ce02f043f 100644 --- a/crates/bsc/evm/src/execute.rs +++ b/crates/bsc/evm/src/execute.rs @@ -1,7 +1,7 @@ //! Bsc block executor. use crate::{post_execution::PostExecutionInput, BscBlockExecutionError, BscEvmConfig}; -use alloy_primitives::{Address, BlockNumber, B256, Bytes, U256}; +use alloy_primitives::{Address, BlockNumber, Bytes, B256, U256}; use core::fmt::Display; use lazy_static::lazy_static; use lru::LruCache; @@ -9,8 +9,8 @@ use parking_lot::RwLock; use reth_bsc_consensus::{ is_breathe_block, validate_block_post_execution, Parlia, ValidatorElectionInfo, ValidatorsInfo, }; -use reth_chainspec::{ChainSpec, EthereumHardforks}; use reth_bsc_forks::BscHardforks; +use reth_chainspec::{ChainSpec, EthereumHardforks}; use reth_errors::{BlockExecutionError, BlockValidationError, ProviderError}; use reth_evm::{ execute::{ diff --git a/crates/bsc/evm/src/lib.rs b/crates/bsc/evm/src/lib.rs index c71e593ec..9f915c569 100644 --- a/crates/bsc/evm/src/lib.rs +++ b/crates/bsc/evm/src/lib.rs @@ -187,9 +187,7 @@ mod tests { use super::*; use alloy_genesis::Genesis; use reth_chainspec::Chain; - use reth_primitives::{ - revm_primitives::{BlockEnv, CfgEnv}, - }; + use reth_primitives::revm_primitives::{BlockEnv, CfgEnv}; use revm_primitives::SpecId; #[test] diff --git a/crates/bsc/evm/src/post_execution.rs b/crates/bsc/evm/src/post_execution.rs index 6409a9daf..158c2b45b 100644 --- a/crates/bsc/evm/src/post_execution.rs +++ b/crates/bsc/evm/src/post_execution.rs @@ -6,8 +6,8 @@ use reth_bsc_consensus::{ COLLECT_ADDITIONAL_VOTES_REWARD_RATIO, DEFAULT_TURN_LENGTH, DIFF_INTURN, MAX_SYSTEM_REWARD, SYSTEM_REWARD_PERCENT, }; -use reth_errors::{BlockExecutionError, BlockValidationError, ProviderError}; use reth_bsc_forks::BscHardforks; +use reth_errors::{BlockExecutionError, BlockValidationError, ProviderError}; use reth_evm::ConfigureEvm; use reth_primitives::{ parlia::{Snapshot, VoteAddress, VoteAttestation}, diff --git a/crates/bsc/evm/src/pre_execution.rs b/crates/bsc/evm/src/pre_execution.rs index 6ed254894..6e7a3183f 100644 --- a/crates/bsc/evm/src/pre_execution.rs +++ b/crates/bsc/evm/src/pre_execution.rs @@ -6,9 +6,9 @@ use blst::{ BLST_ERROR, }; use reth_bsc_consensus::{DIFF_INTURN, DIFF_NOTURN}; +use reth_bsc_forks::BscHardforks; use reth_errors::{BlockExecutionError, ProviderError}; use reth_ethereum_forks::EthereumHardforks; -use reth_bsc_forks::BscHardforks; use reth_evm::ConfigureEvm; use reth_primitives::{ parlia::{Snapshot, VoteAddress, MAX_ATTESTATION_EXTRA_LENGTH}, @@ -230,9 +230,7 @@ mod tests { use alloy_primitives::{b256, hex}; use blst::min_pk::{PublicKey, Signature}; - use reth_primitives::{ - parlia::{VoteAddress, VoteData, VoteSignature}, - }; + use reth_primitives::parlia::{VoteAddress, VoteData, VoteSignature}; #[test] fn verify_vote_attestation() { diff --git a/crates/bsc/node/src/node.rs b/crates/bsc/node/src/node.rs index adfc6b2e5..43100e202 100644 --- a/crates/bsc/node/src/node.rs +++ b/crates/bsc/node/src/node.rs @@ -1,23 +1,23 @@ //! BSC Node types config. -use std::sync::Arc; use crate::EthEngineTypes; use reth_basic_payload_builder::{BasicPayloadJobGenerator, BasicPayloadJobGeneratorConfig}; use reth_bsc_consensus::Parlia; use reth_chainspec::ChainSpec; -use reth_ethereum_engine_primitives::{EthBuiltPayload, EthPayloadAttributes, EthPayloadBuilderAttributes, EthereumEngineValidator}; +use reth_ethereum_engine_primitives::{ + EthBuiltPayload, EthPayloadAttributes, EthPayloadBuilderAttributes, EthereumEngineValidator, +}; use reth_evm_bsc::{BscEvmConfig, BscExecutorProvider}; use reth_network::NetworkHandle; use reth_node_api::{ConfigureEvm, EngineValidator, FullNodeComponents, NodeAddOns}; use reth_node_builder::{ components::{ - ComponentsBuilder, ConsensusBuilder, ExecutorBuilder, NetworkBuilder, - PayloadServiceBuilder, PoolBuilder, + ComponentsBuilder, ConsensusBuilder, EngineValidatorBuilder, ExecutorBuilder, + NetworkBuilder, PayloadServiceBuilder, PoolBuilder, }, node::{FullNodeTypes, NodeTypes, NodeTypesWithEngine}, BuilderContext, Node, PayloadBuilderConfig, PayloadTypes, }; -use reth_node_builder::components::EngineValidatorBuilder; use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService}; use reth_primitives::Header; use reth_provider::CanonStateSubscriptions; @@ -27,6 +27,7 @@ use reth_transaction_pool::{ blobstore::DiskFileBlobStore, EthTransactionPool, TransactionPool, TransactionValidationTaskExecutor, }; +use std::sync::Arc; /// Type configuration for a regular BSC node. #[derive(Debug, Default, Clone, Copy)] diff --git a/crates/chain-state/src/test_utils.rs b/crates/chain-state/src/test_utils.rs index d7434e55d..e0065374d 100644 --- a/crates/chain-state/src/test_utils.rs +++ b/crates/chain-state/src/test_utils.rs @@ -170,7 +170,8 @@ impl TestBlockBuilder { ommers: Vec::new(), withdrawals: Some(vec![].into()), sidecars: None, - requests: None,}, + requests: None, + }, }; SealedBlockWithSenders::new(block, vec![self.signer; num_txs as usize]).unwrap() diff --git a/crates/cli/commands/src/node.rs b/crates/cli/commands/src/node.rs index 7a90b6d8b..9f62566f8 100644 --- a/crates/cli/commands/src/node.rs +++ b/crates/cli/commands/src/node.rs @@ -10,8 +10,8 @@ use reth_ethereum_cli::chainspec::EthereumChainSpecParser; use reth_node_builder::{NodeBuilder, WithLaunchContext}; use reth_node_core::{ args::{ - DatabaseArgs, DatadirArgs, DebugArgs, DevArgs, NetworkArgs, - PayloadBuilderArgs, PerformanceOptimizationArgs, PruningArgs, RpcServerArgs, TxPoolArgs, + DatabaseArgs, DatadirArgs, DebugArgs, DevArgs, NetworkArgs, PayloadBuilderArgs, + PerformanceOptimizationArgs, PruningArgs, RpcServerArgs, TxPoolArgs, }, node_config::NodeConfig, version, diff --git a/crates/consensus/auto-seal/src/lib.rs b/crates/consensus/auto-seal/src/lib.rs index 032793569..3424b68b3 100644 --- a/crates/consensus/auto-seal/src/lib.rs +++ b/crates/consensus/auto-seal/src/lib.rs @@ -399,8 +399,13 @@ impl StorageInner { // root here let Block { mut header, body, .. } = block.block; - let body = BlockBody { transactions: body.transactions, ommers, withdrawals, sidecars: None, requests }; - + let body = BlockBody { + transactions: body.transactions, + ommers, + withdrawals, + sidecars: None, + requests, + }; trace!(target: "consensus::auto", ?execution_outcome, ?header, ?body, "executed block, calculating state root and completing header"); // now we need to update certain header fields with the results of the execution diff --git a/crates/consensus/common/src/validation.rs b/crates/consensus/common/src/validation.rs index 5a4f6449e..f813da3ca 100644 --- a/crates/consensus/common/src/validation.rs +++ b/crates/consensus/common/src/validation.rs @@ -480,11 +480,13 @@ mod tests { ( SealedBlock { header: SealedHeader::new(header, seal), - body: BlockBody { transactions, - ommers, - withdrawals: None, - sidecars: None, - requests: None}, + body: BlockBody { + transactions, + ommers, + withdrawals: None, + sidecars: None, + requests: None, + }, }, parent, ) diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index 2cf9e7425..74dca746e 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -2192,7 +2192,10 @@ where .collect::>(); let exec_time = Instant::now(); - let output = self.metrics.executor.execute_metered(executor, (&block, U256::MAX, Some(&ancestor_blocks)).into())?; + let output = self + .metrics + .executor + .execute_metered(executor, (&block, U256::MAX, Some(&ancestor_blocks)).into())?; trace!(target: "engine::tree", elapsed=?exec_time.elapsed(), ?block_number, "Executed block"); if let Err(err) = self.consensus.validate_block_post_execution( @@ -2259,7 +2262,9 @@ where } trie_output = _trie_output; let root_elapsed = root_time.elapsed(); - self.metrics.block_validation.record_state_root(&trie_output, root_elapsed.as_secs_f64()); + self.metrics + .block_validation + .record_state_root(&trie_output, root_elapsed.as_secs_f64()); debug!(target: "engine::tree", ?root_elapsed, ?block_number, "Calculated state root"); } diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index ddd3d9acd..1357f1b6f 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -346,7 +346,12 @@ where let env = self.evm_env_for_block(&block.header, total_difficulty); let output = { let evm = self.executor.evm_config.evm_with_env(&mut self.state, env); - self.executor.execute_state_transitions(block, evm, state_hook, self.prefetch_tx.clone()) + self.executor.execute_state_transitions( + block, + evm, + state_hook, + self.prefetch_tx.clone(), + ) }?; // 3. apply post execution changes @@ -646,7 +651,8 @@ mod tests { ommers: vec![], withdrawals: None, sidecars: None, - requests: None,}, + requests: None, + }, }, senders: vec![], }, @@ -680,7 +686,8 @@ mod tests { ommers: vec![], withdrawals: None, sidecars: None, - requests: None,}, + requests: None, + }, }, senders: vec![], }, @@ -748,7 +755,8 @@ mod tests { ommers: vec![], withdrawals: None, sidecars: None, - requests: None,}, + requests: None, + }, }, senders: vec![], }, @@ -804,7 +812,8 @@ mod tests { ommers: vec![], withdrawals: None, sidecars: None, - requests: None,}, + requests: None, + }, }, senders: vec![], }, diff --git a/crates/ethereum/payload/src/lib.rs b/crates/ethereum/payload/src/lib.rs index 84d393ccc..dc997aa96 100644 --- a/crates/ethereum/payload/src/lib.rs +++ b/crates/ethereum/payload/src/lib.rs @@ -417,10 +417,15 @@ where }; // seal the block - let block = - Block { + let block = Block { header, - body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals, sidecars: None, requests }, + body: BlockBody { + transactions: executed_txs, + ommers: vec![], + withdrawals, + sidecars: None, + requests, + }, }; let sealed_block = block.seal_slow(); diff --git a/crates/evm/execution-types/src/execution_outcome.rs b/crates/evm/execution-types/src/execution_outcome.rs index 6cd2736f2..74c7a3b21 100644 --- a/crates/evm/execution-types/src/execution_outcome.rs +++ b/crates/evm/execution-types/src/execution_outcome.rs @@ -1,7 +1,7 @@ use crate::BlockExecutionOutput; use alloy_primitives::{Address, BlockNumber, Bloom, Log, B256, U256}; use reth_primitives::{ - logs_bloom, Account, Bytecode, parlia::Snapshot, Receipt, Receipts, Requests, StorageEntry, + logs_bloom, parlia::Snapshot, Account, Bytecode, Receipt, Receipts, Requests, StorageEntry, }; use reth_trie::HashedPostState; use revm::{ diff --git a/crates/evm/src/metrics.rs b/crates/evm/src/metrics.rs index 8e10c7183..9b3b27bed 100644 --- a/crates/evm/src/metrics.rs +++ b/crates/evm/src/metrics.rs @@ -116,7 +116,11 @@ impl ExecutorMetrics { } /// Execute the given block and update metrics for the execution. - pub fn metered_one(&self, input: BlockExecutionInput<'_, BlockWithSenders, Header>, f: F) -> R + pub fn metered_one( + &self, + input: BlockExecutionInput<'_, BlockWithSenders, Header>, + f: F, + ) -> R where F: FnOnce(BlockExecutionInput<'_, BlockWithSenders, Header>) -> R, { diff --git a/crates/exex/exex/src/backfill/test_utils.rs b/crates/exex/exex/src/backfill/test_utils.rs index 2afc61768..a372c6171 100644 --- a/crates/exex/exex/src/backfill/test_utils.rs +++ b/crates/exex/exex/src/backfill/test_utils.rs @@ -127,7 +127,8 @@ fn blocks( }), )], sidecars: Some(Default::default()), - ..Default::default()}, + ..Default::default() + }, } .with_recovered_senders() .ok_or_eyre("failed to recover senders")?; @@ -159,7 +160,8 @@ fn blocks( }), )], sidecars: Some(Default::default()), - ..Default::default()}, + ..Default::default() + }, } .with_recovered_senders() .ok_or_eyre("failed to recover senders")?; diff --git a/crates/node/builder/src/launch/engine.rs b/crates/node/builder/src/launch/engine.rs index c4d152287..9a133e8e3 100644 --- a/crates/node/builder/src/launch/engine.rs +++ b/crates/node/builder/src/launch/engine.rs @@ -32,9 +32,9 @@ use reth_node_core::{ }; use reth_node_events::{cl::ConsensusLayerHealthEvents, node}; use reth_payload_primitives::PayloadBuilder; -use reth_primitives::EthereumHardforks; #[cfg(feature = "bsc")] use reth_primitives::parlia::ParliaConfig; +use reth_primitives::EthereumHardforks; use reth_provider::providers::{BlockchainProvider2, ProviderNodeTypes}; use reth_rpc_engine_api::{capabilities::EngineCapabilities, EngineApi}; use reth_tasks::TaskExecutor; diff --git a/crates/optimism/chainspec/src/opbnb_qa.rs b/crates/optimism/chainspec/src/opbnb_qa.rs index 6f1ab9680..6b79aae37 100644 --- a/crates/optimism/chainspec/src/opbnb_qa.rs +++ b/crates/optimism/chainspec/src/opbnb_qa.rs @@ -5,13 +5,13 @@ use alloc::sync::Arc; #[cfg(feature = "std")] use std::sync::Arc; +use crate::OpChainSpec; use alloy_chains::Chain; use alloy_primitives::{b256, U256}; use once_cell::sync::Lazy; use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec}; use reth_ethereum_forks::EthereumHardfork; use reth_optimism_forks::OptimismHardfork; -use crate::OpChainSpec; /// The opbnb qa spec pub static OPBNB_QA: Lazy> = Lazy::new(|| { diff --git a/crates/optimism/evm/src/execute.rs b/crates/optimism/evm/src/execute.rs index 4d754d1b9..88432a3bf 100644 --- a/crates/optimism/evm/src/execute.rs +++ b/crates/optimism/evm/src/execute.rs @@ -19,8 +19,10 @@ use reth_optimism_forks::OptimismHardfork; use reth_primitives::{BlockWithSenders, Header, Receipt, Receipts, TxType}; use reth_prune_types::PruneModes; use reth_revm::{ - batch::BlockBatchRecord, db::states::{bundle_state::BundleRetention, StorageSlot}, - state_change::post_block_balance_increments, Evm, State, + batch::BlockBatchRecord, + db::states::{bundle_state::BundleRetention, StorageSlot}, + state_change::post_block_balance_increments, + Evm, State, }; use revm_primitives::{ db::{Database, DatabaseCommit}, @@ -363,7 +365,12 @@ where let (receipts, gas_used) = { let evm = self.executor.evm_config.evm_with_env(&mut self.state, env); - self.executor.execute_pre_and_transactions(block, evm, state_hook, self.prefetch_tx.clone()) + self.executor.execute_pre_and_transactions( + block, + evm, + state_hook, + self.prefetch_tx.clone(), + ) }?; // 3. apply post execution changes diff --git a/crates/optimism/node/src/txpool.rs b/crates/optimism/node/src/txpool.rs index 9d5378e3b..463f7635c 100644 --- a/crates/optimism/node/src/txpool.rs +++ b/crates/optimism/node/src/txpool.rs @@ -3,8 +3,8 @@ use alloy_eips::eip2718::Encodable2718; use alloy_primitives::U256; use parking_lot::RwLock; use reth_chainspec::ChainSpec; -use reth_optimism_forks::OptimismHardforks; use reth_optimism_evm::RethL1BlockInfo; +use reth_optimism_forks::OptimismHardforks; use reth_primitives::{Block, GotExpected, InvalidTransactionError, SealedBlock}; use reth_provider::{BlockReaderIdExt, StateProviderFactory}; use reth_revm::L1BlockInfo; diff --git a/crates/optimism/payload/src/builder.rs b/crates/optimism/payload/src/builder.rs index d0d5a3b38..263f9aa09 100644 --- a/crates/optimism/payload/src/builder.rs +++ b/crates/optimism/payload/src/builder.rs @@ -512,12 +512,13 @@ where // seal the block let block = Block { header, - body: BlockBody { transactions: executed_txs, - ommers: vec![], - withdrawals, - sidecars: None, - requests: None, - }, + body: BlockBody { + transactions: executed_txs, + ommers: vec![], + withdrawals, + sidecars: None, + requests: None, + }, }; let sealed_block = block.seal_slow(); diff --git a/crates/primitives/src/alloy_compat.rs b/crates/primitives/src/alloy_compat.rs index 186b719bb..09267a615 100644 --- a/crates/primitives/src/alloy_compat.rs +++ b/crates/primitives/src/alloy_compat.rs @@ -49,7 +49,8 @@ impl TryFrom From<&'a Block> for HelperRef<'a, Header> { fn from(block: &'a Block) -> Self { - let Block { header, body: BlockBody { transactions, ommers, withdrawals, requests , sidecars} } = - block; + let Block { + header, + body: BlockBody { transactions, ommers, withdrawals, requests, sidecars }, + } = block; Self { header, transactions, @@ -172,15 +174,23 @@ mod block_rlp { impl Decodable for Block { fn decode(b: &mut &[u8]) -> alloy_rlp::Result { - let Helper { header, transactions, ommers, withdrawals, requests, sidecars } = Helper::decode(b)?; - Ok(Self { header, body: BlockBody { transactions, ommers, withdrawals, requests, sidecars } }) + let Helper { header, transactions, ommers, withdrawals, requests, sidecars } = + Helper::decode(b)?; + Ok(Self { + header, + body: BlockBody { transactions, ommers, withdrawals, requests, sidecars }, + }) } } impl Decodable for SealedBlock { fn decode(b: &mut &[u8]) -> alloy_rlp::Result { - let Helper { header, transactions, ommers, withdrawals, requests, sidecars } = Helper::decode(b)?; - Ok(Self { header, body: BlockBody { transactions, ommers, withdrawals, requests, sidecars } }) + let Helper { header, transactions, ommers, withdrawals, requests, sidecars } = + Helper::decode(b)?; + Ok(Self { + header, + body: BlockBody { transactions, ommers, withdrawals, requests, sidecars }, + }) } } @@ -724,7 +734,9 @@ pub(super) mod serde_bincode_compat { use alloc::{borrow::Cow, vec::Vec}; use alloy_consensus::serde_bincode_compat::Header; use alloy_primitives::Address; - use reth_primitives_traits::{serde_bincode_compat::SealedHeader, BlobSidecars, Requests, Withdrawals}; + use reth_primitives_traits::{ + serde_bincode_compat::SealedHeader, BlobSidecars, Requests, Withdrawals, + }; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_with::{DeserializeAs, SerializeAs}; diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 391b934b2..225404e64 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -108,6 +108,10 @@ mod bsc { #[cfg(feature = "bsc")] pub use bsc::*; +use reth_bsc_forks as _; +/// fix the ci errors +use reth_chainspec as _; + // to make lint happy #[cfg(any(feature = "bsc", feature = "opbnb"))] use revm as _; diff --git a/crates/primitives/src/parlia/snapshot.rs b/crates/primitives/src/parlia/snapshot.rs index 3f501657e..b655e1565 100644 --- a/crates/primitives/src/parlia/snapshot.rs +++ b/crates/primitives/src/parlia/snapshot.rs @@ -1,7 +1,8 @@ use std::collections::{BTreeMap, HashMap}; use crate::{ - parlia::{VoteAddress, VoteAttestation, VoteData}, Header, + parlia::{VoteAddress, VoteAttestation, VoteData}, + Header, }; use alloy_primitives::{Address, BlockNumber, B256}; #[cfg(any(test, feature = "reth-codec"))] diff --git a/crates/primitives/src/parlia/vote.rs b/crates/primitives/src/parlia/vote.rs index e3c2abb58..49ff9c9b1 100644 --- a/crates/primitives/src/parlia/vote.rs +++ b/crates/primitives/src/parlia/vote.rs @@ -1,4 +1,4 @@ -use alloy_primitives::{B256, BlockNumber, keccak256, wrap_fixed_bytes}; +use alloy_primitives::{keccak256, wrap_fixed_bytes, BlockNumber, B256}; use alloy_rlp::{RlpDecodable, RlpEncodable}; use bytes::Bytes; #[cfg(any(test, feature = "reth-codec"))] diff --git a/crates/primitives/src/system_contracts/mod.rs b/crates/primitives/src/system_contracts/mod.rs index 8b7c61553..72d9c26d1 100644 --- a/crates/primitives/src/system_contracts/mod.rs +++ b/crates/primitives/src/system_contracts/mod.rs @@ -3,14 +3,14 @@ use std::collections::HashMap; -use crate::{TransactionSigned}; -use alloy_primitives::{hex, Address, BlockNumber}; +use crate::TransactionSigned; use alloy_chains::Chain; +use alloy_primitives::{hex, Address, BlockNumber}; use include_dir::{include_dir, Dir}; use lazy_static::lazy_static; use reth_bsc_chainspec::{BSC_CHAPEL, BSC_MAINNET, BSC_RIALTO}; -use reth_chainspec::ChainSpec; use reth_bsc_forks::BscHardfork; +use reth_chainspec::ChainSpec; use revm_primitives::Bytecode; use thiserror::Error; diff --git a/crates/prune/prune/src/pruner.rs b/crates/prune/prune/src/pruner.rs index 2fcaf7782..635025a10 100644 --- a/crates/prune/prune/src/pruner.rs +++ b/crates/prune/prune/src/pruner.rs @@ -340,8 +340,8 @@ where let prune_target_block = tip_block_number.saturating_sub(self.recent_sidecars_kept_blocks as u64); - let mut range_start = find_fixed_range(prune_target_block, DEFAULT_BLOCKS_PER_STATIC_FILE).start(); - + let mut range_start = + find_fixed_range(prune_target_block, DEFAULT_BLOCKS_PER_STATIC_FILE).start(); if range_start == 0 { return } diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 7d6721a54..7033caa64 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -8,8 +8,8 @@ use alloy_rpc_types::{ serde_helpers::JsonStorageKey, simulate::{SimulatePayload, SimulatedBlock}, state::{EvmOverrides, StateOverride}, - BlockOverrides, BlockSidecar, Bundle, EIP1186AccountProofResponse, - EthCallResponse, FeeHistory, Header, Index, StateContext, SyncStatus, Work, + BlockOverrides, BlockSidecar, Bundle, EIP1186AccountProofResponse, EthCallResponse, FeeHistory, + Header, Index, StateContext, SyncStatus, Work, }; use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; diff --git a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs index 60b129dc2..08e6c68f1 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs @@ -457,10 +457,15 @@ pub trait LoadPendingBlock: EthApiTypes { let sidecars = None; // seal the block - let block = - Block { + let block = Block { header, - body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals, sidecars, requests }, + body: BlockBody { + transactions: executed_txs, + ommers: vec![], + withdrawals, + sidecars, + requests, + }, }; Ok((SealedBlockWithSenders { block: block.seal_slow(), senders }, receipts)) } diff --git a/crates/storage/db-api/src/models/mod.rs b/crates/storage/db-api/src/models/mod.rs index 0f6c69ba0..e7e67d4f2 100644 --- a/crates/storage/db-api/src/models/mod.rs +++ b/crates/storage/db-api/src/models/mod.rs @@ -8,8 +8,8 @@ use alloy_genesis::GenesisAccount; use alloy_primitives::{bytes::BufMut, Address, Bytes, Log, B256, U256}; use reth_codecs::{add_arbitrary_tests, Compact}; use reth_primitives::{ - parlia::Snapshot, Account, BlobSidecar, BlobSidecars, Bytecode, Header, - Receipt, Requests, StorageEntry, TransactionSignedNoHash, TxType, + parlia::Snapshot, Account, BlobSidecar, BlobSidecars, Bytecode, Header, Receipt, Requests, + StorageEntry, TransactionSignedNoHash, TxType, }; use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_stages_types::StageCheckpoint; @@ -328,9 +328,7 @@ add_wrapper_struct!((ClientVersion, CompactClientVersion)); mod tests { use super::*; use rand::Rng; - use reth_primitives::{ - parlia::{ValidatorInfo, VoteAddress, VoteData, DEFAULT_TURN_LENGTH}, - }; + use reth_primitives::parlia::{ValidatorInfo, VoteAddress, VoteData, DEFAULT_TURN_LENGTH}; use std::collections::{BTreeMap, HashMap}; // each value in the database has an extra field named flags that encodes metadata about other diff --git a/crates/storage/provider/src/providers/blockchain_provider.rs b/crates/storage/provider/src/providers/blockchain_provider.rs index 8d6b925c0..c9b16e360 100644 --- a/crates/storage/provider/src/providers/blockchain_provider.rs +++ b/crates/storage/provider/src/providers/blockchain_provider.rs @@ -2,10 +2,11 @@ use crate::{ providers::StaticFileProvider, AccountReader, BlockHashReader, BlockIdReader, BlockNumReader, BlockReader, BlockReaderIdExt, BlockSource, CanonChainTracker, CanonStateNotifications, CanonStateSubscriptions, ChainSpecProvider, ChainStateBlockReader, ChangeSetReader, - DatabaseProviderFactory, DatabaseProviderRO, EvmEnvProvider, HeaderProvider, ParliaSnapshotReader, - ProviderError, ProviderFactory, PruneCheckpointReader, ReceiptProvider, ReceiptProviderIdExt, - RequestsProvider, StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader, - StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider, + DatabaseProviderFactory, DatabaseProviderRO, EvmEnvProvider, HeaderProvider, + ParliaSnapshotReader, ProviderError, ProviderFactory, PruneCheckpointReader, ReceiptProvider, + ReceiptProviderIdExt, RequestsProvider, StageCheckpointReader, StateProviderBox, + StateProviderFactory, StateReader, StaticFileProviderFactory, TransactionVariant, + TransactionsProvider, WithdrawalsProvider, }; use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, HashOrNumber}; use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256}; @@ -21,7 +22,7 @@ use reth_evm::ConfigureEvmEnv; use reth_execution_types::{BundleStateInit, ExecutionOutcome, RevertsInit}; use reth_node_types::NodeTypesWithDB; use reth_primitives::{ - parlia::Snapshot, Account, BlobSidecars, Block, BlockWithSenders, Header, Receipt, SealedBlock, + parlia::Snapshot, Account, BlobSidecars, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals, }; diff --git a/crates/storage/provider/src/providers/database/mod.rs b/crates/storage/provider/src/providers/database/mod.rs index 4146e1b79..3daf4defc 100644 --- a/crates/storage/provider/src/providers/database/mod.rs +++ b/crates/storage/provider/src/providers/database/mod.rs @@ -18,9 +18,9 @@ use reth_errors::{RethError, RethResult}; use reth_evm::ConfigureEvmEnv; use reth_node_types::NodeTypesWithDB; use reth_primitives::{ - parlia::Snapshot, BlobSidecars, Block, BlockWithSenders, Header, Receipt, - SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, TransactionMeta, - TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals, + parlia::Snapshot, Account, BlobSidecars, Block, BlockWithSenders, Header, Receipt, SealedBlock, + SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, + TransactionSignedNoHash, Withdrawal, Withdrawals, }; use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment}; use reth_stages_types::{StageCheckpoint, StageId}; diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index c2db5b6c5..1ac666500 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -41,8 +41,7 @@ use reth_execution_types::{Chain, ExecutionOutcome}; use reth_network_p2p::headers::downloader::SyncTarget; use reth_primitives::{ parlia::Snapshot, Account, BlobSidecars, Block, BlockBody, BlockWithSenders, Bytecode, - GotExpected, Header, Receipt, Requests, - SealedBlock, SealedBlockWithSenders, SealedHeader, + GotExpected, Header, Receipt, Requests, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry, TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, Withdrawal, Withdrawals, }; @@ -1727,12 +1726,7 @@ impl BlockReader for DatabasePr return Ok(Some(Block { header, - body: BlockBody { transactions, - ommers, - withdrawals, - sidecars, - requests, - }, + body: BlockBody { transactions, ommers, withdrawals, sidecars, requests }, })) } } @@ -1795,12 +1789,14 @@ impl BlockReader for DatabasePr |header, transactions, senders, ommers, withdrawals, requests| { Block { header, - body: BlockBody { transactions, - ommers, - withdrawals, - sidecars: Some(Default::default()), - requests, - } } + body: BlockBody { + transactions, + ommers, + withdrawals, + sidecars: Some(Default::default()), + requests, + }, + } // Note: we're using unchecked here because we know the block contains valid txs // wrt to its height and can ignore the s value check so pre // EIP-2 txs are allowed @@ -1823,12 +1819,13 @@ impl BlockReader for DatabasePr |header, transactions, senders, ommers, withdrawals, requests| { SealedBlock { header, - body: BlockBody { transactions, - ommers, - withdrawals, - sidecars: Some(Default::default()), - requests, - }, + body: BlockBody { + transactions, + ommers, + withdrawals, + sidecars: Some(Default::default()), + requests, + }, } // Note: we're using unchecked here because we know the block contains valid txs // wrt to its height and can ignore the s value check so pre @@ -1870,9 +1867,12 @@ impl BlockReader for DatabasePr range, |range| self.headers_range(range), |header, transactions, ommers, withdrawals, sidecars, requests, senders| { - Block { header, body: BlockBody { transactions, ommers, withdrawals, sidecars, requests } } - .try_with_senders_unchecked(senders) - .map_err(|_| ProviderError::SenderRecoveryError) + Block { + header, + body: BlockBody { transactions, ommers, withdrawals, sidecars, requests }, + } + .try_with_senders_unchecked(senders) + .map_err(|_| ProviderError::SenderRecoveryError) }, ) } diff --git a/crates/storage/provider/src/providers/mod.rs b/crates/storage/provider/src/providers/mod.rs index c534a0ddb..20879b1bf 100644 --- a/crates/storage/provider/src/providers/mod.rs +++ b/crates/storage/provider/src/providers/mod.rs @@ -21,9 +21,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices}; use reth_evm::ConfigureEvmEnv; use reth_node_types::NodeTypesWithDB; use reth_primitives::{ - parlia::Snapshot, Account, BlobSidecars, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, - SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, - Withdrawals, + parlia::Snapshot, Account, BlobSidecars, Block, BlockWithSenders, Header, Receipt, SealedBlock, + SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, + TransactionSignedNoHash, Withdrawal, Withdrawals, }; use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_stages_types::{StageCheckpoint, StageId}; diff --git a/crates/storage/provider/src/providers/static_file/jar.rs b/crates/storage/provider/src/providers/static_file/jar.rs index 48d664a78..b3bc49d9c 100644 --- a/crates/storage/provider/src/providers/static_file/jar.rs +++ b/crates/storage/provider/src/providers/static_file/jar.rs @@ -14,7 +14,8 @@ use reth_db::static_file::{ }; use reth_db_api::models::CompactU256; use reth_primitives::{ - BlobSidecars, Header, Receipt, SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, + BlobSidecars, Header, Receipt, SealedHeader, TransactionMeta, TransactionSigned, + TransactionSignedNoHash, }; use reth_storage_api::SidecarsProvider; use reth_storage_errors::provider::{ProviderError, ProviderResult}; diff --git a/crates/storage/provider/src/providers/static_file/manager.rs b/crates/storage/provider/src/providers/static_file/manager.rs index abe7d93d5..0ba8f7d28 100644 --- a/crates/storage/provider/src/providers/static_file/manager.rs +++ b/crates/storage/provider/src/providers/static_file/manager.rs @@ -32,9 +32,9 @@ use reth_primitives::{ find_fixed_range, HighestStaticFiles, SegmentHeader, SegmentRangeInclusive, DEFAULT_BLOCKS_PER_STATIC_FILE, }, - BlobSidecars, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, - StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, - Withdrawals, + BlobSidecars, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, + SealedHeader, StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, + Withdrawal, Withdrawals, }; use reth_stages_types::{PipelineTarget, StageId}; use reth_storage_api::{DBProvider, SidecarsProvider}; diff --git a/crates/storage/provider/src/providers/static_file/mod.rs b/crates/storage/provider/src/providers/static_file/mod.rs index 9618a3b6c..8390eb43c 100644 --- a/crates/storage/provider/src/providers/static_file/mod.rs +++ b/crates/storage/provider/src/providers/static_file/mod.rs @@ -56,6 +56,7 @@ impl Deref for LoadedJar { mod tests { use super::*; use crate::{test_utils::create_test_provider_factory, HeaderProvider}; + use alloy_eips::eip4844::BlobTransactionSidecar; use alloy_primitives::{BlockHash, TxNumber, B256, U256}; use rand::seq::SliceRandom; use reth_db::{ @@ -63,11 +64,13 @@ mod tests { HeaderTerminalDifficulties, Headers, Sidecars, }; use reth_db_api::transaction::DbTxMut; - use reth_primitives::{static_file::{find_fixed_range, SegmentRangeInclusive, DEFAULT_BLOCKS_PER_STATIC_FILE}, BlobSidecar, BlobSidecars, Header, Receipt, TransactionSignedNoHash}; + use reth_primitives::{ + static_file::{find_fixed_range, SegmentRangeInclusive, DEFAULT_BLOCKS_PER_STATIC_FILE}, + BlobSidecar, BlobSidecars, Header, Receipt, TransactionSignedNoHash, + }; use reth_storage_api::{ReceiptProvider, SidecarsProvider, TransactionsProvider}; use reth_testing_utils::generators::{self, random_header_range}; use std::{fmt::Debug, fs, ops::Range, path::Path}; - use alloy_eips::eip4844::BlobTransactionSidecar; fn assert_eyre(got: T, expected: T, msg: &str) -> eyre::Result<()> { if got != expected { @@ -554,10 +557,10 @@ mod tests { // Data sources let factory = create_test_provider_factory(); let static_files_path = tempfile::tempdir().unwrap(); - let static_file = static_files_path - .path() - .join(StaticFileSegment::Sidecars.filename(&find_fixed_range(*range.end(), DEFAULT_BLOCKS_PER_STATIC_FILE))); - + let static_file = static_files_path.path().join( + StaticFileSegment::Sidecars + .filename(&find_fixed_range(*range.end(), DEFAULT_BLOCKS_PER_STATIC_FILE)), + ); // Setup data let mut provider_rw = factory.provider_rw().unwrap(); let tx = provider_rw.tx_mut(); diff --git a/crates/storage/provider/src/test_utils/blocks.rs b/crates/storage/provider/src/test_utils/blocks.rs index 952be5918..daed90664 100644 --- a/crates/storage/provider/src/test_utils/blocks.rs +++ b/crates/storage/provider/src/test_utils/blocks.rs @@ -9,8 +9,8 @@ use once_cell::sync::Lazy; use reth_db::tables; use reth_db_api::{database::Database, models::StoredBlockBodyIndices}; use reth_primitives::{ - Account, BlockBody, Header, Receipt, SealedBlock, SealedBlockWithSenders, - SealedHeader, Signature, Transaction, TransactionSigned, TxType, Withdrawal, Withdrawals, + Account, BlockBody, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, + Signature, Transaction, TransactionSigned, TxType, Withdrawal, Withdrawals, }; use reth_trie::root::{state_root_unhashed, storage_root_unhashed}; use revm::{db::BundleState, primitives::AccountInfo}; diff --git a/crates/storage/provider/src/test_utils/mock.rs b/crates/storage/provider/src/test_utils/mock.rs index ec8ee833b..65e0fcffc 100644 --- a/crates/storage/provider/src/test_utils/mock.rs +++ b/crates/storage/provider/src/test_utils/mock.rs @@ -21,9 +21,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices}; use reth_evm::ConfigureEvmEnv; use reth_execution_types::{Chain, ExecutionOutcome}; use reth_primitives::{ - Account, BlobSidecars, Block, BlockWithSenders, - Bytecode, GotExpected, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, - TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals, + Account, BlobSidecars, Block, BlockWithSenders, Bytecode, GotExpected, Header, Receipt, + SealedBlock, SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, + TransactionSignedNoHash, Withdrawal, Withdrawals, }; use reth_stages_types::{StageCheckpoint, StageId}; use reth_storage_api::{ diff --git a/crates/storage/provider/src/test_utils/noop.rs b/crates/storage/provider/src/test_utils/noop.rs index aba7bcaf9..266a94aa7 100644 --- a/crates/storage/provider/src/test_utils/noop.rs +++ b/crates/storage/provider/src/test_utils/noop.rs @@ -18,9 +18,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices}; use reth_errors::ProviderError; use reth_evm::ConfigureEvmEnv; use reth_primitives::{ - parlia::Snapshot, Account, BlobSidecars, Block, - BlockWithSenders, Bytecode, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, - TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals, + parlia::Snapshot, Account, BlobSidecars, Block, BlockWithSenders, Bytecode, Header, Receipt, + SealedBlock, SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, + TransactionSignedNoHash, Withdrawal, Withdrawals, }; use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_stages_types::{StageCheckpoint, StageId}; diff --git a/crates/storage/storage-api/src/block.rs b/crates/storage/storage-api/src/block.rs index f7f354dbe..3a073ad60 100644 --- a/crates/storage/storage-api/src/block.rs +++ b/crates/storage/storage-api/src/block.rs @@ -1,7 +1,6 @@ use crate::{ - BlockNumReader, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt, - RequestsProvider, SidecarsProvider, TransactionVariant, TransactionsProvider, - WithdrawalsProvider, + BlockNumReader, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt, RequestsProvider, + SidecarsProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider, }; use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag}; use alloy_primitives::{BlockNumber, Sealable, B256}; diff --git a/crates/trie/trie/src/state.rs b/crates/trie/trie/src/state.rs index 3eadebc22..573f4a84a 100644 --- a/crates/trie/trie/src/state.rs +++ b/crates/trie/trie/src/state.rs @@ -1,17 +1,19 @@ +use crate::{ + prefix_set::{PrefixSetMut, TriePrefixSetsMut}, + Nibbles, +}; use alloy_primitives::{keccak256, Address, B256, U256}; use itertools::Itertools; use rayon::prelude::{IntoParallelIterator, ParallelIterator}; use reth_primitives::Account; -use revm::db::{states::CacheAccount, AccountStatus, BundleAccount}; +use revm::{ + db::{states::CacheAccount, AccountStatus, BundleAccount}, + primitives::EvmState, +}; use std::{ borrow::Cow, collections::{hash_map, HashMap, HashSet}, }; -use revm::primitives::EvmState; -use crate::{ - prefix_set::{PrefixSetMut, TriePrefixSetsMut}, - Nibbles, -}; /// Representation of in-memory hashed state. #[derive(PartialEq, Eq, Clone, Default, Debug)] @@ -52,9 +54,7 @@ impl HashedPostState { } /// Initialize [`HashedPostState`] from evm state. - pub fn from_state( - changes: EvmState, - ) -> Self { + pub fn from_state(changes: EvmState) -> Self { let mut this = Self::default(); for (address, account) in changes { let hashed_address = keccak256(address); diff --git a/testing/testing-utils/src/generators.rs b/testing/testing-utils/src/generators.rs index de5664c3e..bf64cdc3e 100644 --- a/testing/testing-utils/src/generators.rs +++ b/testing/testing-utils/src/generators.rs @@ -241,7 +241,8 @@ pub fn random_block(rng: &mut R, number: u64, block_params: BlockParams) ommers, withdrawals: withdrawals.map(Withdrawals::new), sidecars: Some(Default::default()), - requests: requests.map(Requests),}, + requests: requests.map(Requests), + }, } }