From be6af5c6406fff7bc5b6344aac76e7b8aef1a604 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 11 Feb 2025 11:49:12 +0100 Subject: [PATCH 1/5] feat: add reth-op crate --- .config/zepter.yaml | 2 +- Cargo.lock | 26 ++++++++ Cargo.toml | 2 + crates/engine/local/Cargo.toml | 1 + crates/optimism/reth/Cargo.toml | 85 +++++++++++++++++++++++++ crates/optimism/reth/src/lib.rs | 98 +++++++++++++++++++++++++++++ crates/primitives-traits/Cargo.toml | 1 + crates/storage/db-api/Cargo.toml | 6 +- crates/storage/db/Cargo.toml | 5 +- 9 files changed, 223 insertions(+), 3 deletions(-) create mode 100644 crates/optimism/reth/Cargo.toml create mode 100644 crates/optimism/reth/src/lib.rs diff --git a/.config/zepter.yaml b/.config/zepter.yaml index 7dde825e61ee..d6b4e95eac76 100644 --- a/.config/zepter.yaml +++ b/.config/zepter.yaml @@ -12,7 +12,7 @@ workflows: # Check that `A` activates the features of `B`. "propagate-feature", # These are the features to check: - "--features=std,optimism,dev,asm-keccak,jemalloc,jemalloc-prof,tracy-allocator,serde-bincode-compat,serde,test-utils,arbitrary,bench", + "--features=std,optimism,op,dev,asm-keccak,jemalloc,jemalloc-prof,tracy-allocator,serde-bincode-compat,serde,test-utils,arbitrary,bench", # Do not try to add a new section into `[features]` of `A` only because `B` expose that feature. There are edge-cases where this is still needed, but we can add them manually. "--left-side-feature-missing=ignore", # Ignore the case that `A` it outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on. diff --git a/Cargo.lock b/Cargo.lock index 95c03cf7f162..d10b3cae2af1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8328,6 +8328,32 @@ dependencies = [ "reth-trie-db", ] +[[package]] +name = "reth-op" +version = "1.1.5" +dependencies = [ + "reth-chainspec", + "reth-consensus", + "reth-consensus-common", + "reth-db", + "reth-evm", + "reth-network", + "reth-node-api", + "reth-optimism-chainspec", + "reth-optimism-consensus", + "reth-optimism-evm", + "reth-optimism-node", + "reth-optimism-primitives", + "reth-optimism-rpc", + "reth-primitives-traits", + "reth-provider", + "reth-rpc", + "reth-rpc-api", + "reth-rpc-builder", + "reth-rpc-eth-types", + "reth-storage-api", +] + [[package]] name = "reth-optimism-chainspec" version = "1.1.5" diff --git a/Cargo.toml b/Cargo.toml index d2a4268590f1..c692698ae3ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,6 +75,7 @@ members = [ "crates/optimism/node/", "crates/optimism/payload/", "crates/optimism/primitives/", + "crates/optimism/reth/", "crates/optimism/rpc/", "crates/optimism/storage", "crates/optimism/txpool/", @@ -374,6 +375,7 @@ reth-node-events = { path = "crates/node/events" } reth-node-metrics = { path = "crates/node/metrics" } reth-optimism-node = { path = "crates/optimism/node" } reth-node-types = { path = "crates/node/types" } +reth-op = { path = "crates/optimism/reth" } reth-optimism-chainspec = { path = "crates/optimism/chainspec" } reth-optimism-cli = { path = "crates/optimism/cli" } reth-optimism-consensus = { path = "crates/optimism/consensus" } diff --git a/crates/engine/local/Cargo.toml b/crates/engine/local/Cargo.toml index a6a6ae37163f..d1503db5de12 100644 --- a/crates/engine/local/Cargo.toml +++ b/crates/engine/local/Cargo.toml @@ -49,4 +49,5 @@ workspace = true op = [ "dep:op-alloy-rpc-types-engine", "dep:reth-optimism-chainspec", + "reth-payload-primitives/op", ] diff --git a/crates/optimism/reth/Cargo.toml b/crates/optimism/reth/Cargo.toml new file mode 100644 index 000000000000..f5a2933c9b84 --- /dev/null +++ b/crates/optimism/reth/Cargo.toml @@ -0,0 +1,85 @@ +[package] +name = "reth-op" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true + +[lints] +workspace = true + +[dependencies] +# reth +reth-primitives-traits = { workspace = true, features = ["op"] } +reth-chainspec.workspace = true +reth-network = { workspace = true, optional = true } +reth-provider = { workspace = true, optional = true } +reth-db = { workspace = true, optional = true, features = ["mdbx", "op"] } +reth-storage-api = { workspace = true, optional = true } +reth-node-api = { workspace = true, optional = true } +reth-consensus = { workspace = true, optional = true } +reth-consensus-common = { workspace = true, optional = true } +reth-evm = { workspace = true, optional = true } +reth-rpc = { workspace = true, optional = true } +reth-rpc-api = { workspace = true, optional = true } +reth-rpc-eth-types = { workspace = true, optional = true } +reth-rpc-builder = { workspace = true, optional = true } + +# reth-op +reth-optimism-primitives.workspace = true +reth-optimism-chainspec.workspace = true +reth-optimism-consensus = { workspace = true, optional = true } +reth-optimism-evm = { workspace = true, optional = true } +reth-optimism-node = { workspace = true, optional = true } +reth-optimism-rpc = { workspace = true, optional = true } + +[features] +default = ["std"] +std = [ + "reth-chainspec/std", + "reth-optimism-primitives/std", + "reth-primitives-traits/std", + "reth-consensus?/std", + "reth-consensus-common?/std", +] +arbitrary = [ + "std", + "reth-chainspec/arbitrary", + "reth-optimism-primitives/arbitrary", + "reth-primitives-traits/arbitrary", + "reth-db?/arbitrary", +] + +test-utils = [ + "reth-chainspec/test-utils", + "reth-consensus?/test-utils", + "reth-db?/test-utils", + "reth-evm?/test-utils", + "reth-network?/test-utils", + "reth-optimism-node?/test-utils", + "reth-primitives-traits/test-utils", + "reth-provider?/test-utils", +] + +full = ["consensus", "evm", "node", "provider", "rpc"] + +alloy-compat = [] +consensus = ["dep:reth-consensus", "dep:reth-consensus-common", "dep:reth-optimism-consensus"] +evm = ["dep:reth-evm", "dep:reth-optimism-evm"] +node-api = ["dep:reth-node-api"] +node = ["provider", "consensus", "evm", "node-api", "dep:reth-optimism-node", "rpc"] +rpc = ["dep:reth-rpc", "dep:reth-rpc-builder", "dep:reth-rpc-api", "dep:reth-rpc-eth-types", "dep:reth-optimism-rpc"] +js-tracer = ["rpc", "reth-rpc/js-tracer"] +network = ["dep:reth-network"] +provider = ["storage-api", "dep:reth-provider", "dep:reth-db"] +storage-api = ["dep:reth-storage-api"] +optimism = [ + "reth-db?/optimism", + "reth-optimism-consensus?/optimism", + "reth-optimism-evm?/optimism", + "reth-optimism-node?/optimism", + "reth-optimism-primitives/optimism", + "reth-optimism-rpc?/optimism", +] diff --git a/crates/optimism/reth/src/lib.rs b/crates/optimism/reth/src/lib.rs new file mode 100644 index 000000000000..34fe710fe1e4 --- /dev/null +++ b/crates/optimism/reth/src/lib.rs @@ -0,0 +1,98 @@ +//! Optimism meta crate that provides access to commonly used reth dependencies. + +#![doc( + html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", + html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", + issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" +)] +#![cfg_attr(not(test), warn(unused_crate_dependencies))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] +#![cfg_attr(not(feature = "std"), no_std)] +// The `optimism` feature must be enabled to use this crate. +#![cfg(feature = "optimism")] + +/// Re-exported ethereum types +#[doc(inline)] +pub use reth_optimism_primitives::*; + +/// Re-exported reth primitives +pub mod primitives { + #[doc(inline)] + pub use reth_primitives_traits::*; +} + +/// Re-exported consensus types +#[cfg(feature = "consensus")] +pub mod consensus { + #[doc(inline)] + pub use reth_consensus::*; + pub use reth_consensus_common::*; + pub use reth_optimism_consensus::*; +} + +/// Re-exported from `reth_chainspec` +pub mod chainspec { + #[doc(inline)] + pub use reth_chainspec::*; + #[doc(inline)] + pub use reth_optimism_chainspec::*; +} + +/// Re-exported evm types +#[cfg(feature = "evm")] +pub mod evm { + #[doc(inline)] + pub use reth_optimism_evm::*; + + #[doc(inline)] + pub use reth_evm as primitives; +} + +/// Re-exported reth network types +#[cfg(feature = "network")] +pub mod network { + #[doc(inline)] + pub use reth_network::*; +} + +/// Re-exported reth provider types +#[cfg(feature = "provider")] +pub mod provider { + #[doc(inline)] + pub use reth_provider::*; + + #[doc(inline)] + pub use reth_db as db; +} + +/// Re-exported reth storage api types +#[cfg(feature = "storage-api")] +pub mod storage { + #[doc(inline)] + pub use reth_storage_api::*; +} + +/// Re-exported ethereum node +#[cfg(feature = "node-api")] +pub mod node { + #[doc(inline)] + pub use reth_node_api as api; + #[cfg(feature = "node")] + pub use reth_optimism_node::*; +} + +/// Re-exported rpc types +#[cfg(feature = "rpc")] +pub mod rpc { + #[doc(inline)] + pub use reth_optimism_rpc::*; + #[doc(inline)] + pub use reth_rpc::*; + + #[doc(inline)] + pub use reth_rpc_api as api; + #[doc(inline)] + pub use reth_rpc_builder as builder; + #[doc(inline)] + pub use reth_rpc_eth_types as eth; +} diff --git a/crates/primitives-traits/Cargo.toml b/crates/primitives-traits/Cargo.toml index 90e8c9658538..1882d1ae03e4 100644 --- a/crates/primitives-traits/Cargo.toml +++ b/crates/primitives-traits/Cargo.toml @@ -142,6 +142,7 @@ reth-codec = [ ] op = [ "dep:op-alloy-consensus", + "reth-codecs?/op", ] rayon = [ "dep:rayon", diff --git a/crates/storage/db-api/Cargo.toml b/crates/storage/db-api/Cargo.toml index 3a55380cba3b..c298e0e4c383 100644 --- a/crates/storage/db-api/Cargo.toml +++ b/crates/storage/db-api/Cargo.toml @@ -91,4 +91,8 @@ optimism = [ "reth-optimism-primitives?/optimism", "op", ] -op = ["dep:reth-optimism-primitives", "reth-codecs/op"] +op = [ + "dep:reth-optimism-primitives", + "reth-codecs/op", + "reth-primitives-traits/op", +] diff --git a/crates/storage/db/Cargo.toml b/crates/storage/db/Cargo.toml index aed1c12353cc..619a97821bb9 100644 --- a/crates/storage/db/Cargo.toml +++ b/crates/storage/db/Cargo.toml @@ -104,7 +104,10 @@ arbitrary = [ "alloy-consensus/arbitrary", ] optimism = ["reth-db-api/optimism"] -op = ["reth-db-api/op"] +op = [ + "reth-db-api/op", + "reth-primitives-traits/op", +] disable-lock = [] [[bench]] From 73da29dfbdde5b9ef832dd3fe1e4f0ee8ea1c43b Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 11 Feb 2025 11:50:49 +0100 Subject: [PATCH 2/5] feat: docs --- crates/optimism/reth/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/optimism/reth/src/lib.rs b/crates/optimism/reth/src/lib.rs index 34fe710fe1e4..67635be1eed0 100644 --- a/crates/optimism/reth/src/lib.rs +++ b/crates/optimism/reth/src/lib.rs @@ -26,7 +26,9 @@ pub mod primitives { pub mod consensus { #[doc(inline)] pub use reth_consensus::*; + #[doc(inline)] pub use reth_consensus_common::*; + #[doc(inline)] pub use reth_optimism_consensus::*; } From 2ad0166b53e7a1ad8634b3e1727b446a3fafa37b Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 11 Feb 2025 11:57:18 +0100 Subject: [PATCH 3/5] allow unused --- crates/optimism/reth/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/optimism/reth/src/lib.rs b/crates/optimism/reth/src/lib.rs index 67635be1eed0..563cf0365a8e 100644 --- a/crates/optimism/reth/src/lib.rs +++ b/crates/optimism/reth/src/lib.rs @@ -10,6 +10,7 @@ #![cfg_attr(not(feature = "std"), no_std)] // The `optimism` feature must be enabled to use this crate. #![cfg(feature = "optimism")] +#[allow(unused_crate_dependencies)] /// Re-exported ethereum types #[doc(inline)] From 51eb18b9aa02e8c6224ef9e155f2cf1849b19985 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 11 Feb 2025 11:59:29 +0100 Subject: [PATCH 4/5] allow unused --- crates/optimism/reth/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/optimism/reth/src/lib.rs b/crates/optimism/reth/src/lib.rs index 563cf0365a8e..1c9ee9168840 100644 --- a/crates/optimism/reth/src/lib.rs +++ b/crates/optimism/reth/src/lib.rs @@ -10,7 +10,7 @@ #![cfg_attr(not(feature = "std"), no_std)] // The `optimism` feature must be enabled to use this crate. #![cfg(feature = "optimism")] -#[allow(unused_crate_dependencies)] +#![allow(unused_crate_dependencies)] /// Re-exported ethereum types #[doc(inline)] From 1a85ab1dfade4a2fe19bc68bde23784864762369 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 11 Feb 2025 12:07:15 +0100 Subject: [PATCH 5/5] allow unused --- crates/optimism/reth/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/optimism/reth/src/lib.rs b/crates/optimism/reth/src/lib.rs index 1c9ee9168840..98921b0876fc 100644 --- a/crates/optimism/reth/src/lib.rs +++ b/crates/optimism/reth/src/lib.rs @@ -8,9 +8,9 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![cfg_attr(not(feature = "std"), no_std)] +#![allow(unused_crate_dependencies)] // The `optimism` feature must be enabled to use this crate. #![cfg(feature = "optimism")] -#![allow(unused_crate_dependencies)] /// Re-exported ethereum types #[doc(inline)]