Skip to content

Commit 09c0452

Browse files
authored
chore: migrate crates/node to use reth-op meta-crate (#169)
> The Cargo.toml file has a lot of reth dependencies, reth recently added the reth-op crate which re-exports all of the crates behind feature flags. Try to transition the dependencies of the crates in this workspace to reth-op enabling the necessary features (node or full and cli). Similar migrations have been made to the crates in the reth repository's examples folder, which can be a helpful reference for this task. > > In addition to that remove unused dependencies from this workspace dependencies > > try to reduce individual reth- crate dependencies in crates/node by replacing them with a reth_op dependency with the full and cli feature and update the use statements accordingly so they use the re-exported types from reth-op. ## Summary Migrates `crates/node` to use the `reth-op` meta-crate, reducing individual reth dependencies from 24 to 11. ### Changes: - Added `reth-op` dependency with `["full", "cli"]` features - Updated import paths to use reth-op's re-exported modules: - `reth_network` → `reth_op::network` - `reth_transaction_pool` → `reth_op::pool` - `reth_chainspec` → `reth_op::chainspec` - `reth_primitives_traits` → `reth_op::primitives` - etc. - Removed 13 individual reth dependencies now accessed through reth-op - Retained 11 dependencies not fully re-exported by reth-op All tests pass and the codebase builds successfully.
1 parent d071e1b commit 09c0452

File tree

11 files changed

+206
-204
lines changed

11 files changed

+206
-204
lines changed

Cargo.lock

Lines changed: 149 additions & 119 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ alloy = { version = "1.0.9", features = [
149149
"signers",
150150
"reqwest-rustls-tls",
151151
], default-features = false }
152-
alloy-consensus = { version = "1.0.9", default-features = false }
153152
alloy-eips = { version = "1.0.9", default-features = false }
154153
alloy-network = { version = "1.0.9", default-features = false }
155154
alloy-provider = { version = "1.0.9", default-features = false }
@@ -159,30 +158,20 @@ alloy-json-rpc = { version = "1.0.9", default-features = false }
159158
alloy-rpc-types-eth = { version = "1.0.9", default-features = false }
160159
alloy-rpc-types-engine = { version = "1.0.9", default-features = false }
161160
alloy-signer-local = { version = "1.0.9", features = ["mnemonic"] }
162-
alloy-transport = { version = "1.0.9", default-features = false }
163-
alloy-transport-http = { version = "1.0.9", default-features = false, features = [
164-
"reqwest",
165-
"reqwest-rustls-tls",
166-
] }
167161
alloy-primitives = { version = "1.1.0", default-features = false }
168162

169-
reqwest = { version = "0.12.9", default-features = false, features = [
170-
"rustls-tls",
171-
] }
172-
173163
# tokio
174164
tokio = { version = "1.21", default-features = false }
175165

176-
# Updated to Reth 1.4.8
177-
reth = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
166+
reth-op = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
167+
168+
# Individual reth crates still needed (not included in reth-op)
178169
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
179170
reth-cli = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
180171
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
181-
reth-evm = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
182172
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
183173
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
184174
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
185-
reth-node-core = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
186175
reth-errors = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
187176
reth-optimism-node = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
188177
reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
@@ -193,37 +182,18 @@ reth-optimism-payload-builder = { git = "https://github.com/paradigmxyz/reth.git
193182
reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
194183
reth-trie-db = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
195184
reth-trie-common = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
196-
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
197185
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
198-
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
199186
reth-primitives-traits = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
200187
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
201-
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
202188
reth-storage-api = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
203189
reth-tracing = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
204190
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
205191
reth-network = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
206192
reth-network-types = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
207193
reth-chain-state = { git = "https://github.com/paradigmxyz/reth.git", version = "1.4.8" }
208194

209-
# alloy-evm - updated to match Reth 1.4.8
210-
alloy-evm = { version = "0.10", default-features = false }
211-
alloy-op-evm = { version = "0.10", default-features = false }
212-
213-
# revm-optimism - updated to match Reth 1.4.8
214-
op-revm = { version = "5.0.0", default-features = false }
215-
216195
# op-alloy - updated to match Reth 1.4.8
217196
op-alloy-consensus = { version = "0.17.2", default-features = false }
218-
op-alloy-rpc-types = { version = "0.17.2", default-features = false }
219-
op-alloy-network = { version = "0.17.2", default-features = false }
220-
221-
# Updated revm to match Reth 1.4.8
222-
revm = { version = "24.0.1", default-features = false }
223-
revm-primitives = { version = "19.0.0" }
224-
revm-interpreter = { version = "20.0.0", default-features = false }
225-
revm-precompile = { version = "22.0.0", default-features = false, features = ["secp256r1"] }
226-
revm-inspectors = { version = "0.23.0", default-features = false }
227197

228198
# metrics
229199
metrics = "0.24.0"
@@ -246,8 +216,6 @@ futures = "0.3"
246216
url = "2.5"
247217
parking_lot = "0.12"
248218

249-
# misc-testing
250-
rstest = "0.18.2"
251219

252220
## TODO(dan): remove this when reth removes
253221
#[patch.crates-io]

bin/odyssey/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ odyssey-wallet.workspace = true
2020
odyssey-walltime.workspace = true
2121
eyre.workspace = true
2222
tracing.workspace = true
23+
reth-op = { workspace = true, features = ["node", "cli"] }
2324
reth-cli-util.workspace = true
2425
reth-node-builder.workspace = true
26+
reth-provider.workspace = true
2527
reth-optimism-node = { workspace = true, features = ["js-tracer"] }
2628
reth-optimism-cli.workspace = true
27-
reth-provider.workspace = true
2829

2930
[features]
3031
default = ["jemalloc"]

crates/node/Cargo.toml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,20 @@ categories.workspace = true
1212
[dependencies]
1313
odyssey-common.workspace = true
1414

15-
reth-primitives-traits.workspace = true
15+
# Use reth-op with full and cli features to reduce individual dependencies
16+
reth-op = { workspace = true, features = ["full", "cli"] }
17+
18+
# These still need to be imported separately as they're not fully re-exported by reth-op
1619
reth-cli.workspace = true
1720
reth-errors.workspace = true
18-
reth-node-api.workspace = true
19-
reth-node-builder.workspace = true
20-
reth-optimism-node.workspace = true
21-
reth-optimism-forks.workspace = true
22-
reth-optimism-chainspec.workspace = true
23-
reth-optimism-primitives.workspace = true
24-
reth-optimism-payload-builder.workspace = true
25-
reth-optimism-rpc.workspace = true
26-
reth-chainspec.workspace = true
2721
reth-rpc-eth-api.workspace = true
2822
reth-rpc-eth-types.workspace = true
29-
reth-transaction-pool.workspace = true
3023
reth-trie-common.workspace = true
3124
reth-trie-db.workspace = true
32-
reth-network.workspace = true
25+
reth-optimism-forks.workspace = true
3326
reth-network-types.workspace = true
27+
reth-optimism-payload-builder.workspace = true
28+
reth-optimism-rpc.workspace = true
3429
reth-chain-state.workspace = true
3530

3631
alloy-eips.workspace = true

crates/node/src/broadcaster.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
//! Sponsor periodic broadcaster
22
33
use alloy_primitives::Address;
4-
use reth_network::{transactions::TransactionsHandle, NetworkPrimitives};
5-
use reth_transaction_pool::TransactionPool;
4+
use reth_op::{
5+
network::{transactions::TransactionsHandle, NetworkPrimitives},
6+
pool::TransactionPool,
7+
};
68
use std::time::Duration;
79

810
/// Periodically broadcasts sponsored transactions from the transaction pool.

crates/node/src/chainspec.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
//! Odyssey chainspec parsing logic.
22
use alloy_primitives::U256;
3-
use reth_chainspec::{
4-
BaseFeeParams, BaseFeeParamsKind, Chain, ChainHardforks, ChainSpec, EthereumHardfork,
5-
ForkCondition, Hardfork, NamedChain,
3+
use reth_op::{
4+
chainspec::{
5+
make_op_genesis_header, BaseFeeParams, BaseFeeParamsKind, Chain, ChainHardforks, ChainSpec,
6+
EthereumHardfork, ForkCondition, Hardfork, NamedChain, OpChainSpec,
7+
},
8+
primitives::SealedHeader,
69
};
10+
// OpHardfork needs to be imported directly
711
use reth_cli::chainspec::{parse_genesis, ChainSpecParser};
8-
use reth_optimism_chainspec::{make_op_genesis_header, OpChainSpec};
912
use reth_optimism_forks::OpHardfork;
10-
use reth_primitives_traits::SealedHeader;
1113
use std::sync::{Arc, LazyLock};
1214

1315
/// Odyssey forks.
@@ -111,8 +113,8 @@ mod tests {
111113
use std::path::PathBuf;
112114

113115
use super::OdysseyChainSpecParser;
114-
use reth_chainspec::EthereumHardforks;
115116
use reth_cli::chainspec::ChainSpecParser;
117+
use reth_op::chainspec::EthereumHardforks;
116118
use reth_optimism_forks::OpHardforks;
117119

118120
#[test]

crates/node/src/delayed_resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use jsonrpsee::{
88
};
99
use parking_lot::Mutex;
1010
use reth_chain_state::CanonStateNotification;
11-
use reth_optimism_primitives::OpPrimitives;
11+
use reth_op::OpPrimitives;
1212
use serde::de::Error;
1313
use serde_json::value::RawValue;
1414
use std::{

crates/node/src/forwarder.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
33
use alloy_eips::eip2718::Decodable2718;
44
use alloy_primitives::Bytes;
5-
use reth_network::{transactions::TransactionsHandle, NetworkPrimitives};
6-
use reth_primitives_traits::transaction::signed::SignedTransaction;
5+
use reth_op::{
6+
network::{transactions::TransactionsHandle, NetworkPrimitives},
7+
primitives::transaction::signed::SignedTransaction,
8+
};
79
use tokio::sync::broadcast::Receiver;
810
use tracing::trace;
911

crates/node/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
//! This contains mainly the [`OdysseyNode`](node::OdysseyNode) type.
44
//!
55
//! The [`OdysseyNode`](node::OdysseyNode) type implements the
6-
//! [`NodeTypes`](reth_node_builder::NodeTypes) trait, and configures the engine types required for
7-
//! the optimism engine API.
6+
//! [`NodeTypes`](reth_op::node::builder::NodeTypes) trait, and configures the engine types required
7+
//! for the optimism engine API.
88
99
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1010
#![warn(unused_crate_dependencies)]

crates/node/src/node.rs

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,38 @@
44
//! required for the optimism engine API.
55
66
use op_alloy_consensus::OpPooledTransaction;
7-
use reth_network::{
8-
transactions::{
9-
config::TransactionPropagationKind, TransactionPropagationMode, TransactionsManagerConfig,
10-
},
11-
NetworkHandle, NetworkManager, PeersInfo,
12-
};
137
use reth_network_types::ReputationChangeWeights;
14-
use reth_node_api::{FullNodeTypes, TxTy};
15-
use reth_node_builder::{
16-
components::{
17-
BasicPayloadServiceBuilder, ComponentsBuilder, NetworkBuilder, PoolBuilderConfigOverrides,
8+
use reth_op::{
9+
chainspec::OpChainSpec,
10+
network::{
11+
transactions::{
12+
config::TransactionPropagationKind, TransactionPropagationMode,
13+
TransactionsManagerConfig,
14+
},
15+
NetworkHandle, NetworkManager, PeersInfo,
1816
},
19-
BuilderContext, Node, NodeAdapter, NodeComponentsBuilder, NodeTypes,
20-
};
21-
use reth_optimism_chainspec::OpChainSpec;
22-
use reth_optimism_node::{
23-
args::RollupArgs,
2417
node::{
25-
OpAddOns, OpConsensusBuilder, OpExecutorBuilder, OpNetworkBuilder, OpPayloadBuilder,
26-
OpPoolBuilder,
18+
api::{FullNodeTypes, TxTy},
19+
args::RollupArgs,
20+
builder::{
21+
components::{
22+
BasicPayloadServiceBuilder, ComponentsBuilder, NetworkBuilder,
23+
PoolBuilderConfigOverrides,
24+
},
25+
BuilderContext, Node, NodeAdapter, NodeComponentsBuilder, NodeTypes,
26+
},
27+
node::{
28+
OpAddOns, OpConsensusBuilder, OpExecutorBuilder, OpNetworkBuilder, OpPayloadBuilder,
29+
OpPoolBuilder,
30+
},
31+
rpc::OpEngineApiBuilder,
32+
OpEngineTypes, OpEngineValidatorBuilder, OpNetworkPrimitives, OpStorage,
2733
},
28-
rpc::OpEngineApiBuilder,
29-
OpEngineTypes, OpEngineValidatorBuilder, OpNetworkPrimitives, OpStorage,
34+
pool::{PoolTransaction, SubPoolLimit, TransactionPool, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER},
35+
OpPrimitives,
3036
};
3137
use reth_optimism_payload_builder::config::OpDAConfig;
32-
use reth_optimism_primitives::OpPrimitives;
3338
use reth_optimism_rpc::eth::OpEthApiBuilder;
34-
use reth_transaction_pool::{
35-
PoolTransaction, SubPoolLimit, TransactionPool, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER,
36-
};
3739
use reth_trie_db::MerklePatriciaTrie;
3840
use std::time::Duration;
3941
use tracing::info;

0 commit comments

Comments
 (0)