Skip to content

Commit

Permalink
chore: remove most ethers mentions and code (#6999)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Mar 6, 2024
1 parent c7826cb commit a1df972
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 326 deletions.
275 changes: 3 additions & 272 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion book/intro.md
Expand Up @@ -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**

Expand Down
3 changes: 1 addition & 2 deletions crates/net/eth-wire/Cargo.toml
Expand Up @@ -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
Expand Down Expand Up @@ -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"] }
Expand Down
9 changes: 6 additions & 3 deletions crates/net/network/Cargo.toml
Expand Up @@ -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"] }

Expand All @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/Cargo.toml
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
43 changes: 0 additions & 43 deletions crates/primitives/src/header.rs
Expand Up @@ -988,49 +988,6 @@ impl From<HeadersDirection> for bool {
}
}

#[cfg(feature = "test-utils")]
mod ethers_compat {
use super::*;
use ethers_core::types::{Block, H256};

impl From<&Block<H256>> for Header {
fn from(block: &Block<H256>) -> 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<H256>> for SealedHeader {
fn from(block: &Block<H256>) -> 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};
Expand Down

0 comments on commit a1df972

Please sign in to comment.