chore: fix some warnings (#7515)

This commit is contained in:
DaniPopes
2024-04-08 20:10:10 +02:00
committed by GitHub
parent 6a104cc174
commit 3826772886
23 changed files with 25 additions and 137 deletions

8
Cargo.lock generated
View File

@ -2002,7 +2002,6 @@ dependencies = [
name = "custom-evm"
version = "0.0.0"
dependencies = [
"alloy-chains",
"eyre",
"reth",
"reth-node-api",
@ -2027,7 +2026,6 @@ dependencies = [
name = "custom-node"
version = "0.0.0"
dependencies = [
"alloy-chains",
"eyre",
"reth",
"reth-basic-payload-builder",
@ -6050,7 +6048,6 @@ dependencies = [
name = "reth"
version = "0.2.0-beta.5"
dependencies = [
"alloy-chains",
"alloy-rlp",
"aquamarine",
"assert_matches",
@ -6368,7 +6365,6 @@ dependencies = [
name = "reth-dns-discovery"
version = "0.2.0-beta.5"
dependencies = [
"alloy-chains",
"alloy-rlp",
"data-encoding",
"enr",
@ -6451,7 +6447,6 @@ dependencies = [
name = "reth-eth-wire"
version = "0.2.0-beta.5"
dependencies = [
"alloy-chains",
"alloy-rlp",
"arbitrary",
"async-stream",
@ -6486,7 +6481,6 @@ dependencies = [
name = "reth-eth-wire-types"
version = "0.2.0-beta.5"
dependencies = [
"alloy-chains",
"alloy-rlp",
"arbitrary",
"async-stream",
@ -6751,7 +6745,6 @@ dependencies = [
name = "reth-network-api"
version = "0.2.0-beta.5"
dependencies = [
"alloy-chains",
"reth-discv4",
"reth-eth-wire",
"reth-primitives",
@ -7451,7 +7444,6 @@ dependencies = [
name = "reth-trie"
version = "0.2.0-beta.5"
dependencies = [
"alloy-chains",
"alloy-rlp",
"auto_impl",
"criterion",

View File

@ -254,22 +254,17 @@ reth-trie = { path = "crates/trie" }
reth-trie-parallel = { path = "crates/trie-parallel" }
# revm
revm = { version = "8.0.0", features = [
"std",
"secp256k1",
], default-features = false }
revm-primitives = { version = "3.1.0", features = [
"std",
], default-features = false }
revm = { version = "8.0.0", features = ["std", "secp256k1"], default-features = false }
revm-primitives = { version = "3.1.0", features = ["std"], default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "5baa6b3" }
# eth
alloy-chains = { version = "0.1", feature = ["serde", "rlp", "arbitrary"] }
alloy-chains = "0.1.15"
alloy-primitives = "0.7.0"
alloy-dyn-abi = "0.7.0"
alloy-sol-types = "0.7.0"
alloy-rlp = "0.3.4"
alloy-trie = "0.3"
alloy-trie = "0.3.1"
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
@ -282,7 +277,6 @@ alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "6aab21
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
# misc
aquamarine = "0.5"
bytes = "1.5"

View File

@ -54,7 +54,6 @@ reth-node-builder.workspace = true
# crypto
alloy-rlp.workspace = true
alloy-chains.workspace = true
# tracing
tracing.workspace = true
@ -127,7 +126,7 @@ optimism = [
"reth-auto-seal-consensus/optimism",
"reth-blockchain-tree/optimism",
"dep:reth-node-optimism",
"reth-node-core/optimism"
"reth-node-core/optimism",
]
# no-op feature flag for switching between the `optimism` and default functionality in CI matrices

View File

@ -41,7 +41,6 @@ serde_with = { version = "3.3.0", optional = true }
[dev-dependencies]
tokio = { workspace = true, features = ["sync", "rt", "rt-multi-thread"] }
reth-tracing.workspace = true
alloy-chains.workspace = true
[features]
default = ["serde"]

View File

@ -412,10 +412,9 @@ fn convert_enr_node_record(enr: &Enr<SecretKey>) -> Option<DnsNodeRecordUpdate>
mod tests {
use super::*;
use crate::tree::TreeRootEntry;
use alloy_chains::Chain;
use alloy_rlp::Encodable;
use enr::EnrKey;
use reth_primitives::{Hardfork, MAINNET};
use reth_primitives::{Chain, Hardfork, MAINNET};
use secp256k1::rand::thread_rng;
use std::{future::poll_fn, net::Ipv4Addr};

View File

@ -17,7 +17,6 @@ workspace = true
reth-codecs.workspace = true
reth-primitives.workspace = true
alloy-rlp = { workspace = true, features = ["derive"] }
alloy-chains = { workspace = true, features = ["serde", "rlp", "arbitrary"] }
bytes.workspace = true
derive_more.workspace = true

View File

@ -1,8 +1,9 @@
use crate::EthVersion;
use alloy_chains::{Chain, NamedChain};
use alloy_rlp::{RlpDecodable, RlpEncodable};
use reth_codecs::derive_arbitrary;
use reth_primitives::{hex, ChainSpec, ForkId, Genesis, Hardfork, Head, B256, MAINNET, U256};
use reth_primitives::{
hex, Chain, ChainSpec, ForkId, Genesis, Hardfork, Head, NamedChain, B256, MAINNET, U256,
};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::fmt::{Debug, Display};
@ -227,11 +228,11 @@ impl StatusBuilder {
#[cfg(test)]
mod tests {
use crate::{EthVersion, Status};
use alloy_chains::{Chain, NamedChain};
use alloy_rlp::{Decodable, Encodable};
use rand::Rng;
use reth_primitives::{
hex, ChainSpec, ForkCondition, ForkHash, ForkId, Genesis, Hardfork, Head, B256, U256,
hex, Chain, ChainSpec, ForkCondition, ForkHash, ForkId, Genesis, Hardfork, Head,
NamedChain, B256, U256,
};
use std::str::FromStr;

View File

@ -17,7 +17,6 @@ reth-codecs.workspace = true
reth-primitives.workspace = true
reth-ecies.workspace = true
alloy-rlp = { workspace = true, features = ["derive"] }
alloy-chains = { workspace = true, features = ["serde", "rlp", "arbitrary"] }
reth-discv4.workspace = true
reth-eth-wire-types.workspace = true

View File

@ -1,82 +0,0 @@
//! Builder structs for messages.
use crate::Status;
use alloy_chains::Chain;
use reth_primitives::{ForkId, B256, U256};
/// Builder for [`Status`] messages.
///
/// # Example
/// ```
/// use reth_eth_wire::{types::Status, EthVersion};
/// use reth_primitives::{Chain, Hardfork, B256, MAINNET, MAINNET_GENESIS_HASH, U256};
///
/// // this is just an example status message!
/// let status = Status::builder()
/// .version(EthVersion::Eth66.into())
/// .chain(Chain::mainnet())
/// .total_difficulty(U256::from(100))
/// .blockhash(B256::from(MAINNET_GENESIS_HASH))
/// .genesis(B256::from(MAINNET_GENESIS_HASH))
/// .forkid(MAINNET.hardfork_fork_id(Hardfork::Paris).unwrap())
/// .build();
///
/// assert_eq!(
/// status,
/// Status {
/// version: EthVersion::Eth66.into(),
/// chain: Chain::mainnet(),
/// total_difficulty: U256::from(100),
/// blockhash: B256::from(MAINNET_GENESIS_HASH),
/// genesis: B256::from(MAINNET_GENESIS_HASH),
/// forkid: MAINNET.hardfork_fork_id(Hardfork::Paris).unwrap(),
/// }
/// );
/// ```
#[derive(Debug, Default)]
pub struct StatusBuilder {
status: Status,
}
impl StatusBuilder {
/// Consumes the type and creates the actual [`Status`] message.
pub fn build(self) -> Status {
self.status
}
/// Sets the protocol version.
pub fn version(mut self, version: u8) -> Self {
self.status.version = version;
self
}
/// Sets the chain id.
pub fn chain(mut self, chain: Chain) -> Self {
self.status.chain = chain;
self
}
/// Sets the total difficulty.
pub fn total_difficulty(mut self, total_difficulty: U256) -> Self {
self.status.total_difficulty = total_difficulty;
self
}
/// Sets the block hash.
pub fn blockhash(mut self, blockhash: B256) -> Self {
self.status.blockhash = blockhash;
self
}
/// Sets the genesis hash.
pub fn genesis(mut self, genesis: B256) -> Self {
self.status.genesis = genesis;
self
}
/// Sets the fork id.
pub fn forkid(mut self, forkid: ForkId) -> Self {
self.status.forkid = forkid;
self
}
}

View File

@ -6,8 +6,7 @@ use crate::{
version::ParseVersionError,
DisconnectReason,
};
use alloy_chains::Chain;
use reth_primitives::{GotExpected, GotExpectedBoxed, ValidationError, B256};
use reth_primitives::{Chain, GotExpected, GotExpectedBoxed, ValidationError, B256};
use std::io;
/// Errors when sending/receiving messages

View File

@ -351,11 +351,10 @@ mod tests {
p2pstream::{ProtocolVersion, UnauthedP2PStream},
EthMessage, EthStream, EthVersion, HelloMessageWithProtocols, PassthroughCodec, Status,
};
use alloy_chains::NamedChain;
use futures::{SinkExt, StreamExt};
use reth_discv4::DEFAULT_DISCOVERY_PORT;
use reth_ecies::stream::ECIESStream;
use reth_primitives::{pk2id, ForkFilter, Head, B256, U256};
use reth_primitives::{pk2id, ForkFilter, Head, NamedChain, B256, U256};
use secp256k1::{SecretKey, SECP256K1};
use std::time::Duration;
use tokio::net::{TcpListener, TcpStream};

View File

@ -3,9 +3,8 @@
use crate::{
EthVersion, HelloMessageWithProtocols, P2PStream, ProtocolVersion, Status, UnauthedP2PStream,
};
use alloy_chains::Chain;
use reth_discv4::DEFAULT_DISCOVERY_PORT;
use reth_primitives::{pk2id, ForkFilter, Head, B256, U256};
use reth_primitives::{pk2id, Chain, ForkFilter, Head, B256, U256};
use secp256k1::{SecretKey, SECP256K1};
use std::net::SocketAddr;
use tokio::net::TcpStream;

View File

@ -17,7 +17,6 @@ reth-primitives.workspace = true
reth-eth-wire.workspace = true
reth-rpc-types.workspace = true
reth-discv4.workspace = true
alloy-chains.workspace = true
# io
serde = { workspace = true, features = ["derive"], optional = true }

View File

@ -7,10 +7,9 @@ use crate::{
NetworkError, NetworkInfo, PeerInfo, PeerKind, Peers, PeersInfo, Reputation,
ReputationChangeKind,
};
use alloy_chains::Chain;
use reth_discv4::DEFAULT_DISCOVERY_PORT;
use reth_eth_wire::{DisconnectReason, ProtocolVersion};
use reth_primitives::{NodeRecord, PeerId};
use reth_primitives::{Chain, NodeRecord, PeerId};
use reth_rpc_types::{EthProtocolInfo, NetworkStatus};
use std::net::{IpAddr, SocketAddr};

View File

@ -7,10 +7,9 @@ use crate::{
net::{goerli_nodes, mainnet_nodes, sepolia_nodes},
proofs::state_root_ref_unhashed,
revm_primitives::{address, b256},
Address, BlockNumber, ForkFilter, ForkFilterKey, ForkHash, ForkId, Genesis, Hardfork, Head,
Header, NodeRecord, SealedHeader, B256, EMPTY_OMMER_ROOT_HASH, U256,
Address, BlockNumber, Chain, ForkFilter, ForkFilterKey, ForkHash, ForkId, Genesis, Hardfork,
Head, Header, NamedChain, NodeRecord, SealedHeader, B256, EMPTY_OMMER_ROOT_HASH, U256,
};
use alloy_chains::{Chain, NamedChain};
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use std::{

View File

@ -142,7 +142,7 @@ mod tests {
{
#[inline(always)]
fn op_cs(f: impl FnOnce(ChainSpecBuilder) -> ChainSpecBuilder) -> ChainSpec {
let cs = ChainSpecBuilder::mainnet().chain(alloy_chains::Chain::from_id(10));
let cs = ChainSpecBuilder::mainnet().chain(crate::Chain::from_id(10));
f(cs).build()
}

View File

@ -11,17 +11,17 @@ use reth_provider::{AccountReader, BlockHashReader, StateProvider, StateRootProv
use reth_trie::updates::TrieUpdates;
use revm::{
db::BundleState,
inspector_handle_register,
primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
GetInspector,
};
use std::collections::HashMap;
#[cfg(feature = "optimism")]
use {
reth_primitives::revm::env::fill_op_tx_env,
revm::{
inspector_handle_register,
primitives::{HandlerCfg, SpecId},
Database, Evm, EvmBuilder,
Database, Evm, EvmBuilder, GetInspector,
},
};

View File

@ -20,7 +20,6 @@ revm.workspace = true
# alloy
alloy-rlp.workspace = true
alloy-chains.workspace = true
# tracing
tracing.workspace = true

View File

@ -165,11 +165,10 @@ where
mod tests {
use super::*;
use crate::StateRoot;
use alloy_chains::Chain;
use once_cell::sync::Lazy;
use reth_db::database::Database;
use reth_interfaces::RethResult;
use reth_primitives::{Account, Bytes, ChainSpec, StorageEntry, HOLESKY, MAINNET, U256};
use reth_primitives::{Account, Bytes, Chain, ChainSpec, StorageEntry, HOLESKY, MAINNET, U256};
use reth_provider::{test_utils::create_test_provider_factory, HashingWriter, ProviderFactory};
use std::{str::FromStr, sync::Arc};

View File

@ -13,6 +13,5 @@ reth-primitives.workspace = true
reth-node-ethereum.workspace = true
reth-tracing.workspace = true
alloy-chains.workspace = true
eyre.workspace = true
tokio.workspace = true

View File

@ -2,7 +2,6 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
use alloy_chains::Chain;
use reth::{
builder::{node::NodeTypes, NodeBuilder},
primitives::{
@ -21,7 +20,7 @@ use reth::{
use reth_node_api::{ConfigureEvm, ConfigureEvmEnv};
use reth_node_core::{args::RpcServerArgs, node_config::NodeConfig};
use reth_node_ethereum::{EthEngineTypes, EthEvmConfig, EthereumNode};
use reth_primitives::{ChainSpec, Genesis, Header, Transaction};
use reth_primitives::{Chain, ChainSpec, Genesis, Header, Transaction};
use reth_tracing::{RethTracer, Tracer};
use std::sync::Arc;

View File

@ -17,7 +17,6 @@ reth-ethereum-payload-builder.workspace = true
reth-node-ethereum.workspace = true
reth-tracing.workspace = true
alloy-chains.workspace = true
eyre.workspace = true
tokio.workspace = true
thiserror.workspace = true

View File

@ -17,7 +17,6 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
use alloy_chains::Chain;
use reth::{
builder::{
components::{ComponentsBuilder, PayloadServiceBuilder},
@ -46,7 +45,7 @@ use reth_payload_builder::{
error::PayloadBuilderError, EthBuiltPayload, EthPayloadBuilderAttributes, PayloadBuilderHandle,
PayloadBuilderService,
};
use reth_primitives::{Address, ChainSpec, Genesis, Header, Withdrawals, B256};
use reth_primitives::{Address, Chain, ChainSpec, Genesis, Header, Withdrawals, B256};
use reth_rpc_types::{
engine::{
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3,