Skip to content

Commit

Permalink
rem duplicate imports
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita committed Feb 20, 2024
1 parent 398f21d commit 3b91d55
Show file tree
Hide file tree
Showing 30 changed files with 27 additions and 44 deletions.
1 change: 0 additions & 1 deletion crates/interpreter/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion crates/precompile/src/modexp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/bytecode.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 0 additions & 1 deletion crates/primitives/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 3 additions & 4 deletions crates/primitives/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion crates/primitives/src/env/handler_cfg.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/kzg/env_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion crates/primitives/src/kzg/trusted_setup_points.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
1 change: 0 additions & 1 deletion crates/primitives/src/result.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 4 additions & 1 deletion crates/revm/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
1 change: 0 additions & 1 deletion crates/revm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions crates/revm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<EXT, DB: Database> {
Expand Down Expand Up @@ -173,7 +172,6 @@ impl<DB: Database> EvmContext<DB> {
///
/// Loading of accounts/storages is needed to make them warm.
#[inline]
#[must_use]
pub fn load_access_list(&mut self) -> Result<(), EVMError<DB::Error>> {
for (address, slots) in self.env.tx.access_list.iter() {
self.journaled_state
Expand Down Expand Up @@ -596,9 +594,7 @@ impl<DB: Database> EvmContext<DB> {
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");
Expand Down
1 change: 0 additions & 1 deletion crates/revm/src/db/emptydb.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use alloc::string::ToString;
use core::{convert::Infallible, fmt, marker::PhantomData};
use revm_interpreter::primitives::{
db::{Database, DatabaseRef},
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/db/in_memory_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion crates/revm/src/db/states/bundle_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 2 additions & 5 deletions crates/revm/src/db/states/bundle_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/db/states/cache.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/db/states/changes.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/db/states/reverts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
6 changes: 1 addition & 5 deletions crates/revm/src/db/states/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/db/states/transition_state.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
},
Context, ContextWithHandlerCfg, Frame, FrameOrResult, FrameResult,
};
use alloc::vec::Vec;

use core::fmt;
use revm_interpreter::{CallInputs, CreateInputs};

Expand Down
1 change: 0 additions & 1 deletion crates/revm/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/handler/handle_types/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
1 change: 0 additions & 1 deletion crates/revm/src/handler/mainnet/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::{
primitives::{Env, Spec},
CallFrame, Context, CreateFrame, Frame, FrameOrResult, FrameResult,
};
use alloc::boxed::Box;

use revm_interpreter::{CallOutcome, InterpreterResult};

Expand Down
1 change: 0 additions & 1 deletion crates/revm/src/handler/register.rs
Original file line number Diff line number Diff line change
@@ -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>;
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/inspector/handler_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DB: Database> {
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/journaled_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 3b91d55

Please sign in to comment.