Skip to content

Commit 1504cb0

Browse files
authored
chore: bump to revm 33 (#12538)
* initial changes, some breaking ones to resolve * fix breaking changes * unpin patches, bump versions * flag any returning outcomes as having a precompile called * apply revm patch * fix tests * fix test
1 parent 7e82dd9 commit 1504cb0

File tree

12 files changed

+265
-146
lines changed

12 files changed

+265
-146
lines changed

Cargo.lock

Lines changed: 148 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ foundry-compilers = { version = "0.19.5", default-features = false, features = [
227227
"rustls",
228228
"svm-solc",
229229
] }
230-
foundry-fork-db = "0.20"
230+
foundry-fork-db = "0.21"
231231
solang-parser = { version = "=0.3.9", package = "foundry-solang-parser" }
232232
solar = { package = "solar-compiler", version = "=0.1.8", default-features = false }
233233
svm = { package = "svm-rs", version = "0.5", default-features = false, features = [
@@ -286,13 +286,13 @@ op-alloy-rpc-types = "0.22.0"
286286
op-alloy-flz = "0.13.1"
287287

288288
## alloy-evm
289-
alloy-evm = "0.23.2"
290-
alloy-op-evm = "0.23.2"
289+
alloy-evm = "0.24.1"
290+
alloy-op-evm = "0.24.1"
291291

292292
# revm
293-
revm = { version = "31.0.0", default-features = false }
294-
revm-inspectors = { version = "0.32.0", features = ["serde"] }
295-
op-revm = { version = "12.0.0", default-features = false }
293+
revm = { version = "33.0.0", default-features = false }
294+
revm-inspectors = { version = "0.33.0", features = ["serde"] }
295+
op-revm = { version = "14.0.0", default-features = false }
296296

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

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

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

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

453453
# solar
454454
solar = { package = "solar-compiler", git = "https://github.com/paradigmxyz/solar.git", rev = "0bea5f0" }

crates/anvil/src/eth/backend/mem/inspector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ where
139139
}
140140

141141
#[allow(clippy::redundant_clone)]
142-
fn log(&mut self, interp: &mut Interpreter, ecx: &mut CTX, log: Log) {
142+
fn log_full(&mut self, interp: &mut Interpreter, ecx: &mut CTX, log: Log) {
143143
call_inspectors!([&mut self.tracer, &mut self.log_collector], |inspector| {
144-
inspector.log(interp, ecx, log.clone());
144+
inspector.log_full(interp, ecx, log.clone());
145145
});
146146
}
147147

crates/anvil/src/evm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ mod tests {
5858
Ok(PrecompileOutput {
5959
bytes: Bytes::copy_from_slice(input.data),
6060
gas_used: 0,
61+
gas_refunded: 0,
6162
reverted: false,
6263
})
6364
}),

crates/anvil/tests/it/fork.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,7 @@ async fn test_config_with_osaka_hardfork_with_precompile_factory() {
18781878
Ok(revm::precompile::PrecompileOutput {
18791879
bytes: Bytes::copy_from_slice(input.data),
18801880
gas_used: 0,
1881+
gas_refunded: 0,
18811882
reverted: false,
18821883
})
18831884
},

crates/cheatcodes/src/evm.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,12 @@ impl Cheatcode for loadCall {
256256
fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result {
257257
let Self { target, slot } = *self;
258258
ccx.ensure_not_precompile(&target)?;
259-
ccx.ecx.journaled_state.load_account(target)?;
260-
let mut val = ccx.ecx.journaled_state.sload(target, slot.into())?;
259+
260+
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
261+
journal.load_account(db, target)?;
262+
let mut val = journal
263+
.sload(db, target, slot.into(), false)
264+
.map_err(|e| fmt_err!("failed to load storage slot: {:?}", e))?;
261265

262266
if val.is_cold && val.data.is_zero() {
263267
if ccx.state.has_arbitrary_storage(&target) {
@@ -611,10 +615,11 @@ impl Cheatcode for etchCall {
611615
fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result {
612616
let Self { target, newRuntimeBytecode } = self;
613617
ccx.ensure_not_precompile(target)?;
614-
ccx.ecx.journaled_state.load_account(*target)?;
618+
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
619+
journal.load_account(db, *target)?;
615620
let bytecode = Bytecode::new_raw_checked(newRuntimeBytecode.clone())
616621
.map_err(|e| fmt_err!("failed to create bytecode: {e}"))?;
617-
ccx.ecx.journaled_state.set_code(*target, bytecode);
622+
journal.set_code(*target, bytecode);
618623
Ok(Default::default())
619624
}
620625
}
@@ -664,7 +669,10 @@ impl Cheatcode for storeCall {
664669
let Self { target, slot, value } = *self;
665670
ccx.ensure_not_precompile(&target)?;
666671
ensure_loaded_account(ccx.ecx, target)?;
667-
ccx.ecx.journaled_state.sstore(target, slot.into(), value.into())?;
672+
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
673+
journal
674+
.sstore(db, target, slot.into(), value.into(), false)
675+
.map_err(|e| fmt_err!("failed to store storage slot: {:?}", e))?;
668676
Ok(Default::default())
669677
}
670678
}
@@ -970,7 +978,8 @@ impl Cheatcode for getStorageSlotsCall {
970978
if storage_type.encoding == ENCODING_BYTES {
971979
// Try to check if it's a long bytes/string by reading the current storage
972980
// value
973-
if let Ok(value) = ccx.ecx.journaled_state.sload(*target, slot) {
981+
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
982+
if let Ok(value) = journal.sload(db, *target, slot, false) {
974983
let value_bytes = value.data.to_be_bytes::<32>();
975984
let length_byte = value_bytes[31];
976985
// Check if it's a long bytes/string (LSB is 1)
@@ -1124,7 +1133,8 @@ impl Cheatcode for getEvmVersionCall {
11241133
}
11251134

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

@@ -1345,8 +1355,9 @@ pub(super) fn journaled_account<'a>(
13451355
}
13461356

13471357
pub(super) fn ensure_loaded_account(ecx: Ecx, addr: Address) -> Result<()> {
1348-
ecx.journaled_state.load_account(addr)?;
1349-
ecx.journaled_state.touch(addr);
1358+
let (db, journal, _) = ecx.as_db_env_and_journal();
1359+
journal.load_account(db, addr)?;
1360+
journal.touch(addr);
13501361
Ok(())
13511362
}
13521363

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

15751586
// Try to load the account and get its code
1576-
let account = ccx.ecx.journaled_state.load_account(address).ok()?;
1587+
let (db, journal, _) = ccx.ecx.as_db_env_and_journal();
1588+
let account = journal.load_account(db, address).ok()?;
15771589
let code = account.info.code.as_ref()?;
15781590

15791591
// Skip if code is empty

0 commit comments

Comments
 (0)