From ce339f4c74db9b9ecf2b38edabf5865bcaa8408f Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:44:37 +0200 Subject: [PATCH] chore: bump revm to latest main --- Cargo.lock | 29 +++++++++--- Cargo.toml | 19 ++++---- bin/reth/src/init.rs | 5 +- crates/primitives/src/account.rs | 22 +-------- .../revm/revm-inspectors/src/access_list.rs | 1 - .../revm-inspectors/src/stack/maybe_owned.rs | 25 +++------- crates/revm/revm-inspectors/src/stack/mod.rs | 15 ++---- .../revm-inspectors/src/tracing/fourbyte.rs | 1 - .../revm-inspectors/src/tracing/js/mod.rs | 10 +--- .../revm/revm-inspectors/src/tracing/mod.rs | 21 +++------ .../revm-inspectors/src/tracing/opcount.rs | 1 - crates/revm/revm-primitives/src/env.rs | 1 - crates/revm/src/database.rs | 8 +--- crates/revm/src/executor.rs | 47 +++++++++++-------- crates/rpc/rpc/src/eth/error.rs | 8 +++- 15 files changed, 90 insertions(+), 123 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf825eaba2ec..6fc26a030b1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -669,6 +669,10 @@ name = "bitflags" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +dependencies = [ + "arbitrary", + "serde", +] [[package]] name = "bitvec" @@ -2854,7 +2858,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ "ahash 0.8.3", - "serde", ] [[package]] @@ -2865,6 +2868,7 @@ checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" dependencies = [ "ahash 0.8.3", "allocator-api2", + "serde", ] [[package]] @@ -6210,9 +6214,11 @@ dependencies = [ [[package]] name = "revm" version = "3.3.0" -source = "git+https://github.com/bluealloy/revm/?branch=release/v25#88337924f4d16ed1f5e4cde12a03d0cb755cd658" +source = "git+https://github.com/bluealloy/revm/#ef57a46824d52d2e334e5bd4126b7b17a9cc5c8a" dependencies = [ "auto_impl", + "once_cell", + "rayon", "revm-interpreter", "revm-precompile", ] @@ -6220,7 +6226,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "1.1.2" -source = "git+https://github.com/bluealloy/revm/?branch=release/v25#88337924f4d16ed1f5e4cde12a03d0cb755cd658" +source = "git+https://github.com/bluealloy/revm/#ef57a46824d52d2e334e5bd4126b7b17a9cc5c8a" dependencies = [ "derive_more", "enumn", @@ -6231,7 +6237,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "2.0.3" -source = "git+https://github.com/bluealloy/revm/?branch=release/v25#88337924f4d16ed1f5e4cde12a03d0cb755cd658" +source = "git+https://github.com/bluealloy/revm/#ef57a46824d52d2e334e5bd4126b7b17a9cc5c8a" dependencies = [ "k256", "num", @@ -6247,16 +6253,17 @@ dependencies = [ [[package]] name = "revm-primitives" version = "1.1.2" -source = "git+https://github.com/bluealloy/revm/?branch=release/v25#88337924f4d16ed1f5e4cde12a03d0cb755cd658" +source = "git+https://github.com/bluealloy/revm/#ef57a46824d52d2e334e5bd4126b7b17a9cc5c8a" dependencies = [ "arbitrary", "auto_impl", + "bitflags 2.3.3", "bitvec 1.0.1", "bytes", "derive_more", "enumn", "fixed-hash", - "hashbrown 0.13.2", + "hashbrown 0.14.0", "hex", "hex-literal 0.4.1", "primitive-types", @@ -6266,6 +6273,7 @@ dependencies = [ "ruint", "serde", "sha3", + "to-binary", ] [[package]] @@ -7508,6 +7516,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "to-binary" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4424552bc848fd1afbcd81f0e8a54b7401b90fd81bb418655ad6dc6d0823bbe3" +dependencies = [ + "hex", +] + [[package]] name = "tokio" version = "1.29.1" diff --git a/Cargo.toml b/Cargo.toml index 244240b97686..e6e8fc962a0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,9 +62,7 @@ rust-version = "1.70" # Remember to update .clippy.toml and README.md license = "MIT OR Apache-2.0" homepage = "https://paradigmxyz.github.io/reth" repository = "https://github.com/paradigmxyz/reth" -exclude = [ - ".github/", -] +exclude = [".github/"] # Like release, but with full debug symbols. Useful for e.g. `perf`. [profile.debug-fast] @@ -78,8 +76,8 @@ codegen-units = 1 incremental = false [patch.crates-io] -revm = { git = "https://github.com/bluealloy/revm/", branch = "release/v25" } -revm-primitives = { git = "https://github.com/bluealloy/revm/", branch = "release/v25" } +revm = { git = "https://github.com/bluealloy/revm/" } +revm-primitives = { git = "https://github.com/bluealloy/revm/" } [workspace.dependencies] ## reth @@ -102,8 +100,7 @@ reth-transaction-pool = { path = "./crates/transaction-pool" } reth-tasks = { path = "./crates/tasks" } reth-network = { path = "./crates/net/network" } reth-network-api = { path = "./crates/net/network-api" } -reth-rpc-types-compat = { path = "./crates/rpc/rpc-types-compat"} - +reth-rpc-types-compat = { path = "./crates/rpc/rpc-types-compat" } ## eth ethers-core = { version = "2.0.8", default-features = false } @@ -144,10 +141,14 @@ jsonrpsee-core = { version = "0.19" } jsonrpsee-types = { version = "0.19" } ## crypto -secp256k1 = { version = "0.27.0", default-features = false, features = ["global-context", "rand-std", "recovery"] } +secp256k1 = { version = "0.27.0", default-features = false, features = [ + "global-context", + "rand-std", + "recovery", +] } # for eip-4844 c-kzg = { git = "https://github.com/ethereum/c-kzg-4844" } ### misc-testing proptest = "1.0" -arbitrary = "1.1" \ No newline at end of file +arbitrary = "1.1" diff --git a/bin/reth/src/init.rs b/bin/reth/src/init.rs index 5296c249762c..5151246df5d5 100644 --- a/bin/reth/src/init.rs +++ b/bin/reth/src/init.rs @@ -91,9 +91,10 @@ pub fn insert_genesis_state( let mut bytecode_hash = None; if let Some(code) = &account.code { let bytecode = Bytecode::new_raw(code.0.clone()); + let hash = bytecode.hash_slow(); // FIXME: Can bytecode_hash be Some(Bytes::new()) here? - bytecode_hash = Some(bytecode.hash); - state.add_bytecode(bytecode.hash, bytecode); + bytecode_hash = Some(hash); + state.add_bytecode(hash, bytecode); } state.create_account( 0, diff --git a/crates/primitives/src/account.rs b/crates/primitives/src/account.rs index 708ebd186787..876c8e30c325 100644 --- a/crates/primitives/src/account.rs +++ b/crates/primitives/src/account.rs @@ -48,9 +48,6 @@ impl Account { /// Bytecode for an account. /// /// A wrapper around [`revm::primitives::Bytecode`][RevmBytecode] with encoding/decoding support. -/// -/// Note: Upon decoding bytecode from the database, you *should* set the code hash using -/// [`Self::with_code_hash`]. #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub struct Bytecode(pub RevmBytecode); @@ -61,18 +58,6 @@ impl Bytecode { pub fn new_raw(bytes: Bytes) -> Self { Self(RevmBytecode::new_raw(bytes)) } - - /// Create new bytecode from raw bytes and its hash. - pub fn new_raw_with_hash(bytes: Bytes, code_hash: H256) -> Self { - let revm_bytecode = unsafe { RevmBytecode::new_raw_with_hash(bytes, code_hash) }; - Self(revm_bytecode) - } - - /// Set the hash of the inner bytecode. - pub fn with_code_hash(mut self, code_hash: H256) -> Self { - self.0.hash = code_hash; - self - } } impl Deref for Bytecode { @@ -121,15 +106,10 @@ impl Compact for Bytecode { let decoded = match variant { 0 => Bytecode(RevmBytecode::new_raw(bytes)), 1 => Bytecode(unsafe { - RevmBytecode::new_checked( - bytes, - buf.read_u64::().unwrap() as usize, - None, - ) + RevmBytecode::new_checked(bytes, buf.read_u64::().unwrap() as usize) }), 2 => Bytecode(RevmBytecode { bytecode: bytes, - hash: KECCAK_EMPTY, state: BytecodeState::Analysed { len: buf.read_u64::().unwrap() as usize, jump_map: JumpMap::from_slice(buf), diff --git a/crates/revm/revm-inspectors/src/access_list.rs b/crates/revm/revm-inspectors/src/access_list.rs index 41faf88a2b0f..36996291ea58 100644 --- a/crates/revm/revm-inspectors/src/access_list.rs +++ b/crates/revm/revm-inspectors/src/access_list.rs @@ -66,7 +66,6 @@ where &mut self, interpreter: &mut Interpreter, _data: &mut EVMData<'_, DB>, - _is_static: bool, ) -> InstructionResult { let pc = interpreter.program_counter(); let op = interpreter.contract.bytecode.bytecode()[pc]; diff --git a/crates/revm/revm-inspectors/src/stack/maybe_owned.rs b/crates/revm/revm-inspectors/src/stack/maybe_owned.rs index 897546f16723..c2e675835613 100644 --- a/crates/revm/revm-inspectors/src/stack/maybe_owned.rs +++ b/crates/revm/revm-inspectors/src/stack/maybe_owned.rs @@ -72,11 +72,10 @@ where &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { match self { MaybeOwnedInspector::Owned(insp) => { - return insp.borrow_mut().initialize_interp(interp, data, is_static) + return insp.borrow_mut().initialize_interp(interp, data) } MaybeOwnedInspector::Stacked(_) => {} } @@ -84,16 +83,9 @@ where InstructionResult::Continue } - 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 { match self { - MaybeOwnedInspector::Owned(insp) => { - return insp.borrow_mut().step(interp, data, is_static) - } + MaybeOwnedInspector::Owned(insp) => return insp.borrow_mut().step(interp, data), MaybeOwnedInspector::Stacked(_) => {} } @@ -119,12 +111,11 @@ where &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, eval: InstructionResult, ) -> InstructionResult { match self { MaybeOwnedInspector::Owned(insp) => { - return insp.borrow_mut().step_end(interp, data, is_static, eval) + return insp.borrow_mut().step_end(interp, data, eval) } MaybeOwnedInspector::Stacked(_) => {} } @@ -136,12 +127,9 @@ where &mut self, data: &mut EVMData<'_, DB>, inputs: &mut CallInputs, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { match self { - MaybeOwnedInspector::Owned(insp) => { - return insp.borrow_mut().call(data, inputs, is_static) - } + MaybeOwnedInspector::Owned(insp) => return insp.borrow_mut().call(data, inputs), MaybeOwnedInspector::Stacked(_) => {} } @@ -155,11 +143,10 @@ where remaining_gas: Gas, ret: InstructionResult, out: Bytes, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { match self { MaybeOwnedInspector::Owned(insp) => { - return insp.borrow_mut().call_end(data, inputs, remaining_gas, ret, out, is_static) + return insp.borrow_mut().call_end(data, inputs, remaining_gas, ret, out) } MaybeOwnedInspector::Stacked(_) => {} } diff --git a/crates/revm/revm-inspectors/src/stack/mod.rs b/crates/revm/revm-inspectors/src/stack/mod.rs index 7144c269d360..101c149657d8 100644 --- a/crates/revm/revm-inspectors/src/stack/mod.rs +++ b/crates/revm/revm-inspectors/src/stack/mod.rs @@ -105,10 +105,9 @@ where &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { call_inspectors!(inspector, [&mut self.custom_print_tracer], { - let status = inspector.initialize_interp(interpreter, data, is_static); + let status = inspector.initialize_interp(interpreter, data); // Allow inspectors to exit early if status != InstructionResult::Continue { @@ -123,10 +122,9 @@ where &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { call_inspectors!(inspector, [&mut self.custom_print_tracer], { - let status = inspector.step(interpreter, data, is_static); + let status = inspector.step(interpreter, data); // Allow inspectors to exit early if status != InstructionResult::Continue { @@ -153,11 +151,10 @@ where &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, eval: InstructionResult, ) -> InstructionResult { call_inspectors!(inspector, [&mut self.custom_print_tracer], { - let status = inspector.step_end(interpreter, data, is_static, eval); + let status = inspector.step_end(interpreter, data, eval); // Allow inspectors to exit early if status != InstructionResult::Continue { @@ -172,10 +169,9 @@ where &mut self, data: &mut EVMData<'_, DB>, inputs: &mut CallInputs, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!(inspector, [&mut self.custom_print_tracer], { - let (status, gas, retdata) = inspector.call(data, inputs, is_static); + let (status, gas, retdata) = inspector.call(data, inputs); // Allow inspectors to exit early if status != InstructionResult::Continue { @@ -193,11 +189,10 @@ where remaining_gas: Gas, ret: InstructionResult, out: Bytes, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!(inspector, [&mut self.custom_print_tracer], { let (new_ret, new_gas, new_out) = - inspector.call_end(data, inputs, remaining_gas, ret, out.clone(), is_static); + inspector.call_end(data, inputs, remaining_gas, ret, out.clone()); // If the inspector returns a different ret or a revert with a non-empty message, // we assume it wants to tell us something diff --git a/crates/revm/revm-inspectors/src/tracing/fourbyte.rs b/crates/revm/revm-inspectors/src/tracing/fourbyte.rs index ffebf976c5d4..977d2a5595e4 100644 --- a/crates/revm/revm-inspectors/src/tracing/fourbyte.rs +++ b/crates/revm/revm-inspectors/src/tracing/fourbyte.rs @@ -51,7 +51,6 @@ where &mut self, _data: &mut EVMData<'_, DB>, call: &mut CallInputs, - _is_static: bool, ) -> (InstructionResult, Gas, Bytes) { if call.input.len() >= 4 { let selector = Selector::try_from(&call.input[..4]).expect("input is at least 4 bytes"); diff --git a/crates/revm/revm-inspectors/src/tracing/js/mod.rs b/crates/revm/revm-inspectors/src/tracing/js/mod.rs index b79b41f648f5..0a5cbe6487f5 100644 --- a/crates/revm/revm-inspectors/src/tracing/js/mod.rs +++ b/crates/revm/revm-inspectors/src/tracing/js/mod.rs @@ -287,12 +287,7 @@ impl Inspector for JsInspector where DB: Database, { - 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 { if self.step_fn.is_none() { return InstructionResult::Continue } @@ -332,7 +327,6 @@ where &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - _is_static: bool, eval: InstructionResult, ) -> InstructionResult { if self.step_fn.is_none() { @@ -366,7 +360,6 @@ where &mut self, data: &mut EVMData<'_, DB>, inputs: &mut CallInputs, - _is_static: bool, ) -> (InstructionResult, Gas, Bytes) { self.register_precompiles(&data.precompiles); @@ -410,7 +403,6 @@ where remaining_gas: Gas, ret: InstructionResult, out: Bytes, - _is_static: bool, ) -> (InstructionResult, Gas, Bytes) { if self.exit_fn.is_some() { let frame_result = diff --git a/crates/revm/revm-inspectors/src/tracing/mod.rs b/crates/revm/revm-inspectors/src/tracing/mod.rs index 48f772ebde81..2d0527e50173 100644 --- a/crates/revm/revm-inspectors/src/tracing/mod.rs +++ b/crates/revm/revm-inspectors/src/tracing/mod.rs @@ -359,19 +359,13 @@ where &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { - self.gas_inspector.initialize_interp(interp, data, is_static) + self.gas_inspector.initialize_interp(interp, data) } - 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 { if self.config.record_steps { - self.gas_inspector.step(interp, data, is_static); + self.gas_inspector.step(interp, data); self.start_step(interp, data); } @@ -400,11 +394,10 @@ where &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, eval: InstructionResult, ) -> InstructionResult { if self.config.record_steps { - self.gas_inspector.step_end(interp, data, is_static, eval); + self.gas_inspector.step_end(interp, data, eval); self.fill_step_on_step_end(interp, data, eval); } InstructionResult::Continue @@ -414,9 +407,8 @@ where &mut self, data: &mut EVMData<'_, DB>, inputs: &mut CallInputs, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { - self.gas_inspector.call(data, inputs, is_static); + self.gas_inspector.call(data, inputs); // determine correct `from` and `to` based on the call scheme let (from, to) = match inputs.context.scheme { @@ -462,9 +454,8 @@ where gas: Gas, ret: InstructionResult, out: Bytes, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { - self.gas_inspector.call_end(data, inputs, gas, ret, out.clone(), is_static); + self.gas_inspector.call_end(data, inputs, gas, ret, out.clone()); self.fill_trace_on_call_end(data, ret, &gas, out.clone(), None); diff --git a/crates/revm/revm-inspectors/src/tracing/opcount.rs b/crates/revm/revm-inspectors/src/tracing/opcount.rs index c13154747716..623443579e4e 100644 --- a/crates/revm/revm-inspectors/src/tracing/opcount.rs +++ b/crates/revm/revm-inspectors/src/tracing/opcount.rs @@ -29,7 +29,6 @@ where &mut self, _interp: &mut Interpreter, _data: &mut EVMData<'_, DB>, - _is_static: bool, ) -> InstructionResult { self.count += 1; InstructionResult::Continue diff --git a/crates/revm/revm-primitives/src/env.rs b/crates/revm/revm-primitives/src/env.rs index 0d717a9e790e..15e3d0bf68e8 100644 --- a/crates/revm/revm-primitives/src/env.rs +++ b/crates/revm/revm-primitives/src/env.rs @@ -38,7 +38,6 @@ pub fn fill_cfg_env( cfg_env.chain_id = U256::from(chain_spec.chain().id()); cfg_env.spec_id = spec_id; - cfg_env.perf_all_precompiles_have_balance = false; cfg_env.perf_analyse_created_bytecodes = AnalysisKind::Analyse; } diff --git a/crates/revm/src/database.rs b/crates/revm/src/database.rs index 1cbb304acd85..43296a47e033 100644 --- a/crates/revm/src/database.rs +++ b/crates/revm/src/database.rs @@ -48,13 +48,7 @@ impl DatabaseRef for State { } fn code_by_hash(&self, code_hash: H256) -> Result { - let bytecode = self.0.bytecode_by_hash(code_hash)?; - - if let Some(bytecode) = bytecode { - Ok(bytecode.with_code_hash(code_hash).0) - } else { - Ok(Bytecode::new()) - } + self.0.bytecode_by_hash(code_hash).map(|b| b.unwrap_or_default().0) } fn storage(&self, address: H160, index: U256) -> Result { diff --git a/crates/revm/src/executor.rs b/crates/revm/src/executor.rs index 5ce714521fba..c98a0707888e 100644 --- a/crates/revm/src/executor.rs +++ b/crates/revm/src/executor.rs @@ -406,7 +406,7 @@ pub fn commit_state_changes( { // iterate over all changed accounts for (address, account) in changes { - if account.is_destroyed { + if account.is_selfdestructed() { // get old account that we are destroying. let db_account = match db.accounts.entry(address) { Entry::Occupied(entry) => entry.into_mut(), @@ -495,7 +495,7 @@ pub fn commit_state_changes( } }; - cached_account.account_state = if account.storage_cleared { + cached_account.account_state = if account.is_created() { cached_account.storage.clear(); AccountState::StorageCleared } else if cached_account.account_state.is_storage_cleared() { @@ -657,15 +657,13 @@ mod tests { AccountReader, BlockHashReader, StateProvider, StateRootProvider, }; use reth_rlp::Decodable; + use revm::primitives::AccountStatus; use std::{collections::HashMap, str::FromStr}; static DEFAULT_REVM_ACCOUNT: Lazy = Lazy::new(|| RevmAccount { info: AccountInfo::default(), storage: hash_map::HashMap::default(), - is_destroyed: false, - is_touched: false, - storage_cleared: false, - is_not_existing: false, + status: AccountStatus::empty(), }); #[derive(Debug, Default, Clone, Eq, PartialEq)] @@ -1132,8 +1130,7 @@ mod tests { hash_map::HashMap::from([( account, RevmAccount { - is_destroyed: true, - is_touched: true, + status: AccountStatus::SelfDestructed | AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, )]), @@ -1146,8 +1143,7 @@ mod tests { hash_map::HashMap::from([( account, RevmAccount { - is_touched: true, - storage_cleared: true, + status: AccountStatus::Created | AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, )]), @@ -1186,8 +1182,7 @@ mod tests { hash_map::HashMap::from([( address, RevmAccount { - is_destroyed: true, - storage_cleared: true, + status: AccountStatus::Created | AccountStatus::SelfDestructed, ..DEFAULT_REVM_ACCOUNT.clone() }, )]), @@ -1214,7 +1209,7 @@ mod tests { 1, hash_map::HashMap::from([( address, - RevmAccount { is_touched: true, ..DEFAULT_REVM_ACCOUNT.clone() }, + RevmAccount { status: AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, )]), true, &mut post_state, @@ -1225,7 +1220,7 @@ mod tests { 1, hash_map::HashMap::from([( address, - RevmAccount { is_touched: true, ..DEFAULT_REVM_ACCOUNT.clone() }, + RevmAccount { status: AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, )]), true, &mut post_state, @@ -1251,7 +1246,7 @@ mod tests { 1, hash_map::HashMap::from([( address, - RevmAccount { is_touched: true, ..DEFAULT_REVM_ACCOUNT.clone() }, + RevmAccount { status: AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, )]), false, &mut post_state, @@ -1264,7 +1259,7 @@ mod tests { 2, hash_map::HashMap::from([( address, - RevmAccount { is_touched: true, ..DEFAULT_REVM_ACCOUNT.clone() }, + RevmAccount { status: AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, )]), true, &mut post_state, @@ -1298,8 +1293,14 @@ mod tests { executor.commit_changes( 1, hash_map::HashMap::from([ - (address1, RevmAccount { is_touched: true, ..DEFAULT_REVM_ACCOUNT.clone() }), - (address2, RevmAccount { is_touched: true, ..DEFAULT_REVM_ACCOUNT.clone() }), + ( + address1, + RevmAccount { status: AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, + ), + ( + address2, + RevmAccount { status: AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, + ), ]), false, &mut post_state_before_state_clear, @@ -1324,8 +1325,14 @@ mod tests { executor.commit_changes( 2, hash_map::HashMap::from([ - (address3, RevmAccount { is_touched: true, ..DEFAULT_REVM_ACCOUNT.clone() }), - (address4, RevmAccount { is_touched: true, ..DEFAULT_REVM_ACCOUNT.clone() }), + ( + address3, + RevmAccount { status: AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, + ), + ( + address4, + RevmAccount { status: AccountStatus::Touched, ..DEFAULT_REVM_ACCOUNT.clone() }, + ), ]), true, &mut post_state_after_state_clear, diff --git a/crates/rpc/rpc/src/eth/error.rs b/crates/rpc/rpc/src/eth/error.rs index 3b3d179b48ae..b58b046b6b7c 100644 --- a/crates/rpc/rpc/src/eth/error.rs +++ b/crates/rpc/rpc/src/eth/error.rs @@ -203,6 +203,9 @@ where /// `tip` for `max_priority_fee_per_gas` #[derive(thiserror::Error, Debug)] pub enum RpcInvalidTransactionError { + /// Returned when an access list is provided for blocks before Berlin hardfork. + #[error("access lists are not supported")] + AccessListNotSupported, /// returned if the nonce of a transaction is lower than the one present in the local chain. #[error("nonce too low")] NonceTooLow, @@ -336,6 +339,9 @@ impl From for RpcInvalidTransactionError { fn from(err: revm::primitives::InvalidTransaction) -> Self { use revm::primitives::InvalidTransaction; match err { + InvalidTransaction::AccessListNotSupported => { + RpcInvalidTransactionError::AccessListNotSupported + } InvalidTransaction::InvalidChainId => RpcInvalidTransactionError::InvalidChainId, InvalidTransaction::GasMaxFeeGreaterThanPriorityFee => { RpcInvalidTransactionError::TipAboveFeeCap @@ -348,7 +354,7 @@ impl From for RpcInvalidTransactionError { RpcInvalidTransactionError::GasTooHigh } InvalidTransaction::RejectCallerWithCode => RpcInvalidTransactionError::SenderNoEOA, - InvalidTransaction::LackOfFundForGasLimit { .. } => { + InvalidTransaction::LackOfFundForMaxFee { .. } => { RpcInvalidTransactionError::InsufficientFunds } InvalidTransaction::OverflowPaymentInTransaction => {