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
39 changes: 26 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ alloy-transport = { version = "1.0.23", default-features = false }
alloy-transport-http = { version = "1.0.23", default-features = false }
alloy-transport-ipc = { version = "1.0.23", default-features = false }
alloy-transport-ws = { version = "1.0.23", default-features = false }
alloy-hardforks = { version = "0.2.12", default-features = false }
alloy-op-hardforks = { version = "0.2.12", default-features = false }
alloy-hardforks = { version = "0.3.0", default-features = false }
alloy-op-hardforks = { version = "0.3.0", default-features = false }

## alloy-core
alloy-dyn-abi = "1.3.1"
Expand Down Expand Up @@ -265,8 +265,8 @@ revm-inspectors = { version = "0.29.0", features = ["serde"] }
op-revm = { version = "10.0.0", default-features = false }

## alloy-evm
alloy-evm = "0.19.0"
alloy-op-evm = "0.19.0"
alloy-evm = "0.20.1"
alloy-op-evm = "0.20.1"

## cli
anstream = "0.6"
Expand Down
12 changes: 10 additions & 2 deletions crates/anvil/src/eth/backend/cheats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ use alloy_primitives::{
};
use parking_lot::RwLock;
use revm::precompile::{
PrecompileError, PrecompileOutput, PrecompileResult, secp256k1::ec_recover_run,
PrecompileError, PrecompileId, PrecompileOutput, PrecompileResult, secp256k1::ec_recover_run,
utilities::right_pad,
};
use std::sync::Arc;
use std::{borrow::Cow, sync::Arc};

/// ID for the [`CheatEcrecover::precompile_id`] precompile.
static PRECOMPILE_ID_CHEAT_ECRECOVER: PrecompileId =
PrecompileId::Custom(Cow::Borrowed("cheat_ecrecover"));

/// Manages user modifications that may affect the node's behavior
///
Expand Down Expand Up @@ -127,6 +131,10 @@ impl Precompile for CheatEcrecover {
ec_recover_run(input.data, input.gas)
}

fn precompile_id(&self) -> &PrecompileId {
&PRECOMPILE_ID_CHEAT_ECRECOVER
}

fn is_pure(&self) -> bool {
false
}
Expand Down
5 changes: 4 additions & 1 deletion crates/anvil/src/eth/backend/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,10 @@ impl<DB: Db + ?Sized, V: TransactionValidator> Iterator for &mut TransactionExec
if cheats.has_recover_overrides() {
let cheat_ecrecover = CheatEcrecover::new(Arc::clone(&cheats));
evm.precompiles_mut().apply_precompile(&EC_RECOVER, move |_| {
Some(DynPrecompile::new_stateful(move |input| cheat_ecrecover.call(input)))
Some(DynPrecompile::new_stateful(
cheat_ecrecover.precompile_id().clone(),
move |input| cheat_ecrecover.call(input),
))
});
}

Expand Down
5 changes: 4 additions & 1 deletion crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,10 @@ impl Backend {
if cheats.has_recover_overrides() {
let cheat_ecrecover = CheatEcrecover::new(Arc::clone(&cheats));
evm.precompiles_mut().apply_precompile(&EC_RECOVER, move |_| {
Some(DynPrecompile::new_stateful(move |input| cheat_ecrecover.call(input)))
Some(DynPrecompile::new_stateful(
cheat_ecrecover.precompile_id().clone(),
move |input| cheat_ecrecover.call(input),
))
});
}

Expand Down
5 changes: 5 additions & 0 deletions crates/anvil/src/hardfork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ pub fn spec_id_from_ethereum_hardfork(hardfork: EthereumHardfork) -> SpecId {
EthereumHardfork::Cancun => SpecId::CANCUN,
EthereumHardfork::Prague => SpecId::PRAGUE,
EthereumHardfork::Osaka => SpecId::OSAKA,
EthereumHardfork::Bpo1
| EthereumHardfork::Bpo2
| EthereumHardfork::Bpo3
| EthereumHardfork::Bpo4
| EthereumHardfork::Bpo5 => unimplemented!(),
}
}

Expand Down
Loading