Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Patch revm to current head commit #5032

Closed
wants to merge 2 commits into from
Closed
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
28 changes: 17 additions & 11 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ reth-ecies = { path = "./crates/net/ecies" }
reth-tracing = { path = "./crates/tracing" }

# revm
revm = "3.5.0"
revm-primitives = "1.3.0"
revm = { git = "https://github.com/bluealloy/revm", rev = "68f78ae0a4c2b351f2fe36236164d07933d0d4d5" }
revm-primitives = { git = "https://github.com/bluealloy/revm", rev = "68f78ae0a4c2b351f2fe36236164d07933d0d4d5" }

## eth
alloy-primitives = "0.4"
Expand Down
20 changes: 10 additions & 10 deletions crates/payload/builder/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'a, DB: DatabaseRef> Database for CachedReadsDbMut<'a, DB> {
let basic = match self.cached.accounts.entry(address) {
Entry::Occupied(entry) => entry.get().info.clone(),
Entry::Vacant(entry) => {
entry.insert(CachedAccount::new(self.db.basic(address)?)).info.clone()
entry.insert(CachedAccount::new(self.db.basic_ref(address)?)).info.clone()
}
};
Ok(basic)
Expand All @@ -71,7 +71,7 @@ impl<'a, DB: DatabaseRef> Database for CachedReadsDbMut<'a, DB> {
fn code_by_hash(&mut self, code_hash: B256) -> Result<Bytecode, Self::Error> {
let code = match self.cached.contracts.entry(code_hash) {
Entry::Occupied(entry) => entry.get().clone(),
Entry::Vacant(entry) => entry.insert(self.db.code_by_hash(code_hash)?).clone(),
Entry::Vacant(entry) => entry.insert(self.db.code_by_hash_ref(code_hash)?).clone(),
};
Ok(code)
}
Expand All @@ -83,17 +83,17 @@ impl<'a, DB: DatabaseRef> Database for CachedReadsDbMut<'a, DB> {
match acc_entry.storage.entry(index) {
Entry::Occupied(entry) => Ok(*entry.get()),
Entry::Vacant(entry) => {
let slot = self.db.storage(address, index)?;
let slot = self.db.storage_ref(address, index)?;
entry.insert(slot);
Ok(slot)
}
}
}
Entry::Vacant(acc_entry) => {
// acc needs to be loaded for us to access slots.
let info = self.db.basic(address)?;
let info = self.db.basic_ref(address)?;
let (account, value) = if info.is_some() {
let value = self.db.storage(address, index)?;
let value = self.db.storage_ref(address, index)?;
let mut account = CachedAccount::new(info);
account.storage.insert(index, value);
(account, value)
Expand All @@ -109,7 +109,7 @@ impl<'a, DB: DatabaseRef> Database for CachedReadsDbMut<'a, DB> {
fn block_hash(&mut self, number: U256) -> Result<B256, Self::Error> {
let code = match self.cached.block_hashes.entry(number) {
Entry::Occupied(entry) => *entry.get(),
Entry::Vacant(entry) => *entry.insert(self.db.block_hash(number)?),
Entry::Vacant(entry) => *entry.insert(self.db.block_hash_ref(number)?),
};
Ok(code)
}
Expand All @@ -127,19 +127,19 @@ pub struct CachedReadsDBRef<'a, DB> {
impl<'a, DB: DatabaseRef> DatabaseRef for CachedReadsDBRef<'a, DB> {
type Error = <DB as DatabaseRef>::Error;

fn basic(&self, address: Address) -> Result<Option<AccountInfo>, Self::Error> {
fn basic_ref(&self, address: Address) -> Result<Option<AccountInfo>, Self::Error> {
self.inner.borrow_mut().basic(address)
}

fn code_by_hash(&self, code_hash: B256) -> Result<Bytecode, Self::Error> {
fn code_by_hash_ref(&self, code_hash: B256) -> Result<Bytecode, Self::Error> {
self.inner.borrow_mut().code_by_hash(code_hash)
}

fn storage(&self, address: Address, index: U256) -> Result<U256, Self::Error> {
fn storage_ref(&self, address: Address, index: U256) -> Result<U256, Self::Error> {
self.inner.borrow_mut().storage(address, index)
}

fn block_hash(&self, number: U256) -> Result<B256, Self::Error> {
fn block_hash_ref(&self, number: U256) -> Result<B256, Self::Error> {
self.inner.borrow_mut().block_hash(number)
}
}
Expand Down
105 changes: 0 additions & 105 deletions crates/primitives/src/contract.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ mod block;
mod chain;
mod compression;
pub mod constants;
pub mod contract;
pub mod eip4844;
mod forkid;
pub mod fs;
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/revm-inspectors/src/access_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ where
{
fn step(
&mut self,
interpreter: &mut Interpreter,
interpreter: &mut Interpreter<'_>,
_data: &mut EVMData<'_, DB>,
) -> InstructionResult {
match interpreter.current_opcode() {
Expand Down
15 changes: 8 additions & 7 deletions crates/revm/revm-inspectors/src/stack/maybe_owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
{
fn initialize_interp(
&mut self,
interp: &mut Interpreter,
interp: &mut Interpreter<'_>,
data: &mut EVMData<'_, DB>,
) -> InstructionResult {
match self {
Expand All @@ -84,7 +84,11 @@ where
InstructionResult::Continue
}

fn step(&mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>) -> InstructionResult {
fn step(
&mut self,
interp: &mut Interpreter<'_>,
data: &mut EVMData<'_, DB>,
) -> InstructionResult {
match self {
MaybeOwnedInspector::Owned(insp) => return insp.borrow_mut().step(interp, data),
MaybeOwnedInspector::Stacked(_) => {}
Expand All @@ -110,14 +114,11 @@ where

fn step_end(
&mut self,
interp: &mut Interpreter,
interp: &mut Interpreter<'_>,
data: &mut EVMData<'_, DB>,
eval: InstructionResult,
) -> InstructionResult {
match self {
MaybeOwnedInspector::Owned(insp) => {
return insp.borrow_mut().step_end(interp, data, eval)
}
MaybeOwnedInspector::Owned(insp) => return insp.borrow_mut().step_end(interp, data),
MaybeOwnedInspector::Stacked(_) => {}
}

Expand Down
9 changes: 4 additions & 5 deletions crates/revm/revm-inspectors/src/stack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ where
{
fn initialize_interp(
&mut self,
interpreter: &mut Interpreter,
interpreter: &mut Interpreter<'_>,
data: &mut EVMData<'_, DB>,
) -> InstructionResult {
call_inspectors!(inspector, [&mut self.custom_print_tracer], {
Expand All @@ -119,7 +119,7 @@ where

fn step(
&mut self,
interpreter: &mut Interpreter,
interpreter: &mut Interpreter<'_>,
data: &mut EVMData<'_, DB>,
) -> InstructionResult {
call_inspectors!(inspector, [&mut self.custom_print_tracer], {
Expand Down Expand Up @@ -148,12 +148,11 @@ where

fn step_end(
&mut self,
interpreter: &mut Interpreter,
interpreter: &mut Interpreter<'_>,
data: &mut EVMData<'_, DB>,
eval: InstructionResult,
) -> InstructionResult {
call_inspectors!(inspector, [&mut self.custom_print_tracer], {
let status = inspector.step_end(interpreter, data, eval);
let status = inspector.step_end(interpreter, data);

// Allow inspectors to exit early
if status != InstructionResult::Continue {
Expand Down
6 changes: 3 additions & 3 deletions crates/revm/revm-inspectors/src/tracing/builder/geth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl GethTraceBuilder {
if !is_diff {
let mut prestate = PreStateMode::default();
for (addr, _) in account_diffs {
let db_acc = db.basic(addr)?.unwrap_or_default();
let db_acc = db.basic_ref(addr)?.unwrap_or_default();

prestate.0.insert(
addr,
Expand All @@ -210,7 +210,7 @@ impl GethTraceBuilder {
let mut state_diff = DiffMode::default();
let mut change_types = HashMap::with_capacity(account_diffs.len());
for (addr, changed_acc) in account_diffs {
let db_acc = db.basic(addr)?.unwrap_or_default();
let db_acc = db.basic_ref(addr)?.unwrap_or_default();
let db_code = db_acc.code.as_ref();
let db_code_hash = db_acc.code_hash;

Expand All @@ -223,7 +223,7 @@ impl GethTraceBuilder {
if db_code_hash == KECCAK_EMPTY {
None
} else {
db.code_by_hash(db_code_hash).ok().map(|code| code.original_bytes())
db.code_by_hash_ref(db_code_hash).ok().map(|code| code.original_bytes())
}
})
.map(Into::into);
Expand Down
Loading