From dfebcc4f85c9331aec867fac9642f29b07e40548 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sun, 18 Feb 2024 22:31:00 -0500 Subject: [PATCH 01/10] chore: make clippy happy --- crates/net/network/tests/it/txgossip.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/net/network/tests/it/txgossip.rs b/crates/net/network/tests/it/txgossip.rs index a13f0f22a271..68a7775f0e6a 100644 --- a/crates/net/network/tests/it/txgossip.rs +++ b/crates/net/network/tests/it/txgossip.rs @@ -82,15 +82,15 @@ async fn test_4844_tx_gossip_penalization() { let network_handle = peer0.network(); let peer0_reputation_before = - peer1.peer_handle().peer_by_id(peer0.peer_id().clone()).await.unwrap().reputation(); + peer1.peer_handle().peer_by_id(*peer0.peer_id()).await.unwrap().reputation(); // sends txs directly to peer1 - network_handle.send_transactions(peer1.peer_id().clone(), signed_txs); + network_handle.send_transactions(*peer1.peer_id(), signed_txs); let received = peer1_tx_listener.recv().await.unwrap(); let peer0_reputation_after = - peer1.peer_handle().peer_by_id(peer0.peer_id().clone()).await.unwrap().reputation(); + peer1.peer_handle().peer_by_id(*peer0.peer_id()).await.unwrap().reputation(); assert_ne!(peer0_reputation_before, peer0_reputation_after); assert_eq!(received, txs[1].transaction().hash); @@ -130,24 +130,23 @@ async fn test_sending_invalid_transactions() { input: Default::default(), }; let tx = TransactionSigned::from_transaction_and_signature(tx.into(), Default::default()); - peer0.network().send_transactions(peer1.peer_id().clone(), vec![Arc::new(tx)]); + peer0.network().send_transactions(*peer1.peer_id(), vec![Arc::new(tx)]); } // await disconnect for bad tx spam - while let Some(ev) = peer1_events.next().await { + if let Some(ev) = peer1_events.next().await { match ev { NetworkEvent::SessionClosed { peer_id, .. } => { assert_eq!(peer_id, *peer0.peer_id()); - break } NetworkEvent::SessionEstablished { .. } => { - panic!("unexpected event") + panic!("unexpected SessionEstablished event") } NetworkEvent::PeerAdded(_) => { - panic!("unexpected event") + panic!("unexpected PeerAdded event") } NetworkEvent::PeerRemoved(_) => { - panic!("unexpected event") + panic!("unexpected PeerRemoved event") } } } From e6b80ad8f22b43d956bd8f8348a7dd5ea1990662 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sun, 18 Feb 2024 22:43:12 -0500 Subject: [PATCH 02/10] make clippy even happier --- crates/storage/codecs/derive/src/arbitrary.rs | 2 +- crates/storage/codecs/derive/src/compact/mod.rs | 2 +- crates/storage/codecs/derive/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/storage/codecs/derive/src/arbitrary.rs b/crates/storage/codecs/derive/src/arbitrary.rs index 0768aa7c70dc..3e36f940527a 100644 --- a/crates/storage/codecs/derive/src/arbitrary.rs +++ b/crates/storage/codecs/derive/src/arbitrary.rs @@ -1,4 +1,4 @@ -use proc_macro::{self, TokenStream}; +use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::DeriveInput; diff --git a/crates/storage/codecs/derive/src/compact/mod.rs b/crates/storage/codecs/derive/src/compact/mod.rs index 41b4ccfc55ac..7e1ed9b42d43 100644 --- a/crates/storage/codecs/derive/src/compact/mod.rs +++ b/crates/storage/codecs/derive/src/compact/mod.rs @@ -1,4 +1,4 @@ -use proc_macro::{self, TokenStream}; +use proc_macro::TokenStream; use proc_macro2::{Ident, TokenStream as TokenStream2}; use quote::{format_ident, quote}; use syn::{parse_macro_input, Data, DeriveInput}; diff --git a/crates/storage/codecs/derive/src/lib.rs b/crates/storage/codecs/derive/src/lib.rs index f7334557fbb9..eef973c33041 100644 --- a/crates/storage/codecs/derive/src/lib.rs +++ b/crates/storage/codecs/derive/src/lib.rs @@ -8,7 +8,7 @@ #![allow(unreachable_pub, missing_docs)] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -use proc_macro::{self, TokenStream, TokenTree}; +use proc_macro::{TokenStream, TokenTree}; use quote::{format_ident, quote}; use syn::{parse_macro_input, DeriveInput}; From 4390f579d7bda5a77df8e67c0e719f75f9d5b6df Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sun, 18 Feb 2024 22:44:45 -0500 Subject: [PATCH 03/10] make clippy even even happier --- crates/storage/codecs/src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/crates/storage/codecs/src/lib.rs b/crates/storage/codecs/src/lib.rs index cdd4bc0488c9..fc5baa6c7c5a 100644 --- a/crates/storage/codecs/src/lib.rs +++ b/crates/storage/codecs/src/lib.rs @@ -9,9 +9,6 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![cfg_attr(not(feature = "std"), no_std)] -extern crate alloc; -use alloc::vec::Vec; - pub use codecs_derive::*; use alloy_primitives::{Address, Bloom, Bytes, B256, B512, U256}; From dc6b36c114556b55c556bcb4f66a3095f27f3d01 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sun, 18 Feb 2024 22:46:15 -0500 Subject: [PATCH 04/10] make clippy even even even happier --- crates/rpc/rpc-types/src/beacon/payload.rs | 1 - crates/rpc/rpc-types/src/beacon/withdrawals.rs | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/rpc/rpc-types/src/beacon/payload.rs b/crates/rpc/rpc-types/src/beacon/payload.rs index 42dbf9eb1004..49b68ed5cf74 100644 --- a/crates/rpc/rpc-types/src/beacon/payload.rs +++ b/crates/rpc/rpc-types/src/beacon/payload.rs @@ -527,7 +527,6 @@ impl<'de> DeserializeAs<'de, ExecutionPayload> for BeaconExecutionPayload<'de> { pub mod beacon_payload { use super::*; - use serde::{Deserializer, Serializer}; /// Serialize the payload attributes for the beacon API. pub fn serialize( diff --git a/crates/rpc/rpc-types/src/beacon/withdrawals.rs b/crates/rpc/rpc-types/src/beacon/withdrawals.rs index 6a9282588847..ea2930c5fc4d 100644 --- a/crates/rpc/rpc-types/src/beacon/withdrawals.rs +++ b/crates/rpc/rpc-types/src/beacon/withdrawals.rs @@ -1,6 +1,5 @@ -use alloy_primitives::Address; - use crate::Withdrawal; +use alloy_primitives::Address; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_with::{serde_as, DeserializeAs, DisplayFromStr, SerializeAs}; @@ -40,7 +39,6 @@ impl<'de> DeserializeAs<'de, Withdrawal> for BeaconWithdrawal { /// big-endian hex. pub mod beacon_withdrawals { use super::*; - use serde::{Deserialize, Deserializer, Serialize, Serializer}; /// Serialize the payload attributes for the beacon API. pub fn serialize(payload_attributes: &Withdrawal, serializer: S) -> Result From 57f70c7f18e9df110d26d48120d877746c473739 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sun, 18 Feb 2024 22:48:37 -0500 Subject: [PATCH 05/10] make clippy even even even even happier --- crates/rpc/rpc-types/src/beacon/payload.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/crates/rpc/rpc-types/src/beacon/payload.rs b/crates/rpc/rpc-types/src/beacon/payload.rs index 49b68ed5cf74..38572eecd9eb 100644 --- a/crates/rpc/rpc-types/src/beacon/payload.rs +++ b/crates/rpc/rpc-types/src/beacon/payload.rs @@ -105,7 +105,6 @@ struct BeaconOptimismPayloadAttributes { pub mod beacon_api_payload_attributes_optimism { use super::*; use crate::engine::{OptimismPayloadAttributes, PayloadAttributes}; - use serde::{Deserialize, Deserializer, Serialize, Serializer}; /// Serialize the payload attributes for the beacon API. pub fn serialize( @@ -170,7 +169,6 @@ pub mod beacon_api_payload_attributes_optimism { pub mod beacon_api_payload_attributes { use super::*; use crate::engine::PayloadAttributes; - use serde::{Deserialize, Deserializer, Serialize, Serializer}; /// Serialize the payload attributes for the beacon API. pub fn serialize( @@ -309,7 +307,6 @@ impl<'a> From<&'a ExecutionPayloadV1> for BeaconExecutionPayloadV1<'a> { /// big-endian hex. pub mod beacon_payload_v1 { use super::*; - use serde::{Deserializer, Serializer}; /// Serialize the payload attributes for the beacon API. pub fn serialize( @@ -364,7 +361,6 @@ impl<'a> From<&'a ExecutionPayloadV2> for BeaconExecutionPayloadV2<'a> { /// big-endian hex. pub mod beacon_payload_v2 { use super::*; - use serde::{Deserializer, Serializer}; /// Serialize the payload attributes for the beacon API. pub fn serialize( @@ -420,7 +416,6 @@ impl<'a> From<&'a ExecutionPayloadV3> for BeaconExecutionPayloadV3<'a> { /// big-endian hex. pub mod beacon_payload_v3 { use super::*; - use serde::{Deserializer, Serializer}; /// Serialize the payload attributes for the beacon API. pub fn serialize( From afe8ae06a694f2b3d1d47937514b2b4f381f33fc Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sun, 18 Feb 2024 23:49:04 -0500 Subject: [PATCH 06/10] make clippy very happy --- bin/reth/src/cli/mod.rs | 4 +--- bin/reth/src/commands/node/mod.rs | 1 - crates/blockchain-tree/src/blockchain_tree.rs | 5 ++--- crates/consensus/beacon/src/engine/mod.rs | 9 ++++----- crates/consensus/beacon/src/engine/sync.rs | 6 +++--- crates/consensus/common/src/calc.rs | 2 +- crates/consensus/common/src/validation.rs | 6 +++--- crates/interfaces/src/test_utils/generators.rs | 5 +---- crates/net/common/src/bandwidth_meter.rs | 2 +- crates/net/discv4/src/lib.rs | 2 +- crates/net/discv4/src/test_utils.rs | 2 +- crates/net/dns/src/lib.rs | 1 - crates/net/dns/src/tree.rs | 1 - crates/net/downloaders/src/bodies/bodies.rs | 3 +-- crates/net/downloaders/src/bodies/request.rs | 3 --- crates/net/downloaders/src/file_client.rs | 2 +- .../downloaders/src/headers/reverse_headers.rs | 1 - crates/net/ecies/src/algorithm.rs | 1 - crates/net/ecies/src/stream.rs | 2 +- crates/net/eth-wire/src/multiplex.rs | 2 +- crates/net/eth-wire/src/p2pstream.rs | 2 +- crates/net/eth-wire/src/types/broadcast.rs | 6 +----- crates/net/eth-wire/src/types/version.rs | 1 - crates/net/network/src/cache.rs | 2 +- crates/net/network/src/fetch/mod.rs | 2 +- crates/net/network/src/session/active.rs | 4 +--- .../net/network/src/transactions/validation.rs | 7 +++---- .../node-core/src/args/payload_builder_args.rs | 2 +- crates/node-core/src/args/pruning_args.rs | 2 +- crates/node-core/src/cli/db_type.rs | 1 - crates/node-core/src/events/node.rs | 1 - crates/node-core/src/init.rs | 1 - crates/primitives/benches/trie_root.rs | 6 +----- crates/primitives/src/block.rs | 2 +- crates/primitives/src/chain/spec.rs | 8 +------- crates/primitives/src/constants/eip4844.rs | 1 - crates/primitives/src/proofs.rs | 7 ++----- crates/primitives/src/receipt.rs | 1 - crates/primitives/src/revm/config.rs | 4 ++-- crates/primitives/src/transaction/optimism.rs | 3 +-- crates/prune/src/metrics.rs | 2 +- crates/rpc/ipc/src/stream_codec.rs | 2 +- crates/rpc/rpc-builder/src/auth.rs | 2 +- crates/rpc/rpc-builder/src/lib.rs | 2 +- crates/rpc/rpc-engine-api/src/engine_api.rs | 1 - crates/rpc/rpc-testing-util/src/trace.rs | 1 - crates/rpc/rpc-types/src/mev.rs | 1 - crates/rpc/rpc/src/eth/api/transactions.rs | 6 +++--- crates/rpc/rpc/src/eth/gas_oracle.rs | 2 -- crates/rpc/rpc/src/layers/jwt_secret.rs | 8 +------- crates/stages/src/pipeline/mod.rs | 4 +--- crates/stages/src/stages/execution.rs | 2 +- crates/stages/src/stages/hashing_account.rs | 7 +------ crates/stages/src/stages/hashing_storage.rs | 6 ++---- .../stages/src/stages/index_account_history.rs | 2 +- .../stages/src/stages/index_storage_history.rs | 4 ++-- crates/stages/src/stages/merkle.rs | 4 +--- crates/stages/src/stages/mod.rs | 1 - crates/stages/src/stages/total_difficulty.rs | 12 +++++------- crates/stages/src/stages/tx_lookup.rs | 6 ++---- crates/storage/codecs/src/lib.rs | 1 - crates/storage/db/src/abstraction/table.rs | 1 - .../db/src/implementation/mdbx/cursor.rs | 2 +- .../storage/db/src/implementation/mdbx/mod.rs | 3 +-- crates/storage/nippy-jar/src/filter/cuckoo.rs | 2 +- crates/storage/nippy-jar/src/lib.rs | 1 - crates/storage/nippy-jar/src/phf/mod.rs | 2 +- .../bundle_state/bundle_state_with_receipts.rs | 17 +++++------------ crates/storage/provider/src/chain.rs | 3 +-- .../provider/src/providers/snapshot/mod.rs | 3 +-- crates/transaction-pool/src/blobstore/disk.rs | 2 +- crates/trie/src/trie.rs | 3 +-- crates/trie/src/trie_cursor/database_cursors.rs | 8 ++------ testing/ef-tests/src/models.rs | 3 +-- 74 files changed, 80 insertions(+), 169 deletions(-) diff --git a/bin/reth/src/cli/mod.rs b/bin/reth/src/cli/mod.rs index 659e36bfea68..46f219d3c75c 100644 --- a/bin/reth/src/cli/mod.rs +++ b/bin/reth/src/cli/mod.rs @@ -165,9 +165,7 @@ impl Commands { #[cfg(test)] mod tests { use clap::CommandFactory; - - use crate::args::{utils::SUPPORTED_CHAINS, ColorMode}; - + use crate::args::{ColorMode}; use super::*; #[test] diff --git a/bin/reth/src/commands/node/mod.rs b/bin/reth/src/commands/node/mod.rs index 07dfb6ba4789..c1ffc0f1a64a 100644 --- a/bin/reth/src/commands/node/mod.rs +++ b/bin/reth/src/commands/node/mod.rs @@ -246,7 +246,6 @@ impl NodeCommand { #[cfg(test)] mod tests { use super::*; - use crate::args::utils::SUPPORTED_CHAINS; use reth_discv4::DEFAULT_DISCOVERY_PORT; use std::{ net::{IpAddr, Ipv4Addr}, diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index 887700e84944..cb153c1d32df 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -1262,13 +1262,12 @@ mod tests { blocks::BlockChainTestData, create_test_provider_factory_with_chain_spec, TestExecutorFactory, }, - BlockWriter, BundleStateWithReceipts, ProviderFactory, + ProviderFactory, }; use reth_revm::EvmProcessorFactory; use reth_trie::StateRoot; use std::{ - collections::{HashMap, HashSet}, - sync::Arc, + collections::{HashMap}, }; fn setup_externals( diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index c35e1d1d0171..fc7ecd08bebd 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -33,7 +33,6 @@ use reth_provider::{ use reth_rpc_types::engine::{ CancunPayloadFields, ExecutionPayload, PayloadStatus, PayloadStatusEnum, PayloadValidationError, }; - use reth_stages::{ControlFlow, Pipeline, PipelineError}; use reth_tasks::TaskSpawner; use reth_tokio_util::EventListeners; @@ -1896,8 +1895,8 @@ mod tests { use reth_provider::{BlockWriter, ProviderFactory}; use reth_rpc_types::engine::{ForkchoiceState, ForkchoiceUpdated, PayloadStatus}; use reth_rpc_types_compat::engine::payload::try_block_to_payload_v1; - use reth_stages::{ExecOutput, PipelineError, StageError}; - use std::{collections::VecDeque, sync::Arc, time::Duration}; + use reth_stages::{ExecOutput, StageError}; + use std::{collections::VecDeque, sync::Arc}; use tokio::sync::oneshot::error::TryRecvError; // Pipeline error is propagated. @@ -2353,10 +2352,10 @@ mod tests { mod new_payload { use super::*; - use reth_interfaces::test_utils::{generators, generators::random_block}; + use reth_interfaces::test_utils::generators::random_block; use reth_primitives::{ genesis::{Genesis, GenesisAllocator}, - Hardfork, U256, + Hardfork, }; use reth_provider::test_utils::blocks::BlockChainTestData; diff --git a/crates/consensus/beacon/src/engine/sync.rs b/crates/consensus/beacon/src/engine/sync.rs index adf10e4f74d8..6b25643e95a0 100644 --- a/crates/consensus/beacon/src/engine/sync.rs +++ b/crates/consensus/beacon/src/engine/sync.rs @@ -397,8 +397,8 @@ mod tests { use reth_db::{mdbx::DatabaseEnv, test_utils::TempDatabase}; use reth_interfaces::{p2p::either::EitherDownloader, test_utils::TestFullBlockClient}; use reth_primitives::{ - constants::ETHEREUM_BLOCK_GAS_LIMIT, stage::StageCheckpoint, BlockBody, ChainSpec, - ChainSpecBuilder, Header, SealedHeader, MAINNET, + constants::ETHEREUM_BLOCK_GAS_LIMIT, stage::StageCheckpoint, BlockBody, ChainSpecBuilder, + Header, SealedHeader, MAINNET, }; use reth_provider::{ test_utils::{create_test_provider_factory_with_chain_spec, TestExecutorFactory}, @@ -406,7 +406,7 @@ mod tests { }; use reth_stages::{test_utils::TestStages, ExecOutput, StageError}; use reth_tasks::TokioTaskExecutor; - use std::{collections::VecDeque, future::poll_fn, ops::Range, sync::Arc}; + use std::{collections::VecDeque, future::poll_fn, ops::Range}; use tokio::sync::watch; struct TestPipelineBuilder { diff --git a/crates/consensus/common/src/calc.rs b/crates/consensus/common/src/calc.rs index 87ead142f607..1afeb40f145c 100644 --- a/crates/consensus/common/src/calc.rs +++ b/crates/consensus/common/src/calc.rs @@ -102,7 +102,7 @@ pub fn ommer_reward( #[cfg(test)] mod tests { use super::*; - use reth_primitives::{MAINNET, U256}; + use reth_primitives::{MAINNET}; #[test] fn calc_base_block_reward() { diff --git a/crates/consensus/common/src/validation.rs b/crates/consensus/common/src/validation.rs index 439f540f8505..49bf6d248d95 100644 --- a/crates/consensus/common/src/validation.rs +++ b/crates/consensus/common/src/validation.rs @@ -320,9 +320,9 @@ mod tests { test_utils::generators::{self, Rng}, }; use reth_primitives::{ - constants::eip4844::DATA_GAS_PER_BLOB, hex_literal::hex, proofs, Account, Address, - BlockBody, BlockHash, BlockHashOrNumber, Bytes, ChainSpecBuilder, Header, Signature, - TransactionKind, TransactionSigned, Withdrawal, Withdrawals, MAINNET, U256, + hex_literal::hex, proofs, Account, Address, BlockBody, BlockHash, BlockHashOrNumber, Bytes, + ChainSpecBuilder, Signature, TransactionKind, TransactionSigned, Withdrawal, + Withdrawals, MAINNET, U256, }; use std::ops::RangeBounds; diff --git a/crates/interfaces/src/test_utils/generators.rs b/crates/interfaces/src/test_utils/generators.rs index 58814bd9f23e..eb6e72cccc4b 100644 --- a/crates/interfaces/src/test_utils/generators.rs +++ b/crates/interfaces/src/test_utils/generators.rs @@ -387,10 +387,7 @@ pub fn random_log(rng: &mut R, address: Option
, topics_count: O #[cfg(test)] mod tests { use super::*; - use reth_primitives::{ - hex, public_key_to_address, AccessList, Signature, TransactionKind, TxEip1559, - }; - use secp256k1::KeyPair; + use reth_primitives::{hex, public_key_to_address, AccessList, Signature, TxEip1559}; use std::str::FromStr; #[test] diff --git a/crates/net/common/src/bandwidth_meter.rs b/crates/net/common/src/bandwidth_meter.rs index aac8658a0e26..cc61d0c078f0 100644 --- a/crates/net/common/src/bandwidth_meter.rs +++ b/crates/net/common/src/bandwidth_meter.rs @@ -176,7 +176,7 @@ mod tests { use super::*; use tokio::{ io::{duplex, AsyncReadExt, AsyncWriteExt, DuplexStream}, - net::{TcpListener, TcpStream}, + net::TcpListener, }; async fn duplex_stream_ping_pong( diff --git a/crates/net/discv4/src/lib.rs b/crates/net/discv4/src/lib.rs index 784901e586a6..48a7066fdc50 100644 --- a/crates/net/discv4/src/lib.rs +++ b/crates/net/discv4/src/lib.rs @@ -2193,7 +2193,7 @@ mod tests { use alloy_rlp::{Decodable, Encodable}; use rand::{thread_rng, Rng}; use reth_primitives::{hex, mainnet_nodes, ForkHash}; - use std::{future::poll_fn, net::Ipv4Addr}; + use std::{future::poll_fn}; #[tokio::test] async fn test_configured_enr_forkid_entry() { diff --git a/crates/net/discv4/src/test_utils.rs b/crates/net/discv4/src/test_utils.rs index c56a75a184cc..d0aac032a5ed 100644 --- a/crates/net/discv4/src/test_utils.rs +++ b/crates/net/discv4/src/test_utils.rs @@ -314,7 +314,7 @@ pub fn rng_message(rng: &mut impl RngCore) -> Message { mod tests { use super::*; use crate::Discv4Event; - use std::net::{IpAddr, Ipv4Addr}; + use std::net::Ipv4Addr; /// This test creates two local UDP sockets. The mocked discovery service responds to specific /// messages and we check the actual service receives answers diff --git a/crates/net/dns/src/lib.rs b/crates/net/dns/src/lib.rs index 30d9588aa2db..3a260fd12443 100644 --- a/crates/net/dns/src/lib.rs +++ b/crates/net/dns/src/lib.rs @@ -415,7 +415,6 @@ mod tests { use reth_primitives::{Hardfork, MAINNET}; use secp256k1::rand::thread_rng; use std::{future::poll_fn, net::Ipv4Addr}; - use tokio_stream::StreamExt; #[tokio::test] async fn test_start_root_sync() { diff --git a/crates/net/dns/src/tree.rs b/crates/net/dns/src/tree.rs index cc9efeb7d321..53220f694e52 100644 --- a/crates/net/dns/src/tree.rs +++ b/crates/net/dns/src/tree.rs @@ -364,7 +364,6 @@ fn ensure_strip_key(input: &mut &str, key: &str, err: &'static str) -> ParseEntr #[cfg(test)] mod tests { use super::*; - use secp256k1::SecretKey; #[test] fn parse_root_entry() { diff --git a/crates/net/downloaders/src/bodies/bodies.rs b/crates/net/downloaders/src/bodies/bodies.rs index 2cfdeb42c1a6..4be064b7d291 100644 --- a/crates/net/downloaders/src/bodies/bodies.rs +++ b/crates/net/downloaders/src/bodies/bodies.rs @@ -596,12 +596,11 @@ mod tests { test_utils::{generate_bodies, TestBodiesClient}, }; use assert_matches::assert_matches; - use futures_util::stream::StreamExt; use reth_db::test_utils::create_test_rw_db; use reth_interfaces::test_utils::{generators, generators::random_block_range, TestConsensus}; use reth_primitives::{BlockBody, B256, MAINNET}; use reth_provider::ProviderFactory; - use std::{collections::HashMap, sync::Arc}; + use std::{collections::HashMap}; // Check that the blocks are emitted in order of block number, not in order of // first-downloaded diff --git a/crates/net/downloaders/src/bodies/request.rs b/crates/net/downloaders/src/bodies/request.rs index cc54acf3b800..d4d97ae67d08 100644 --- a/crates/net/downloaders/src/bodies/request.rs +++ b/crates/net/downloaders/src/bodies/request.rs @@ -253,11 +253,8 @@ mod tests { test_utils::{generate_bodies, TestBodiesClient}, }; use reth_interfaces::{ - p2p::bodies::response::BlockResponse, test_utils::{generators, generators::random_header_range, TestConsensus}, }; - use reth_primitives::B256; - use std::sync::Arc; /// Check if future returns empty bodies without dispathing any requests. #[tokio::test] diff --git a/crates/net/downloaders/src/file_client.rs b/crates/net/downloaders/src/file_client.rs index 2ccd6d6bb244..0e4efb90054c 100644 --- a/crates/net/downloaders/src/file_client.rs +++ b/crates/net/downloaders/src/file_client.rs @@ -10,7 +10,7 @@ use reth_interfaces::p2p::{ use reth_primitives::{ BlockBody, BlockHash, BlockHashOrNumber, BlockNumber, Header, HeadersDirection, PeerId, B256, }; -use std::{self, collections::HashMap, path::Path}; +use std::{collections::HashMap, path::Path}; use thiserror::Error; use tokio::{fs::File, io::AsyncReadExt}; use tokio_stream::StreamExt; diff --git a/crates/net/downloaders/src/headers/reverse_headers.rs b/crates/net/downloaders/src/headers/reverse_headers.rs index 14a95302edc7..b95d996277ff 100644 --- a/crates/net/downloaders/src/headers/reverse_headers.rs +++ b/crates/net/downloaders/src/headers/reverse_headers.rs @@ -1225,7 +1225,6 @@ mod tests { use crate::headers::test_utils::child_header; use assert_matches::assert_matches; use reth_interfaces::test_utils::{TestConsensus, TestHeadersClient}; - use reth_primitives::SealedHeader; /// Tests that `replace_number` works the same way as Option::replace #[test] diff --git a/crates/net/ecies/src/algorithm.rs b/crates/net/ecies/src/algorithm.rs index 54d9dd194bc7..14c37514dfd1 100644 --- a/crates/net/ecies/src/algorithm.rs +++ b/crates/net/ecies/src/algorithm.rs @@ -23,7 +23,6 @@ use secp256k1::{ }; use sha2::Sha256; use sha3::Keccak256; -use std::convert::TryFrom; const PROTOCOL_VERSION: usize = 4; diff --git a/crates/net/ecies/src/stream.rs b/crates/net/ecies/src/stream.rs index 363224859511..29fa869b51e2 100644 --- a/crates/net/ecies/src/stream.rs +++ b/crates/net/ecies/src/stream.rs @@ -149,7 +149,7 @@ where mod tests { use super::*; use crate::util::pk2id; - use secp256k1::{rand, SECP256K1}; + use secp256k1::{SECP256K1}; use tokio::net::{TcpListener, TcpStream}; #[tokio::test] diff --git a/crates/net/eth-wire/src/multiplex.rs b/crates/net/eth-wire/src/multiplex.rs index 0cb9cd62fc9e..40e3d234b26e 100644 --- a/crates/net/eth-wire/src/multiplex.rs +++ b/crates/net/eth-wire/src/multiplex.rs @@ -643,7 +643,7 @@ mod tests { connect_passthrough, eth_handshake, eth_hello, proto::{test_hello, TestProtoMessage}, }, - UnauthedEthStream, UnauthedP2PStream, + UnauthedP2PStream, }; use tokio::{net::TcpListener, sync::oneshot}; use tokio_util::codec::Decoder; diff --git a/crates/net/eth-wire/src/p2pstream.rs b/crates/net/eth-wire/src/p2pstream.rs index 6c68369ed5a8..3688c79c17b4 100644 --- a/crates/net/eth-wire/src/p2pstream.rs +++ b/crates/net/eth-wire/src/p2pstream.rs @@ -810,7 +810,7 @@ impl Decodable for ProtocolVersion { mod tests { use super::*; use crate::{ - capability::SharedCapability, test_utils::eth_hello, DisconnectReason, EthVersion, + capability::SharedCapability, test_utils::eth_hello, EthVersion, }; use tokio::net::{TcpListener, TcpStream}; use tokio_util::codec::Decoder; diff --git a/crates/net/eth-wire/src/types/broadcast.rs b/crates/net/eth-wire/src/types/broadcast.rs index ab2cc5e481c4..71942029eb35 100644 --- a/crates/net/eth-wire/src/types/broadcast.rs +++ b/crates/net/eth-wire/src/types/broadcast.rs @@ -12,10 +12,7 @@ use reth_primitives::{Block, Bytes, TransactionSigned, TxHash, B256, U128}; use std::{collections::HashMap, mem, sync::Arc}; #[cfg(feature = "arbitrary")] -use proptest::prelude::*; - -#[cfg(feature = "arbitrary")] -use proptest::{arbitrary::Arbitrary, collection::vec}; +use proptest::{collection::vec, prelude::*}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; @@ -664,7 +661,6 @@ impl FromIterator<(TxHash, Option<(u8, usize)>)> for RequestTxHashes { #[cfg(test)] mod tests { use super::*; - use alloy_rlp::{Decodable, Encodable}; use bytes::BytesMut; use reth_primitives::hex; use std::str::FromStr; diff --git a/crates/net/eth-wire/src/types/version.rs b/crates/net/eth-wire/src/types/version.rs index 50a4a327330f..c7d49cabcd4b 100644 --- a/crates/net/eth-wire/src/types/version.rs +++ b/crates/net/eth-wire/src/types/version.rs @@ -131,7 +131,6 @@ impl From for &'static str { #[cfg(test)] mod tests { use super::{EthVersion, ParseVersionError}; - use std::{convert::TryFrom, string::ToString}; #[test] fn test_eth_version_try_from_str() { diff --git a/crates/net/network/src/cache.rs b/crates/net/network/src/cache.rs index f88594988d03..3a18d67450c5 100644 --- a/crates/net/network/src/cache.rs +++ b/crates/net/network/src/cache.rs @@ -2,7 +2,7 @@ use core::hash::BuildHasher; use derive_more::{Deref, DerefMut}; use itertools::Itertools; use linked_hash_set::LinkedHashSet; -use schnellru::{self, ByLength, Limiter, RandomState, Unlimited}; +use schnellru::{ByLength, Limiter, RandomState, Unlimited}; use std::{borrow::Borrow, fmt, hash::Hash, num::NonZeroUsize}; /// A minimal LRU cache based on a `LinkedHashSet` with limited capacity. diff --git a/crates/net/network/src/fetch/mod.rs b/crates/net/network/src/fetch/mod.rs index 988428261d1b..e244e70aa4cc 100644 --- a/crates/net/network/src/fetch/mod.rs +++ b/crates/net/network/src/fetch/mod.rs @@ -429,7 +429,7 @@ pub(crate) enum BlockResponseOutcome { mod tests { use super::*; use crate::{peers::PeersManager, PeersConfig}; - use reth_primitives::{SealedHeader, B256, B512}; + use reth_primitives::{SealedHeader, B512}; use std::future::poll_fn; #[tokio::test(flavor = "multi_thread")] diff --git a/crates/net/network/src/session/active.rs b/crates/net/network/src/session/active.rs index 3bf677b01a9d..de40bc8a38cd 100644 --- a/crates/net/network/src/session/active.rs +++ b/crates/net/network/src/session/active.rs @@ -761,8 +761,7 @@ fn calculate_new_timeout(current_timeout: Duration, estimated_rtt: Duration) -> mod tests { use super::*; use crate::session::{ - config::{INITIAL_REQUEST_TIMEOUT, PROTOCOL_BREACH_REQUEST_TIMEOUT}, - handle::PendingSessionEvent, + config::PROTOCOL_BREACH_REQUEST_TIMEOUT, handle::PendingSessionEvent, start_pending_incoming_session, }; use reth_ecies::{stream::ECIESStream, util::pk2id}; @@ -773,7 +772,6 @@ mod tests { use reth_net_common::bandwidth_meter::{BandwidthMeter, MeteredStream}; use reth_primitives::{ForkFilter, Hardfork, MAINNET}; use secp256k1::{SecretKey, SECP256K1}; - use std::time::Duration; use tokio::{ net::{TcpListener, TcpStream}, sync::mpsc, diff --git a/crates/net/network/src/transactions/validation.rs b/crates/net/network/src/transactions/validation.rs index 0f4c43509c03..630abd8ccea0 100644 --- a/crates/net/network/src/transactions/validation.rs +++ b/crates/net/network/src/transactions/validation.rs @@ -223,9 +223,9 @@ impl FilterAnnouncement for EthAnnouncementFilter { let NewPooledTransactionHashes68 { mut hashes, mut types, mut sizes } = msg; debug_assert!( - hashes.len() == types.len() && hashes.len() == sizes.len(), "`%hashes`, `%types` and `%sizes` should all be the same length, decoding of `NewPooledTransactionHashes68` should handle this, -`%hashes`: {hashes:?}, -`%types`: {types:?}, + hashes.len() == types.len() && hashes.len() == sizes.len(), "`%hashes`, `%types` and `%sizes` should all be the same length, decoding of `NewPooledTransactionHashes68` should handle this, +`%hashes`: {hashes:?}, +`%types`: {types:?}, `%sizes: {sizes:?}`" ); @@ -332,7 +332,6 @@ impl FilterAnnouncement for EthAnnouncementFilter { #[cfg(test)] mod test { use super::*; - use reth_eth_wire::MAX_MESSAGE_SIZE; use reth_primitives::B256; use std::str::FromStr; diff --git a/crates/node-core/src/args/payload_builder_args.rs b/crates/node-core/src/args/payload_builder_args.rs index 49a8f4ff94ed..17670c0f3cd2 100644 --- a/crates/node-core/src/args/payload_builder_args.rs +++ b/crates/node-core/src/args/payload_builder_args.rs @@ -119,7 +119,7 @@ impl TypedValueParser for ExtradataValueParser { #[cfg(test)] mod tests { use super::*; - use clap::{Args, Parser}; + use clap::{Parser}; /// A helper type to parse Args more easily #[derive(Parser)] diff --git a/crates/node-core/src/args/pruning_args.rs b/crates/node-core/src/args/pruning_args.rs index f5465cd69db9..da737170bb3d 100644 --- a/crates/node-core/src/args/pruning_args.rs +++ b/crates/node-core/src/args/pruning_args.rs @@ -51,7 +51,7 @@ impl PruningArgs { #[cfg(test)] mod tests { use super::*; - use clap::{Args, Parser}; + use clap::{Parser}; /// A helper type to parse Args more easily #[derive(Parser)] diff --git a/crates/node-core/src/cli/db_type.rs b/crates/node-core/src/cli/db_type.rs index 14de78172ad0..cc2e6fbbdf97 100644 --- a/crates/node-core/src/cli/db_type.rs +++ b/crates/node-core/src/cli/db_type.rs @@ -105,7 +105,6 @@ impl DatabaseInstance { #[cfg(test)] mod tests { use super::*; - use alloy_chains::Chain; #[test] fn test_database_db_dir() { diff --git a/crates/node-core/src/events/node.rs b/crates/node-core/src/events/node.rs index 7f6b0e01706f..00b5b7fb54d2 100644 --- a/crates/node-core/src/events/node.rs +++ b/crates/node-core/src/events/node.rs @@ -513,7 +513,6 @@ impl Display for Eta { #[cfg(test)] mod tests { use super::*; - use std::time::{Duration, Instant}; #[test] fn eta_display_no_milliseconds() { diff --git a/crates/node-core/src/init.rs b/crates/node-core/src/init.rs index 4bf0f647b762..dd0eca9f3522 100644 --- a/crates/node-core/src/init.rs +++ b/crates/node-core/src/init.rs @@ -235,7 +235,6 @@ mod tests { Address, Chain, ForkTimestamps, Genesis, GenesisAccount, IntegerList, GOERLI, GOERLI_GENESIS_HASH, MAINNET, MAINNET_GENESIS_HASH, SEPOLIA, SEPOLIA_GENESIS_HASH, }; - use std::collections::HashMap; fn collect_table_entries( tx: &::TX, diff --git a/crates/primitives/benches/trie_root.rs b/crates/primitives/benches/trie_root.rs index ce9d41788c87..57c8da873ea8 100644 --- a/crates/primitives/benches/trie_root.rs +++ b/crates/primitives/benches/trie_root.rs @@ -1,10 +1,6 @@ #![allow(missing_docs, unreachable_pub)] use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use proptest::{ - prelude::*, - strategy::{Strategy, ValueTree}, - test_runner::TestRunner, -}; +use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner}; use reth_primitives::{proofs::triehash::KeccakHasher, ReceiptWithBloom, B256}; /// Benchmarks different implementations of the root calculation. diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index dbd7ce30db44..3b6d25f1f88a 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -521,7 +521,7 @@ impl BlockBody { #[cfg(test)] mod tests { - use super::{BlockId, BlockNumberOrTag::*, *}; + use super::{BlockNumberOrTag::*, *}; use crate::hex_literal::hex; use alloy_rlp::{Decodable, Encodable}; use reth_rpc_types::HexStringMissingPrefixError; diff --git a/crates/primitives/src/chain/spec.rs b/crates/primitives/src/chain/spec.rs index 83dace716615..05b4f269e89c 100644 --- a/crates/primitives/src/chain/spec.rs +++ b/crates/primitives/src/chain/spec.rs @@ -1660,13 +1660,7 @@ impl DepositContract { #[cfg(test)] mod tests { use super::*; - #[cfg(feature = "optimism")] - use crate::OP_GOERLI; - use crate::{ - b256, hex, trie::TrieAccount, ChainConfig, GenesisAccount, B256, DEV, GOERLI, HOLESKY, - MAINNET, SEPOLIA, U256, - }; - use alloy_chains::NamedChain; + use crate::{b256, hex, trie::TrieAccount, ChainConfig, GenesisAccount}; use alloy_rlp::Encodable; use bytes::BytesMut; use std::{collections::HashMap, str::FromStr}; diff --git a/crates/primitives/src/constants/eip4844.rs b/crates/primitives/src/constants/eip4844.rs index 10e83f5d4a42..9ac04b862a8f 100644 --- a/crates/primitives/src/constants/eip4844.rs +++ b/crates/primitives/src/constants/eip4844.rs @@ -52,7 +52,6 @@ mod trusted_setup { #[cfg(test)] mod tests { use super::*; - use std::sync::Arc; #[test] fn ensure_load_kzg_settings() { diff --git a/crates/primitives/src/proofs.rs b/crates/primitives/src/proofs.rs index 5263ced26296..17a614aff1aa 100644 --- a/crates/primitives/src/proofs.rs +++ b/crates/primitives/src/proofs.rs @@ -261,12 +261,9 @@ pub mod triehash { #[cfg(test)] mod tests { use super::*; - #[cfg(not(feature = "optimism"))] - use crate::proofs::calculate_receipt_root; use crate::{ - bloom, constants::EMPTY_ROOT_HASH, hex_literal::hex, proofs::calculate_transaction_root, - Address, Block, GenesisAccount, Log, Receipt, ReceiptWithBloom, TxType, B256, GOERLI, - HOLESKY, MAINNET, SEPOLIA, U256, + bloom, constants::EMPTY_ROOT_HASH, hex_literal::hex, Block, GenesisAccount, Log, TxType, + GOERLI, HOLESKY, MAINNET, SEPOLIA, }; use alloy_primitives::b256; use alloy_rlp::Decodable; diff --git a/crates/primitives/src/receipt.rs b/crates/primitives/src/receipt.rs index 2c78747089f6..e56d76564005 100644 --- a/crates/primitives/src/receipt.rs +++ b/crates/primitives/src/receipt.rs @@ -547,7 +547,6 @@ mod tests { use super::*; use crate::hex_literal::hex; use alloy_primitives::{address, b256, bytes, Bytes}; - use alloy_rlp::{Decodable, Encodable}; // Test vector from: https://eips.ethereum.org/EIPS/eip-2481 #[test] diff --git a/crates/primitives/src/revm/config.rs b/crates/primitives/src/revm/config.rs index a194e2f4109e..0dcadaa03c92 100644 --- a/crates/primitives/src/revm/config.rs +++ b/crates/primitives/src/revm/config.rs @@ -1,4 +1,4 @@ -use crate::{revm_primitives, ChainSpec, Hardfork, Head}; +use crate::{ChainSpec, Hardfork, Head}; /// Returns the spec id at the given timestamp. /// @@ -80,7 +80,7 @@ pub fn revm_spec(chain_spec: &ChainSpec, block: Head) -> revm_primitives::SpecId #[cfg(test)] mod tests { use super::*; - use crate::{ChainSpecBuilder, Head, MAINNET, U256}; + use crate::{ChainSpecBuilder, MAINNET, U256}; #[test] fn test_to_revm_spec() { diff --git a/crates/primitives/src/transaction/optimism.rs b/crates/primitives/src/transaction/optimism.rs index 535a7cd8f0e5..400074bd0ad7 100644 --- a/crates/primitives/src/transaction/optimism.rs +++ b/crates/primitives/src/transaction/optimism.rs @@ -145,8 +145,7 @@ impl TxDeposit { #[cfg(test)] mod tests { use super::*; - use crate::{revm_primitives::hex_literal::hex, Bytes, TransactionSigned}; - use alloy_rlp::Decodable; + use crate::{revm_primitives::hex_literal::hex, TransactionSigned}; use bytes::BytesMut; #[test] diff --git a/crates/prune/src/metrics.rs b/crates/prune/src/metrics.rs index a84e9d5469c1..65bff626897f 100644 --- a/crates/prune/src/metrics.rs +++ b/crates/prune/src/metrics.rs @@ -1,4 +1,4 @@ -use reth_metrics::{metrics, metrics::Histogram, Metrics}; +use reth_metrics::{metrics::Histogram, Metrics}; use reth_primitives::PruneSegment; use std::collections::HashMap; diff --git a/crates/rpc/ipc/src/stream_codec.rs b/crates/rpc/ipc/src/stream_codec.rs index 44ddfea2b8b8..3245d776cd32 100644 --- a/crates/rpc/ipc/src/stream_codec.rs +++ b/crates/rpc/ipc/src/stream_codec.rs @@ -141,7 +141,7 @@ impl tokio_util::codec::Encoder for StreamCodec { #[cfg(test)] mod tests { use super::*; - use bytes::{BufMut, BytesMut}; + use bytes::BufMut; use tokio_util::codec::Decoder; #[test] diff --git a/crates/rpc/rpc-builder/src/auth.rs b/crates/rpc/rpc-builder/src/auth.rs index 9f5edda1a9da..70cea96dbad4 100644 --- a/crates/rpc/rpc-builder/src/auth.rs +++ b/crates/rpc/rpc-builder/src/auth.rs @@ -25,7 +25,7 @@ use reth_rpc::{ AuthLayer, BlockingTaskPool, Claims, EngineEthApi, EthApi, EthFilter, EthSubscriptionIdProvider, JwtAuthValidator, JwtSecret, }; -use reth_rpc_api::{servers::*, EngineApiServer}; +use reth_rpc_api::{servers::*}; use reth_tasks::TaskSpawner; use reth_transaction_pool::TransactionPool; use std::{ diff --git a/crates/rpc/rpc-builder/src/lib.rs b/crates/rpc/rpc-builder/src/lib.rs index 8518560a7ad2..678ff40f0a12 100644 --- a/crates/rpc/rpc-builder/src/lib.rs +++ b/crates/rpc/rpc-builder/src/lib.rs @@ -198,7 +198,7 @@ use reth_rpc::{ EthApi, EthFilter, EthPubSub, EthSubscriptionIdProvider, JwtAuthValidator, JwtSecret, NetApi, OtterscanApi, RPCApi, RethApi, TraceApi, TxPoolApi, Web3Api, }; -use reth_rpc_api::{servers::*, EngineApiServer}; +use reth_rpc_api::{servers::*}; use reth_tasks::{TaskSpawner, TokioTaskExecutor}; use reth_transaction_pool::{noop::NoopTransactionPool, TransactionPool}; // re-export for convenience diff --git a/crates/rpc/rpc-engine-api/src/engine_api.rs b/crates/rpc/rpc-engine-api/src/engine_api.rs index f9d003aeaa74..f5cc4f5f2cfa 100644 --- a/crates/rpc/rpc-engine-api/src/engine_api.rs +++ b/crates/rpc/rpc-engine-api/src/engine_api.rs @@ -693,7 +693,6 @@ mod tests { use reth_provider::test_utils::MockEthProvider; use reth_rpc_types_compat::engine::payload::execution_payload_from_sealed_block; use reth_tasks::TokioTaskExecutor; - use std::sync::Arc; use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver}; fn setup_engine_api() -> (EngineApiTestHandle, EngineApi, EthEngineTypes>) diff --git a/crates/rpc/rpc-testing-util/src/trace.rs b/crates/rpc/rpc-testing-util/src/trace.rs index df89923646cd..b2e6ce9c3803 100644 --- a/crates/rpc/rpc-testing-util/src/trace.rs +++ b/crates/rpc/rpc-testing-util/src/trace.rs @@ -522,7 +522,6 @@ mod tests { use jsonrpsee::http_client::HttpClientBuilder; use reth_primitives::BlockNumberOrTag; use reth_rpc_types::trace::filter::TraceFilterMode; - use std::collections::HashSet; fn assert_is_stream(_: &St) {} diff --git a/crates/rpc/rpc-types/src/mev.rs b/crates/rpc/rpc-types/src/mev.rs index e565e223618d..2137e1ecf246 100644 --- a/crates/rpc/rpc-types/src/mev.rs +++ b/crates/rpc/rpc-types/src/mev.rs @@ -729,7 +729,6 @@ mod u256_numeric_string { #[cfg(test)] mod tests { use super::*; - use alloy_primitives::Bytes; use std::str::FromStr; #[test] diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index 8d5999a7efbc..3031bfa4b233 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -1418,13 +1418,13 @@ mod tests { cache::EthStateCache, gas_oracle::GasPriceOracle, FeeHistoryCache, FeeHistoryCacheConfig, }, - BlockingTaskPool, EthApi, + BlockingTaskPool, }; use reth_network_api::noop::NoopNetwork; use reth_node_ethereum::EthEvmConfig; - use reth_primitives::{constants::ETHEREUM_BLOCK_GAS_LIMIT, hex_literal::hex, Bytes}; + use reth_primitives::{constants::ETHEREUM_BLOCK_GAS_LIMIT, hex_literal::hex}; use reth_provider::test_utils::NoopProvider; - use reth_transaction_pool::{test_utils::testing_pool, TransactionPool}; + use reth_transaction_pool::{test_utils::testing_pool}; #[tokio::test] async fn send_raw_transaction() { diff --git a/crates/rpc/rpc/src/eth/gas_oracle.rs b/crates/rpc/rpc/src/eth/gas_oracle.rs index 4085eb22f9b1..5b645e6b80aa 100644 --- a/crates/rpc/rpc/src/eth/gas_oracle.rs +++ b/crates/rpc/rpc/src/eth/gas_oracle.rs @@ -305,8 +305,6 @@ impl Default for GasPriceOracleResult { #[cfg(test)] mod tests { - use reth_primitives::constants::GWEI_TO_WEI; - use super::*; #[test] diff --git a/crates/rpc/rpc/src/layers/jwt_secret.rs b/crates/rpc/rpc/src/layers/jwt_secret.rs index 3dab8d30ae03..a6b09e77496a 100644 --- a/crates/rpc/rpc/src/layers/jwt_secret.rs +++ b/crates/rpc/rpc/src/layers/jwt_secret.rs @@ -220,14 +220,8 @@ impl Claims { #[cfg(test)] mod tests { use super::*; - use crate::layers::jwt_secret::JWT_MAX_IAT_DIFF; use assert_matches::assert_matches; - use jsonwebtoken::{encode, Algorithm, EncodingKey, Header}; - use reth_primitives::fs::FsPathError; - use std::{ - path::Path, - time::{Duration, SystemTime, UNIX_EPOCH}, - }; + use jsonwebtoken::{encode, EncodingKey, Header}; use tempfile::tempdir; #[test] diff --git a/crates/stages/src/pipeline/mod.rs b/crates/stages/src/pipeline/mod.rs index 66de426df233..0890eca519d2 100644 --- a/crates/stages/src/pipeline/mod.rs +++ b/crates/stages/src/pipeline/mod.rs @@ -1,6 +1,5 @@ use crate::{ - error::*, BlockErrorKind, ExecInput, ExecOutput, MetricEvent, MetricEventsSender, Stage, - StageError, StageExt, UnwindInput, + error::*, ExecInput, ExecOutput, MetricEvent, MetricEventsSender, Stage, StageExt, UnwindInput, }; use futures_util::Future; use reth_db::database::Database; @@ -493,7 +492,6 @@ mod tests { provider::ProviderError, test_utils::{generators, generators::random_header}, }; - use reth_primitives::stage::StageCheckpoint; use reth_provider::test_utils::create_test_provider_factory; use tokio_stream::StreamExt; diff --git a/crates/stages/src/stages/execution.rs b/crates/stages/src/stages/execution.rs index beefd98a69eb..ff6c378240cd 100644 --- a/crates/stages/src/stages/execution.rs +++ b/crates/stages/src/stages/execution.rs @@ -505,7 +505,7 @@ mod tests { use reth_node_ethereum::EthEvmConfig; use reth_primitives::{ address, hex_literal::hex, keccak256, stage::StageUnitCheckpoint, Account, Bytecode, - ChainSpecBuilder, PruneModes, SealedBlock, StorageEntry, B256, MAINNET, U256, + ChainSpecBuilder, SealedBlock, StorageEntry, B256, MAINNET, }; use reth_provider::{AccountReader, BlockWriter, ProviderFactory, ReceiptProvider}; use reth_revm::EvmProcessorFactory; diff --git a/crates/stages/src/stages/hashing_account.rs b/crates/stages/src/stages/hashing_account.rs index 323fd1c1b300..d4b5b668a469 100644 --- a/crates/stages/src/stages/hashing_account.rs +++ b/crates/stages/src/stages/hashing_account.rs @@ -435,12 +435,7 @@ mod tests { mod test_utils { use super::*; - use crate::{ - stages::hashing_account::AccountHashingStage, - test_utils::{StageTestRunner, TestStageDB}, - ExecInput, ExecOutput, UnwindInput, - }; - use reth_db::{cursor::DbCursorRO, tables, transaction::DbTx}; + use crate::test_utils::{StageTestRunner, TestStageDB}; use reth_primitives::Address; pub(crate) struct AccountHashingTestRunner { diff --git a/crates/stages/src/stages/hashing_storage.rs b/crates/stages/src/stages/hashing_storage.rs index d508846a43c4..1e3033738969 100644 --- a/crates/stages/src/stages/hashing_storage.rs +++ b/crates/stages/src/stages/hashing_storage.rs @@ -232,15 +232,13 @@ mod tests { use rand::Rng; use reth_db::{ cursor::{DbCursorRO, DbCursorRW}, - models::{BlockNumberAddress, StoredBlockBodyIndices}, + models::StoredBlockBodyIndices, }; use reth_interfaces::test_utils::{ generators, generators::{random_block_range, random_contract_account_range}, }; - use reth_primitives::{ - stage::StageUnitCheckpoint, Address, SealedBlock, StorageEntry, B256, U256, - }; + use reth_primitives::{stage::StageUnitCheckpoint, Address, SealedBlock, B256, U256}; stage_test_suite_ext!(StorageHashingTestRunner, storage_hashing); diff --git a/crates/stages/src/stages/index_account_history.rs b/crates/stages/src/stages/index_account_history.rs index 355a63a7d5c2..045bfe04e8de 100644 --- a/crates/stages/src/stages/index_account_history.rs +++ b/crates/stages/src/stages/index_account_history.rs @@ -122,7 +122,7 @@ mod tests { generators, generators::{random_block_range, random_changeset_range, random_contract_account_range}, }; - use reth_primitives::{address, Address, BlockNumber, PruneMode, B256}; + use reth_primitives::{address, Address, BlockNumber, B256}; use std::collections::BTreeMap; const ADDRESS: Address = address!("0000000000000000000000000000000000000001"); diff --git a/crates/stages/src/stages/index_storage_history.rs b/crates/stages/src/stages/index_storage_history.rs index c189a90c320b..f2deffabbb7d 100644 --- a/crates/stages/src/stages/index_storage_history.rs +++ b/crates/stages/src/stages/index_storage_history.rs @@ -110,7 +110,7 @@ mod tests { models::{ sharded_key, storage_sharded_key::{StorageShardedKey, NUM_OF_INDICES_IN_SHARD}, - BlockNumberAddress, ShardedKey, StoredBlockBodyIndices, + ShardedKey, StoredBlockBodyIndices, }, tables, transaction::{DbTx, DbTxMut}, @@ -121,7 +121,7 @@ mod tests { generators::{random_block_range, random_changeset_range, random_contract_account_range}, }; use reth_primitives::{ - address, b256, Address, BlockNumber, PruneMode, StorageEntry, B256, U256, + address, b256, Address, BlockNumber, StorageEntry, B256, U256, }; use std::collections::BTreeMap; diff --git a/crates/stages/src/stages/merkle.rs b/crates/stages/src/stages/merkle.rs index 7b74ca47b8fb..bf5c2b0f00e5 100644 --- a/crates/stages/src/stages/merkle.rs +++ b/crates/stages/src/stages/merkle.rs @@ -345,8 +345,6 @@ mod tests { use assert_matches::assert_matches; use reth_db::{ cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}, - tables, - transaction::{DbTx, DbTxMut}, }; use reth_interfaces::test_utils::{ generators, @@ -355,7 +353,7 @@ mod tests { }, }; use reth_primitives::{ - keccak256, stage::StageUnitCheckpoint, SealedBlock, StorageEntry, B256, U256, + keccak256, stage::StageUnitCheckpoint, SealedBlock, StorageEntry, U256, }; use reth_trie::test_utils::{state_root, state_root_prehashed}; use std::collections::BTreeMap; diff --git a/crates/stages/src/stages/mod.rs b/crates/stages/src/stages/mod.rs index e958350ffcd3..3c60eed6cceb 100644 --- a/crates/stages/src/stages/mod.rs +++ b/crates/stages/src/stages/mod.rs @@ -41,7 +41,6 @@ mod tests { use super::*; use crate::{ stage::Stage, - stages::{ExecutionStage, IndexAccountHistoryStage, IndexStorageHistoryStage}, test_utils::TestStageDB, ExecInput, }; diff --git a/crates/stages/src/stages/total_difficulty.rs b/crates/stages/src/stages/total_difficulty.rs index d523cf4ce850..57f63f7a12f1 100644 --- a/crates/stages/src/stages/total_difficulty.rs +++ b/crates/stages/src/stages/total_difficulty.rs @@ -125,8 +125,12 @@ fn stage_checkpoint( #[cfg(test)] mod tests { + use super::*; + use crate::test_utils::{ + stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError, + TestStageDB, UnwindStageTestRunner, + }; use assert_matches::assert_matches; - use reth_db::transaction::DbTx; use reth_interfaces::test_utils::{ generators, generators::{random_header, random_header_range}, @@ -135,12 +139,6 @@ mod tests { use reth_primitives::{stage::StageUnitCheckpoint, BlockNumber, SealedHeader}; use reth_provider::HeaderProvider; - use super::*; - use crate::test_utils::{ - stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError, - TestStageDB, UnwindStageTestRunner, - }; - stage_test_suite_ext!(TotalDifficultyTestRunner, total_difficulty); #[tokio::test] diff --git a/crates/stages/src/stages/tx_lookup.rs b/crates/stages/src/stages/tx_lookup.rs index a741bed28582..4e58ed038df1 100644 --- a/crates/stages/src/stages/tx_lookup.rs +++ b/crates/stages/src/stages/tx_lookup.rs @@ -193,10 +193,8 @@ mod tests { generators, generators::{random_block, random_block_range}, }; - use reth_primitives::{ - stage::StageUnitCheckpoint, BlockNumber, PruneCheckpoint, PruneMode, SealedBlock, B256, - }; - use reth_provider::{BlockReader, ProviderError, PruneCheckpointWriter, TransactionsProvider}; + use reth_primitives::{stage::StageUnitCheckpoint, BlockNumber, SealedBlock, B256}; + use reth_provider::{TransactionsProvider}; use std::ops::Sub; // Implement stage test suite. diff --git a/crates/storage/codecs/src/lib.rs b/crates/storage/codecs/src/lib.rs index fc5baa6c7c5a..5b2fc4efdbba 100644 --- a/crates/storage/codecs/src/lib.rs +++ b/crates/storage/codecs/src/lib.rs @@ -369,7 +369,6 @@ const fn decode_varuint_panic() -> ! { #[cfg(test)] mod tests { use super::*; - use alloy_primitives::{Address, Bytes}; #[test] fn compact_bytes() { diff --git a/crates/storage/db/src/abstraction/table.rs b/crates/storage/db/src/abstraction/table.rs index 3767f4f1acb0..72dc8b9ffc93 100644 --- a/crates/storage/db/src/abstraction/table.rs +++ b/crates/storage/db/src/abstraction/table.rs @@ -7,7 +7,6 @@ use crate::{ use serde::{Deserialize, Serialize}; use std::{ fmt::Debug, - marker::{Send, Sync}, }; /// Trait that will transform the data to be saved in the DB in a (ideally) compressed format diff --git a/crates/storage/db/src/implementation/mdbx/cursor.rs b/crates/storage/db/src/implementation/mdbx/cursor.rs index 215d320600cf..43adc249272f 100644 --- a/crates/storage/db/src/implementation/mdbx/cursor.rs +++ b/crates/storage/db/src/implementation/mdbx/cursor.rs @@ -12,7 +12,7 @@ use crate::{ DatabaseError, }; use reth_interfaces::db::{DatabaseErrorInfo, DatabaseWriteError, DatabaseWriteOperation}; -use reth_libmdbx::{self, Error as MDBXError, TransactionKind, WriteFlags, RO, RW}; +use reth_libmdbx::{Error as MDBXError, TransactionKind, WriteFlags, RO, RW}; use std::{borrow::Cow, collections::Bound, marker::PhantomData, ops::RangeBounds, sync::Arc}; /// Read only Cursor. diff --git a/crates/storage/db/src/implementation/mdbx/mod.rs b/crates/storage/db/src/implementation/mdbx/mod.rs index 5dfa32863433..21e90bae540f 100644 --- a/crates/storage/db/src/implementation/mdbx/mod.rs +++ b/crates/storage/db/src/implementation/mdbx/mod.rs @@ -356,7 +356,6 @@ mod tests { use crate::{ abstraction::table::{Encode, Table}, cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW, ReverseWalker, Walker}, - database::Database, models::{AccountBeforeTx, ShardedKey}, tables::{AccountHistory, CanonicalHeaders, Headers, PlainAccountState, PlainStorageState}, test_utils::*, @@ -366,7 +365,7 @@ mod tests { use reth_interfaces::db::{DatabaseWriteError, DatabaseWriteOperation}; use reth_libmdbx::Error; use reth_primitives::{Account, Address, Header, IntegerList, StorageEntry, B256, U256}; - use std::{path::Path, str::FromStr, sync::Arc}; + use std::{str::FromStr}; use tempfile::TempDir; /// Create database for testing diff --git a/crates/storage/nippy-jar/src/filter/cuckoo.rs b/crates/storage/nippy-jar/src/filter/cuckoo.rs index 70c3be24a408..7c05a8f5816e 100644 --- a/crates/storage/nippy-jar/src/filter/cuckoo.rs +++ b/crates/storage/nippy-jar/src/filter/cuckoo.rs @@ -1,6 +1,6 @@ use super::InclusionFilter; use crate::NippyJarError; -use cuckoofilter::{self, CuckooFilter, ExportedCuckooFilter}; +use cuckoofilter::{CuckooFilter, ExportedCuckooFilter}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::collections::hash_map::DefaultHasher; diff --git a/crates/storage/nippy-jar/src/lib.rs b/crates/storage/nippy-jar/src/lib.rs index 20d499a63603..ad112c9d0659 100644 --- a/crates/storage/nippy-jar/src/lib.rs +++ b/crates/storage/nippy-jar/src/lib.rs @@ -13,7 +13,6 @@ use serde::{Deserialize, Serialize}; use std::{ error::Error as StdError, fs::File, - marker::Sync, ops::Range, path::{Path, PathBuf}, }; diff --git a/crates/storage/nippy-jar/src/phf/mod.rs b/crates/storage/nippy-jar/src/phf/mod.rs index d04d4fc2db49..5ac5d516997f 100644 --- a/crates/storage/nippy-jar/src/phf/mod.rs +++ b/crates/storage/nippy-jar/src/phf/mod.rs @@ -1,6 +1,6 @@ use crate::NippyJarError; use serde::{Deserialize, Serialize}; -use std::{clone::Clone, hash::Hash, marker::Sync}; +use std::hash::Hash; mod fmph; pub use fmph::Fmph; diff --git a/crates/storage/provider/src/bundle_state/bundle_state_with_receipts.rs b/crates/storage/provider/src/bundle_state/bundle_state_with_receipts.rs index 6f977c68809a..c87c6ede80aa 100644 --- a/crates/storage/provider/src/bundle_state/bundle_state_with_receipts.rs +++ b/crates/storage/provider/src/bundle_state/bundle_state_with_receipts.rs @@ -329,28 +329,21 @@ impl BundleStateWithReceipts { #[cfg(test)] mod tests { use super::*; - use crate::{test_utils::create_test_provider_factory, AccountReader, BundleStateWithReceipts}; + use crate::{test_utils::create_test_provider_factory, AccountReader}; use reth_db::{ - cursor::{DbCursorRO, DbDupCursorRO}, + cursor::DbDupCursorRO, database::Database, models::{AccountBeforeTx, BlockNumberAddress}, - tables, test_utils::create_test_rw_db, - transaction::DbTx, - }; - use reth_primitives::{ - keccak256, revm::compat::into_reth_acc, Address, Receipt, Receipts, StorageEntry, B256, - U256, }; + use reth_primitives::keccak256; use reth_trie::{test_utils::state_root, StateRoot}; use revm::{ db::{ states::{ - bundle_state::{BundleRetention, OriginalValuesKnown}, - changes::PlainStorageRevert, - PlainStorageChangeset, + bundle_state::BundleRetention, changes::PlainStorageRevert, PlainStorageChangeset, }, - BundleState, EmptyDB, + EmptyDB, }, primitives::{ Account as RevmAccount, AccountInfo as RevmAccountInfo, AccountStatus, HashMap, diff --git a/crates/storage/provider/src/chain.rs b/crates/storage/provider/src/chain.rs index 6fb97ec6036c..17cf7e199641 100644 --- a/crates/storage/provider/src/chain.rs +++ b/crates/storage/provider/src/chain.rs @@ -471,9 +471,8 @@ pub enum ChainSplit { #[cfg(test)] mod tests { use super::*; - use reth_primitives::{Address, Receipts, B256}; + use reth_primitives::{Receipts, B256}; use revm::{ - db::BundleState, primitives::{AccountInfo, HashMap}, }; diff --git a/crates/storage/provider/src/providers/snapshot/mod.rs b/crates/storage/provider/src/providers/snapshot/mod.rs index 076f7b85e958..7a9327c291ba 100644 --- a/crates/storage/provider/src/providers/snapshot/mod.rs +++ b/crates/storage/provider/src/providers/snapshot/mod.rs @@ -42,7 +42,7 @@ impl Deref for LoadedJar { mod tests { use super::*; use crate::{test_utils::create_test_provider_factory, HeaderProvider}; - use rand::{self, seq::SliceRandom}; + use rand::seq::SliceRandom; use reth_db::{ cursor::DbCursorRO, snapshot::create_snapshot_T1_T2_T3, @@ -50,7 +50,6 @@ mod tests { CanonicalHeaders, HeaderNumbers, HeaderTD, Headers, RawTable, }; use reth_interfaces::test_utils::generators::{self, random_header_range}; - use reth_nippy_jar::NippyJar; use reth_primitives::{BlockNumber, B256, U256}; #[test] diff --git a/crates/transaction-pool/src/blobstore/disk.rs b/crates/transaction-pool/src/blobstore/disk.rs index 69f7de7e4d7c..4b2dee86ec4e 100644 --- a/crates/transaction-pool/src/blobstore/disk.rs +++ b/crates/transaction-pool/src/blobstore/disk.rs @@ -415,7 +415,7 @@ mod tests { use super::*; use proptest::{ prelude::*, - strategy::{Strategy, ValueTree}, + strategy::{ValueTree}, test_runner::TestRunner, }; use std::sync::atomic::Ordering; diff --git a/crates/trie/src/trie.rs b/crates/trie/src/trie.rs index cdf5a2f659ec..246f6f09d836 100644 --- a/crates/trie/src/trie.rs +++ b/crates/trie/src/trie.rs @@ -479,10 +479,9 @@ mod tests { }; use reth_primitives::{ hex_literal::hex, - keccak256, proofs::triehash::KeccakHasher, trie::{BranchNodeCompact, TrieMask}, - Account, Address, StorageEntry, B256, U256, + Account, StorageEntry, U256, }; use reth_provider::{test_utils::create_test_provider_factory, DatabaseProviderRW}; use std::{ diff --git a/crates/trie/src/trie_cursor/database_cursors.rs b/crates/trie/src/trie_cursor/database_cursors.rs index 4db790af5ee4..c24b335c539b 100644 --- a/crates/trie/src/trie_cursor/database_cursors.rs +++ b/crates/trie/src/trie_cursor/database_cursors.rs @@ -117,14 +117,10 @@ where #[cfg(test)] mod tests { use super::*; - use reth_db::{ - cursor::{DbCursorRO, DbCursorRW}, - tables, - transaction::DbTxMut, - }; + use reth_db::{cursor::DbCursorRW, transaction::DbTxMut}; use reth_primitives::{ hex_literal::hex, - trie::{BranchNodeCompact, StorageTrieEntry, StoredBranchNode}, + trie::{StorageTrieEntry, StoredBranchNode}, }; use reth_provider::test_utils::create_test_provider_factory; diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 88ae94845ed3..992cd40a1b1e 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -11,7 +11,7 @@ use reth_primitives::{ ChainSpecBuilder, Header as RethHeader, SealedHeader, StorageEntry, Withdrawals, B256, B64, U256, }; -use serde::{self, Deserialize}; +use serde::Deserialize; use std::{collections::BTreeMap, ops::Deref}; /// The definition of a blockchain test. @@ -408,7 +408,6 @@ pub type AccessList = Vec; #[cfg(test)] mod tests { use super::*; - use serde_json; #[test] fn header_deserialize() { From 8a4c238bdbf73802249d756e2118d6488597ab13 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sun, 18 Feb 2024 23:50:43 -0500 Subject: [PATCH 07/10] cargo fmt --- bin/reth/src/cli/mod.rs | 4 ++-- crates/blockchain-tree/src/blockchain_tree.rs | 4 +--- crates/consensus/common/src/calc.rs | 2 +- crates/consensus/common/src/validation.rs | 4 ++-- crates/net/discv4/src/lib.rs | 2 +- crates/net/downloaders/src/bodies/bodies.rs | 2 +- crates/net/downloaders/src/bodies/request.rs | 4 +--- crates/net/ecies/src/stream.rs | 2 +- crates/net/eth-wire/src/p2pstream.rs | 4 +--- crates/node-core/src/args/payload_builder_args.rs | 2 +- crates/node-core/src/args/pruning_args.rs | 2 +- crates/rpc/rpc-builder/src/auth.rs | 2 +- crates/rpc/rpc-builder/src/lib.rs | 2 +- crates/rpc/rpc/src/eth/api/transactions.rs | 2 +- crates/stages/src/stages/index_storage_history.rs | 4 +--- crates/stages/src/stages/merkle.rs | 8 ++------ crates/stages/src/stages/mod.rs | 6 +----- crates/stages/src/stages/tx_lookup.rs | 2 +- crates/storage/db/src/abstraction/table.rs | 4 +--- crates/storage/db/src/implementation/mdbx/mod.rs | 2 +- crates/storage/provider/src/chain.rs | 4 +--- crates/transaction-pool/src/blobstore/disk.rs | 6 +----- 22 files changed, 25 insertions(+), 49 deletions(-) diff --git a/bin/reth/src/cli/mod.rs b/bin/reth/src/cli/mod.rs index 46f219d3c75c..7082a8b1a17f 100644 --- a/bin/reth/src/cli/mod.rs +++ b/bin/reth/src/cli/mod.rs @@ -164,9 +164,9 @@ impl Commands { #[cfg(test)] mod tests { - use clap::CommandFactory; - use crate::args::{ColorMode}; use super::*; + use crate::args::ColorMode; + use clap::CommandFactory; #[test] fn parse_color_mode() { diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index cb153c1d32df..d85dc3d34ae4 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -1266,9 +1266,7 @@ mod tests { }; use reth_revm::EvmProcessorFactory; use reth_trie::StateRoot; - use std::{ - collections::{HashMap}, - }; + use std::collections::HashMap; fn setup_externals( exec_res: Vec, diff --git a/crates/consensus/common/src/calc.rs b/crates/consensus/common/src/calc.rs index 1afeb40f145c..d280d704431b 100644 --- a/crates/consensus/common/src/calc.rs +++ b/crates/consensus/common/src/calc.rs @@ -102,7 +102,7 @@ pub fn ommer_reward( #[cfg(test)] mod tests { use super::*; - use reth_primitives::{MAINNET}; + use reth_primitives::MAINNET; #[test] fn calc_base_block_reward() { diff --git a/crates/consensus/common/src/validation.rs b/crates/consensus/common/src/validation.rs index 49bf6d248d95..6857c4a23084 100644 --- a/crates/consensus/common/src/validation.rs +++ b/crates/consensus/common/src/validation.rs @@ -321,8 +321,8 @@ mod tests { }; use reth_primitives::{ hex_literal::hex, proofs, Account, Address, BlockBody, BlockHash, BlockHashOrNumber, Bytes, - ChainSpecBuilder, Signature, TransactionKind, TransactionSigned, Withdrawal, - Withdrawals, MAINNET, U256, + ChainSpecBuilder, Signature, TransactionKind, TransactionSigned, Withdrawal, Withdrawals, + MAINNET, U256, }; use std::ops::RangeBounds; diff --git a/crates/net/discv4/src/lib.rs b/crates/net/discv4/src/lib.rs index 48a7066fdc50..b81ab478bc28 100644 --- a/crates/net/discv4/src/lib.rs +++ b/crates/net/discv4/src/lib.rs @@ -2193,7 +2193,7 @@ mod tests { use alloy_rlp::{Decodable, Encodable}; use rand::{thread_rng, Rng}; use reth_primitives::{hex, mainnet_nodes, ForkHash}; - use std::{future::poll_fn}; + use std::future::poll_fn; #[tokio::test] async fn test_configured_enr_forkid_entry() { diff --git a/crates/net/downloaders/src/bodies/bodies.rs b/crates/net/downloaders/src/bodies/bodies.rs index 4be064b7d291..f3b9f1a7c390 100644 --- a/crates/net/downloaders/src/bodies/bodies.rs +++ b/crates/net/downloaders/src/bodies/bodies.rs @@ -600,7 +600,7 @@ mod tests { use reth_interfaces::test_utils::{generators, generators::random_block_range, TestConsensus}; use reth_primitives::{BlockBody, B256, MAINNET}; use reth_provider::ProviderFactory; - use std::{collections::HashMap}; + use std::collections::HashMap; // Check that the blocks are emitted in order of block number, not in order of // first-downloaded diff --git a/crates/net/downloaders/src/bodies/request.rs b/crates/net/downloaders/src/bodies/request.rs index d4d97ae67d08..c6f1447a9f27 100644 --- a/crates/net/downloaders/src/bodies/request.rs +++ b/crates/net/downloaders/src/bodies/request.rs @@ -252,9 +252,7 @@ mod tests { bodies::test_utils::zip_blocks, test_utils::{generate_bodies, TestBodiesClient}, }; - use reth_interfaces::{ - test_utils::{generators, generators::random_header_range, TestConsensus}, - }; + use reth_interfaces::test_utils::{generators, generators::random_header_range, TestConsensus}; /// Check if future returns empty bodies without dispathing any requests. #[tokio::test] diff --git a/crates/net/ecies/src/stream.rs b/crates/net/ecies/src/stream.rs index 29fa869b51e2..c84beb7676a7 100644 --- a/crates/net/ecies/src/stream.rs +++ b/crates/net/ecies/src/stream.rs @@ -149,7 +149,7 @@ where mod tests { use super::*; use crate::util::pk2id; - use secp256k1::{SECP256K1}; + use secp256k1::SECP256K1; use tokio::net::{TcpListener, TcpStream}; #[tokio::test] diff --git a/crates/net/eth-wire/src/p2pstream.rs b/crates/net/eth-wire/src/p2pstream.rs index 3688c79c17b4..eef45f44d369 100644 --- a/crates/net/eth-wire/src/p2pstream.rs +++ b/crates/net/eth-wire/src/p2pstream.rs @@ -809,9 +809,7 @@ impl Decodable for ProtocolVersion { #[cfg(test)] mod tests { use super::*; - use crate::{ - capability::SharedCapability, test_utils::eth_hello, EthVersion, - }; + use crate::{capability::SharedCapability, test_utils::eth_hello, EthVersion}; use tokio::net::{TcpListener, TcpStream}; use tokio_util::codec::Decoder; diff --git a/crates/node-core/src/args/payload_builder_args.rs b/crates/node-core/src/args/payload_builder_args.rs index 17670c0f3cd2..a0a3b76314b6 100644 --- a/crates/node-core/src/args/payload_builder_args.rs +++ b/crates/node-core/src/args/payload_builder_args.rs @@ -119,7 +119,7 @@ impl TypedValueParser for ExtradataValueParser { #[cfg(test)] mod tests { use super::*; - use clap::{Parser}; + use clap::Parser; /// A helper type to parse Args more easily #[derive(Parser)] diff --git a/crates/node-core/src/args/pruning_args.rs b/crates/node-core/src/args/pruning_args.rs index da737170bb3d..86808e3ba18f 100644 --- a/crates/node-core/src/args/pruning_args.rs +++ b/crates/node-core/src/args/pruning_args.rs @@ -51,7 +51,7 @@ impl PruningArgs { #[cfg(test)] mod tests { use super::*; - use clap::{Parser}; + use clap::Parser; /// A helper type to parse Args more easily #[derive(Parser)] diff --git a/crates/rpc/rpc-builder/src/auth.rs b/crates/rpc/rpc-builder/src/auth.rs index 70cea96dbad4..b1fc2389acac 100644 --- a/crates/rpc/rpc-builder/src/auth.rs +++ b/crates/rpc/rpc-builder/src/auth.rs @@ -25,7 +25,7 @@ use reth_rpc::{ AuthLayer, BlockingTaskPool, Claims, EngineEthApi, EthApi, EthFilter, EthSubscriptionIdProvider, JwtAuthValidator, JwtSecret, }; -use reth_rpc_api::{servers::*}; +use reth_rpc_api::servers::*; use reth_tasks::TaskSpawner; use reth_transaction_pool::TransactionPool; use std::{ diff --git a/crates/rpc/rpc-builder/src/lib.rs b/crates/rpc/rpc-builder/src/lib.rs index 678ff40f0a12..1f9db9b676a9 100644 --- a/crates/rpc/rpc-builder/src/lib.rs +++ b/crates/rpc/rpc-builder/src/lib.rs @@ -198,7 +198,7 @@ use reth_rpc::{ EthApi, EthFilter, EthPubSub, EthSubscriptionIdProvider, JwtAuthValidator, JwtSecret, NetApi, OtterscanApi, RPCApi, RethApi, TraceApi, TxPoolApi, Web3Api, }; -use reth_rpc_api::{servers::*}; +use reth_rpc_api::servers::*; use reth_tasks::{TaskSpawner, TokioTaskExecutor}; use reth_transaction_pool::{noop::NoopTransactionPool, TransactionPool}; // re-export for convenience diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index 3031bfa4b233..ef0a6f6216cd 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -1424,7 +1424,7 @@ mod tests { use reth_node_ethereum::EthEvmConfig; use reth_primitives::{constants::ETHEREUM_BLOCK_GAS_LIMIT, hex_literal::hex}; use reth_provider::test_utils::NoopProvider; - use reth_transaction_pool::{test_utils::testing_pool}; + use reth_transaction_pool::test_utils::testing_pool; #[tokio::test] async fn send_raw_transaction() { diff --git a/crates/stages/src/stages/index_storage_history.rs b/crates/stages/src/stages/index_storage_history.rs index f2deffabbb7d..73eb53da4ca5 100644 --- a/crates/stages/src/stages/index_storage_history.rs +++ b/crates/stages/src/stages/index_storage_history.rs @@ -120,9 +120,7 @@ mod tests { generators, generators::{random_block_range, random_changeset_range, random_contract_account_range}, }; - use reth_primitives::{ - address, b256, Address, BlockNumber, StorageEntry, B256, U256, - }; + use reth_primitives::{address, b256, Address, BlockNumber, StorageEntry, B256, U256}; use std::collections::BTreeMap; const ADDRESS: Address = address!("0000000000000000000000000000000000000001"); diff --git a/crates/stages/src/stages/merkle.rs b/crates/stages/src/stages/merkle.rs index bf5c2b0f00e5..de94cf9d3d78 100644 --- a/crates/stages/src/stages/merkle.rs +++ b/crates/stages/src/stages/merkle.rs @@ -343,18 +343,14 @@ mod tests { TestStageDB, UnwindStageTestRunner, }; use assert_matches::assert_matches; - use reth_db::{ - cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}, - }; + use reth_db::cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}; use reth_interfaces::test_utils::{ generators, generators::{ random_block, random_block_range, random_changeset_range, random_contract_account_range, }, }; - use reth_primitives::{ - keccak256, stage::StageUnitCheckpoint, SealedBlock, StorageEntry, U256, - }; + use reth_primitives::{keccak256, stage::StageUnitCheckpoint, SealedBlock, StorageEntry, U256}; use reth_trie::test_utils::{state_root, state_root_prehashed}; use std::collections::BTreeMap; diff --git a/crates/stages/src/stages/mod.rs b/crates/stages/src/stages/mod.rs index 3c60eed6cceb..6e63083d753a 100644 --- a/crates/stages/src/stages/mod.rs +++ b/crates/stages/src/stages/mod.rs @@ -39,11 +39,7 @@ pub use tx_lookup::*; #[cfg(test)] mod tests { use super::*; - use crate::{ - stage::Stage, - test_utils::TestStageDB, - ExecInput, - }; + use crate::{stage::Stage, test_utils::TestStageDB, ExecInput}; use alloy_rlp::Decodable; use reth_db::{ cursor::DbCursorRO, diff --git a/crates/stages/src/stages/tx_lookup.rs b/crates/stages/src/stages/tx_lookup.rs index 4e58ed038df1..d5c9202bab78 100644 --- a/crates/stages/src/stages/tx_lookup.rs +++ b/crates/stages/src/stages/tx_lookup.rs @@ -194,7 +194,7 @@ mod tests { generators::{random_block, random_block_range}, }; use reth_primitives::{stage::StageUnitCheckpoint, BlockNumber, SealedBlock, B256}; - use reth_provider::{TransactionsProvider}; + use reth_provider::TransactionsProvider; use std::ops::Sub; // Implement stage test suite. diff --git a/crates/storage/db/src/abstraction/table.rs b/crates/storage/db/src/abstraction/table.rs index 72dc8b9ffc93..a68aa9bb0e23 100644 --- a/crates/storage/db/src/abstraction/table.rs +++ b/crates/storage/db/src/abstraction/table.rs @@ -5,9 +5,7 @@ use crate::{ }; use serde::{Deserialize, Serialize}; -use std::{ - fmt::Debug, -}; +use std::fmt::Debug; /// Trait that will transform the data to be saved in the DB in a (ideally) compressed format pub trait Compress: Send + Sync + Sized + Debug { diff --git a/crates/storage/db/src/implementation/mdbx/mod.rs b/crates/storage/db/src/implementation/mdbx/mod.rs index 21e90bae540f..92e8821d2961 100644 --- a/crates/storage/db/src/implementation/mdbx/mod.rs +++ b/crates/storage/db/src/implementation/mdbx/mod.rs @@ -365,7 +365,7 @@ mod tests { use reth_interfaces::db::{DatabaseWriteError, DatabaseWriteOperation}; use reth_libmdbx::Error; use reth_primitives::{Account, Address, Header, IntegerList, StorageEntry, B256, U256}; - use std::{str::FromStr}; + use std::str::FromStr; use tempfile::TempDir; /// Create database for testing diff --git a/crates/storage/provider/src/chain.rs b/crates/storage/provider/src/chain.rs index 17cf7e199641..ae549043e94f 100644 --- a/crates/storage/provider/src/chain.rs +++ b/crates/storage/provider/src/chain.rs @@ -472,9 +472,7 @@ pub enum ChainSplit { mod tests { use super::*; use reth_primitives::{Receipts, B256}; - use revm::{ - primitives::{AccountInfo, HashMap}, - }; + use revm::primitives::{AccountInfo, HashMap}; #[test] fn chain_append() { diff --git a/crates/transaction-pool/src/blobstore/disk.rs b/crates/transaction-pool/src/blobstore/disk.rs index 4b2dee86ec4e..1359ec07d204 100644 --- a/crates/transaction-pool/src/blobstore/disk.rs +++ b/crates/transaction-pool/src/blobstore/disk.rs @@ -413,11 +413,7 @@ pub enum OpenDiskFileBlobStore { #[cfg(test)] mod tests { use super::*; - use proptest::{ - prelude::*, - strategy::{ValueTree}, - test_runner::TestRunner, - }; + use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner}; use std::sync::atomic::Ordering; fn tmp_store() -> (DiskFileBlobStore, tempfile::TempDir) { From cd2ef64bb206bb4009aa933f6ed713dec28b07e5 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sun, 18 Feb 2024 23:57:42 -0500 Subject: [PATCH 08/10] make clippy happy --- crates/transaction-pool/benches/priority.rs | 6 +----- crates/transaction-pool/benches/reorder.rs | 6 +----- crates/transaction-pool/benches/truncate.rs | 2 +- crates/transaction-pool/src/maintain.rs | 4 +--- crates/trie/benches/prefix_set.rs | 2 +- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/crates/transaction-pool/benches/priority.rs b/crates/transaction-pool/benches/priority.rs index 073b58b85d3b..0c8847fb7057 100644 --- a/crates/transaction-pool/benches/priority.rs +++ b/crates/transaction-pool/benches/priority.rs @@ -2,11 +2,7 @@ use criterion::{ black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, }; -use proptest::{ - prelude::*, - strategy::{Strategy, ValueTree}, - test_runner::TestRunner, -}; +use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner}; use reth_transaction_pool::{blob_tx_priority, fee_delta}; fn generate_test_data_fee_delta() -> (u128, u128) { diff --git a/crates/transaction-pool/benches/reorder.rs b/crates/transaction-pool/benches/reorder.rs index b81f0dafce03..d3a8f34e9360 100644 --- a/crates/transaction-pool/benches/reorder.rs +++ b/crates/transaction-pool/benches/reorder.rs @@ -2,11 +2,7 @@ use criterion::{ criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, }; -use proptest::{ - prelude::*, - strategy::{Strategy, ValueTree}, - test_runner::TestRunner, -}; +use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner}; use reth_transaction_pool::test_utils::MockTransaction; /// Transaction Pool trait for benching. diff --git a/crates/transaction-pool/benches/truncate.rs b/crates/transaction-pool/benches/truncate.rs index 8a34c18fbf56..63f433473915 100644 --- a/crates/transaction-pool/benches/truncate.rs +++ b/crates/transaction-pool/benches/truncate.rs @@ -4,7 +4,7 @@ use criterion::{ }; use proptest::{ prelude::*, - strategy::{Strategy, ValueTree}, + strategy::ValueTree, test_runner::{RngAlgorithm, TestRng, TestRunner}, }; use reth_primitives::{hex_literal::hex, Address}; diff --git a/crates/transaction-pool/src/maintain.rs b/crates/transaction-pool/src/maintain.rs index b74fcc5a5efd..8fa99f87d3a0 100644 --- a/crates/transaction-pool/src/maintain.rs +++ b/crates/transaction-pool/src/maintain.rs @@ -671,9 +671,7 @@ mod tests { blobstore::InMemoryBlobStore, validate::EthTransactionValidatorBuilder, CoinbaseTipOrdering, EthPooledTransaction, Pool, PoolTransaction, TransactionOrigin, }; - use reth_primitives::{ - fs, hex, FromRecoveredPooledTransaction, PooledTransactionsElement, MAINNET, U256, - }; + use reth_primitives::{fs, hex, PooledTransactionsElement, MAINNET, U256}; use reth_provider::test_utils::{ExtendedAccount, MockEthProvider}; use reth_tasks::TaskManager; diff --git a/crates/trie/benches/prefix_set.rs b/crates/trie/benches/prefix_set.rs index 7ff96cd84c34..89388f2e6890 100644 --- a/crates/trie/benches/prefix_set.rs +++ b/crates/trie/benches/prefix_set.rs @@ -4,7 +4,7 @@ use criterion::{ }; use proptest::{ prelude::*, - strategy::{Strategy, ValueTree}, + strategy::ValueTree, test_runner::{basic_result_cache, TestRunner}, }; use reth_primitives::trie::Nibbles; From bde39442aff160f6fb4099c49a5caf999b998f8a Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sun, 18 Feb 2024 23:59:39 -0500 Subject: [PATCH 09/10] make clippy happy --- crates/revm/src/processor.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/revm/src/processor.rs b/crates/revm/src/processor.rs index f10f375d8c3f..f8244112bdca 100644 --- a/crates/revm/src/processor.rs +++ b/crates/revm/src/processor.rs @@ -597,9 +597,7 @@ mod tests { Account, Bytecode, Bytes, ChainSpecBuilder, ForkCondition, Signature, StorageKey, Transaction, TransactionKind, TxEip1559, MAINNET, }; - use reth_provider::{ - AccountReader, BlockHashReader, BundleStateWithReceipts, StateRootProvider, - }; + use reth_provider::{AccountReader, BlockHashReader, StateRootProvider}; use reth_trie::updates::TrieUpdates; use revm::{Database, TransitionState}; use std::collections::HashMap; From 748008a36ddf115fb1eea0365c27069e4e9db760 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Mon, 19 Feb 2024 00:03:48 -0500 Subject: [PATCH 10/10] make clippy happy --- crates/revm/src/processor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/revm/src/processor.rs b/crates/revm/src/processor.rs index f8244112bdca..d9442697cade 100644 --- a/crates/revm/src/processor.rs +++ b/crates/revm/src/processor.rs @@ -597,6 +597,8 @@ mod tests { Account, Bytecode, Bytes, ChainSpecBuilder, ForkCondition, Signature, StorageKey, Transaction, TransactionKind, TxEip1559, MAINNET, }; + #[cfg(feature = "optimism")] + use reth_provider::BundleStateWithReceipts; use reth_provider::{AccountReader, BlockHashReader, StateRootProvider}; use reth_trie::updates::TrieUpdates; use revm::{Database, TransitionState};