From a1df9724643c0992e3121b94312ccb36212686c6 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Wed, 6 Mar 2024 15:38:15 +0100 Subject: [PATCH] chore: remove most ethers mentions and code (#6999) --- Cargo.lock | 275 +------------------------------- Cargo.toml | 4 +- README.md | 2 +- book/intro.md | 2 +- crates/net/eth-wire/Cargo.toml | 3 +- crates/net/network/Cargo.toml | 9 +- crates/primitives/Cargo.toml | 3 +- crates/primitives/src/header.rs | 43 ----- 8 files changed, 15 insertions(+), 326 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 744b09f63..ea700e47b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,16 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - [[package]] name = "additional-rpc-namespace-in-cli" version = "0.0.0" @@ -807,12 +797,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "bech32" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" - [[package]] name = "beef" version = "0.5.2" @@ -1137,16 +1121,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "bs58" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" -dependencies = [ - "sha2", - "tinyvec", -] - [[package]] name = "bstr" version = "0.2.17" @@ -1400,58 +1374,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" -[[package]] -name = "coins-bip32" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" -dependencies = [ - "bs58", - "coins-core", - "digest 0.10.7", - "hmac", - "k256", - "serde", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-bip39" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" -dependencies = [ - "bitvec", - "coins-bip32", - "hmac", - "once_cell", - "pbkdf2 0.12.2", - "rand 0.8.5", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-core" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" -dependencies = [ - "base64 0.21.7", - "bech32", - "bs58", - "digest 0.10.7", - "generic-array", - "hex", - "ripemd", - "serde", - "serde_derive", - "sha2", - "sha3", - "thiserror", -] - [[package]] name = "colorchoice" version = "1.0.0" @@ -2024,7 +1946,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ - "uuid 1.7.0", + "uuid", ] [[package]] @@ -2473,28 +2395,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "eth-keystore" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" -dependencies = [ - "aes 0.8.4", - "ctr 0.9.2", - "digest 0.10.7", - "hex", - "hmac", - "pbkdf2 0.11.0", - "rand 0.8.5", - "scrypt", - "serde", - "serde_json", - "sha2", - "sha3", - "thiserror", - "uuid 0.8.2", -] - [[package]] name = "ethabi" version = "18.0.0" @@ -2566,63 +2466,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ethers-contract" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43304317c7f776876e47f2f637859f6d0701c1ec7930a150f169d5fbe7d76f5a" -dependencies = [ - "const-hex", - "ethers-contract-abigen", - "ethers-contract-derive", - "ethers-core", - "ethers-providers", - "futures-util", - "once_cell", - "pin-project", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "ethers-contract-abigen" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f96502317bf34f6d71a3e3d270defaa9485d754d789e15a8e04a84161c95eb" -dependencies = [ - "Inflector", - "const-hex", - "dunce", - "ethers-core", - "eyre", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "serde", - "serde_json", - "syn 2.0.52", - "toml", - "walkdir", -] - -[[package]] -name = "ethers-contract-derive" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452ff6b0a64507ce8d67ffd48b1da3b42f03680dcf5382244e9c93822cbbf5de" -dependencies = [ - "Inflector", - "const-hex", - "ethers-contract-abigen", - "ethers-core", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.52", -] - [[package]] name = "ethers-core" version = "2.0.13" @@ -2631,7 +2474,6 @@ checksum = "aab3cef6cc1c9fd7f787043c81ad3052eff2b96a3878ef1526aa446311bdbfc9" dependencies = [ "arrayvec", "bytes", - "cargo_metadata", "chrono", "const-hex", "elliptic-curve", @@ -2639,46 +2481,18 @@ dependencies = [ "generic-array", "k256", "num_enum 0.7.2", - "once_cell", "open-fastrlp", "rand 0.8.5", "rlp", "serde", "serde_json", "strum 0.25.0", - "syn 2.0.52", "tempfile", "thiserror", "tiny-keccak", "unicode-xid", ] -[[package]] -name = "ethers-middleware" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145211f34342487ef83a597c1e69f0d3e01512217a7c72cc8a25931854c7dca0" -dependencies = [ - "async-trait", - "auto_impl", - "ethers-contract", - "ethers-core", - "ethers-providers", - "ethers-signers", - "futures-channel", - "futures-locks", - "futures-util", - "instant", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "url", -] - [[package]] name = "ethers-providers" version = "2.0.13" @@ -2717,25 +2531,6 @@ dependencies = [ "ws_stream_wasm", ] -[[package]] -name = "ethers-signers" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3b125a103b56aef008af5d5fb48191984aa326b50bfd2557d231dc499833de3" -dependencies = [ - "async-trait", - "coins-bip32", - "coins-bip39", - "const-hex", - "elliptic-curve", - "eth-keystore", - "ethers-core", - "rand 0.8.5", - "sha2", - "thiserror", - "tracing", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -2959,16 +2754,6 @@ dependencies = [ "waker-fn", ] -[[package]] -name = "futures-locks" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" -dependencies = [ - "futures-channel", - "futures-task", -] - [[package]] name = "futures-macro" version = "0.3.30" @@ -4925,25 +4710,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest 0.10.7", - "hmac", -] - [[package]] name = "peeking_take_while" version = "0.1.2" @@ -6111,7 +5877,6 @@ dependencies = [ "async-stream", "bytes", "derive_more", - "ethers-core", "futures", "metrics", "pin-project", @@ -6305,9 +6070,7 @@ dependencies = [ "derive_more", "enr", "ethers-core", - "ethers-middleware", "ethers-providers", - "ethers-signers", "fnv", "futures", "futures-test", @@ -6613,7 +6376,6 @@ dependencies = [ "clap", "criterion", "derive_more", - "ethers-core", "hash-db", "itertools 0.12.1", "modular-bitfield", @@ -7415,15 +7177,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f" -[[package]] -name = "salsa20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher 0.4.4", -] - [[package]] name = "same-file" version = "1.0.6" @@ -7483,18 +7236,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "scrypt" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" -dependencies = [ - "hmac", - "pbkdf2 0.11.0", - "salsa20", - "sha2", -] - [[package]] name = "sct" version = "0.7.1" @@ -8127,7 +7868,7 @@ dependencies = [ "debugid", "memmap2 0.9.4", "stable_deref_trait", - "uuid 1.7.0", + "uuid", ] [[package]] @@ -8615,7 +8356,7 @@ dependencies = [ "tower-layer", "tower-service", "tracing", - "uuid 1.7.0", + "uuid", ] [[package]] @@ -9040,16 +8781,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom 0.2.12", - "serde", -] - [[package]] name = "uuid" version = "1.7.0" diff --git a/Cargo.toml b/Cargo.toml index ca400b97e..47e4e7cb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -201,10 +201,10 @@ alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy", rev = "975 alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "975a52a" } alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "975a52a" } alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "975a52a" } + +# TODO: Remove ethers-core = { version = "2.0", default-features = false } ethers-providers = { version = "2.0", default-features = false } -ethers-signers = { version = "2.0", default-features = false } -ethers-middleware = { version = "2.0", default-features = false } discv5 = { git = "https://github.com/sigp/discv5", rev = "f289bbd4c57d499bb1bdb393af3c249600a1c662" } # Fork of rust-igd with ipv6 support diff --git a/README.md b/README.md index c9ea2cb6d..f9c356dbe 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ As a full Ethereum node, Reth allows users to connect to the Ethereum network an More concretely, our goals are: 1. **Modularity**: Every component of Reth is built to be used as a library: well-tested, heavily documented and benchmarked. We envision that developers will import the node's crates, mix and match, and innovate on top of them. Examples of such usage include but are not limited to spinning up standalone P2P networks, talking directly to a node's database, or "unbundling" the node into the components you need. To achieve that, we are licensing Reth under the Apache/MIT permissive license. You can learn more about the project's components [here](./docs/repo/layout.md). -2. **Performance**: Reth aims to be fast, so we used Rust and the [Erigon staged-sync](https://erigon.substack.com/p/erigon-stage-sync-and-control-flows) node architecture. We also use our Ethereum libraries (including [ethers-rs](https://github.com/gakonst/ethers-rs/) and [revm](https://github.com/bluealloy/revm/)) which we’ve battle-tested and optimized via [Foundry](https://github.com/foundry-rs/foundry/). +2. **Performance**: Reth aims to be fast, so we used Rust and the [Erigon staged-sync](https://erigon.substack.com/p/erigon-stage-sync-and-control-flows) node architecture. We also use our Ethereum libraries (including [Alloy](https://github.com/alloy-rs/alloy/) and [revm](https://github.com/bluealloy/revm/)) which we’ve battle-tested and optimized via [Foundry](https://github.com/foundry-rs/foundry/). 3. **Free for anyone to use any way they want**: Reth is free open source software, built for the community, by the community. By licensing the software under the Apache/MIT license, we want developers to use it without being bound by business licenses, or having to think about the implications of GPL-like licenses. 4. **Client Diversity**: The Ethereum protocol becomes more antifragile when no node implementation dominates. This ensures that if there's a software bug, the network does not finalize a bad block. By building a new client, we hope to contribute to Ethereum's antifragility. 5. **Support as many EVM chains as possible**: We aspire that Reth can full-sync not only Ethereum, but also other chains like Optimism, Polygon, BNB Smart Chain, and more. If you're working on any of these projects, please reach out. diff --git a/book/intro.md b/book/intro.md index 3d739ba17..71ea24e9f 100644 --- a/book/intro.md +++ b/book/intro.md @@ -35,7 +35,7 @@ To achieve that, we are licensing Reth under the Apache/MIT permissive license. Reth aims to be fast, so we used Rust and the [Erigon staged-sync](https://erigon.substack.com/p/erigon-stage-sync-and-control-flows) node architecture. -We also use our Ethereum libraries (including [ethers-rs](https://github.com/gakonst/ethers-rs/) and [revm](https://github.com/bluealloy/revm/)) which we’ve battle-tested and optimized via [Foundry](https://github.com/foundry-rs/foundry/). +We also use our Ethereum libraries (including [Alloy](https://github.com/alloy-rs/alloy/) and [revm](https://github.com/bluealloy/revm/)) which we’ve battle-tested and optimized via [Foundry](https://github.com/foundry-rs/foundry/). **3. Free for anyone to use any way they want** diff --git a/crates/net/eth-wire/Cargo.toml b/crates/net/eth-wire/Cargo.toml index bab06af47..dba0d168e 100644 --- a/crates/net/eth-wire/Cargo.toml +++ b/crates/net/eth-wire/Cargo.toml @@ -17,7 +17,7 @@ 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"] } +alloy-chains = { workspace = true, features = ["serde", "rlp", "arbitrary"] } reth-discv4.workspace = true # metrics @@ -45,7 +45,6 @@ proptest-derive = { workspace = true, optional = true } reth-net-common.workspace = true reth-primitives = { workspace = true, features = ["arbitrary"] } reth-tracing.workspace = true -ethers-core = { workspace = true, default-features = false } test-fuzz.workspace = true tokio-util = { workspace = true, features = ["io", "codec"] } diff --git a/crates/net/network/Cargo.toml b/crates/net/network/Cargo.toml index 8035ac7db..ad387d8f7 100644 --- a/crates/net/network/Cargo.toml +++ b/crates/net/network/Cargo.toml @@ -81,8 +81,6 @@ reth-transaction-pool = { workspace = true, features = ["test-utils"] } alloy-node-bindings.workspace = true ethers-core = { workspace = true, default-features = false } ethers-providers = { workspace = true, default-features = false, features = ["ws"] } -ethers-signers = { workspace = true, default-features = false } -ethers-middleware = { workspace = true, default-features = false } enr = { workspace = true, features = ["serde", "rust-secp256k1"] } @@ -97,7 +95,12 @@ criterion = { workspace = true, features = ["async_tokio", "html_reports"] } [features] default = ["serde"] serde = ["dep:serde", "dep:humantime-serde", "secp256k1/serde", "enr?/serde", "dep:serde_json"] -test-utils = ["reth-provider/test-utils", "dep:enr", "dep:tempfile", "reth-transaction-pool/test-utils"] +test-utils = [ + "reth-provider/test-utils", + "dep:enr", + "dep:tempfile", + "reth-transaction-pool/test-utils", +] geth-tests = [] optimism = [ "reth-primitives/optimism", diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 875c5ed55..00dbe73a9 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -24,7 +24,6 @@ alloy-chains = { workspace = true, features = ["serde", "rlp"] } alloy-primitives = { workspace = true, features = ["rand", "rlp"] } alloy-rlp = { workspace = true, features = ["arrayvec"] } alloy-trie = { workspace = true, features = ["serde"] } -ethers-core = { workspace = true, default-features = false, optional = true } nybbles = { workspace = true, features = ["serde", "rlp"] } alloy-genesis.workspace = true alloy-eips.workspace = true @@ -110,7 +109,7 @@ optimism = [ "reth-ethereum-forks/optimism", "revm/optimism", ] -test-utils = ["dep:plain_hasher", "dep:hash-db", "dep:ethers-core"] +test-utils = ["dep:plain_hasher", "dep:hash-db"] [[bench]] name = "recover_ecdsa_crit" diff --git a/crates/primitives/src/header.rs b/crates/primitives/src/header.rs index 96b00a337..d6a606321 100644 --- a/crates/primitives/src/header.rs +++ b/crates/primitives/src/header.rs @@ -988,49 +988,6 @@ impl From for bool { } } -#[cfg(feature = "test-utils")] -mod ethers_compat { - use super::*; - use ethers_core::types::{Block, H256}; - - impl From<&Block> for Header { - fn from(block: &Block) -> Self { - Header { - parent_hash: block.parent_hash.0.into(), - number: block.number.unwrap().as_u64(), - gas_limit: block.gas_limit.as_u64(), - difficulty: U256::from_limbs(block.difficulty.0), - nonce: block.nonce.unwrap().to_low_u64_be(), - extra_data: block.extra_data.0.clone().into(), - state_root: block.state_root.0.into(), - transactions_root: block.transactions_root.0.into(), - receipts_root: block.receipts_root.0.into(), - timestamp: block.timestamp.as_u64(), - mix_hash: block.mix_hash.unwrap().0.into(), - beneficiary: block.author.unwrap().0.into(), - base_fee_per_gas: block.base_fee_per_gas.map(|fee| fee.as_u64()), - ommers_hash: block.uncles_hash.0.into(), - gas_used: block.gas_used.as_u64(), - withdrawals_root: None, - logs_bloom: block.logs_bloom.unwrap_or_default().0.into(), - blob_gas_used: None, - excess_blob_gas: None, - parent_beacon_block_root: None, - } - } - } - - impl From<&Block> for SealedHeader { - fn from(block: &Block) -> Self { - let header = Header::from(block); - match block.hash { - Some(hash) => header.seal(hash.0.into()), - None => header.seal_slow(), - } - } - } -} - #[cfg(test)] mod tests { use super::{Bytes, Decodable, Encodable, Header, B256};