From d5dc0b27ebf2e4f7c8fd73cc7023a1a4fea2c0cc Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Sat, 17 Jan 2026 08:32:10 +0000 Subject: [PATCH] fix(storage-api): gate reth-chain dependency behind std feature The reth-chain crate is inherently std-only (uses BTreeMap, Arc, etc.) and was breaking the riscv32imac no_std builds by pulling in serde_core which doesn't support no_std properly. This makes reth-chain optional and only enables it when std feature is active, gating the block_writer module that uses Chain behind std. --- crates/storage/storage-api/Cargo.toml | 7 ++++--- crates/storage/storage-api/src/lib.rs | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/storage/storage-api/Cargo.toml b/crates/storage/storage-api/Cargo.toml index 0786e55aa4..70723cda28 100644 --- a/crates/storage/storage-api/Cargo.toml +++ b/crates/storage/storage-api/Cargo.toml @@ -13,7 +13,7 @@ workspace = true [dependencies] # reth -reth-chain.workspace = true +reth-chain = { workspace = true, optional = true } reth-db-models.workspace = true reth-chainspec.workspace = true reth-db-api = { workspace = true, optional = true } @@ -38,6 +38,7 @@ serde_json = { workspace = true, optional = true } [features] default = ["std"] std = [ + "dep:reth-chain", "reth-chainspec/std", "alloy-consensus/std", "alloy-eips/std", @@ -61,7 +62,7 @@ db-api = [ ] serde = [ - "reth-chain/serde", + "reth-chain?/serde", "reth-ethereum-primitives/serde", "reth-db-models/serde", "reth-execution-types/serde", @@ -80,7 +81,7 @@ serde-bincode-compat = [ "reth-execution-types/serde-bincode-compat", "reth-primitives-traits/serde-bincode-compat", "reth-trie-common/serde-bincode-compat", - "reth-chain/serde-bincode-compat", + "reth-chain?/serde-bincode-compat", "reth-ethereum-primitives/serde-bincode-compat", "alloy-eips/serde-bincode-compat", "alloy-consensus/serde-bincode-compat", diff --git a/crates/storage/storage-api/src/lib.rs b/crates/storage/storage-api/src/lib.rs index 0daf280519..8c69e2090f 100644 --- a/crates/storage/storage-api/src/lib.rs +++ b/crates/storage/storage-api/src/lib.rs @@ -85,7 +85,9 @@ pub use primitives::*; mod block_indices; pub use block_indices::*; +#[cfg(feature = "std")] mod block_writer; +#[cfg(feature = "std")] pub use block_writer::*; mod state_writer;