Skip to content

Commit

Permalink
chore: some no-std touchups (#9480)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jul 12, 2024
1 parent da0efbe commit d8b104f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions crates/primitives/src/transaction/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 3 additions & 0 deletions crates/primitives/src/transaction/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
7 changes: 5 additions & 2 deletions crates/primitives/src/transaction/eip7702.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
///
Expand Down Expand Up @@ -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<H: core::hash::Hasher>(&self, state: &mut H) {
self.chain_id.hash(state);
self.nonce.hash(state);
Expand Down
3 changes: 3 additions & 0 deletions crates/primitives/src/transaction/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit d8b104f

Please sign in to comment.