diff --git a/crates/primitives-traits/Cargo.toml b/crates/primitives-traits/Cargo.toml index 11f714779..97ed1a344 100644 --- a/crates/primitives-traits/Cargo.toml +++ b/crates/primitives-traits/Cargo.toml @@ -42,6 +42,8 @@ test-fuzz.workspace = true rand.workspace = true [features] +default = ["std"] +std = [] test-utils = ["arbitrary"] arbitrary = [ "dep:arbitrary", diff --git a/crates/primitives-traits/src/constants.rs b/crates/primitives-traits/src/constants.rs index bda693976..6c32ab351 100644 --- a/crates/primitives-traits/src/constants.rs +++ b/crates/primitives-traits/src/constants.rs @@ -1,7 +1,7 @@ //! Ethereum protocol-related constants use alloy_primitives::{b256, B256, U256}; -use std::time::Duration; +use core::time::Duration; /// The client version: `reth/v{major}.{minor}.{patch}` pub const RETH_CLIENT_VERSION: &str = concat!("reth/v", env!("CARGO_PKG_VERSION")); diff --git a/crates/primitives-traits/src/header/mod.rs b/crates/primitives-traits/src/header/mod.rs index 5ec41d414..2b112954c 100644 --- a/crates/primitives-traits/src/header/mod.rs +++ b/crates/primitives-traits/src/header/mod.rs @@ -15,9 +15,9 @@ use alloy_eips::{ use alloy_primitives::{keccak256, Address, BlockNumber, Bloom, Bytes, B256, B64, U256}; use alloy_rlp::{length_of_length, Decodable, Encodable}; use bytes::BufMut; +use core::mem; use reth_codecs::{main_codec, Compact}; use revm_primitives::{calc_blob_gasprice, calc_excess_blob_gas}; -use std::mem; /// Block header #[main_codec] diff --git a/crates/primitives-traits/src/header/sealed.rs b/crates/primitives-traits/src/header/sealed.rs index 91918b687..894bd28ae 100644 --- a/crates/primitives-traits/src/header/sealed.rs +++ b/crates/primitives-traits/src/header/sealed.rs @@ -5,11 +5,11 @@ use alloy_primitives::{keccak256, BlockHash}; use alloy_primitives::{BlockNumber, B256, U256}; use alloy_rlp::{Decodable, Encodable}; use bytes::BufMut; +use core::mem; use derive_more::{AsRef, Deref}; #[cfg(any(test, feature = "arbitrary"))] use proptest::prelude::*; use reth_codecs::{add_arbitrary_tests, main_codec, Compact}; -use std::mem; /// A [`Header`] that is sealed at a precalculated hash, use [`SealedHeader::unseal()`] if you want /// to modify header. diff --git a/crates/primitives-traits/src/lib.rs b/crates/primitives-traits/src/lib.rs index 68161709c..0051f6c7d 100644 --- a/crates/primitives-traits/src/lib.rs +++ b/crates/primitives-traits/src/lib.rs @@ -9,6 +9,7 @@ // TODO: remove when https://github.com/proptest-rs/proptest/pull/427 is merged #![allow(unknown_lints, non_local_definitions)] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] +#![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "alloy-compat")] mod alloy_compat;