From f04fc7c5b966a3db6830ddcc31307bbe125001c4 Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 17 Sep 2024 17:52:57 +0800 Subject: [PATCH] chore(primitives, ethereum-forks): replace std feature gate alloc imports (#10945) --- crates/ethereum-forks/src/hardforks/mod.rs | 3 ++- crates/primitives/src/transaction/compat.rs | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/ethereum-forks/src/hardforks/mod.rs b/crates/ethereum-forks/src/hardforks/mod.rs index da767c4a85..28a93c58a3 100644 --- a/crates/ethereum-forks/src/hardforks/mod.rs +++ b/crates/ethereum-forks/src/hardforks/mod.rs @@ -13,7 +13,8 @@ use rustc_hash::FxHashMap; use std::collections::hash_map::Entry; #[cfg(not(feature = "std"))] -use alloc::{boxed::Box, collections::btree_map::Entry, vec::Vec}; +use alloc::collections::btree_map::Entry; +use alloc::{boxed::Box, vec::Vec}; /// Generic trait over a set of ordered hardforks pub trait Hardforks: Default + Clone { diff --git a/crates/primitives/src/transaction/compat.rs b/crates/primitives/src/transaction/compat.rs index be51d0e4bb..f54e553725 100644 --- a/crates/primitives/src/transaction/compat.rs +++ b/crates/primitives/src/transaction/compat.rs @@ -1,9 +1,6 @@ use crate::{Address, Transaction, TransactionSigned, TxKind, U256}; use revm_primitives::{AuthorizationList, TxEnv}; -#[cfg(all(not(feature = "std"), feature = "optimism"))] -use alloc::vec::Vec; - /// Implements behaviour to fill a [`TxEnv`] from another transaction. pub trait FillTxEnv { /// Fills [`TxEnv`] with an [`Address`] and transaction. @@ -14,7 +11,7 @@ impl FillTxEnv for TransactionSigned { fn fill_tx_env(&self, tx_env: &mut TxEnv, sender: Address) { #[cfg(feature = "optimism")] let envelope = { - let mut envelope = Vec::with_capacity(self.length_without_header()); + let mut envelope = alloc::vec::Vec::with_capacity(self.length_without_header()); self.encode_enveloped(&mut envelope); envelope };