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
233 changes: 148 additions & 85 deletions Cargo.lock

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ foundry-compilers = { version = "0.19.5", default-features = false, features = [
"rustls",
"svm-solc",
] }
foundry-fork-db = "0.20"
foundry-fork-db = "0.21"
solang-parser = { version = "=0.3.9", package = "foundry-solang-parser" }
solar = { package = "solar-compiler", version = "=0.1.8", default-features = false }
svm = { package = "svm-rs", version = "0.5", default-features = false, features = [
Expand Down Expand Up @@ -286,13 +286,13 @@ op-alloy-rpc-types = "0.22.0"
op-alloy-flz = "0.13.1"

## alloy-evm
alloy-evm = "0.23.2"
alloy-op-evm = "0.23.2"
alloy-evm = "0.24.1"
alloy-op-evm = "0.24.1"

# revm
revm = { version = "31.0.0", default-features = false }
revm-inspectors = { version = "0.32.0", features = ["serde"] }
op-revm = { version = "12.0.0", default-features = false }
revm = { version = "33.0.0", default-features = false }
revm-inspectors = { version = "0.33.0", features = ["serde"] }
op-revm = { version = "14.0.0", default-features = false }

## cli
anstream = "0.6"
Expand Down Expand Up @@ -437,18 +437,18 @@ rexpect = { git = "https://github.com/rust-cli/rexpect", rev = "2ed0b1898d7edaf6
# alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "7fab7ee" }

## alloy-evm
# alloy-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "085ad53" }
# alloy-op-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "085ad53" }
# alloy-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "237d0a0" }
# alloy-op-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "237d0a0" }

## revm
# revm = { git = "https://github.com/bluealloy/revm.git", rev = "d9cda3a" }
# op-revm = { git = "https://github.com/bluealloy/revm.git", rev = "d9cda3a" }
# revm-inspectors = { git = "https://github.com/zerosnacks/revm-inspectors.git", rev = "340d37e" }
revm = { git = "https://github.com/bluealloy/revm.git", rev = "7e59936" }
op-revm = { git = "https://github.com/bluealloy/revm.git", rev = "7e59936" }
# revm-inspectors = { git = "https://github.com/zerosnacks/revm-inspectors.git", rev = "0aaab71" }

## foundry
# foundry-block-explorers = { git = "https://github.com/foundry-rs/block-explorers.git", rev = "f5b46b2" }
# foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", branch = "main" }
# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "be95912" }
# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "b4299fc" }

# solar
solar = { package = "solar-compiler", git = "https://github.com/paradigmxyz/solar.git", rev = "0bea5f0" }
Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/backend/mem/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ where
}

#[allow(clippy::redundant_clone)]
fn log(&mut self, interp: &mut Interpreter, ecx: &mut CTX, log: Log) {
fn log_full(&mut self, interp: &mut Interpreter, ecx: &mut CTX, log: Log) {
call_inspectors!([&mut self.tracer, &mut self.log_collector], |inspector| {
inspector.log(interp, ecx, log.clone());
inspector.log_full(interp, ecx, log.clone());
});
}

Expand Down
1 change: 1 addition & 0 deletions crates/anvil/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ mod tests {
Ok(PrecompileOutput {
bytes: Bytes::copy_from_slice(input.data),
gas_used: 0,
gas_refunded: 0,
reverted: false,
})
}),
Expand Down
1 change: 1 addition & 0 deletions crates/anvil/tests/it/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1878,6 +1878,7 @@ async fn test_config_with_osaka_hardfork_with_precompile_factory() {
Ok(revm::precompile::PrecompileOutput {
bytes: Bytes::copy_from_slice(input.data),
gas_used: 0,
gas_refunded: 0,
reverted: false,
})
},
Expand Down
32 changes: 22 additions & 10 deletions crates/cheatcodes/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,12 @@ impl Cheatcode for loadCall {
fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result {
let Self { target, slot } = *self;
ccx.ensure_not_precompile(&target)?;
ccx.ecx.journaled_state.load_account(target)?;
let mut val = ccx.ecx.journaled_state.sload(target, slot.into())?;

let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
journal.load_account(db, target)?;
let mut val = journal
.sload(db, target, slot.into(), false)
.map_err(|e| fmt_err!("failed to load storage slot: {:?}", e))?;

if val.is_cold && val.data.is_zero() {
if ccx.state.has_arbitrary_storage(&target) {
Expand Down Expand Up @@ -611,10 +615,11 @@ impl Cheatcode for etchCall {
fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result {
let Self { target, newRuntimeBytecode } = self;
ccx.ensure_not_precompile(target)?;
ccx.ecx.journaled_state.load_account(*target)?;
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
journal.load_account(db, *target)?;
let bytecode = Bytecode::new_raw_checked(newRuntimeBytecode.clone())
.map_err(|e| fmt_err!("failed to create bytecode: {e}"))?;
ccx.ecx.journaled_state.set_code(*target, bytecode);
journal.set_code(*target, bytecode);
Ok(Default::default())
}
}
Expand Down Expand Up @@ -664,7 +669,10 @@ impl Cheatcode for storeCall {
let Self { target, slot, value } = *self;
ccx.ensure_not_precompile(&target)?;
ensure_loaded_account(ccx.ecx, target)?;
ccx.ecx.journaled_state.sstore(target, slot.into(), value.into())?;
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
journal
.sstore(db, target, slot.into(), value.into(), false)
.map_err(|e| fmt_err!("failed to store storage slot: {:?}", e))?;
Ok(Default::default())
}
}
Expand Down Expand Up @@ -970,7 +978,8 @@ impl Cheatcode for getStorageSlotsCall {
if storage_type.encoding == ENCODING_BYTES {
// Try to check if it's a long bytes/string by reading the current storage
// value
if let Ok(value) = ccx.ecx.journaled_state.sload(*target, slot) {
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
if let Ok(value) = journal.sload(db, *target, slot, false) {
let value_bytes = value.data.to_be_bytes::<32>();
let length_byte = value_bytes[31];
// Check if it's a long bytes/string (LSB is 1)
Expand Down Expand Up @@ -1124,7 +1133,8 @@ impl Cheatcode for getEvmVersionCall {
}

pub(super) fn get_nonce(ccx: &mut CheatsCtxt, address: &Address) -> Result {
let account = ccx.ecx.journaled_state.load_account(*address)?;
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
let account = journal.load_account(db, *address)?;
Ok(account.info.nonce.abi_encode())
}

Expand Down Expand Up @@ -1345,8 +1355,9 @@ pub(super) fn journaled_account<'a>(
}

pub(super) fn ensure_loaded_account(ecx: Ecx, addr: Address) -> Result<()> {
ecx.journaled_state.load_account(addr)?;
ecx.journaled_state.touch(addr);
let (db, journal, _) = ecx.as_db_env_and_journal();
journal.load_account(db, addr)?;
journal.touch(addr);
Ok(())
}

Expand Down Expand Up @@ -1573,7 +1584,8 @@ fn get_contract_data<'a>(
let artifacts = ccx.state.config.available_artifacts.as_ref()?;

// Try to load the account and get its code
let account = ccx.ecx.journaled_state.load_account(address).ok()?;
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
let account = journal.load_account(db, address).ok()?;
let code = account.info.code.as_ref()?;

// Skip if code is empty
Expand Down
Loading
Loading