diff --git a/crates/primitives/src/transaction/eip1559.rs b/crates/primitives/src/transaction/eip1559.rs index eb8963ac08a7..5fadb248ba6d 100644 --- a/crates/primitives/src/transaction/eip1559.rs +++ b/crates/primitives/src/transaction/eip1559.rs @@ -4,6 +4,9 @@ use alloy_rlp::{length_of_length, Decodable, Encodable, Header}; use core::mem; use reth_codecs::{main_codec, Compact}; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; + /// A transaction with a priority fee ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)). #[main_codec] #[derive(Debug, Clone, PartialEq, Eq, Hash, Default)] diff --git a/crates/primitives/src/transaction/eip2930.rs b/crates/primitives/src/transaction/eip2930.rs index 914ef071cdac..302ba41bbbbf 100644 --- a/crates/primitives/src/transaction/eip2930.rs +++ b/crates/primitives/src/transaction/eip2930.rs @@ -4,6 +4,9 @@ use alloy_rlp::{length_of_length, Decodable, Encodable, Header}; use core::mem; use reth_codecs::{main_codec, Compact}; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; + /// Transaction with an [`AccessList`] ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930)). #[main_codec] #[derive(Debug, Clone, PartialEq, Eq, Hash, Default)] diff --git a/crates/primitives/src/transaction/eip7702.rs b/crates/primitives/src/transaction/eip7702.rs index 76b60fa04648..194a9a4d3636 100644 --- a/crates/primitives/src/transaction/eip7702.rs +++ b/crates/primitives/src/transaction/eip7702.rs @@ -2,8 +2,11 @@ use super::access_list::AccessList; use crate::{keccak256, Bytes, ChainId, Signature, TxKind, TxType, B256, U256}; use alloy_eips::eip7702::SignedAuthorization; use alloy_rlp::{length_of_length, Decodable, Encodable, Header}; +use core::mem; use reth_codecs::{main_codec, Compact}; -use std::mem; + +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; /// [EIP-7702 Set Code Transaction](https://eips.ethereum.org/EIPS/eip-7702) /// @@ -306,7 +309,7 @@ impl<'a> arbitrary::Arbitrary<'a> for TxEip7702 { } // TODO(onbjerg): This is temporary until we upstream `Hash` for EIP-7702 types in alloy -impl std::hash::Hash for TxEip7702 { +impl core::hash::Hash for TxEip7702 { fn hash(&self, state: &mut H) { self.chain_id.hash(state); self.nonce.hash(state); diff --git a/crates/primitives/src/transaction/legacy.rs b/crates/primitives/src/transaction/legacy.rs index 09b661cf7995..5d99570032b6 100644 --- a/crates/primitives/src/transaction/legacy.rs +++ b/crates/primitives/src/transaction/legacy.rs @@ -3,6 +3,9 @@ use alloy_rlp::{length_of_length, Encodable, Header}; use core::mem; use reth_codecs::{main_codec, Compact}; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; + /// Legacy transaction. #[main_codec] #[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]