diff --git a/Cargo.lock b/Cargo.lock index c95fca6bb0b..4814b2959b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -312,9 +312,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcd754dd6733c3f2d44dd99ddecb7d844428a9b3cdbcafbe65570886bf24b20" +checksum = "5f107d0e588e5d25fcf2db216390445d5804b875a22a419407ad0389b925bb4d" dependencies = [ "alloy-consensus", "alloy-eips 2.0.0", @@ -7644,9 +7644,9 @@ dependencies = [ [[package]] name = "reth-codecs" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a29541038ab108b2e9d527c66b565e717e252e4eef6675377fc21f9ba587f792" +checksum = "a79b3247ae4fbb1d4d35ce83a11fc596428a4c6ea836c98a75a55340192578a4" dependencies = [ "alloy-consensus", "alloy-eips 2.0.0", @@ -7665,9 +7665,9 @@ dependencies = [ [[package]] name = "reth-codecs-derive" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5646d4aff98bd51050fc920bc3ffdff209f2343def9ed31b56eea13c4245c4da" +checksum = "df5dbae40c272b8a1b4fcc08ee2d4e77d3b0ccdb187c1313f412a73ff54ff2a2" dependencies = [ "proc-macro2", "quote", @@ -9347,9 +9347,9 @@ dependencies = [ [[package]] name = "reth-primitives-traits" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96ffdb2ce0cdcd814d39428dc1e9b660c85d85e0b75eb465a1ed0943a48c7bd" +checksum = "cc759fd87c3f65440e5d3bfa3107fe8a13a61a6807cd485c62c49d63c7bf6717" dependencies = [ "alloy-consensus", "alloy-eips 2.0.0", @@ -9893,9 +9893,9 @@ dependencies = [ [[package]] name = "reth-rpc-traits" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c870f120b2e179e44906b7b288b0dea6577573010272adda8fff536e86fedd05" +checksum = "b766da61ec7c46596386b4bc88d9b57d1939d3da2bc9e927567a8a23650e5ce9" dependencies = [ "alloy-consensus", "alloy-network", @@ -10422,18 +10422,18 @@ dependencies = [ [[package]] name = "reth-zstd-compressors" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3882441cf1d51fe24dfc6df9919e6f17edfdb6b121050bd34348e925e61c7af1" +checksum = "82fa54c341d926ec9b0f7fc0c87f831aa4959de699e69caab1a0bfd914326c09" dependencies = [ "zstd", ] [[package]] name = "revm" -version = "36.0.0" +version = "37.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0abc15d09cd211e9e73410ada10134069c794d4bcdb787dfc16a1bf0939849c" +checksum = "11353f234577a63048066df974d8a56e8c090d4de8b5f7d5f2a0d0c3a1ffaa2d" dependencies = [ "revm-bytecode", "revm-context", @@ -10450,9 +10450,9 @@ dependencies = [ [[package]] name = "revm-bytecode" -version = "9.0.0" +version = "10.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86e468df3cf5cf59fa7ef71a3e9ccabb76bb336401ea2c0674f563104cf3c5e" +checksum = "bdbb3a3d735efa94c91f2ef6bf20a35f99a77bc78f3e25bd758336901bdf9661" dependencies = [ "bitvec", "phf", @@ -10462,9 +10462,9 @@ dependencies = [ [[package]] name = "revm-context" -version = "15.0.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eb1f0a76b14d684a444fc52f7bf6b7564bf882599d91ee62e76d602e7a187c7" +checksum = "c0e3d41127977e351ed795689147e6e59b0fa88e387840f921e46c440bb2fb44" dependencies = [ "bitvec", "cfg-if", @@ -10479,9 +10479,9 @@ dependencies = [ [[package]] name = "revm-context-interface" -version = "16.0.0" +version = "17.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc256b27743e2912ca16899568e6652a372eb5d1d573e6edb16c7836b16cf487" +checksum = "dd61f0f2f646ae74a75e12e7f1d57554868e2dc5c83fc9a761cb95735cb58309" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -10495,9 +10495,9 @@ dependencies = [ [[package]] name = "revm-database" -version = "12.0.0" +version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0a7d6da41061f2c50f99a2632571026b23684b5449ff319914151f4449b6c8" +checksum = "54f97178ab32358be770d09649d6fa86303923cab7afb95577353e7305a04193" dependencies = [ "alloy-eips 1.8.3", "revm-bytecode", @@ -10509,9 +10509,9 @@ dependencies = [ [[package]] name = "revm-database-interface" -version = "10.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd497a38a79057b94a049552cb1f925ad15078bc1a479c132aeeebd1d2ccc768" +checksum = "68e48ddde8f5ef2adaf1e920ccbf57fa6ef2c63c11e3e37d7d9137657873eecc" dependencies = [ "auto_impl", "either", @@ -10523,9 +10523,9 @@ dependencies = [ [[package]] name = "revm-handler" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1eed729ca9b228ae98688f352235871e9b8be3d568d488e4070f64c56e9d3d" +checksum = "f18b03319aee860ecc4631c9180abb0828480f5a4c39507fc735a417bd906984" dependencies = [ "auto_impl", "derive-where", @@ -10542,9 +10542,9 @@ dependencies = [ [[package]] name = "revm-inspector" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf5102391706513689f91cb3cb3d97b5f13a02e8647e6e9cb7620877ef84847" +checksum = "f33e8327376dff859eb18dea3623aa55ef5d580fe38fa0fd4bb92bd95ace60ad" dependencies = [ "auto_impl", "either", @@ -10560,9 +10560,9 @@ dependencies = [ [[package]] name = "revm-inspectors" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac49e53897c4cc59dbd7a7bb097386755a4dfa2bc7088b298f341b5dfcda6f2c" +checksum = "c60802e9f6ef7d94abeb7ed6abe7fa9883df64bcb0ab6274a2464249b6354324" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -10580,9 +10580,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "34.0.0" +version = "35.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf22f80612bb8f58fd1f578750281f2afadb6c93835b14ae6a4d6b75ca26f445" +checksum = "8e5f438f47d40d9830c0498fa3ca16a447b3148ab7b78742cbb1b27a51a50963" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -10593,9 +10593,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "32.1.0" +version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2ec11f45deec71e4945e1809736bb20d454285f9167ab53c5159dae1deb603f" +checksum = "1c07bfcc9361f7b23970a68cbd17bfe255e70182cfb1a8896d06832217fc5439" dependencies = [ "ark-bls12-381", "ark-bn254", @@ -10609,6 +10609,7 @@ dependencies = [ "cfg-if", "k256", "p256", + "revm-context-interface", "revm-primitives", "ripemd", "secp256k1 0.31.1", @@ -10617,9 +10618,9 @@ dependencies = [ [[package]] name = "revm-primitives" -version = "22.1.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfb5ce6cf18b118932bcdb7da05cd9c250f2cb9f64131396b55f3fe3537c35" +checksum = "0c99bda77d9661521ba0b4bc04558c6692074f01e65dd420fa3b893033d9b8a2" dependencies = [ "alloy-primitives", "num_enum", @@ -10629,9 +10630,9 @@ dependencies = [ [[package]] name = "revm-state" -version = "10.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29404707763da607e5d6e4771cb203998c28159279c2f64cc32de08d2814651" +checksum = "0e480426a7d76b458789e4a1be3ffbce9df798f0145f0520c1cdf967755cfcbf" dependencies = [ "alloy-eip7928", "bitflags 2.11.1", diff --git a/Cargo.toml b/Cargo.toml index 7ca7f4cea91..e13daefa138 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -325,8 +325,8 @@ reth-cli = { path = "crates/cli/cli" } reth-cli-commands = { path = "crates/cli/commands" } reth-cli-runner = { path = "crates/cli/runner" } reth-cli-util = { path = "crates/cli/util" } -reth-codecs = { version = "0.2.0", default-features = false } -reth-codecs-derive = "0.2.0" +reth-codecs = { version = "0.3.0", default-features = false } +reth-codecs-derive = "0.3.0" reth-config = { path = "crates/config", default-features = false } reth-consensus = { path = "crates/consensus/consensus", default-features = false } reth-consensus-common = { path = "crates/consensus/common", default-features = false } @@ -394,7 +394,7 @@ reth-payload-builder-primitives = { path = "crates/payload/builder-primitives" } reth-payload-primitives = { path = "crates/payload/primitives" } reth-payload-validator = { path = "crates/payload/validator" } reth-payload-util = { path = "crates/payload/util" } -reth-primitives-traits = { version = "0.2.0", default-features = false } +reth-primitives-traits = { version = "0.3.0", default-features = false } reth-provider = { path = "crates/storage/provider" } reth-prune = { path = "crates/prune/prune" } reth-prune-types = { path = "crates/prune/types", default-features = false } @@ -410,7 +410,7 @@ reth-rpc-eth-types = { path = "crates/rpc/rpc-eth-types", default-features = fal reth-rpc-layer = { path = "crates/rpc/rpc-layer" } reth-rpc-server-types = { path = "crates/rpc/rpc-server-types" } reth-rpc-convert = { path = "crates/rpc/rpc-convert" } -reth-rpc-traits = { version = "0.2.0", default-features = false } +reth-rpc-traits = { version = "0.3.0", default-features = false } reth-stages = { path = "crates/stages/stages" } reth-stages-api = { path = "crates/stages/api" } reth-stages-types = { path = "crates/stages/types", default-features = false } @@ -429,17 +429,17 @@ reth-trie-common = { path = "crates/trie/common", default-features = false } reth-trie-db = { path = "crates/trie/db" } reth-trie-parallel = { path = "crates/trie/parallel" } reth-trie-sparse = { path = "crates/trie/sparse", default-features = false } -reth-zstd-compressors = { version = "0.2.0", default-features = false } +reth-zstd-compressors = { version = "0.3.0", default-features = false } # revm -revm = { version = "36.0.0", default-features = false } -revm-bytecode = { version = "9.0.0", default-features = false } -revm-database = { version = "12.0.0", default-features = false } -revm-state = { version = "10.0.0", default-features = false } -revm-primitives = { version = "22.1.0", default-features = false } -revm-interpreter = { version = "34.0.0", default-features = false } -revm-database-interface = { version = "10.0.0", default-features = false } -revm-inspectors = "0.37.0" +revm = { version = "37.0.0", default-features = false } +revm-bytecode = { version = "10.0.0", default-features = false } +revm-database = { version = "13.0.0", default-features = false } +revm-state = { version = "11.0.0", default-features = false } +revm-primitives = { version = "23.0.0", default-features = false } +revm-interpreter = { version = "35.0.0", default-features = false } +revm-database-interface = { version = "11.0.0", default-features = false } +revm-inspectors = "0.38.0" # eth alloy-dyn-abi = "1.5.6" @@ -449,7 +449,7 @@ alloy-sol-types = { version = "1.5.6", default-features = false } alloy-chains = { version = "0.2.33", default-features = false } alloy-eip2124 = { version = "0.2.0", default-features = false } alloy-eip7928 = { version = "0.3.0", default-features = false } -alloy-evm = { version = "0.31.0", default-features = false } +alloy-evm = { version = "0.32.0", default-features = false } alloy-rlp = { version = "0.3.13", default-features = false, features = ["core-net"] } alloy-trie = { version = "0.9.4", default-features = false } diff --git a/bin/reth-bb/src/evm.rs b/bin/reth-bb/src/evm.rs index 6d56914ad1d..92a0b85755f 100644 --- a/bin/reth-bb/src/evm.rs +++ b/bin/reth-bb/src/evm.rs @@ -11,7 +11,7 @@ use alloy_eips::eip7685::Requests; use alloy_evm::{ block::{ BlockExecutionError, BlockExecutionResult, BlockExecutor, BlockExecutorFactory, - BlockExecutorFor, ExecutableTx, OnStateHook, StateChangeSource, StateDB, + BlockExecutorFor, ExecutableTx, GasOutput, OnStateHook, StateChangeSource, StateDB, }, eth::{EthBlockExecutionCtx, EthBlockExecutor, EthEvmContext, EthTxResult}, precompiles::PrecompilesMap, @@ -386,7 +386,10 @@ where self.inner_mut().execute_transaction_without_commit(tx) } - fn commit_transaction(&mut self, output: Self::Result) -> Result { + fn commit_transaction( + &mut self, + output: Self::Result, + ) -> Result { let gas_used = self.inner_mut().commit_transaction(output)?; // Fix up cumulative_gas_used on the just-committed receipt so that diff --git a/crates/engine/tree/src/tree/precompile_cache.rs b/crates/engine/tree/src/tree/precompile_cache.rs index b0fde8264b3..860cea61188 100644 --- a/crates/engine/tree/src/tree/precompile_cache.rs +++ b/crates/engine/tree/src/tree/precompile_cache.rs @@ -73,7 +73,9 @@ where } } -/// Cache entry, precompile successful output. +/// Cache entry for a successful precompile output. +/// +/// We intentionally do not cache non-successful statuses or errors. #[derive(Debug, Clone, PartialEq, Eq)] pub struct CacheEntry { output: PrecompileOutput, @@ -180,7 +182,9 @@ where let result = self.precompile.call(input); match &result { - Ok(output) => { + // Only successful outputs are cacheable. Non-success statuses and errors must execute + // again instead of poisoning the cache for subsequent calls. + Ok(output) if output.is_success() => { let size = self.cache.insert( Bytes::copy_from_slice(calldata), CacheEntry { output: output.clone(), spec: self.spec_id.clone() }, @@ -228,17 +232,21 @@ mod tests { use super::*; use reth_evm::{EthEvmFactory, Evm, EvmEnv, EvmFactory}; use reth_revm::db::EmptyDB; - use revm::{context::TxEnv, precompile::PrecompileOutput}; + use revm::{ + context::TxEnv, + precompile::{PrecompileOutput, PrecompileStatus}, + }; use revm_primitives::hardfork::SpecId; #[test] fn test_precompile_cache_basic() { let dyn_precompile: DynPrecompile = (|_input: PrecompileInput<'_>| -> PrecompileResult { Ok(PrecompileOutput { + status: PrecompileStatus::Success, gas_used: 0, - gas_refunded: 0, + state_gas_used: 0, + reservoir: 0, bytes: Bytes::default(), - reverted: false, }) }) .into(); @@ -247,10 +255,11 @@ mod tests { CachedPrecompile::new(dyn_precompile, PrecompileCache::default(), SpecId::PRAGUE, None); let output = PrecompileOutput { + status: PrecompileStatus::Success, gas_used: 50, - gas_refunded: 0, + state_gas_used: 0, + reservoir: 0, bytes: alloy_primitives::Bytes::copy_from_slice(b"cached_result"), - reverted: false, }; let input = b"test_input"; @@ -279,10 +288,11 @@ mod tests { assert_eq!(input.data, input_data); Ok(PrecompileOutput { + status: PrecompileStatus::Success, gas_used: 5000, - gas_refunded: 0, + state_gas_used: 0, + reservoir: 0, bytes: alloy_primitives::Bytes::copy_from_slice(b"output_from_precompile_1"), - reverted: false, }) } }) @@ -294,10 +304,11 @@ mod tests { assert_eq!(input.data, input_data); Ok(PrecompileOutput { + status: PrecompileStatus::Success, gas_used: 7000, - gas_refunded: 0, + state_gas_used: 0, + reservoir: 0, bytes: alloy_primitives::Bytes::copy_from_slice(b"output_from_precompile_2"), - reverted: false, }) } }) diff --git a/crates/ethereum/evm/src/lib.rs b/crates/ethereum/evm/src/lib.rs index 2f694af86f4..bdbdb030462 100644 --- a/crates/ethereum/evm/src/lib.rs +++ b/crates/ethereum/evm/src/lib.rs @@ -175,6 +175,7 @@ where suggested_fee_recipient: attributes.suggested_fee_recipient, prev_randao: attributes.prev_randao, gas_limit: attributes.gas_limit, + slot_number: attributes.slot_number, }, self.chain_spec().next_block_base_fee(parent, attributes.timestamp).unwrap_or_default(), self.chain_spec(), diff --git a/crates/ethereum/payload/src/lib.rs b/crates/ethereum/payload/src/lib.rs index d97eb8ffe4c..4cd14fab927 100644 --- a/crates/ethereum/payload/src/lib.rs +++ b/crates/ethereum/payload/src/lib.rs @@ -191,6 +191,7 @@ where parent_beacon_block_root: attributes.parent_beacon_block_root(), withdrawals: attributes.withdrawals.clone().map(Into::into), extra_data: builder_config.extra_data, + slot_number: attributes.slot_number(), }, ) .map_err(PayloadBuilderError::other)?; diff --git a/crates/evm/evm/src/execute.rs b/crates/evm/evm/src/execute.rs index 500b2e56754..46c04b8e796 100644 --- a/crates/evm/evm/src/execute.rs +++ b/crates/evm/evm/src/execute.rs @@ -466,7 +466,7 @@ where self.executor.execute_transaction_with_commit_condition((tx_env, &tx), f)? { self.transactions.push(tx); - Ok(Some(gas_used)) + Ok(Some(gas_used.tx_gas_used())) } else { Ok(None) } diff --git a/crates/evm/evm/src/lib.rs b/crates/evm/evm/src/lib.rs index 9902166d8ea..8894ed5e3e8 100644 --- a/crates/evm/evm/src/lib.rs +++ b/crates/evm/evm/src/lib.rs @@ -117,6 +117,7 @@ pub use alloy_evm::{ /// gas_limit: 30_000_000, /// withdrawals: Some(withdrawals), /// parent_beacon_block_root: Some(beacon_root), +/// slot_number: None, /// }; /// /// // Build a new block on top of parent @@ -501,4 +502,6 @@ pub struct NextBlockEnvAttributes { pub withdrawals: Option, /// Optional extra data. pub extra_data: Bytes, + /// Optional slot number for post-Amsterdam payloads. + pub slot_number: Option, } diff --git a/crates/rpc/rpc-eth-api/src/helpers/call.rs b/crates/rpc/rpc-eth-api/src/helpers/call.rs index 2fadf5f489b..e417943fea8 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/call.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/call.rs @@ -517,7 +517,7 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA let result = this.inspect(&mut db, evm_env.clone(), tx_env.clone(), &mut inspector)?; let access_list = inspector.into_access_list(); - let gas_used = result.result.gas_used(); + let gas_used = result.result.tx_gas_used(); tx_env.set_access_list(access_list.clone()); if let Err(err) = Self::Error::ensure_success(result.result) { return Ok(AccessListResult { @@ -529,7 +529,7 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA // transact again to get the exact gas used let result = this.transact(&mut db, evm_env, tx_env)?; - let gas_used = result.result.gas_used(); + let gas_used = result.result.tx_gas_used(); let error = Self::Error::ensure_success(result.result).err().map(|e| e.to_string()); Ok(AccessListResult { access_list, gas_used: U256::from(gas_used), error }) diff --git a/crates/rpc/rpc-eth-api/src/helpers/estimate.rs b/crates/rpc/rpc-eth-api/src/helpers/estimate.rs index 3f0d75243e8..0870ab146e3 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/estimate.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/estimate.rs @@ -204,7 +204,7 @@ pub trait EstimateCall: Call { // NOTE: this is the gas the transaction used, which is less than the // transaction requires to succeed. - let mut gas_used = res.result.gas_used(); + let mut gas_used = res.result.tx_gas_used(); // the lowest value is capped by the gas used by the unconstrained transaction let mut lowest_gas_limit = gas_used.saturating_sub(1); @@ -225,7 +225,7 @@ pub trait EstimateCall: Call { res = evm.transact(optimistic_tx_env).map_err(Self::Error::from_evm_err)?; // Update the gas used based on the new result. - gas_used = res.result.gas_used(); + gas_used = res.result.tx_gas_used(); // Update the gas limit estimates (highest and lowest) based on the execution result. update_estimated_gas_range( res.result, diff --git a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs index 1b3cbf05706..d506a6c5c68 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs @@ -435,6 +435,7 @@ impl BuildPendingEnv for NextBlockEnvAttributes { parent_beacon_block_root: parent.parent_beacon_block_root(), withdrawals: parent.withdrawals_root().map(|_| Default::default()), extra_data: parent.extra_data().clone(), + slot_number: parent.slot_number().map(|slot| slot.saturating_add(1)), } } } @@ -457,4 +458,14 @@ mod tests { assert_eq!(attrs.parent_beacon_block_root, Some(beacon_root)); } + + #[test] + fn pending_env_increments_parent_slot_number() { + let header = Header { slot_number: Some(7), ..Default::default() }; + let sealed = SealedHeader::new(header, B256::ZERO); + + let attrs = NextBlockEnvAttributes::build_pending_env(&sealed); + + assert_eq!(attrs.slot_number, Some(8)); + } } diff --git a/crates/rpc/rpc-eth-types/src/error/api.rs b/crates/rpc/rpc-eth-types/src/error/api.rs index 1c7ab07eaee..0a1c6b6e5bb 100644 --- a/crates/rpc/rpc-eth-types/src/error/api.rs +++ b/crates/rpc/rpc-eth-types/src/error/api.rs @@ -126,7 +126,7 @@ pub trait FromEvmError: ExecutionResult::Success { output, .. } => Ok(output.into_data()), ExecutionResult::Revert { output, .. } => Err(Self::from_revert(output)), ExecutionResult::Halt { reason, gas, .. } => { - Err(Self::from_evm_halt(reason, gas.used())) + Err(Self::from_evm_halt(reason, gas.tx_gas_used())) } } } diff --git a/crates/rpc/rpc-eth-types/src/error/mod.rs b/crates/rpc/rpc-eth-types/src/error/mod.rs index 12f0498a33a..872ba92fb58 100644 --- a/crates/rpc/rpc-eth-types/src/error/mod.rs +++ b/crates/rpc/rpc-eth-types/src/error/mod.rs @@ -559,6 +559,7 @@ where EVMError::Header(err) => err.into(), EVMError::Database(err) => err.into(), EVMError::Custom(err) => Self::EvmCustom(err), + EVMError::CustomAny(err) => Self::EvmCustom(err.to_string()), } } } diff --git a/crates/rpc/rpc-eth-types/src/simulate.rs b/crates/rpc/rpc-eth-types/src/simulate.rs index cfb020b0aef..7946459cfe3 100644 --- a/crates/rpc/rpc-eth-types/src/simulate.rs +++ b/crates/rpc/rpc-eth-types/src/simulate.rs @@ -314,7 +314,7 @@ where code: SIMULATE_VM_ERROR_CODE, ..SimulateError::invalid_params() }), - gas_used: gas.used(), + gas_used: gas.tx_gas_used(), logs: Vec::new(), status: false, ..Default::default() @@ -329,7 +329,7 @@ where code: SIMULATE_REVERT_CODE, ..SimulateError::invalid_params() }), - gas_used: gas.used(), + gas_used: gas.tx_gas_used(), status: false, logs: Vec::new(), ..Default::default() @@ -338,7 +338,7 @@ where ExecutionResult::Success { output, gas, logs, .. } => SimCallResult { return_data: output.into_data(), error: None, - gas_used: gas.used(), + gas_used: gas.tx_gas_used(), logs: logs .into_iter() .map(|log| { diff --git a/crates/rpc/rpc/src/eth/bundle.rs b/crates/rpc/rpc/src/eth/bundle.rs index 6060e8e1ce0..0327d5c7c07 100644 --- a/crates/rpc/rpc/src/eth/bundle.rs +++ b/crates/rpc/rpc/src/eth/bundle.rs @@ -188,7 +188,7 @@ where let gas_price = tx .effective_tip_per_gas(basefee) .expect("fee is always valid; execution succeeded"); - let gas_used = result.gas_used(); + let gas_used = result.tx_gas_used(); total_gas_used += gas_used; let gas_fees = U256::from(gas_used) * U256::from(gas_price); diff --git a/crates/rpc/rpc/src/eth/sim_bundle.rs b/crates/rpc/rpc/src/eth/sim_bundle.rs index 3d4ea9a9496..c70360d76c3 100644 --- a/crates/rpc/rpc/src/eth/sim_bundle.rs +++ b/crates/rpc/rpc/src/eth/sim_bundle.rs @@ -348,7 +348,7 @@ where .into()); } - let gas_used = result.gas_used(); + let gas_used = result.tx_gas_used(); total_gas_used += gas_used; // coinbase is always present in the result state diff --git a/crates/rpc/rpc/src/testing.rs b/crates/rpc/rpc/src/testing.rs index 61b452bb7dc..80dd2b1a06c 100644 --- a/crates/rpc/rpc/src/testing.rs +++ b/crates/rpc/rpc/src/testing.rs @@ -119,6 +119,7 @@ where parent_beacon_block_root: request.payload_attributes.parent_beacon_block_root, withdrawals: withdrawals.map(Into::into), extra_data: request.extra_data.unwrap_or_default(), + slot_number: request.payload_attributes.slot_number, }; let mut builder = evm_config diff --git a/crates/tasks/src/utils.rs b/crates/tasks/src/utils.rs index 5d35a0d4fa5..f535922bc27 100644 --- a/crates/tasks/src/utils.rs +++ b/crates/tasks/src/utils.rs @@ -45,6 +45,7 @@ pub fn increase_thread_priority() { /// Should be called once after tracing is initialized. /// /// No-op on non-Linux platforms. +#[allow(clippy::missing_const_for_fn)] pub fn deprioritize_background_threads() { #[cfg(target_os = "linux")] _deprioritize_background_threads(); diff --git a/crates/transaction-pool/src/validate/eth.rs b/crates/transaction-pool/src/validate/eth.rs index 63a64a655b2..c91b6e05ef2 100644 --- a/crates/transaction-pool/src/validate/eth.rs +++ b/crates/transaction-pool/src/validate/eth.rs @@ -1414,7 +1414,7 @@ pub fn ensure_intrinsic_gas( ); let gas_limit = transaction.gas_limit(); - if gas_limit < gas.initial_gas || gas_limit < gas.floor_gas { + if gas_limit < gas.initial_total_gas || gas_limit < gas.floor_gas { Err(InvalidPoolTransactionError::IntrinsicGasTooLow) } else { Ok(()) diff --git a/examples/custom-beacon-withdrawals/src/main.rs b/examples/custom-beacon-withdrawals/src/main.rs index bc65d714269..bdae84f9e56 100644 --- a/examples/custom-beacon-withdrawals/src/main.rs +++ b/examples/custom-beacon-withdrawals/src/main.rs @@ -5,7 +5,7 @@ use alloy_eips::eip4895::Withdrawal; use alloy_evm::{ - block::{BlockExecutorFactory, BlockExecutorFor, ExecutableTx}, + block::{BlockExecutorFactory, BlockExecutorFor, ExecutableTx, GasOutput}, eth::{EthBlockExecutionCtx, EthBlockExecutor, EthTxResult}, precompiles::PrecompilesMap, revm::context::Block as _, @@ -211,7 +211,10 @@ where self.inner.execute_transaction_without_commit(tx) } - fn commit_transaction(&mut self, output: Self::Result) -> Result { + fn commit_transaction( + &mut self, + output: Self::Result, + ) -> Result { self.inner.commit_transaction(output) } diff --git a/examples/custom-evm/src/main.rs b/examples/custom-evm/src/main.rs index 58d8ac9c607..abcfaf80fda 100644 --- a/examples/custom-evm/src/main.rs +++ b/examples/custom-evm/src/main.rs @@ -22,7 +22,7 @@ use reth_ethereum::{ context_interface::result::{EVMError, HaltReason}, inspector::{Inspector, NoOpInspector}, interpreter::interpreter::EthInterpreter, - precompile::{PrecompileOutput, PrecompileResult, Precompiles}, + precompile::{PrecompileOutput, Precompiles}, primitives::hardfork::SpecId, MainBuilder, MainContext, }, @@ -110,7 +110,7 @@ pub fn prague_custom() -> &'static Precompiles { let precompile = Precompile::new( PrecompileId::custom("custom"), address!("0x0000000000000000000000000000000000000999"), - |_, _| PrecompileResult::Ok(PrecompileOutput::new(0, Bytes::new())), + |_, _, _| Ok(PrecompileOutput::new(0, Bytes::new(), 0)), ); precompiles.extend([precompile]); precompiles