Skip to content

Commit

Permalink
refactor: simplify use statements (#864)
Browse files Browse the repository at this point in the history
* refactor: simplify use statements

* Update crates/interpreter/src/instructions/host.rs

---------

Co-authored-by: rakita <rakita@users.noreply.github.com>
  • Loading branch information
IaroslavMazur and rakita committed Nov 16, 2023
1 parent 29fca8b commit aa56677
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 35 deletions.
3 changes: 1 addition & 2 deletions bins/revme/src/cmd/format_kzg_setup.rs
@@ -1,6 +1,5 @@
pub use revm::primitives::kzg::{parse_kzg_trusted_setup, G1Points, G2Points, KzgErrors};
use std::path::PathBuf;
use std::{env, fs};
use std::{env, fs, path::PathBuf};
use structopt::StructOpt;

/// Statetest command
Expand Down
1 change: 0 additions & 1 deletion bins/revme/src/cmd/statetest/models/mod.rs
Expand Up @@ -117,7 +117,6 @@ pub type AccessList = Vec<AccessListItem>;
mod tests {

use super::*;
use revm::primitives::Address;
use serde_json::Error;

#[test]
Expand Down
5 changes: 2 additions & 3 deletions crates/interpreter/src/host.rs
@@ -1,12 +1,11 @@
use crate::primitives::Bytecode;
use crate::{
primitives::{Address, Bytes, Env, B256, U256},
primitives::{Address, Bytecode, Bytes, Env, B256, U256},
SelfDestructResult,
};
use alloc::vec::Vec;
pub use dummy::DummyHost;

mod dummy;
pub use dummy::DummyHost;

/// EVM context host.
pub trait Host {
Expand Down
7 changes: 3 additions & 4 deletions crates/interpreter/src/instructions/host.rs
@@ -1,10 +1,9 @@
use crate::interpreter::InterpreterAction;
use crate::primitives::{Address, Bytes, Spec, SpecId::*, B256, MAX_INITCODE_SIZE, U256};
use crate::{
gas::{self, COLD_ACCOUNT_ACCESS_COST, WARM_STORAGE_READ_COST},
interpreter::Interpreter,
interpreter::{Interpreter, InterpreterAction},
primitives::{Address, Bytes, Spec, SpecId::*, B256, U256},
CallContext, CallInputs, CallScheme, CreateInputs, CreateScheme, Host, InstructionResult,
Transfer,
Transfer, MAX_INITCODE_SIZE,
};
use alloc::{boxed::Box, vec::Vec};
use core::cmp::min;
Expand Down
1 change: 0 additions & 1 deletion crates/interpreter/src/instructions/i256.rs
Expand Up @@ -123,7 +123,6 @@ pub fn i256_mod(mut first: U256, mut second: U256) -> U256 {
#[cfg(test)]
mod tests {
use super::*;
use crate::primitives::U256;
use core::num::Wrapping;

#[test]
Expand Down
5 changes: 2 additions & 3 deletions crates/interpreter/src/interpreter.rs
Expand Up @@ -8,10 +8,9 @@ pub use contract::Contract;
pub use shared_memory::{next_multiple_of_32, SharedMemory};
pub use stack::{Stack, STACK_LIMIT};

use crate::primitives::Bytes;
use crate::{
push, push_b256, return_ok, return_revert, CallInputs, CreateInputs, Gas, Host,
InstructionResult,
primitives::Bytes, push, push_b256, return_ok, return_revert, CallInputs, CreateInputs, Gas,
Host, InstructionResult,
};
use alloc::boxed::Box;
use core::cmp::min;
Expand Down
3 changes: 1 addition & 2 deletions crates/precompile/src/blake2.rs
@@ -1,5 +1,4 @@
use crate::{Error, PrecompileWithAddress, StandardPrecompileFn};
use crate::{Precompile, PrecompileResult};
use crate::{Error, Precompile, PrecompileResult, PrecompileWithAddress, StandardPrecompileFn};
use core::convert::TryInto;

const F_ROUND: u64 = 1;
Expand Down
6 changes: 4 additions & 2 deletions crates/primitives/src/bytecode.rs
@@ -1,7 +1,9 @@
use crate::{hex, keccak256, Bytes, B256, KECCAK_EMPTY};
use alloc::{sync::Arc, vec::Vec};
use bitvec::prelude::{bitvec, Lsb0};
use bitvec::vec::BitVec;
use bitvec::{
prelude::{bitvec, Lsb0},
vec::BitVec,
};
use core::fmt::Debug;

/// A map of valid `jump` destinations.
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/constants.rs
Expand Up @@ -4,7 +4,7 @@ use crate::Address;
/// By default limit is 0x6000 (~25kb)
pub const MAX_CODE_SIZE: usize = 0x6000;

/// Number of blocks hashes that EVM can access in the past
/// Number of block hashes that EVM can access in the past
pub const BLOCK_HASH_HISTORY: usize = 256;

/// EIP-3860: Limit and meter initcode
Expand Down
5 changes: 1 addition & 4 deletions crates/primitives/src/db.rs
@@ -1,7 +1,4 @@
use crate::AccountInfo;
use crate::U256;
use crate::{Account, Bytecode};
use crate::{Address, B256};
use crate::{Account, AccountInfo, Address, Bytecode, B256, U256};
use auto_impl::auto_impl;
use hashbrown::HashMap as Map;

Expand Down
4 changes: 1 addition & 3 deletions crates/primitives/src/state.rs
Expand Up @@ -279,9 +279,7 @@ impl AccountInfo {

#[cfg(test)]
mod tests {
use crate::Account;
use crate::KECCAK_EMPTY;
use crate::U256;
use crate::{Account, KECCAK_EMPTY, U256};

#[test]
fn account_is_empty_balance() {
Expand Down
3 changes: 1 addition & 2 deletions crates/revm/src/frame.rs
@@ -1,5 +1,4 @@
use crate::JournalCheckpoint;
use crate::{interpreter::Interpreter, primitives::Address};
use crate::{interpreter::Interpreter, primitives::Address, JournalCheckpoint};
use core::ops::Range;

/// Call CallStackFrame.
Expand Down
3 changes: 1 addition & 2 deletions crates/revm/src/handler/optimism.rs
Expand Up @@ -238,10 +238,9 @@ pub fn end_handle<SPEC: Spec, DB: Database>(

#[cfg(test)]
mod tests {
use crate::primitives::{BedrockSpec, RegolithSpec};
use crate::primitives::{BedrockSpec, RegolithSpec, B256};

use super::*;
use crate::primitives::B256;

#[test]
fn test_revert_gas() {
Expand Down
8 changes: 5 additions & 3 deletions crates/revm/src/inspector/gas.rs
Expand Up @@ -150,9 +150,11 @@ mod tests {
#[test]
#[cfg(not(feature = "optimism"))]
fn test_gas_inspector() {
use crate::db::BenchmarkDB;
use crate::interpreter::opcode;
use crate::primitives::{address, Bytecode, Bytes, TransactTo};
use crate::{
db::BenchmarkDB,
interpreter::opcode,
primitives::{address, Bytecode, Bytes, TransactTo},
};

let contract_data: Bytes = Bytes::from(vec![
opcode::PUSH1,
Expand Down
3 changes: 1 addition & 2 deletions crates/revm/src/lib.rs
Expand Up @@ -47,8 +47,7 @@ pub use revm_interpreter as interpreter;
pub use revm_interpreter::primitives;

// reexport inspector implementations
pub use inspector::inspectors;
pub use inspector::{inspector_instruction, Inspector};
pub use inspector::{inspector_instruction, inspectors, Inspector};

// export Optimism types, helpers, and constants
#[cfg(feature = "optimism")]
Expand Down

0 comments on commit aa56677

Please sign in to comment.