Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b9f75a0
refactor: allow chain-specific configuration of Evm
Wodann May 1, 2024
9f4abf7
refactor: rename Transaction::transact_to and clarify docs
Wodann Jun 18, 2024
ae14441
refactor: remove trait bounds on Transaction super trait
Wodann Jun 18, 2024
13aabf4
refactor: remove trait bounds from Block supertrait
Wodann Jun 18, 2024
2a84559
fix: clippy warnings
Wodann Jun 19, 2024
1c17cd0
fix: cargo doc
Wodann Jun 19, 2024
904f0f5
refactor: limit trait bounds on HaltReason
Wodann Jun 19, 2024
8a1530c
refactor: allow moving of kind
Wodann Jun 19, 2024
29f3be6
refactor: rename Transaction::nonce to nonce_opt to signal that it's …
Wodann Jun 19, 2024
9f5e2d3
refactor: replace AccessList with alloy version
Wodann Jun 19, 2024
3baf771
refactor: rename gas_priority_fee to max_priority_fee_per_gas
Wodann Jun 20, 2024
4710a4b
refactor: correct trait bound on ExecutionResult::clone
Wodann Jun 20, 2024
5bf0156
Clone
Wodann Jun 20, 2024
612bb40
refactor: only allow optional nonce check via CfgEnv
Wodann Jun 20, 2024
94d529b
fix: use alloy-eips with fix for serde
Wodann Jun 21, 2024
e68f3af
build: bump to alloy-eips v0.1.2
Wodann Jun 24, 2024
da97359
build: Cargo.lock file
Wodann Jun 24, 2024
c903557
fix: revme
Wodann Jun 24, 2024
23525aa
refactor: derive DummyHost
Wodann Jun 24, 2024
729b236
refactor: derive Clone for ExecutionResult
Wodann Jun 24, 2024
a35aaa6
refactor: remove EVMErrorForChain
Wodann Jun 24, 2024
11a4fe6
refactor: remove EVMErrorForChain
Wodann Jun 24, 2024
b3b9b71
refactor: derive Clone for CfgEnvWithChainSpec
Wodann Jun 24, 2024
1c908e1
refactor: use EVMResultGeneric
Wodann Jun 24, 2024
a4e49cc
refactor: use EVMResultGeneric
Wodann Jun 24, 2024
8e3e3be
refactor: use EVMResultGeneric
Wodann Jun 24, 2024
adf87c4
refactor: use EVMResultGeneric
Wodann Jun 24, 2024
4761941
refactor: use EVMResultGeneric
Wodann Jun 24, 2024
78fe3f2
refactor: use EVMResultGeneric
Wodann Jun 24, 2024
e65e829
refactor: add convenience EVMErrorForChain type alias
Wodann Jun 24, 2024
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
Prev Previous commit
Next Next commit
refactor: remove EVMErrorForChain
  • Loading branch information
Wodann committed Jun 25, 2024
commit a35aaa6717c244256d27e1f441a3aac1ec467c40
5 changes: 0 additions & 5 deletions crates/primitives/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ impl<DBError, TransactionValidationErrorT> EVMError<DBError, TransactionValidati
}
}

pub type EVMErrorForChain<DBError, ChainSpecT> = EVMError<
DBError,
<<ChainSpecT as ChainSpec>::Transaction as TransactionValidation>::ValidationError,
>;

#[cfg(feature = "std")]
impl<DBError, TransactionValidationErrorT> std::error::Error
for EVMError<DBError, TransactionValidationErrorT>
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/context/evm_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
return_ok, CallInputs, Contract, Gas, InstructionResult, Interpreter, InterpreterResult,
},
primitives::{
Address, Bytes, ChainSpec, EVMError, EVMErrorForChain, Env, TransactionValidation, U256,
Address, Bytes, ChainSpec, EVMError, result::EVMResultGeneric, Env, TransactionValidation, U256,
},
ContextPrecompiles, FrameOrResult, CALL_STACK_LIMIT,
};
Expand Down Expand Up @@ -89,7 +89,7 @@ impl<ChainSpecT: ChainSpec, DB: Database> EvmContext<ChainSpecT, DB> {
address: &Address,
input_data: &Bytes,
gas: Gas,
) -> Result<Option<InterpreterResult>, EVMErrorForChain<DB::Error, ChainSpecT>> {
) -> EVMResultGeneric<Option<InterpreterResult>, ChainSpecT, DB::Error> {
let Some(outcome) =
self.precompiles
.call(address, input_data, gas.limit(), &mut self.inner)
Expand Down
6 changes: 3 additions & 3 deletions crates/revm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::{
handler::{EnvWithChainSpec, Handler},
interpreter::{CallInputs, CreateInputs, EOFCreateInputs, InterpreterAction, SharedMemory},
primitives::{
CfgEnv, ChainSpec, EVMError, EVMErrorForChain, EVMResult, EthChainSpec, ExecutionResult,
ResultAndState, SpecId, Transaction as _, TransactionValidation, TxKind,
result::EVMResultGeneric, CfgEnv, ChainSpec, EVMError, EVMResult, EthChainSpec,
ExecutionResult, ResultAndState, SpecId, Transaction as _, TransactionValidation, TxKind,
},
Context, ContextWithChainSpec, Frame, FrameOrResult, FrameResult,
};
Expand Down Expand Up @@ -44,7 +44,7 @@ impl<EXT, ChainSpecT: ChainSpec, DB: Database + DatabaseCommit> Evm<'_, ChainSpe
/// Commit the changes to the database.
pub fn transact_commit(
&mut self,
) -> Result<ExecutionResult<ChainSpecT>, EVMErrorForChain<DB::Error, ChainSpecT>> {
) -> EVMResultGeneric<ExecutionResult<ChainSpecT>, ChainSpecT, DB::Error> {
let ResultAndState { result, state } = self.transact()?;
self.context.evm.db.commit(state);
Ok(result)
Expand Down
8 changes: 4 additions & 4 deletions crates/revm/src/handler/handle_types/post_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
handler::mainnet,
interpreter::Gas,
primitives::{
db::Database, ChainSpec, EVMError, EVMErrorForChain, EVMResultGeneric, ResultAndState,
db::Database, ChainSpec, EVMError, EVMResultGeneric, ResultAndState,
Spec, TransactionValidation,
},
Context, FrameResult,
Expand Down Expand Up @@ -121,16 +121,16 @@ impl<'a, ChainSpecT: ChainSpec, EXT, DB: Database> PostExecutionHandler<'a, Chai
&self,
context: &mut Context<ChainSpecT, EXT, DB>,
result: FrameResult,
) -> Result<ResultAndState<ChainSpecT>, EVMErrorForChain<DB::Error, ChainSpecT>> {
) -> EVMResultGeneric<ResultAndState<ChainSpecT>, ChainSpecT, DB::Error> {
(self.output)(context, result)
}

/// End handler.
pub fn end(
&self,
context: &mut Context<ChainSpecT, EXT, DB>,
end_output: Result<ResultAndState<ChainSpecT>, EVMErrorForChain<DB::Error, ChainSpecT>>,
) -> Result<ResultAndState<ChainSpecT>, EVMErrorForChain<DB::Error, ChainSpecT>> {
end_output: EVMResultGeneric<ResultAndState<ChainSpecT>, ChainSpecT, DB::Error>,
) -> EVMResultGeneric<ResultAndState<ChainSpecT>, ChainSpecT, DB::Error> {
(self.end)(context, end_output)
}

Expand Down
10 changes: 5 additions & 5 deletions crates/revm/src/handler/mainnet/post_execution.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
interpreter::{Gas, SuccessOrHalt},
primitives::{
db::Database, Block, ChainSpec, EVMError, EVMErrorForChain, ExecutionResult,
db::Database, result::EVMResultGeneric, Block, ChainSpec, EVMError, ExecutionResult,
ResultAndState, Spec, SpecId::LONDON, Transaction, TransactionValidation, U256,
},
Context, FrameResult,
Expand All @@ -11,8 +11,8 @@ use crate::{
#[inline]
pub fn end<ChainSpecT: ChainSpec, EXT, DB: Database>(
_context: &mut Context<ChainSpecT, EXT, DB>,
evm_output: Result<ResultAndState<ChainSpecT>, EVMErrorForChain<DB::Error, ChainSpecT>>,
) -> Result<ResultAndState<ChainSpecT>, EVMErrorForChain<DB::Error, ChainSpecT>> {
evm_output: EVMResultGeneric<ResultAndState<ChainSpecT>, ChainSpecT, DB::Error>,
) -> EVMResultGeneric<ResultAndState<ChainSpecT>, ChainSpecT, DB::Error> {
evm_output
}

Expand Down Expand Up @@ -67,7 +67,7 @@ pub fn reward_beneficiary<ChainSpecT: ChainSpec, SPEC: Spec, EXT, DB: Database>(
pub fn reimburse_caller<ChainSpecT: ChainSpec, EXT, DB: Database>(
context: &mut Context<ChainSpecT, EXT, DB>,
gas: &Gas,
) -> Result<(), EVMErrorForChain<DB::Error, ChainSpecT>> {
) -> EVMResultGeneric<(), ChainSpecT, DB::Error> {
let caller = context.evm.env.tx.caller();
let effective_gas_price = context.evm.env.effective_gas_price();

Expand All @@ -92,7 +92,7 @@ pub fn reimburse_caller<ChainSpecT: ChainSpec, EXT, DB: Database>(
pub fn output<ChainSpecT: ChainSpec, EXT, DB: Database>(
context: &mut Context<ChainSpecT, EXT, DB>,
result: FrameResult,
) -> Result<ResultAndState<ChainSpecT>, EVMErrorForChain<DB::Error, ChainSpecT>> {
) -> EVMResultGeneric<ResultAndState<ChainSpecT>, ChainSpecT, DB::Error> {
context.evm.take_error().map_err(EVMError::Database)?;

// used gas with refund calculated.
Expand Down