diff --git a/src/addons/call_forwarder.rs b/src/addons/call_forwarder.rs index a1c3964fa..e78154e05 100644 --- a/src/addons/call_forwarder.rs +++ b/src/addons/call_forwarder.rs @@ -2,18 +2,18 @@ use alloy_eips::BlockId; use alloy_json_rpc::RpcObject; use alloy_primitives::{Bytes, U256}; use alloy_rpc_types_eth::{ - state::{EvmOverrides, StateOverride}, BlockOverrides, + state::{EvmOverrides, StateOverride}, }; use jsonrpsee::{ http_client::{HttpClient, HttpClientBuilder}, proc_macros::rpc, rpc_params, - types::{error::INTERNAL_ERROR_CODE, ErrorObject}, + types::{ErrorObject, error::INTERNAL_ERROR_CODE}, }; -use jsonrpsee_core::{async_trait, client::ClientT, ClientError, RpcResult}; +use jsonrpsee_core::{ClientError, RpcResult, async_trait, client::ClientT}; use reth_rpc::eth::EthApiTypes; -use reth_rpc_eth_api::{helpers::EthCall, RpcTxReq}; +use reth_rpc_eth_api::{RpcTxReq, helpers::EthCall}; #[rpc(server, namespace = "eth")] pub(crate) trait CallForwarderApi { diff --git a/src/addons/hl_node_compliance.rs b/src/addons/hl_node_compliance.rs index 3cd227cc5..49867ca95 100644 --- a/src/addons/hl_node_compliance.rs +++ b/src/addons/hl_node_compliance.rs @@ -15,29 +15,29 @@ use alloy_eips::{BlockId, BlockNumberOrTag}; use alloy_json_rpc::RpcObject; use alloy_primitives::{B256, U256}; use alloy_rpc_types::{ - pubsub::{Params, SubscriptionKind}, BlockTransactions, Filter, FilterChanges, FilterId, Log, PendingTransactionFilterKind, TransactionInfo, + pubsub::{Params, SubscriptionKind}, }; -use jsonrpsee::{proc_macros::rpc, PendingSubscriptionSink, SubscriptionMessage, SubscriptionSink}; -use jsonrpsee_core::{async_trait, RpcResult}; -use jsonrpsee_types::{error::INTERNAL_ERROR_CODE, ErrorObject}; +use jsonrpsee::{PendingSubscriptionSink, SubscriptionMessage, SubscriptionSink, proc_macros::rpc}; +use jsonrpsee_core::{RpcResult, async_trait}; +use jsonrpsee_types::{ErrorObject, error::INTERNAL_ERROR_CODE}; use reth::{api::FullNodeComponents, builder::rpc::RpcContext, tasks::TaskSpawner}; use reth_primitives_traits::{BlockBody as _, SignedTransaction}; use reth_provider::{BlockIdReader, BlockReader, BlockReaderIdExt, ReceiptProvider}; -use reth_rpc::{eth::pubsub::SubscriptionSerializeError, EthFilter, EthPubSub, RpcTypes}; +use reth_rpc::{EthFilter, EthPubSub, RpcTypes, eth::pubsub::SubscriptionSerializeError}; use reth_rpc_eth_api::{ - helpers::{EthBlocks, EthTransactions, LoadReceipt}, - transaction::ConvertReceiptInput, EthApiServer, EthApiTypes, EthFilterApiServer, EthPubSubApiServer, FullEthApiTypes, RpcBlock, RpcConvert, RpcHeader, RpcNodeCoreExt, RpcReceipt, RpcTransaction, RpcTxReq, + helpers::{EthBlocks, EthTransactions, LoadReceipt}, + transaction::ConvertReceiptInput, }; use serde::Serialize; use std::{marker::PhantomData, sync::Arc}; use tokio_stream::{Stream, StreamExt}; -use tracing::{trace, Instrument}; +use tracing::{Instrument, trace}; -use crate::{node::primitives::HlPrimitives, HlBlock}; +use crate::{HlBlock, node::primitives::HlPrimitives}; pub trait EthWrapper: EthApiServer< diff --git a/src/addons/tx_forwarder.rs b/src/addons/tx_forwarder.rs index 0d473bd9f..dcd64dc5e 100644 --- a/src/addons/tx_forwarder.rs +++ b/src/addons/tx_forwarder.rs @@ -2,14 +2,14 @@ use std::time::Duration; use alloy_json_rpc::RpcObject; use alloy_network::Ethereum; -use alloy_primitives::{Bytes, B256}; +use alloy_primitives::{B256, Bytes}; use alloy_rpc_types::TransactionRequest; use jsonrpsee::{ http_client::{HttpClient, HttpClientBuilder}, proc_macros::rpc, - types::{error::INTERNAL_ERROR_CODE, ErrorObject}, + types::{ErrorObject, error::INTERNAL_ERROR_CODE}, }; -use jsonrpsee_core::{async_trait, client::ClientT, ClientError, RpcResult}; +use jsonrpsee_core::{ClientError, RpcResult, async_trait, client::ClientT}; use reth::rpc::{result::internal_rpc_err, server_types::eth::EthApiError}; use reth_rpc_eth_api::RpcReceipt; diff --git a/src/chainspec/hl.rs b/src/chainspec/hl.rs index bc095550e..a210e7b11 100644 --- a/src/chainspec/hl.rs +++ b/src/chainspec/hl.rs @@ -1,5 +1,5 @@ use alloy_chains::{Chain, NamedChain}; -use alloy_primitives::{b256, Address, Bytes, B256, B64, U256}; +use alloy_primitives::{Address, B64, B256, Bytes, U256, b256}; use reth_chainspec::{ChainHardforks, ChainSpec, EthereumHardfork, ForkCondition, Hardfork}; use reth_primitives::{Header, SealedHeader}; use std::sync::LazyLock; diff --git a/src/chainspec/parser.rs b/src/chainspec/parser.rs index 610e5f212..0ac712b8b 100644 --- a/src/chainspec/parser.rs +++ b/src/chainspec/parser.rs @@ -1,4 +1,4 @@ -use crate::chainspec::{hl::hl_testnet, HlChainSpec}; +use crate::chainspec::{HlChainSpec, hl::hl_testnet}; use super::hl::hl_mainnet; use reth_cli::chainspec::ChainSpecParser; diff --git a/src/consensus.rs b/src/consensus.rs index ad81bb4d5..60c6a2abc 100644 --- a/src/consensus.rs +++ b/src/consensus.rs @@ -1,4 +1,4 @@ -use alloy_primitives::{BlockNumber, B256}; +use alloy_primitives::{B256, BlockNumber}; use reth_provider::{BlockNumReader, ProviderError}; use std::cmp::Ordering; diff --git a/src/evm/api/builder.rs b/src/evm/api/builder.rs index 67152d616..7f2998fa5 100644 --- a/src/evm/api/builder.rs +++ b/src/evm/api/builder.rs @@ -2,8 +2,8 @@ use super::HlEvmInner; use crate::evm::{spec::HlSpecId, transaction::HlTxTr}; use reth_revm::context::ContextTr; use revm::{ - context::Cfg, context_interface::Block, handler::instructions::EthInstructions, - interpreter::interpreter::EthInterpreter, Context, Database, + Context, Database, context::Cfg, context_interface::Block, + handler::instructions::EthInstructions, interpreter::interpreter::EthInterpreter, }; /// Trait that allows for hl HlEvm to be built. diff --git a/src/evm/api/ctx.rs b/src/evm/api/ctx.rs index 32b53fa1c..e0a19d231 100644 --- a/src/evm/api/ctx.rs +++ b/src/evm/api/ctx.rs @@ -1,8 +1,8 @@ use crate::evm::{spec::HlSpecId, transaction::HlTxEnv}; use revm::{ + Context, Journal, MainContext, context::{BlockEnv, CfgEnv, TxEnv}, database_interface::EmptyDB, - Context, Journal, MainContext, }; /// Type alias for the default context type of the HlEvm. diff --git a/src/evm/api/exec.rs b/src/evm/api/exec.rs index b4944e06f..8aafcaa1e 100644 --- a/src/evm/api/exec.rs +++ b/src/evm/api/exec.rs @@ -1,16 +1,16 @@ use super::HlEvmInner; use crate::evm::{spec::HlSpecId, transaction::HlTxTr}; use revm::{ - context::{result::HaltReason, ContextSetters}, - context_interface::{ - result::{EVMError, ExecutionResult, ResultAndState}, - Cfg, ContextTr, Database, JournalTr, - }, - handler::{instructions::EthInstructions, PrecompileProvider}, - inspector::{InspectCommitEvm, InspectEvm, Inspector, JournalExt}, - interpreter::{interpreter::EthInterpreter, InterpreterResult}, - state::EvmState, DatabaseCommit, ExecuteCommitEvm, ExecuteEvm, + context::{ContextSetters, result::HaltReason}, + context_interface::{ + Cfg, ContextTr, Database, JournalTr, + result::{EVMError, ExecutionResult, ResultAndState}, + }, + handler::{PrecompileProvider, instructions::EthInstructions}, + inspector::{InspectCommitEvm, InspectEvm, Inspector, JournalExt}, + interpreter::{InterpreterResult, interpreter::EthInterpreter}, + state::EvmState, }; // Type alias for HL context diff --git a/src/evm/api/mod.rs b/src/evm/api/mod.rs index 737a3a58c..485dab173 100644 --- a/src/evm/api/mod.rs +++ b/src/evm/api/mod.rs @@ -1,15 +1,15 @@ use revm::{ + Inspector, bytecode::opcode::BLOCKHASH, context::{ContextSetters, Evm, FrameStack}, context_interface::ContextTr, handler::{ + EthFrame, EthPrecompiles, EvmTr, FrameInitOrResult, FrameTr, PrecompileProvider, evm::{ContextDbError, FrameInitResult}, instructions::{EthInstructions, InstructionProvider}, - EthFrame, EthPrecompiles, EvmTr, FrameInitOrResult, FrameTr, PrecompileProvider, }, inspector::{InspectorEvmTr, JournalExt}, - interpreter::{interpreter::EthInterpreter, Instruction, InterpreterResult}, - Inspector, + interpreter::{Instruction, InterpreterResult, interpreter::EthInterpreter}, }; use crate::chainspec::MAINNET_CHAIN_ID; diff --git a/src/evm/api/patch.rs b/src/evm/api/patch.rs index 0fce3045f..62c85ac48 100644 --- a/src/evm/api/patch.rs +++ b/src/evm/api/patch.rs @@ -7,8 +7,8 @@ use alloy_primitives::keccak256; use revm::{ context::Host, interpreter::{ - as_u64_saturated, interpreter_types::StackTr, popn_top, InstructionContext, - InterpreterTypes, + InstructionContext, InterpreterTypes, as_u64_saturated, interpreter_types::StackTr, + popn_top, }, primitives::{BLOCK_HASH_HISTORY, U256}, }; diff --git a/src/evm/transaction.rs b/src/evm/transaction.rs index 4e22f9f41..7b1592030 100644 --- a/src/evm/transaction.rs +++ b/src/evm/transaction.rs @@ -7,7 +7,7 @@ use reth_primitives_traits::SignerRecoverable; use revm::{ context::TxEnv, context_interface::transaction::Transaction, - primitives::{Address, Bytes, TxKind, B256, U256}, + primitives::{Address, B256, Bytes, TxKind, U256}, }; #[auto_impl(&, &mut, Box, Arc)] diff --git a/src/hardforks/hl.rs b/src/hardforks/hl.rs index e3ecc0458..557d9324f 100644 --- a/src/hardforks/hl.rs +++ b/src/hardforks/hl.rs @@ -2,7 +2,7 @@ use alloy_chains::{Chain, NamedChain}; use core::any::Any; use reth_chainspec::ForkCondition; -use reth_ethereum_forks::{hardfork, ChainHardforks, EthereumHardfork, Hardfork}; +use reth_ethereum_forks::{ChainHardforks, EthereumHardfork, Hardfork, hardfork}; hardfork!( /// The name of a hl hardfork. diff --git a/src/main.rs b/src/main.rs index 4c5232749..78125b78a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,12 +9,12 @@ use reth_hl::{ hl_node_compliance::install_hl_node_compliance, tx_forwarder::{self, EthForwarderApiServer}, }, - chainspec::{parser::HlChainSpecParser, HlChainSpec}, + chainspec::{HlChainSpec, parser::HlChainSpecParser}, node::{ + HlNode, cli::{Cli, HlNodeArgs}, rpc::precompile::{HlBlockPrecompileApiServer, HlBlockPrecompileExt}, storage::tables::Tables, - HlNode, }, }; use tracing::info; diff --git a/src/node/cli.rs b/src/node/cli.rs index f232bc183..fec922ef1 100644 --- a/src/node/cli.rs +++ b/src/node/cli.rs @@ -1,21 +1,21 @@ use crate::{ - chainspec::{parser::HlChainSpecParser, HlChainSpec}, - node::{consensus::HlConsensus, evm::config::HlEvmConfig, storage::tables::Tables, HlNode}, + chainspec::{HlChainSpec, parser::HlChainSpecParser}, + node::{HlNode, consensus::HlConsensus, evm::config::HlEvmConfig, storage::tables::Tables}, pseudo_peer::BlockSourceArgs, }; use clap::{Args, Parser}; use reth::{ + CliRunner, args::LogArgs, builder::{NodeBuilder, WithLaunchContext}, cli::Commands, prometheus_exporter::install_prometheus_recorder, version::version_metadata, - CliRunner, }; use reth_chainspec::EthChainSpec; use reth_cli::chainspec::ChainSpecParser; use reth_cli_commands::{common::EnvironmentArgs, launcher::FnLauncher}; -use reth_db::{init_db, mdbx::init_db_for, DatabaseEnv}; +use reth_db::{DatabaseEnv, init_db, mdbx::init_db_for}; use reth_tracing::FileWorkerGuard; use std::{ fmt::{self}, diff --git a/src/node/consensus/mod.rs b/src/node/consensus/mod.rs index ce2ea1dda..7a990bc9b 100644 --- a/src/node/consensus/mod.rs +++ b/src/node/consensus/mod.rs @@ -1,9 +1,9 @@ -use crate::{hardforks::HlHardforks, node::HlNode, HlBlock, HlBlockBody, HlPrimitives}; +use crate::{HlBlock, HlBlockBody, HlPrimitives, hardforks::HlHardforks, node::HlNode}; use alloy_consensus::Header; use reth::{ api::{FullNodeTypes, NodeTypes}, beacon_consensus::EthBeaconConsensus, - builder::{components::ConsensusBuilder, BuilderContext}, + builder::{BuilderContext, components::ConsensusBuilder}, consensus::{Consensus, ConsensusError, FullConsensus, HeaderValidator}, consensus_common::validation::{ validate_against_parent_4844, validate_against_parent_hash_number, diff --git a/src/node/consensus/reth_copy.rs b/src/node/consensus/reth_copy.rs index b1930b0dd..f4934dfed 100644 --- a/src/node/consensus/reth_copy.rs +++ b/src/node/consensus/reth_copy.rs @@ -1,11 +1,11 @@ //! Copy of reth codebase. -use alloy_consensus::{proofs::calculate_receipt_root, BlockHeader, TxReceipt}; +use alloy_consensus::{BlockHeader, TxReceipt, proofs::calculate_receipt_root}; use alloy_eips::eip7685::Requests; -use alloy_primitives::{Bloom, B256}; +use alloy_primitives::{B256, Bloom}; use reth::consensus::ConsensusError; use reth_chainspec::EthereumHardforks; -use reth_primitives::{gas_spent_by_transactions, GotExpected, RecoveredBlock}; +use reth_primitives::{GotExpected, RecoveredBlock, gas_spent_by_transactions}; use reth_primitives_traits::{Block, Receipt as ReceiptTrait}; pub fn validate_block_post_execution( diff --git a/src/node/evm/assembler.rs b/src/node/evm/assembler.rs index 68fa922b9..4a3911024 100644 --- a/src/node/evm/assembler.rs +++ b/src/node/evm/assembler.rs @@ -1,6 +1,6 @@ use crate::{ - node::evm::config::{HlBlockExecutorFactory, HlEvmConfig}, HlBlock, + node::evm::config::{HlBlockExecutorFactory, HlEvmConfig}, }; use alloy_consensus::Header; use reth_evm::{ diff --git a/src/node/evm/config.rs b/src/node/evm/config.rs index c2783bec4..60958cf58 100644 --- a/src/node/evm/config.rs +++ b/src/node/evm/config.rs @@ -1,5 +1,6 @@ use super::{executor::HlBlockExecutor, factory::HlEvmFactory}; use crate::{ + HlBlock, HlBlockBody, HlPrimitives, chainspec::HlChainSpec, evm::{spec::HlSpecId, transaction::HlTxEnv}, hardforks::HlHardforks, @@ -9,31 +10,30 @@ use crate::{ rpc::engine_api::validator::HlExecutionData, types::HlExtras, }, - HlBlock, HlBlockBody, HlPrimitives, }; -use alloy_consensus::{BlockHeader, Header, Transaction as _, TxReceipt, EMPTY_OMMER_ROOT_HASH}; -use alloy_eips::{merge::BEACON_NONCE, Encodable2718}; +use alloy_consensus::{BlockHeader, EMPTY_OMMER_ROOT_HASH, Header, Transaction as _, TxReceipt}; +use alloy_eips::{Encodable2718, merge::BEACON_NONCE}; use alloy_primitives::{Log, U256}; use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks}; use reth_evm::{ - block::{BlockExecutionError, BlockExecutorFactory, BlockExecutorFor}, - eth::{receipt_builder::ReceiptBuilder, EthBlockExecutionCtx}, - execute::{BlockAssembler, BlockAssemblerInput}, - precompiles::PrecompilesMap, ConfigureEngineEvm, ConfigureEvm, EvmEnv, EvmEnvFor, EvmFactory, ExecutableTxIterator, ExecutionCtxFor, FromRecoveredTx, FromTxWithEncoded, IntoTxEnv, NextBlockEnvAttributes, + block::{BlockExecutionError, BlockExecutorFactory, BlockExecutorFor}, + eth::{EthBlockExecutionCtx, receipt_builder::ReceiptBuilder}, + execute::{BlockAssembler, BlockAssemblerInput}, + precompiles::PrecompilesMap, }; use reth_evm_ethereum::EthBlockAssembler; use reth_payload_primitives::NewPayloadError; -use reth_primitives::{logs_bloom, BlockTy, HeaderTy, Receipt, SealedBlock, SealedHeader}; -use reth_primitives_traits::{proofs, SignerRecoverable, WithEncoded}; +use reth_primitives::{BlockTy, HeaderTy, Receipt, SealedBlock, SealedHeader, logs_bloom}; +use reth_primitives_traits::{SignerRecoverable, WithEncoded, proofs}; use reth_provider::BlockExecutionResult; use reth_revm::State; use revm::{ + Inspector, context::{BlockEnv, CfgEnv, TxEnv}, context_interface::block::BlobExcessGasAndPrice, primitives::hardfork::SpecId, - Inspector, }; use std::{borrow::Cow, convert::Infallible, sync::Arc}; @@ -45,10 +45,10 @@ pub struct HlBlockAssembler { impl BlockAssembler for HlBlockAssembler where F: for<'a> BlockExecutorFactory< - ExecutionCtx<'a> = HlBlockExecutionCtx<'a>, - Transaction = TransactionSigned, - Receipt = Receipt, - >, + ExecutionCtx<'a> = HlBlockExecutionCtx<'a>, + Transaction = TransactionSigned, + Receipt = Receipt, + >, { type Block = HlBlock; @@ -240,9 +240,9 @@ where R: ReceiptBuilder>, Spec: EthereumHardforks + HlHardforks + EthChainSpec + Hardforks + Clone, EvmF: EvmFactory< - Tx: FromRecoveredTx + FromTxWithEncoded, - Precompiles = PrecompilesMap, - >, + Tx: FromRecoveredTx + FromTxWithEncoded, + Precompiles = PrecompilesMap, + >, R::Transaction: From + Clone, Self: 'static, HlTxEnv: IntoTxEnv<::Tx>, diff --git a/src/node/evm/factory.rs b/src/node/evm/factory.rs index 7a08ab3e9..138a06e2a 100644 --- a/src/node/evm/factory.rs +++ b/src/node/evm/factory.rs @@ -7,16 +7,16 @@ use crate::evm::{ spec::HlSpecId, transaction::HlTxEnv, }; -use reth_evm::{precompiles::PrecompilesMap, Database, EvmEnv, EvmFactory}; +use reth_evm::{Database, EvmEnv, EvmFactory, precompiles::PrecompilesMap}; use reth_revm::Context; use revm::{ + Inspector, context::{ - result::{EVMError, HaltReason}, TxEnv, + result::{EVMError, HaltReason}, }, inspector::NoOpInspector, precompile::{PrecompileSpecId, Precompiles}, - Inspector, }; /// Factory producing [`HlEvm`]. diff --git a/src/node/evm/mod.rs b/src/node/evm/mod.rs index da5098708..c78e87a4c 100644 --- a/src/node/evm/mod.rs +++ b/src/node/evm/mod.rs @@ -1,6 +1,6 @@ use crate::{ evm::{ - api::{ctx::HlContext, HlEvmInner}, + api::{HlEvmInner, ctx::HlContext}, spec::HlSpecId, transaction::HlTxEnv, }, @@ -10,18 +10,18 @@ use alloy_primitives::{Address, Bytes}; use config::HlEvmConfig; use reth::{ api::FullNodeTypes, - builder::{components::ExecutorBuilder, BuilderContext}, + builder::{BuilderContext, components::ExecutorBuilder}, }; use reth_evm::{Database, Evm, EvmEnv}; use revm::{ - context::{ - result::{EVMError, ExecutionResult, HaltReason, Output, ResultAndState, SuccessReason}, - BlockEnv, TxEnv, - }, - handler::{instructions::EthInstructions, EthPrecompiles, PrecompileProvider}, - interpreter::{interpreter::EthInterpreter, InterpreterResult}, - state::EvmState, Context, ExecuteEvm, InspectEvm, Inspector, + context::{ + BlockEnv, TxEnv, + result::{EVMError, ExecutionResult, HaltReason, Output, ResultAndState, SuccessReason}, + }, + handler::{EthPrecompiles, PrecompileProvider, instructions::EthInstructions}, + interpreter::{InterpreterResult, interpreter::EthInterpreter}, + state::EvmState, }; use std::ops::{Deref, DerefMut}; @@ -98,11 +98,7 @@ where &mut self, tx: Self::Tx, ) -> Result, Self::Error> { - if self.inspect { - self.inner.inspect_tx(tx) - } else { - self.inner.transact(tx) - } + if self.inspect { self.inner.inspect_tx(tx) } else { self.inner.transact(tx) } } fn transact_system_call( diff --git a/src/node/evm/patch.rs b/src/node/evm/patch.rs index 943f2539e..adf9730e4 100644 --- a/src/node/evm/patch.rs +++ b/src/node/evm/patch.rs @@ -1,4 +1,4 @@ -use alloy_primitives::{address, Address}; +use alloy_primitives::{Address, address}; use reth_evm::block::BlockExecutionError; use revm::{primitives::HashMap, state::Account}; diff --git a/src/node/mod.rs b/src/node/mod.rs index 7b6aeee04..51a1c213e 100644 --- a/src/node/mod.rs +++ b/src/node/mod.rs @@ -4,11 +4,11 @@ use crate::{ pool::HlPoolBuilder, primitives::{HlBlock, HlPrimitives}, rpc::{ + HlEthApiBuilder, engine_api::{ builder::HlEngineApiBuilder, payload::HlPayloadTypes, validator::HlPayloadValidatorBuilder, }, - HlEthApiBuilder, }, storage::HlStorage, }, @@ -20,14 +20,14 @@ use network::HlNetworkBuilder; use reth::{ api::{FullNodeTypes, NodeTypes}, builder::{ + Node, NodeAdapter, components::{ComponentsBuilder, NoopPayloadServiceBuilder}, rpc::RpcAddOns, - Node, NodeAdapter, }, }; use reth_engine_primitives::ConsensusEngineHandle; use std::{marker::PhantomData, sync::Arc}; -use tokio::sync::{oneshot, Mutex}; +use tokio::sync::{Mutex, oneshot}; pub mod cli; pub mod consensus; diff --git a/src/node/network/block_import/mod.rs b/src/node/network/block_import/mod.rs index 85a01293d..fe7c20699 100644 --- a/src/node/network/block_import/mod.rs +++ b/src/node/network/block_import/mod.rs @@ -8,7 +8,7 @@ use reth_primitives::NodePrimitives; use service::{BlockMsg, ImportEvent, Outcome}; use std::{ fmt, - task::{ready, Context, Poll}, + task::{Context, Poll, ready}, }; use crate::node::network::HlNewBlock; diff --git a/src/node/network/block_import/service.rs b/src/node/network/block_import/service.rs index 44dd79575..9860348fd 100644 --- a/src/node/network/block_import/service.rs +++ b/src/node/network/block_import/service.rs @@ -1,17 +1,17 @@ use super::handle::ImportHandle; use crate::{ + HlBlock, HlBlockBody, consensus::HlConsensus, node::{ network::HlNewBlock, rpc::engine_api::payload::HlPayloadTypes, types::{BlockAndReceipts, EvmBlock}, }, - HlBlock, HlBlockBody, }; use alloy_consensus::{BlockBody, Header}; use alloy_primitives::U128; use alloy_rpc_types::engine::{ForkchoiceState, PayloadStatusEnum}; -use futures::{future::Either, stream::FuturesUnordered, StreamExt}; +use futures::{StreamExt, future::Either, stream::FuturesUnordered}; use reth_engine_primitives::{ConsensusEngineHandle, EngineTypes}; use reth_eth_wire::NewBlock; use reth_network::{ diff --git a/src/node/network/mod.rs b/src/node/network/mod.rs index 12b23d525..a9fc469e0 100644 --- a/src/node/network/mod.rs +++ b/src/node/network/mod.rs @@ -1,20 +1,20 @@ #![allow(clippy::owned_cow)] use crate::{ + HlBlock, consensus::HlConsensus, node::{ - network::block_import::{handle::ImportHandle, service::ImportService, HlBlockImport}, + HlNode, + network::block_import::{HlBlockImport, handle::ImportHandle, service::ImportService}, primitives::HlPrimitives, rpc::engine_api::payload::HlPayloadTypes, types::ReadPrecompileCalls, - HlNode, }, - pseudo_peer::{start_pseudo_peer, BlockSourceConfig}, - HlBlock, + pseudo_peer::{BlockSourceConfig, start_pseudo_peer}, }; use alloy_rlp::{Decodable, Encodable}; use reth::{ api::{FullNodeTypes, TxTy}, - builder::{components::NetworkBuilder, BuilderContext}, + builder::{BuilderContext, components::NetworkBuilder}, transaction_pool::{PoolTransaction, TransactionPool}, }; use reth_discv4::NodeRecord; @@ -26,7 +26,7 @@ use reth_network_api::PeersInfo; use reth_provider::StageCheckpointReader; use reth_stages_types::StageId; use std::sync::Arc; -use tokio::sync::{mpsc, oneshot, Mutex}; +use tokio::sync::{Mutex, mpsc, oneshot}; use tracing::info; pub mod block_import; @@ -38,8 +38,8 @@ pub struct HlNewBlock(pub NewBlock); mod rlp { use super::*; use crate::{ - node::primitives::{BlockBody, TransactionSigned}, HlBlockBody, + node::primitives::{BlockBody, TransactionSigned}, }; use alloy_consensus::{BlobTransactionSidecar, Header}; use alloy_primitives::{Address, U128}; diff --git a/src/node/pool.rs b/src/node/pool.rs index 7fc087fc8..1bb87719c 100644 --- a/src/node/pool.rs +++ b/src/node/pool.rs @@ -6,12 +6,12 @@ //! Ethereum transaction pool only supports TransactionSigned (EthereumTxEnvelope), //! hence this placeholder for the transaction pool. -use crate::node::{primitives::TransactionSigned, HlNode}; +use crate::node::{HlNode, primitives::TransactionSigned}; use alloy_consensus::{ - error::ValueError, EthereumTxEnvelope, Transaction as TransactionTrait, TxEip4844, + EthereumTxEnvelope, Transaction as TransactionTrait, TxEip4844, error::ValueError, }; -use alloy_eips::{eip7702::SignedAuthorization, Typed2718}; -use alloy_primitives::{Address, Bytes, ChainId, TxHash, TxKind, B256, U256}; +use alloy_eips::{Typed2718, eip7702::SignedAuthorization}; +use alloy_primitives::{Address, B256, Bytes, ChainId, TxHash, TxKind, U256}; use alloy_rpc_types::AccessList; use reth::{ api::FullNodeTypes, builder::components::PoolBuilder, transaction_pool::PoolTransaction, @@ -19,7 +19,7 @@ use reth::{ use reth_ethereum_primitives::PooledTransactionVariant; use reth_primitives::Recovered; use reth_primitives_traits::InMemorySize; -use reth_transaction_pool::{noop::NoopTransactionPool, EthPoolTransaction}; +use reth_transaction_pool::{EthPoolTransaction, noop::NoopTransactionPool}; use std::sync::Arc; pub struct HlPoolBuilder; diff --git a/src/node/rpc/call.rs b/src/node/rpc/call.rs index c7fe46a21..fb1d447e7 100644 --- a/src/node/rpc/call.rs +++ b/src/node/rpc/call.rs @@ -1,19 +1,19 @@ use core::fmt; use super::{HlEthApi, HlRpcNodeCore}; -use crate::{node::evm::apply_precompiles, HlBlock}; -use alloy_evm::Evm; +use crate::{HlBlock, node::evm::apply_precompiles}; use alloy_consensus::transaction::TxHashRef; +use alloy_evm::Evm; use alloy_primitives::B256; use reth::rpc::server_types::eth::EthApiError; use reth_evm::{ConfigureEvm, Database, EvmEnvFor, HaltReasonFor, InspectorFor, SpecFor, TxEnvFor}; use reth_primitives::{NodePrimitives, Recovered}; use reth_provider::{ProviderError, ProviderTx}; use reth_rpc_eth_api::{ - helpers::{Call, EthCall}, FromEvmError, RpcConvert, RpcNodeCore, + helpers::{Call, EthCall}, }; -use revm::{context::result::ResultAndState, DatabaseCommit}; +use revm::{DatabaseCommit, context::result::ResultAndState}; impl HlRpcNodeCore for N where N: RpcNodeCore> {} @@ -22,11 +22,11 @@ where N: HlRpcNodeCore, EthApiError: FromEvmError, Rpc: RpcConvert< - Primitives = N::Primitives, - Error = EthApiError, - TxEnv = TxEnvFor, - Spec = SpecFor, - >, + Primitives = N::Primitives, + Error = EthApiError, + TxEnv = TxEnvFor, + Spec = SpecFor, + >, { } @@ -35,11 +35,11 @@ where N: HlRpcNodeCore, EthApiError: FromEvmError, Rpc: RpcConvert< - Primitives = N::Primitives, - Error = EthApiError, - TxEnv = TxEnvFor, - Spec = SpecFor, - >, + Primitives = N::Primitives, + Error = EthApiError, + TxEnv = TxEnvFor, + Spec = SpecFor, + >, { #[inline] fn call_gas_limit(&self) -> u64 { diff --git a/src/node/rpc/engine_api/validator.rs b/src/node/rpc/engine_api/validator.rs index 04218ab22..486cb0822 100644 --- a/src/node/rpc/engine_api/validator.rs +++ b/src/node/rpc/engine_api/validator.rs @@ -9,7 +9,7 @@ use alloy_primitives::B256; use alloy_rpc_types_engine::PayloadError; use reth::{ api::{FullNodeComponents, NodeTypes}, - builder::{rpc::PayloadValidatorBuilder, AddOnsContext}, + builder::{AddOnsContext, rpc::PayloadValidatorBuilder}, }; use reth_engine_primitives::{ExecutionPayload, PayloadValidator}; use reth_payload_primitives::NewPayloadError; diff --git a/src/node/rpc/estimate.rs b/src/node/rpc/estimate.rs index f7a44794c..deb084c86 100644 --- a/src/node/rpc/estimate.rs +++ b/src/node/rpc/estimate.rs @@ -1,5 +1,5 @@ -use super::{apply_precompiles, HlEthApi, HlRpcNodeCore}; -use alloy_evm::overrides::{apply_state_overrides, StateOverrideError}; +use super::{HlEthApi, HlRpcNodeCore, apply_precompiles}; +use alloy_evm::overrides::{StateOverrideError, apply_state_overrides}; use alloy_network::TransactionBuilder; use alloy_primitives::{TxKind, U256}; use alloy_rpc_types_eth::state::StateOverride; @@ -9,19 +9,19 @@ use reth_evm::{ConfigureEvm, Evm, EvmEnvFor, SpecFor, TransactionEnv, TxEnvFor}; use reth_revm::{database::StateProviderDatabase, db::CacheDB}; use reth_rpc_convert::{RpcConvert, RpcTxReq}; use reth_rpc_eth_api::{ - helpers::{ - estimate::{update_estimated_gas_range, EstimateCall}, - Call, - }, AsEthApiError, IntoEthApiError, RpcNodeCore, + helpers::{ + Call, + estimate::{EstimateCall, update_estimated_gas_range}, + }, }; use reth_rpc_eth_types::{ - error::{api::FromEvmHalt, FromEvmError}, EthApiError, RevertError, RpcInvalidTransactionError, + error::{FromEvmError, api::FromEvmHalt}, }; use reth_rpc_server_types::constants::gas_oracle::{CALL_STIPEND_GAS, ESTIMATE_GAS_ERROR_RATIO}; use reth_storage_api::StateProvider; -use revm::context_interface::{result::ExecutionResult, Transaction}; +use revm::context_interface::{Transaction, result::ExecutionResult}; use tracing::trace; impl EstimateCall for HlEthApi @@ -30,11 +30,11 @@ where N: HlRpcNodeCore, EthApiError: FromEvmError + From>, Rpc: RpcConvert< - Primitives = N::Primitives, - Error = EthApiError, - TxEnv = TxEnvFor, - Spec = SpecFor, - >, + Primitives = N::Primitives, + Error = EthApiError, + TxEnv = TxEnvFor, + Spec = SpecFor, + >, { // Modified version that adds `apply_precompiles`; comments are stripped out. fn estimate_gas_with( diff --git a/src/node/rpc/precompile.rs b/src/node/rpc/precompile.rs index 752d9916c..12788bc56 100644 --- a/src/node/rpc/precompile.rs +++ b/src/node/rpc/precompile.rs @@ -1,6 +1,6 @@ use alloy_eips::BlockId; use jsonrpsee::proc_macros::rpc; -use jsonrpsee_core::{async_trait, RpcResult}; +use jsonrpsee_core::{RpcResult, async_trait}; use reth_rpc_convert::RpcConvert; use reth_rpc_eth_types::EthApiError; use tracing::trace; diff --git a/src/node/spot_meta/patch.rs b/src/node/spot_meta/patch.rs index bcc047e45..73e5fdd76 100644 --- a/src/node/spot_meta/patch.rs +++ b/src/node/spot_meta/patch.rs @@ -1,5 +1,5 @@ use crate::node::spot_meta::SpotId; -use alloy_primitives::{address, Address}; +use alloy_primitives::{Address, address}; use std::collections::BTreeMap; /// Testnet-specific fix for #67 diff --git a/src/node/storage/mod.rs b/src/node/storage/mod.rs index 3a1a992f3..73f3d8bf6 100644 --- a/src/node/storage/mod.rs +++ b/src/node/storage/mod.rs @@ -1,22 +1,22 @@ use crate::{ + HlBlock, HlBlockBody, HlPrimitives, node::{ primitives::tx_wrapper::{convert_to_eth_block_body, convert_to_hl_block_body}, types::HlExtras, }, - HlBlock, HlBlockBody, HlPrimitives, }; use alloy_consensus::BlockHeader; use alloy_primitives::Bytes; use reth_chainspec::EthereumHardforks; use reth_db::{ + DbTxUnwindExt, cursor::{DbCursorRO, DbCursorRW}, transaction::{DbTx, DbTxMut}, - DbTxUnwindExt, }; use reth_provider::{ - providers::{ChainStorage, NodeTypesForProvider}, BlockBodyReader, BlockBodyWriter, ChainSpecProvider, ChainStorageReader, ChainStorageWriter, DBProvider, DatabaseProvider, EthStorage, ProviderResult, ReadBodyInput, StorageLocation, + providers::{ChainStorage, NodeTypesForProvider}, }; pub mod tables; diff --git a/src/node/storage/tables.rs b/src/node/storage/tables.rs index 4fd17d76d..8efa02c2e 100644 --- a/src/node/storage/tables.rs +++ b/src/node/storage/tables.rs @@ -1,5 +1,5 @@ use alloy_primitives::{BlockNumber, Bytes}; -use reth_db::{table::TableInfo, tables, TableSet, TableType, TableViewer}; +use reth_db::{TableSet, TableType, TableViewer, table::TableInfo, tables}; use std::fmt; tables! { diff --git a/src/node/types/mod.rs b/src/node/types/mod.rs index f08c9ce78..8d6dc353b 100644 --- a/src/node/types/mod.rs +++ b/src/node/types/mod.rs @@ -2,7 +2,7 @@ //! //! Changes: //! - ReadPrecompileCalls supports RLP encoding / decoding -use alloy_primitives::{Address, Bytes, Log, B256}; +use alloy_primitives::{Address, B256, Bytes, Log}; use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable}; use bytes::BufMut; use serde::{Deserialize, Serialize}; diff --git a/src/node/types/reth_compat.rs b/src/node/types/reth_compat.rs index 9d35b8ff4..aea0422bd 100644 --- a/src/node/types/reth_compat.rs +++ b/src/node/types/reth_compat.rs @@ -10,12 +10,12 @@ use std::{ use tracing::info; use crate::{ + HlBlock, HlBlockBody, node::{ primitives::TransactionSigned as TxSigned, - spot_meta::{erc20_contract_to_spot_token, SpotId}, + spot_meta::{SpotId, erc20_contract_to_spot_token}, types::{ReadPrecompileCalls, SystemTx}, }, - HlBlock, HlBlockBody, }; /// A raw transaction. diff --git a/src/pseudo_peer/network.rs b/src/pseudo_peer/network.rs index 336326093..53b75f972 100644 --- a/src/pseudo_peer/network.rs +++ b/src/pseudo_peer/network.rs @@ -1,8 +1,8 @@ use super::service::{BlockHashCache, BlockPoller}; -use crate::{chainspec::HlChainSpec, node::network::HlNetworkPrimitives, HlPrimitives}; +use crate::{HlPrimitives, chainspec::HlChainSpec, node::network::HlNetworkPrimitives}; use reth_network::{ - config::{rng_secret_key, SecretKey}, NetworkConfig, NetworkManager, PeersConfig, + config::{SecretKey, rng_secret_key}, }; use reth_network_peers::TrustedPeer; use reth_provider::test_utils::NoopProvider; diff --git a/src/pseudo_peer/sources/cached.rs b/src/pseudo_peer/sources/cached.rs index 5f65604fc..8db7a5bba 100644 --- a/src/pseudo_peer/sources/cached.rs +++ b/src/pseudo_peer/sources/cached.rs @@ -1,6 +1,6 @@ use super::{BlockSource, BlockSourceBoxed}; use crate::node::types::BlockAndReceipts; -use futures::{future::BoxFuture, FutureExt}; +use futures::{FutureExt, future::BoxFuture}; use reth_network::cache::LruMap; use std::sync::{Arc, RwLock}; diff --git a/src/pseudo_peer/sources/hl_node/file_ops.rs b/src/pseudo_peer/sources/hl_node/file_ops.rs index efcfc8066..226572d65 100644 --- a/src/pseudo_peer/sources/hl_node/file_ops.rs +++ b/src/pseudo_peer/sources/hl_node/file_ops.rs @@ -1,4 +1,4 @@ -use super::{scan::Scanner, time_utils::TimeUtils, HOURLY_SUBDIR}; +use super::{HOURLY_SUBDIR, scan::Scanner, time_utils::TimeUtils}; use crate::node::types::BlockAndReceipts; use std::{ fs::File, diff --git a/src/pseudo_peer/sources/hl_node/mod.rs b/src/pseudo_peer/sources/hl_node/mod.rs index c6a231dca..5af59bad0 100644 --- a/src/pseudo_peer/sources/hl_node/mod.rs +++ b/src/pseudo_peer/sources/hl_node/mod.rs @@ -14,7 +14,7 @@ use self::{ use super::{BlockSource, BlockSourceBoxed}; use crate::node::types::BlockAndReceipts; use futures::future::BoxFuture; -use reth_metrics::{metrics, metrics::Counter, Metrics}; +use reth_metrics::{Metrics, metrics, metrics::Counter}; use std::{ path::{Path, PathBuf}, sync::Arc, @@ -75,8 +75,8 @@ impl BlockSource for HlNodeBlockSource { let too_soon = now - last_poll_time < args.fallback_threshold; if more_recent && too_soon { return Err(eyre::eyre!( - "Not found locally; limiting polling rate before fallback so that hl-node has chance to catch up" - )); + "Not found locally; limiting polling rate before fallback so that hl-node has chance to catch up" + )); } } diff --git a/src/pseudo_peer/sources/hl_node/tests.rs b/src/pseudo_peer/sources/hl_node/tests.rs index 2b01be1d6..a8e96caac 100644 --- a/src/pseudo_peer/sources/hl_node/tests.rs +++ b/src/pseudo_peer/sources/hl_node/tests.rs @@ -1,10 +1,10 @@ use super::*; use crate::{ - node::types::{reth_compat, ReadPrecompileCalls}, - pseudo_peer::sources::{hl_node::scan::LocalBlockAndReceipts, LocalBlockSource}, + node::types::{ReadPrecompileCalls, reth_compat}, + pseudo_peer::sources::{LocalBlockSource, hl_node::scan::LocalBlockAndReceipts}, }; use alloy_consensus::{BlockBody, Header}; -use alloy_primitives::{Address, Bloom, Bytes, B256, B64, U256}; +use alloy_primitives::{Address, B64, B256, Bloom, Bytes, U256}; use std::{io::Write, time::Duration}; const DEFAULT_FALLBACK_THRESHOLD_FOR_TEST: Duration = Duration::from_millis(5000); diff --git a/src/pseudo_peer/sources/hl_node/time_utils.rs b/src/pseudo_peer/sources/hl_node/time_utils.rs index 136287b2a..47071cf53 100644 --- a/src/pseudo_peer/sources/hl_node/time_utils.rs +++ b/src/pseudo_peer/sources/hl_node/time_utils.rs @@ -1,5 +1,5 @@ use std::path::Path; -use time::{macros::format_description, Date, OffsetDateTime, Time}; +use time::{Date, OffsetDateTime, Time, macros::format_description}; pub struct TimeUtils; diff --git a/src/pseudo_peer/sources/local.rs b/src/pseudo_peer/sources/local.rs index cdb7c6d27..1774c5653 100644 --- a/src/pseudo_peer/sources/local.rs +++ b/src/pseudo_peer/sources/local.rs @@ -1,8 +1,8 @@ -use super::{utils, BlockSource}; +use super::{BlockSource, utils}; use crate::node::types::BlockAndReceipts; use eyre::Context; -use futures::{future::BoxFuture, FutureExt}; -use reth_metrics::{metrics, metrics::Counter, Metrics}; +use futures::{FutureExt, future::BoxFuture}; +use reth_metrics::{Metrics, metrics, metrics::Counter}; use std::path::PathBuf; use tracing::info; diff --git a/src/pseudo_peer/sources/s3.rs b/src/pseudo_peer/sources/s3.rs index b5516d6b5..050607030 100644 --- a/src/pseudo_peer/sources/s3.rs +++ b/src/pseudo_peer/sources/s3.rs @@ -1,8 +1,8 @@ -use super::{utils, BlockSource}; +use super::{BlockSource, utils}; use crate::node::types::BlockAndReceipts; use aws_sdk_s3::types::RequestPayer; -use futures::{future::BoxFuture, FutureExt}; -use reth_metrics::{metrics, metrics::Counter, Metrics}; +use futures::{FutureExt, future::BoxFuture}; +use reth_metrics::{Metrics, metrics, metrics::Counter}; use std::{sync::Arc, time::Duration}; use tracing::info; diff --git a/src/version.rs b/src/version.rs index c81580433..ae65bae9f 100644 --- a/src/version.rs +++ b/src/version.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use reth_node_core::version::{try_init_version_metadata, RethCliVersionConsts}; +use reth_node_core::version::{RethCliVersionConsts, try_init_version_metadata}; pub fn init_reth_hl_version() { let cargo_pkg_version = env!("CARGO_PKG_VERSION").to_string();