Skip to content

Commit

Permalink
chore: bump revm (#5698)
Browse files Browse the repository at this point in the history
* chore: bump revm

* chore: fix breaking changes

* feat: add coverage test

* chore: clippy

* chore: switch revm to latest main

* Revert "Revert "feat(evm): Use latest revm main commit (#5669)" (#5695)"

This reverts commit f8a07c3.

* re-add coverage test

* fmt

* chore: clippy

* chore: fix test

* chore: fix test

* chore: remove unused/unnecessary stuff
  • Loading branch information
Evalir authored Aug 23, 2023
1 parent 5816d52 commit c2de140
Show file tree
Hide file tree
Showing 25 changed files with 139 additions and 149 deletions.
93 changes: 60 additions & 33 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ solang-parser = "=0.3.1"
#ethers-solc = { path = "../ethers-rs/ethers-solc" }

[patch.crates-io]
revm = { git = "https://github.com/bluealloy/revm/", branch = "release/v25" }
revm = { git = "https://github.com/bluealloy/revm/", rev = "6b55b9c0ab264c000e087c2f54f2d8dc24b869aa" }
23 changes: 12 additions & 11 deletions crates/anvil/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,18 +781,19 @@ impl NodeConfig {
/// *Note*: only memory based backend for now
pub(crate) async fn setup(&mut self) -> mem::Backend {
// configure the revm environment

let mut cfg = CfgEnv::default();
cfg.spec_id = self.get_hardfork().into();
cfg.chain_id = rU256::from(self.get_chain_id());
cfg.limit_contract_code_size = self.code_size_limit;
// EIP-3607 rejects transactions from senders with deployed code.
// If EIP-3607 is enabled it can cause issues during fuzz/invariant tests if the
// caller is a contract. So we disable the check by default.
cfg.disable_eip3607 = true;
cfg.disable_block_gas_limit = self.disable_block_gas_limit;

let mut env = revm::primitives::Env {
cfg: CfgEnv {
spec_id: self.get_hardfork().into(),
chain_id: rU256::from(self.get_chain_id()),
limit_contract_code_size: self.code_size_limit,
// EIP-3607 rejects transactions from senders with deployed code.
// If EIP-3607 is enabled it can cause issues during fuzz/invariant tests if the
// caller is a contract. So we disable the check by default.
disable_eip3607: true,
disable_block_gas_limit: self.disable_block_gas_limit,
..Default::default()
},
cfg,
block: BlockEnv {
gas_limit: self.gas_limit.into(),
basefee: self.get_base_fee().into(),
Expand Down
21 changes: 6 additions & 15 deletions crates/anvil/src/eth/backend/mem/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,17 @@ impl<DB: Database> revm::Inspector<DB> for Inspector {
&mut self,
interp: &mut Interpreter,
data: &mut EVMData<'_, DB>,
is_static: bool,
) -> InstructionResult {
call_inspectors!([&mut self.tracer], |inspector| {
inspector.initialize_interp(interp, data, is_static);
inspector.initialize_interp(interp, data);
});
InstructionResult::Continue
}

#[inline]
fn step(
&mut self,
interp: &mut Interpreter,
data: &mut EVMData<'_, DB>,
is_static: bool,
) -> InstructionResult {
fn step(&mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>) -> InstructionResult {
call_inspectors!([&mut self.tracer], |inspector| {
inspector.step(interp, data, is_static);
inspector.step(interp, data);
});
InstructionResult::Continue
}
Expand All @@ -92,11 +86,10 @@ impl<DB: Database> revm::Inspector<DB> for Inspector {
&mut self,
interp: &mut Interpreter,
data: &mut EVMData<'_, DB>,
is_static: bool,
eval: InstructionResult,
) -> InstructionResult {
call_inspectors!([&mut self.tracer], |inspector| {
inspector.step_end(interp, data, is_static, eval);
inspector.step_end(interp, data, eval);
});
eval
}
Expand All @@ -106,10 +99,9 @@ impl<DB: Database> revm::Inspector<DB> for Inspector {
&mut self,
data: &mut EVMData<'_, DB>,
call: &mut CallInputs,
is_static: bool,
) -> (InstructionResult, Gas, Bytes) {
call_inspectors!([&mut self.tracer, Some(&mut self.log_collector)], |inspector| {
inspector.call(data, call, is_static);
inspector.call(data, call);
});

(InstructionResult::Continue, Gas::new(call.gas_limit), Bytes::new())
Expand All @@ -123,10 +115,9 @@ impl<DB: Database> revm::Inspector<DB> for Inspector {
remaining_gas: Gas,
ret: InstructionResult,
out: Bytes,
is_static: bool,
) -> (InstructionResult, Gas, Bytes) {
call_inspectors!([&mut self.tracer], |inspector| {
inspector.call_end(data, inputs, remaining_gas, ret, out.clone(), is_static);
inspector.call_end(data, inputs, remaining_gas, ret, out.clone());
});
(ret, remaining_gas, out)
}
Expand Down
Loading

0 comments on commit c2de140

Please sign in to comment.