Skip to content

Commit

Permalink
chore: bump revm (#131)
Browse files Browse the repository at this point in the history
Bump to newest revm, some structs were renamed
  • Loading branch information
rakita authored May 28, 2024
1 parent 0d3f1f4 commit 3add3aa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ alloy-sol-types = "0.7.2"
alloy-primitives = "0.7.2"
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "5940871" }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "5940871" }
revm = { version = "9.0", default-features = false, features = ["std"] }
revm = { version = "9.0", git = "https://github.com/bluealloy/revm.git", rev = "a28a543", default-features = false, features = [
"std",
] }

anstyle = "1.0"
colorchoice = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions src/tracing/builder/geth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl GethTraceBuilder {

// insert the original value of all modified storage slots
for (key, slot) in changed_acc.storage.iter() {
acc_state.storage.insert((*key).into(), slot.previous_or_original_value.into());
acc_state.storage.insert((*key).into(), slot.original_value.into());
}

prestate.0.insert(addr, acc_state);
Expand All @@ -244,7 +244,7 @@ impl GethTraceBuilder {
// handle storage changes
for (key, slot) in changed_acc.storage.iter().filter(|(_, slot)| slot.is_changed())
{
pre_state.storage.insert((*key).into(), slot.previous_or_original_value.into());
pre_state.storage.insert((*key).into(), slot.original_value.into());
post_state.storage.insert((*key).into(), slot.present_value.into());
}

Expand Down
5 changes: 1 addition & 4 deletions src/tracing/builder/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,7 @@ where
for (key, slot) in changed_acc.storage.iter().filter(|(_, slot)| slot.is_changed()) {
entry.storage.insert(
(*key).into(),
Delta::changed(
slot.previous_or_original_value.into(),
slot.present_value.into(),
),
Delta::changed(slot.original_value.into(), slot.present_value.into()),
);
}

Expand Down
14 changes: 7 additions & 7 deletions src/tracing/js/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use revm::{
opcode::{PUSH0, PUSH32},
OpCode, SharedMemory, Stack,
},
primitives::{AccountInfo, Bytecode, State, KECCAK_EMPTY},
primitives::{AccountInfo, Bytecode, EvmState, KECCAK_EMPTY},
DatabaseRef,
};
use std::{cell::RefCell, rc::Rc};
Expand Down Expand Up @@ -326,11 +326,11 @@ unsafe impl Trace for MemoryRef {

/// Represents the state object
#[derive(Clone, Debug)]
pub(crate) struct StateRef(GuardedNullableGc<State>);
pub(crate) struct StateRef(GuardedNullableGc<EvmState>);

impl StateRef {
/// Creates a new stack reference
pub(crate) fn new(state: &State) -> (Self, GcGuard<'_, State>) {
pub(crate) fn new(state: &EvmState) -> (Self, GcGuard<'_, EvmState>) {
let (inner, guard) = GuardedNullableGc::new_ref(state);
(Self(inner), guard)
}
Expand Down Expand Up @@ -744,7 +744,7 @@ pub(crate) struct EvmDbRef {

impl EvmDbRef {
/// Creates a new evm and db JS object.
pub(crate) fn new<'a, 'b, DB>(state: &'a State, db: &'b DB) -> (Self, EvmDbGuard<'a, 'b>)
pub(crate) fn new<'a, 'b, DB>(state: &'a EvmState, db: &'b DB) -> (Self, EvmDbGuard<'a, 'b>)
where
DB: DatabaseRef,
DB::Error: std::fmt::Display,
Expand Down Expand Up @@ -934,7 +934,7 @@ struct EvmDbRefInner {
/// This ensures that the guards are dropped within the lifetime of the borrowed values.
#[must_use]
pub(crate) struct EvmDbGuard<'a, 'b> {
_state_guard: GcGuard<'a, State>,
_state_guard: GcGuard<'a, EvmState>,
_db_guard: GcGuard<'b, Box<dyn DatabaseRef<Error = String> + 'static>>,
}

Expand Down Expand Up @@ -1061,7 +1061,7 @@ mod tests {
let f = result.as_callable().unwrap();

let mut db = CacheDB::new(EmptyDB::new());
let state = State::default();
let state = EvmState::default();
{
let (db, guard) = EvmDbRef::new(&state, &db);
let addr = Address::default();
Expand Down Expand Up @@ -1118,7 +1118,7 @@ mod tests {
obj.get(js_string!("setup"), &mut context).unwrap().as_object().cloned().unwrap();

let db = CacheDB::new(EmptyDB::new());
let state = State::default();
let state = EvmState::default();
{
let (db_ref, guard) = EvmDbRef::new(&state, &db);
let js_db = db_ref.into_js_object(&mut context).unwrap();
Expand Down

0 comments on commit 3add3aa

Please sign in to comment.