diff --git a/crates/interpreter/src/interpreter.rs b/crates/interpreter/src/interpreter.rs index dc9d2387653..8cd5540cce8 100644 --- a/crates/interpreter/src/interpreter.rs +++ b/crates/interpreter/src/interpreter.rs @@ -12,7 +12,6 @@ use crate::{ primitives::Bytes, push, push_b256, return_ok, return_revert, CallInputs, CallOutcome, CreateInputs, CreateOutcome, Gas, Host, InstructionResult, }; -use alloc::borrow::ToOwned; use core::cmp::min; use revm_primitives::U256; diff --git a/crates/precompile/src/lib.rs b/crates/precompile/src/lib.rs index 9a099f78854..e2355dc98fd 100644 --- a/crates/precompile/src/lib.rs +++ b/crates/precompile/src/lib.rs @@ -20,7 +20,6 @@ mod modexp; mod secp256k1; pub mod utilities; -use alloc::{boxed::Box, vec::Vec}; use core::{fmt, hash::Hash}; use once_cell::race::OnceBox; #[doc(hidden)] diff --git a/crates/precompile/src/modexp.rs b/crates/precompile/src/modexp.rs index 0ea50cb5c49..6cd773c8542 100644 --- a/crates/precompile/src/modexp.rs +++ b/crates/precompile/src/modexp.rs @@ -159,7 +159,7 @@ fn berlin_gas_calc(base_length: u64, exp_length: u64, mod_length: u64, exp_highp #[cfg(test)] mod tests { use super::*; - use alloc::vec::Vec; + use revm_primitives::hex; struct Test { diff --git a/crates/primitives/src/bytecode.rs b/crates/primitives/src/bytecode.rs index bbf8791eef3..3c4f3ed5339 100644 --- a/crates/primitives/src/bytecode.rs +++ b/crates/primitives/src/bytecode.rs @@ -1,5 +1,5 @@ use crate::{hex, keccak256, Bytes, B256, KECCAK_EMPTY}; -use alloc::{sync::Arc, vec::Vec}; +use alloc::sync::Arc; use bitvec::{ prelude::{bitvec, Lsb0}, vec::BitVec, diff --git a/crates/primitives/src/db.rs b/crates/primitives/src/db.rs index e9f97401645..726d07e65ec 100644 --- a/crates/primitives/src/db.rs +++ b/crates/primitives/src/db.rs @@ -7,7 +7,6 @@ pub use components::{ use crate::{Account, AccountInfo, Address, Bytecode, HashMap, B256, U256}; use auto_impl::auto_impl; - /// EVM database interface. #[auto_impl(&mut, Box)] pub trait Database { diff --git a/crates/primitives/src/env.rs b/crates/primitives/src/env.rs index f92b4842485..882e783778b 100644 --- a/crates/primitives/src/env.rs +++ b/crates/primitives/src/env.rs @@ -3,11 +3,10 @@ pub mod handler_cfg; pub use handler_cfg::{CfgEnvWithHandlerCfg, EnvWithHandlerCfg, HandlerCfg}; use crate::{ - alloc::vec::Vec, calc_blob_gasprice, Account, Address, Bytes, InvalidHeader, - InvalidTransaction, Spec, SpecId, B256, GAS_PER_BLOB, KECCAK_EMPTY, MAX_BLOB_NUMBER_PER_BLOCK, - MAX_INITCODE_SIZE, U256, VERSIONED_HASH_VERSION_KZG, + calc_blob_gasprice, Account, Address, Bytes, InvalidHeader, InvalidTransaction, Spec, SpecId, + B256, GAS_PER_BLOB, KECCAK_EMPTY, MAX_BLOB_NUMBER_PER_BLOCK, MAX_INITCODE_SIZE, U256, + VERSIONED_HASH_VERSION_KZG, }; -use alloc::boxed::Box; use core::cmp::{min, Ordering}; /// EVM environment configuration. diff --git a/crates/primitives/src/env/handler_cfg.rs b/crates/primitives/src/env/handler_cfg.rs index 1c47e16536a..a6ea438c00f 100644 --- a/crates/primitives/src/env/handler_cfg.rs +++ b/crates/primitives/src/env/handler_cfg.rs @@ -1,5 +1,4 @@ use super::{BlockEnv, CfgEnv, Env, SpecId, TxEnv}; -use alloc::boxed::Box; use core::ops::{Deref, DerefMut}; /// Handler configuration fields. It is used to configure the handler. diff --git a/crates/primitives/src/kzg/env_settings.rs b/crates/primitives/src/kzg/env_settings.rs index 88b818566d5..9f677cc9a81 100644 --- a/crates/primitives/src/kzg/env_settings.rs +++ b/crates/primitives/src/kzg/env_settings.rs @@ -2,7 +2,7 @@ use super::{ trusted_setup_points::{G1_POINTS, G2_POINTS}, KzgSettings, }; -use alloc::{boxed::Box, sync::Arc}; +use alloc::sync::Arc; use core::hash::{Hash, Hasher}; use once_cell::race::OnceBox; diff --git a/crates/primitives/src/kzg/trusted_setup_points.rs b/crates/primitives/src/kzg/trusted_setup_points.rs index 70b422c81eb..3ba7934529e 100644 --- a/crates/primitives/src/kzg/trusted_setup_points.rs +++ b/crates/primitives/src/kzg/trusted_setup_points.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; pub use c_kzg::{BYTES_PER_G1_POINT, BYTES_PER_G2_POINT}; use core::fmt::Display; use derive_more::{AsMut, AsRef, Deref, DerefMut}; diff --git a/crates/primitives/src/result.rs b/crates/primitives/src/result.rs index b765dd7aef4..2074fcf3c77 100644 --- a/crates/primitives/src/result.rs +++ b/crates/primitives/src/result.rs @@ -1,5 +1,4 @@ use crate::{Address, Bytes, Log, State, U256}; -use alloc::{boxed::Box, string::String, vec::Vec}; use core::fmt; /// Result of EVM execution. diff --git a/crates/revm/benches/bench.rs b/crates/revm/benches/bench.rs index 624da8bc67e..8a6cd0eecde 100644 --- a/crates/revm/benches/bench.rs +++ b/crates/revm/benches/bench.rs @@ -3,7 +3,10 @@ use criterion::{ }; use revm::{ db::BenchmarkDB, - interpreter::{analysis::to_analysed, BytecodeLocked, Contract, DummyHost, Interpreter,opcode::make_instruction_table, SharedMemory, EMPTY_SHARED_MEMORY}, + interpreter::{ + analysis::to_analysed, opcode::make_instruction_table, BytecodeLocked, Contract, DummyHost, + Interpreter, SharedMemory, EMPTY_SHARED_MEMORY, + }, primitives::{ address, bytes, hex, BerlinSpec, Bytecode, BytecodeState, Bytes, TransactTo, U256, }, diff --git a/crates/revm/src/builder.rs b/crates/revm/src/builder.rs index a23c1d441cd..a9a836805bd 100644 --- a/crates/revm/src/builder.rs +++ b/crates/revm/src/builder.rs @@ -6,7 +6,6 @@ use crate::{ }, Context, ContextWithHandlerCfg, Evm, Handler, }; -use alloc::boxed::Box; use core::marker::PhantomData; /// Evm Builder allows building or modifying EVM. diff --git a/crates/revm/src/context.rs b/crates/revm/src/context.rs index a84817e93f3..de5f6586daf 100644 --- a/crates/revm/src/context.rs +++ b/crates/revm/src/context.rs @@ -12,7 +12,6 @@ use crate::{ }, FrameOrResult, JournalCheckpoint, CALL_STACK_LIMIT, }; -use alloc::boxed::Box; /// Main Context structure that contains both EvmContext and External context. pub struct Context { @@ -173,7 +172,6 @@ impl EvmContext { /// /// Loading of accounts/storages is needed to make them warm. #[inline] - #[must_use] pub fn load_access_list(&mut self) -> Result<(), EVMError> { for (address, slots) in self.env.tx.access_list.iter() { self.journaled_state @@ -596,9 +594,7 @@ impl EvmContext { pub(crate) mod test_utils { use super::*; use crate::db::CacheDB; - use crate::db::EmptyDB; use crate::primitives::address; - use crate::primitives::SpecId; /// Mock caller address. pub const MOCK_CALLER: Address = address!("0000000000000000000000000000000000000000"); diff --git a/crates/revm/src/db/emptydb.rs b/crates/revm/src/db/emptydb.rs index 27d7641c92c..82abce59cf1 100644 --- a/crates/revm/src/db/emptydb.rs +++ b/crates/revm/src/db/emptydb.rs @@ -1,4 +1,3 @@ -use alloc::string::ToString; use core::{convert::Infallible, fmt, marker::PhantomData}; use revm_interpreter::primitives::{ db::{Database, DatabaseRef}, diff --git a/crates/revm/src/db/in_memory_db.rs b/crates/revm/src/db/in_memory_db.rs index 2fef18b4947..2ba4ac1a40a 100644 --- a/crates/revm/src/db/in_memory_db.rs +++ b/crates/revm/src/db/in_memory_db.rs @@ -4,7 +4,7 @@ use crate::primitives::{ U256, }; use crate::Database; -use alloc::vec::Vec; + use core::convert::Infallible; /// A [Database] implementation that stores all state changes in memory. diff --git a/crates/revm/src/db/states/bundle_account.rs b/crates/revm/src/db/states/bundle_account.rs index 3d9347d8a4a..6fc33869c71 100644 --- a/crates/revm/src/db/states/bundle_account.rs +++ b/crates/revm/src/db/states/bundle_account.rs @@ -2,7 +2,10 @@ use super::{ reverts::AccountInfoRevert, AccountRevert, AccountStatus, RevertToSlot, StorageWithOriginalValues, TransitionAccount, }; -use crate::{interpreter::primitives::{AccountInfo, StorageSlot, U256}, precompile::HashMap}; +use crate::{ + interpreter::primitives::{AccountInfo, StorageSlot, U256}, + precompile::HashMap, +}; /// Account information focused on creating of database changesets /// and Reverts. diff --git a/crates/revm/src/db/states/bundle_state.rs b/crates/revm/src/db/states/bundle_state.rs index 75c38b827aa..45fd5c08171 100644 --- a/crates/revm/src/db/states/bundle_state.rs +++ b/crates/revm/src/db/states/bundle_state.rs @@ -3,15 +3,12 @@ use super::{ reverts::{AccountInfoRevert, Reverts}, AccountRevert, AccountStatus, BundleAccount, PlainStateReverts, RevertToSlot, TransitionState, }; -use alloc::{ - collections::{BTreeMap, BTreeSet}, - vec::Vec, -}; -use core::{mem, ops::RangeInclusive}; use crate::primitives::{ hash_map::{self, Entry}, AccountInfo, Address, Bytecode, HashMap, HashSet, StorageSlot, B256, KECCAK_EMPTY, U256, }; +use alloc::collections::{BTreeMap, BTreeSet}; +use core::{mem, ops::RangeInclusive}; /// This builder is used to help to facilitate the initialization of `BundleState` struct #[derive(Debug)] diff --git a/crates/revm/src/db/states/cache.rs b/crates/revm/src/db/states/cache.rs index a3232029adc..e558e08e873 100644 --- a/crates/revm/src/db/states/cache.rs +++ b/crates/revm/src/db/states/cache.rs @@ -1,7 +1,7 @@ use super::{ plain_account::PlainStorage, transition_account::TransitionAccount, CacheAccount, PlainAccount, }; -use alloc::vec::Vec; + use revm_interpreter::primitives::{ Account, AccountInfo, Address, Bytecode, HashMap, State as EVMState, B256, }; diff --git a/crates/revm/src/db/states/changes.rs b/crates/revm/src/db/states/changes.rs index 4a559e699e2..4a31cd9ccac 100644 --- a/crates/revm/src/db/states/changes.rs +++ b/crates/revm/src/db/states/changes.rs @@ -1,5 +1,5 @@ use super::RevertToSlot; -use alloc::vec::Vec; + use revm_interpreter::primitives::{AccountInfo, Address, Bytecode, B256, U256}; /// accounts/storages/contracts for inclusion into database. diff --git a/crates/revm/src/db/states/reverts.rs b/crates/revm/src/db/states/reverts.rs index 513101ded2b..1eb3ee9aa71 100644 --- a/crates/revm/src/db/states/reverts.rs +++ b/crates/revm/src/db/states/reverts.rs @@ -2,7 +2,7 @@ use super::{ changes::PlainStorageRevert, AccountStatus, BundleAccount, PlainStateReverts, StorageWithOriginalValues, }; -use alloc::vec::Vec; + use core::ops::{Deref, DerefMut}; use revm_interpreter::primitives::{AccountInfo, Address, HashMap, U256}; diff --git a/crates/revm/src/db/states/state.rs b/crates/revm/src/db/states/state.rs index ec82cb87ff2..ea4b191beb3 100644 --- a/crates/revm/src/db/states/state.rs +++ b/crates/revm/src/db/states/state.rs @@ -3,11 +3,7 @@ use super::{ CacheAccount, StateBuilder, TransitionAccount, TransitionState, }; use crate::db::EmptyDB; -use alloc::{ - boxed::Box, - collections::{btree_map, BTreeMap}, - vec::Vec, -}; +use alloc::collections::{btree_map, BTreeMap}; use revm_interpreter::primitives::{ db::{Database, DatabaseCommit}, hash_map, Account, AccountInfo, Address, Bytecode, HashMap, B256, BLOCK_HASH_HISTORY, U256, diff --git a/crates/revm/src/db/states/transition_state.rs b/crates/revm/src/db/states/transition_state.rs index 269492405e8..46297e863a8 100644 --- a/crates/revm/src/db/states/transition_state.rs +++ b/crates/revm/src/db/states/transition_state.rs @@ -1,5 +1,5 @@ use super::TransitionAccount; -use alloc::vec::Vec; + use revm_interpreter::primitives::{hash_map::Entry, Address, HashMap}; #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/crates/revm/src/evm.rs b/crates/revm/src/evm.rs index 9db4c508543..f4c03726ac0 100644 --- a/crates/revm/src/evm.rs +++ b/crates/revm/src/evm.rs @@ -13,7 +13,7 @@ use crate::{ }, Context, ContextWithHandlerCfg, Frame, FrameOrResult, FrameResult, }; -use alloc::vec::Vec; + use core::fmt; use revm_interpreter::{CallInputs, CreateInputs}; diff --git a/crates/revm/src/frame.rs b/crates/revm/src/frame.rs index e519fdf2baf..9ec9b2f29e3 100644 --- a/crates/revm/src/frame.rs +++ b/crates/revm/src/frame.rs @@ -3,7 +3,6 @@ use crate::{ primitives::{Address, Output}, JournalCheckpoint, }; -use alloc::boxed::Box; use core::ops::Range; use revm_interpreter::{CallOutcome, CreateOutcome, Gas, InstructionResult, InterpreterResult}; diff --git a/crates/revm/src/handler.rs b/crates/revm/src/handler.rs index 1d4654b3b76..ed1b34bfd95 100644 --- a/crates/revm/src/handler.rs +++ b/crates/revm/src/handler.rs @@ -15,7 +15,7 @@ use crate::{ primitives::{db::Database, spec_to_generic, HandlerCfg, Spec, SpecId}, Evm, }; -use alloc::vec::Vec; + use register::{EvmHandler, HandleRegisters}; use self::register::{HandleRegister, HandleRegisterBox}; diff --git a/crates/revm/src/handler/handle_types/execution.rs b/crates/revm/src/handler/handle_types/execution.rs index 7ed7aa5e8c9..c5ac1ad68ef 100644 --- a/crates/revm/src/handler/handle_types/execution.rs +++ b/crates/revm/src/handler/handle_types/execution.rs @@ -4,7 +4,7 @@ use crate::{ primitives::{db::Database, Spec}, CallFrame, Context, CreateFrame, Frame, FrameOrResult, FrameResult, }; -use alloc::{boxed::Box, sync::Arc}; +use alloc::sync::Arc; use revm_interpreter::{CallOutcome, CreateOutcome, InterpreterResult}; diff --git a/crates/revm/src/handler/mainnet/execution.rs b/crates/revm/src/handler/mainnet/execution.rs index d56d94e99a5..259c5261a7c 100644 --- a/crates/revm/src/handler/mainnet/execution.rs +++ b/crates/revm/src/handler/mainnet/execution.rs @@ -7,7 +7,6 @@ use crate::{ primitives::{Env, Spec}, CallFrame, Context, CreateFrame, Frame, FrameOrResult, FrameResult, }; -use alloc::boxed::Box; use revm_interpreter::{CallOutcome, InterpreterResult}; diff --git a/crates/revm/src/handler/register.rs b/crates/revm/src/handler/register.rs index 2a5e9df89ee..fbdfc1851a4 100644 --- a/crates/revm/src/handler/register.rs +++ b/crates/revm/src/handler/register.rs @@ -1,5 +1,4 @@ use crate::{db::Database, handler::Handler, interpreter::opcode::InstructionTables, Evm}; -use alloc::boxed::Box; /// EVM Handler pub type EvmHandler<'a, EXT, DB> = Handler<'a, Evm<'a, EXT, DB>, EXT, DB>; diff --git a/crates/revm/src/inspector/handler_register.rs b/crates/revm/src/inspector/handler_register.rs index f55bf84b540..97064d02905 100644 --- a/crates/revm/src/inspector/handler_register.rs +++ b/crates/revm/src/inspector/handler_register.rs @@ -6,7 +6,7 @@ use crate::{ interpreter::{opcode, opcode::BoxedInstruction, InstructionResult, Interpreter}, Evm, FrameOrResult, FrameResult, Inspector, JournalEntry, }; -use alloc::{boxed::Box, rc::Rc, sync::Arc, vec::Vec}; +use alloc::{rc::Rc, sync::Arc}; /// Provides access to an `Inspector` instance. pub trait GetInspector { diff --git a/crates/revm/src/journaled_state.rs b/crates/revm/src/journaled_state.rs index 27882a4f3b7..053ba6ceeea 100644 --- a/crates/revm/src/journaled_state.rs +++ b/crates/revm/src/journaled_state.rs @@ -3,7 +3,7 @@ use crate::primitives::{ db::Database, hash_map::Entry, Account, Address, Bytecode, HashMap, HashSet, Log, SpecId::*, State, StorageSlot, TransientStorage, KECCAK_EMPTY, PRECOMPILE3, U256, }; -use alloc::vec::Vec; + use core::mem; use revm_interpreter::primitives::SpecId;