From 21270b280e99ad10bfff829b12fa5c8daee2aceb Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 6 Jan 2025 22:48:41 +0100 Subject: [PATCH] chore: no-std consensus common (#13686) --- Cargo.toml | 2 +- crates/consensus/common/Cargo.toml | 11 +++++++++++ crates/consensus/common/src/lib.rs | 1 + crates/evm/Cargo.toml | 3 ++- crates/optimism/evm/Cargo.toml | 3 ++- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1c470f72ef9c0..be300f7d3118c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -318,7 +318,7 @@ reth-codecs = { path = "crates/storage/codecs" } reth-codecs-derive = { path = "crates/storage/codecs/derive" } reth-config = { path = "crates/config" } reth-consensus = { path = "crates/consensus/consensus", default-features = false } -reth-consensus-common = { path = "crates/consensus/common" } +reth-consensus-common = { path = "crates/consensus/common", default-features = false } reth-consensus-debug-client = { path = "crates/consensus/debug-client" } reth-db = { path = "crates/storage/db", default-features = false } reth-db-api = { path = "crates/storage/db-api" } diff --git a/crates/consensus/common/Cargo.toml b/crates/consensus/common/Cargo.toml index e551c64cc81b9..448b3a16830f9 100644 --- a/crates/consensus/common/Cargo.toml +++ b/crates/consensus/common/Cargo.toml @@ -26,3 +26,14 @@ alloy-eips.workspace = true alloy-consensus.workspace = true rand.workspace = true +[features] +default = ["std"] +std = [ + "alloy-consensus/std", + "alloy-eips/std", + "alloy-primitives/std", + "reth-chainspec/std", + "reth-consensus/std", + "reth-primitives/std", + "reth-primitives-traits/std" +] diff --git a/crates/consensus/common/src/lib.rs b/crates/consensus/common/src/lib.rs index e3503656bb343..9e5eb2aaf0fd6 100644 --- a/crates/consensus/common/src/lib.rs +++ b/crates/consensus/common/src/lib.rs @@ -7,6 +7,7 @@ )] #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] +#![cfg_attr(not(feature = "std"), no_std)] /// Collection of consensus validation methods. pub mod validation; diff --git a/crates/evm/Cargo.toml b/crates/evm/Cargo.toml index 0d9bc26c0e071..8f58e82412758 100644 --- a/crates/evm/Cargo.toml +++ b/crates/evm/Cargo.toml @@ -58,7 +58,8 @@ std = [ "revm-primitives/std", "revm/std", "reth-ethereum-forks/std", - "reth-chainspec/std" + "reth-chainspec/std", + "reth-consensus-common/std" ] test-utils = [ "dep:parking_lot", diff --git a/crates/optimism/evm/Cargo.toml b/crates/optimism/evm/Cargo.toml index 190b5d4f9deb1..e2ec79401c82c 100644 --- a/crates/optimism/evm/Cargo.toml +++ b/crates/optimism/evm/Cargo.toml @@ -73,7 +73,8 @@ std = [ "reth-optimism-forks/std", "thiserror/std", "op-alloy-consensus/std", - "reth-chainspec/std" + "reth-chainspec/std", + "reth-consensus-common/std" ] optimism = [ "reth-primitives/optimism",