Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions bins/revme/src/cmd/bench/burntpix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use revm::{
context::TxEnv,
database::{CacheDB, BENCH_CALLER},
database_interface::EmptyDB,
primitives::{hex, keccak256, Address, Bytes, TxKind, B256, U256},
primitives::{StorageKey, StorageValue},
primitives::{hex, keccak256, Address, Bytes, StorageKey, StorageValue, TxKind, B256, U256},
state::{AccountInfo, Bytecode},
Context, ExecuteEvm, MainBuilder, MainContext,
};
Expand Down
10 changes: 6 additions & 4 deletions bins/revme/src/cmd/blockchaintest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ use serde_json::json;
use statetest_types::blockchain::{
Account, BlockchainTest, BlockchainTestCase, ForkSpec, Withdrawal,
};
use std::collections::BTreeMap;
use std::fs;
use std::path::{Path, PathBuf};
use std::time::Instant;
use std::{
collections::BTreeMap,
fs,
path::{Path, PathBuf},
time::Instant,
};
use thiserror::Error;
use walkdir::{DirEntry, WalkDir};

Expand Down
4 changes: 1 addition & 3 deletions bins/revme/src/cmd/evmrunner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ use revm::{
primitives::{hex, TxKind},
Context, Database, ExecuteEvm, MainBuilder, MainContext,
};
use std::path::PathBuf;
use std::{borrow::Cow, fs};
use std::{io::Error as IoError, time::Instant};
use std::{borrow::Cow, fs, io::Error as IoError, path::PathBuf, time::Instant};

#[derive(Debug, thiserror::Error)]
pub enum Errors {
Expand Down
2 changes: 1 addition & 1 deletion bins/revme/src/cmd/statetest/merkle_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::convert::Infallible;
use alloy_rlp::{RlpEncodable, RlpMaxEncodedLen};
use hash_db::Hasher;
use plain_hasher::PlainHasher;
use revm::primitives::{keccak256, Address, Log, B256, U256};
use revm::{
context::result::{EVMError, ExecutionResult, HaltReason, InvalidTransaction},
database::{EmptyDB, PlainAccount, State},
primitives::{keccak256, Address, Log, B256, U256},
};
use triehash::sec_trie_root;

Expand Down
3 changes: 1 addition & 2 deletions bins/revme/src/cmd/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use revm::{
database,
database_interface::EmptyDB,
inspector::{inspectors::TracerEip3155, InspectCommitEvm},
primitives::U256,
primitives::{hardfork::SpecId, Bytes, B256},
primitives::{hardfork::SpecId, Bytes, B256, U256},
Context, ExecuteCommitEvm, MainBuilder, MainContext,
};
use serde_json::json;
Expand Down
3 changes: 1 addition & 2 deletions crates/context/interface/src/cfg.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Configuration for the EVM. Containing [`SpecId`].
use auto_impl::auto_impl;
use core::fmt::Debug;
use core::hash::Hash;
use core::{fmt::Debug, hash::Hash};
use primitives::{hardfork::SpecId, Address, TxKind, U256};

/// Configuration for the EVM.
Expand Down
3 changes: 1 addition & 2 deletions crates/context/interface/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ pub use transaction_type::TransactionType;

use crate::result::InvalidTransaction;
use auto_impl::auto_impl;
use core::cmp::min;
use core::fmt::Debug;
use core::{cmp::min, fmt::Debug};
use primitives::{eip4844::GAS_PER_BLOB, Address, Bytes, TxKind, B256, U256};
use std::boxed::Box;

Expand Down
6 changes: 4 additions & 2 deletions crates/context/src/evm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! This module contains [`Evm`] struct.
use core::fmt::Debug;
use core::ops::{Deref, DerefMut};
use core::{
fmt::Debug,
ops::{Deref, DerefMut},
};

use context_interface::FrameStack;

Expand Down
2 changes: 1 addition & 1 deletion crates/context/src/journal/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use context_interface::{
journaled_state::{
account::JournaledAccount,
entry::{JournalEntryTr, SelfdestructionRevertStatus},
AccountLoad, JournalCheckpoint, JournalLoadError, TransferError,
},
journaled_state::{AccountLoad, JournalCheckpoint, JournalLoadError, TransferError},
};
use core::mem;
use database_interface::Database;
Expand Down
3 changes: 1 addition & 2 deletions crates/database/interface/src/empty_db.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Empty database implementation.
use crate::{DBErrorMarker, Database, DatabaseRef};
use core::error::Error;
use core::{convert::Infallible, fmt, marker::PhantomData};
use core::{convert::Infallible, error::Error, fmt, marker::PhantomData};
use primitives::{keccak256, Address, StorageKey, StorageValue, B256};
use state::{AccountInfo, Bytecode};
use std::string::ToString;
Expand Down
3 changes: 1 addition & 2 deletions crates/ee-tests/src/op_revm_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ use revm::{
state::Bytecode,
Context, ExecuteEvm, InspectEvm, Inspector, Journal, SystemCallEvm,
};
use std::path::PathBuf;
use std::vec::Vec;
use std::{path::PathBuf, vec::Vec};

// Re-export the constant for testdata directory path
const TESTS_TESTDATA: &str = "tests/op_revm_testdata";
Expand Down
19 changes: 9 additions & 10 deletions crates/handler/src/frame.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
use crate::evm::FrameTr;
use crate::item_or_result::FrameInitOrResult;
use crate::{precompile_provider::PrecompileProvider, ItemOrResult};
use crate::{CallFrame, CreateFrame, FrameData, FrameResult};
use crate::{
evm::FrameTr, item_or_result::FrameInitOrResult, precompile_provider::PrecompileProvider,
CallFrame, CreateFrame, FrameData, FrameResult, ItemOrResult,
};
use context::result::FromStringError;
use context_interface::context::ContextError;
use context_interface::local::{FrameToken, OutFrame};
use context_interface::ContextTr;
use context_interface::{
context::ContextError,
journaled_state::{JournalCheckpoint, JournalTr},
Cfg, Database,
local::{FrameToken, OutFrame},
Cfg, ContextTr, Database,
};
use core::cmp::min;
use derive_where::derive_where;
use interpreter::interpreter_action::FrameInit;
use interpreter::{
gas,
interpreter::{EthInterpreter, ExtBytecode},
interpreter_action::FrameInit,
interpreter_types::ReturnData,
CallInput, CallInputs, CallOutcome, CallValue, CreateInputs, CreateOutcome, CreateScheme,
FrameInput, Gas, InputsImpl, InstructionResult, Interpreter, InterpreterAction,
Expand All @@ -24,8 +23,8 @@ use interpreter::{
use primitives::{
constants::CALL_STACK_LIMIT,
hardfork::SpecId::{self, HOMESTEAD, LONDON, SPURIOUS_DRAGON},
keccak256, Address, Bytes, U256,
};
use primitives::{keccak256, Address, Bytes, U256};
use state::Bytecode;
use std::{borrow::ToOwned, boxed::Box, vec::Vec};

Expand Down
14 changes: 7 additions & 7 deletions crates/handler/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use crate::{
evm::FrameTr, execution, post_execution, pre_execution, validation, EvmTr, FrameResult,
ItemOrResult,
};
use context::result::{ExecutionResult, FromStringError};
use context::LocalContextTr;
use context_interface::context::ContextError;
use context_interface::ContextTr;
use context::{
result::{ExecutionResult, FromStringError},
LocalContextTr,
};
use context_interface::{
context::ContextError,
result::{HaltReasonTr, InvalidHeader, InvalidTransaction},
Cfg, Database, JournalTr, Transaction,
Cfg, ContextTr, Database, JournalTr, Transaction,
};
use interpreter::interpreter_action::FrameInit;
use interpreter::{Gas, InitialAndFloorGas, SharedMemory};
use interpreter::{interpreter_action::FrameInit, Gas, InitialAndFloorGas, SharedMemory};
use primitives::U256;
use state::Bytecode;

Expand Down
6 changes: 2 additions & 4 deletions crates/handler/src/mainnet_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ impl MainContext for Context<BlockEnv, TxEnv, CfgEnv, EmptyDB, Journal<EmptyDB>,

#[cfg(test)]
mod test {
use crate::ExecuteEvm;
use crate::{MainBuilder, MainContext};
use crate::{ExecuteEvm, MainBuilder, MainContext};
use alloy_signer::{Either, SignerSync};
use alloy_signer_local::PrivateKeySigner;
use bytecode::{
Expand All @@ -84,8 +83,7 @@ mod test {
use context::{Context, TxEnv};
use context_interface::transaction::Authorization;
use database::{BenchmarkDB, EEADDRESS, FFADDRESS};
use primitives::{hardfork::SpecId, TxKind, U256};
use primitives::{StorageKey, StorageValue};
use primitives::{hardfork::SpecId, StorageKey, StorageValue, TxKind, U256};

#[test]
fn sanity_eip7702_tx() {
Expand Down
9 changes: 3 additions & 6 deletions crates/handler/src/pre_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@

use crate::{EvmTr, PrecompileProvider};
use bytecode::Bytecode;
use context_interface::transaction::{AccessListItemTr, AuthorizationTr};
use context_interface::ContextTr;
use context_interface::{
journaled_state::JournalTr,
result::InvalidTransaction,
transaction::{Transaction, TransactionType},
Block, Cfg, Database,
transaction::{AccessListItemTr, AuthorizationTr, Transaction, TransactionType},
Block, Cfg, ContextTr, Database,
};
use core::cmp::Ordering;
use primitives::{eip7702, hardfork::SpecId, U256};
use primitives::{Address, HashMap, HashSet, StorageKey};
use primitives::{eip7702, hardfork::SpecId, Address, HashMap, HashSet, StorageKey, U256};
use state::AccountInfo;

/// Loads and warms accounts for execution, including precompiles and access list.
Expand Down
9 changes: 5 additions & 4 deletions crates/handler/src/precompile_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ use auto_impl::auto_impl;
use context::{Cfg, LocalContextTr};
use context_interface::{ContextTr, JournalTr};
use interpreter::{CallInput, CallInputs, Gas, InstructionResult, InterpreterResult};
use precompile::PrecompileError;
use precompile::{PrecompileSpecId, Precompiles};
use precompile::{PrecompileError, PrecompileSpecId, Precompiles};
use primitives::{hardfork::SpecId, Address, Bytes};
use std::boxed::Box;
use std::string::{String, ToString};
use std::{
boxed::Box,
string::{String, ToString},
};

/// Provider for precompiled contracts in the EVM.
#[auto_impl(&mut, Box)]
Expand Down
3 changes: 1 addition & 2 deletions crates/inspector/src/eip3155.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::inspectors::GasInspector;
use crate::Inspector;
use crate::{inspectors::GasInspector, Inspector};
use context::{Cfg, ContextTr, JournalTr, Transaction};
use interpreter::{
interpreter_types::{Jumps, LoopControl, MemoryTr, StackTr},
Expand Down
3 changes: 1 addition & 2 deletions crates/interpreter/src/interpreter/ext_bytecode/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use super::ExtBytecode;
use crate::interpreter::Jumps;
use primitives::B256;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::borrow::Cow;
use std::format;
use std::{borrow::Cow, format};

#[derive(Serialize, Deserialize)]
struct ExtBytecodeSerde<'a> {
Expand Down
6 changes: 4 additions & 2 deletions crates/interpreter/src/interpreter_types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::{CallInput, InstructionResult, InterpreterAction};
use core::cell::Ref;
use core::ops::{Deref, Range};
use core::{
cell::Ref,
ops::{Deref, Range},
};
use primitives::{hardfork::SpecId, Address, Bytes, B256, U256};

/// Helper function to read immediates data from the bytecode
Expand Down
3 changes: 1 addition & 2 deletions crates/interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ pub mod interpreter_types;
// Reexport primary types.
pub use context_interface::{
context::{SStoreResult, SelfDestructResult, StateLoad},
CreateScheme,
host, CreateScheme, Host,
};
pub use context_interface::{host, Host};
pub use gas::{Gas, InitialAndFloorGas};
pub use instruction_context::InstructionContext;
pub use instruction_result::*;
Expand Down
5 changes: 2 additions & 3 deletions crates/op-revm/src/fast_lz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,13 @@ fn u24(input: &[u8], idx: u32) -> u32 {
mod tests {
use super::*;
use crate::api::{builder::OpBuilder, default_ctx::DefaultOp};
use alloy_sol_types::sol;
use alloy_sol_types::SolCall;
use alloy_sol_types::{sol, SolCall};
use revm::{
bytecode::Bytecode,
database::{BenchmarkDB, EEADDRESS, FFADDRESS},
primitives::{bytes, Bytes, TxKind, U256},
Context, ExecuteEvm,
};
use revm::{Context, ExecuteEvm};
use rstest::rstest;
use std::vec::Vec;

Expand Down
3 changes: 1 addition & 2 deletions crates/op-revm/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ use revm::{
},
primitives::{hardfork::SpecId, Address, OnceLock},
};
use std::boxed::Box;
use std::string::String;
use std::{boxed::Box, string::String};

/// Optimism precompile provider
#[derive(Debug, Clone)]
Expand Down
3 changes: 1 addition & 2 deletions crates/precompile/bench/eip1962.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Benchmarks for the BN254 precompiles
use criterion::{measurement::Measurement, BenchmarkGroup};
use primitives::hex;
use primitives::Bytes;
use primitives::{hex, Bytes};
use revm_precompile::bn254::{
add::ISTANBUL_ADD_GAS_COST,
mul::ISTANBUL_MUL_GAS_COST,
Expand Down
4 changes: 1 addition & 3 deletions crates/precompile/src/bls12_381/g1_add.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! BLS12-381 G1 add precompile. More details in [`g1_add`]
use super::utils::{pad_g1_point, remove_g1_padding};
use crate::bls12_381_const::{
G1_ADD_ADDRESS, G1_ADD_BASE_GAS_FEE, G1_ADD_INPUT_LENGTH, PADDED_G1_LENGTH,
};
use crate::{
bls12_381_const::{G1_ADD_ADDRESS, G1_ADD_BASE_GAS_FEE, G1_ADD_INPUT_LENGTH, PADDED_G1_LENGTH},
crypto, Precompile, PrecompileError, PrecompileId, PrecompileOutput, PrecompileResult,
};

Expand Down
16 changes: 9 additions & 7 deletions crates/precompile/src/bls12_381/g1_msm.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
//! BLS12-381 G1 msm precompile. More details in [`g1_msm`]
use crate::bls12_381::utils::{pad_g1_point, remove_g1_padding};
use crate::bls12_381::G1Point;
use crate::bls12_381_const::{
DISCOUNT_TABLE_G1_MSM, G1_MSM_ADDRESS, G1_MSM_BASE_GAS_FEE, G1_MSM_INPUT_LENGTH,
PADDED_G1_LENGTH, SCALAR_LENGTH,
};
use crate::bls12_381_utils::msm_required_gas;
use crate::{
bls12_381::{
utils::{pad_g1_point, remove_g1_padding},
G1Point,
},
bls12_381_const::{
DISCOUNT_TABLE_G1_MSM, G1_MSM_ADDRESS, G1_MSM_BASE_GAS_FEE, G1_MSM_INPUT_LENGTH,
PADDED_G1_LENGTH, SCALAR_LENGTH,
},
bls12_381_utils::msm_required_gas,
crypto, Precompile, PrecompileError, PrecompileId, PrecompileOutput, PrecompileResult,
};

Expand Down
4 changes: 1 addition & 3 deletions crates/precompile/src/bls12_381/g2_add.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! BLS12-381 G2 add precompile. More details in [`g2_add`]
use super::utils::{pad_g2_point, remove_g2_padding};
use crate::bls12_381_const::{
G2_ADD_ADDRESS, G2_ADD_BASE_GAS_FEE, G2_ADD_INPUT_LENGTH, PADDED_G2_LENGTH,
};
use crate::{
bls12_381_const::{G2_ADD_ADDRESS, G2_ADD_BASE_GAS_FEE, G2_ADD_INPUT_LENGTH, PADDED_G2_LENGTH},
crypto, Precompile, PrecompileError, PrecompileId, PrecompileOutput, PrecompileResult,
};

Expand Down
10 changes: 5 additions & 5 deletions crates/precompile/src/bls12_381/g2_msm.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! BLS12-381 G2 msm precompile. More details in [`g2_msm`]
use super::utils::{pad_g2_point, remove_g2_padding};
use crate::bls12_381_const::{
DISCOUNT_TABLE_G2_MSM, G2_MSM_ADDRESS, G2_MSM_BASE_GAS_FEE, G2_MSM_INPUT_LENGTH,
PADDED_G2_LENGTH, SCALAR_LENGTH,
};
use crate::bls12_381_utils::msm_required_gas;
use crate::{
bls12_381_const::{
DISCOUNT_TABLE_G2_MSM, G2_MSM_ADDRESS, G2_MSM_BASE_GAS_FEE, G2_MSM_INPUT_LENGTH,
PADDED_G2_LENGTH, SCALAR_LENGTH,
},
bls12_381_utils::msm_required_gas,
crypto, Precompile, PrecompileError, PrecompileId, PrecompileOutput, PrecompileResult,
};

Expand Down
6 changes: 3 additions & 3 deletions crates/precompile/src/bls12_381/map_fp2_to_g2.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! BLS12-381 map fp2 to g2 precompile. More details in [`map_fp2_to_g2`]
use super::utils::{pad_g2_point, remove_fp_padding};
use crate::bls12_381_const::{
MAP_FP2_TO_G2_ADDRESS, MAP_FP2_TO_G2_BASE_GAS_FEE, PADDED_FP2_LENGTH, PADDED_FP_LENGTH,
};
use crate::{
bls12_381_const::{
MAP_FP2_TO_G2_ADDRESS, MAP_FP2_TO_G2_BASE_GAS_FEE, PADDED_FP2_LENGTH, PADDED_FP_LENGTH,
},
crypto, Precompile, PrecompileError, PrecompileId, PrecompileOutput, PrecompileResult,
};

Expand Down
2 changes: 1 addition & 1 deletion crates/precompile/src/bls12_381/map_fp_to_g1.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! BLS12-381 map fp to g1 precompile. More details in [`map_fp_to_g1`]
use super::utils::{pad_g1_point, remove_fp_padding};
use crate::bls12_381_const::{MAP_FP_TO_G1_ADDRESS, MAP_FP_TO_G1_BASE_GAS_FEE, PADDED_FP_LENGTH};
use crate::{
bls12_381_const::{MAP_FP_TO_G1_ADDRESS, MAP_FP_TO_G1_BASE_GAS_FEE, PADDED_FP_LENGTH},
crypto, Precompile, PrecompileError, PrecompileId, PrecompileOutput, PrecompileResult,
};

Expand Down
Loading
Loading