diff --git a/Cargo.lock b/Cargo.lock index adac7422cf..d3b62ae97c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -266,9 +266,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.1.0-alpha.2" +version = "0.1.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee1682d3b973d08cdcba76014b5e119142c0f0d094b3ba372164e61abd53d9f" +checksum = "f40fe575395f20dc9527c2dc65350786492e9723d2035e9f716269b65be34c9c" dependencies = [ "alloy-consensus", "alloy-eips", @@ -397,9 +397,9 @@ dependencies = [ [[package]] name = "alloy-op-evm" -version = "0.1.0-alpha.2" +version = "0.1.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4770f99f1ea0e6bfa110744f7d4c0eeffdbba62316349906bff6a773aa5fda4c" +checksum = "1ed217773009445cba32f02418828a282c7bcb7721909cf4f6aaa9a263618817" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5868,9 +5868,9 @@ dependencies = [ [[package]] name = "op-revm" -version = "1.0.0-alpha.5" +version = "1.0.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61d0efbcc12d851c5f1e034d97f055491424b35515a2956ff8c3886fd9e0c148" +checksum = "983c408745202267f1f483d091fb498986613ccd6c95e44d634cc0d7a2a9f275" dependencies = [ "auto_impl", "once_cell", @@ -10087,9 +10087,9 @@ dependencies = [ [[package]] name = "revm" -version = "20.0.0-alpha.6" +version = "20.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33790dc343daaa413e5426a508094e2055db97200e6e1a9362339e672058259d" +checksum = "4502328b029ff68ddbbe42994faf7384c8aac0a47d53c3323ea52c7696fe2154" dependencies = [ "revm-bytecode", "revm-context", @@ -10106,9 +10106,9 @@ dependencies = [ [[package]] name = "revm-bytecode" -version = "1.0.0-alpha.4" +version = "1.0.0-alpha.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1f19307417b325447bcb4bb12586d47c91df6551d33e4b6ced89eeedae7f5b" +checksum = "f018d50979559e6c0fcad3f0e5c5bd54e4ebff3d6f0d4da82ac83fe7f5bc3ac0" dependencies = [ "bitvec", "phf", @@ -10118,9 +10118,9 @@ dependencies = [ [[package]] name = "revm-context" -version = "1.0.0-alpha.5" +version = "1.0.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e100b379bda77580ad0fe7cc54b87675bfb1d4762ac6747b7933f01984e238cb" +checksum = "247e37d3df5918952a004f637b6b6a018daee83163c540f8b2c3b14ae05e9e78" dependencies = [ "cfg-if", "derive-where", @@ -10134,9 +10134,9 @@ dependencies = [ [[package]] name = "revm-context-interface" -version = "1.0.0-alpha.5" +version = "1.0.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "828f3d1147ac4eff5c98e4c3714f659a97781aa4f8f0f67087c9639bdc44cb61" +checksum = "ef08da7b423908efbfd5733bb3fb08916319fdec0a879f6d1fb5c8ae1994b239" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -10149,9 +10149,9 @@ dependencies = [ [[package]] name = "revm-database" -version = "1.0.0-alpha.4" +version = "1.0.0-alpha.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1ade2662c72125f191296da438fdb42388311b0080db660459015dacfeeb9f" +checksum = "cefe6672af9849f9fd6ef836aff4b32020952992454e66597d32da68341fb89e" dependencies = [ "alloy-eips", "auto_impl", @@ -10164,9 +10164,9 @@ dependencies = [ [[package]] name = "revm-database-interface" -version = "1.0.0-alpha.4" +version = "1.0.0-alpha.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830335bea29c435ad60d532198444af1fa9d9de6724887c36156dc643c3b6f62" +checksum = "f8b4ab0ff9891593c719abdfadc8968450e1e2e0a8320339dd6968813a23db9d" dependencies = [ "auto_impl", "revm-primitives", @@ -10176,9 +10176,9 @@ dependencies = [ [[package]] name = "revm-handler" -version = "1.0.0-alpha.6" +version = "1.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "278c4ce30c07a5a5ac26b4f5f72fed5120e764bd051ec5eeb6fbdb4ff537383e" +checksum = "12d95e6f9ccc5e9129d2ee3672125f0e1d7cc4c6a488d99818f7c6559e2bf4bc" dependencies = [ "auto_impl", "revm-bytecode", @@ -10194,16 +10194,15 @@ dependencies = [ [[package]] name = "revm-inspector" -version = "1.0.0-alpha.6" +version = "1.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8faa8ebce23b85a42f660560dd3553371e5b97352a2fe229a9e849e91cd0a113" +checksum = "5289f17f28b3ab3be2d1be9e604eca7a1a554e7da336ddbe8860798e2bea88bc" dependencies = [ "auto_impl", "revm-context", "revm-database-interface", "revm-handler", "revm-interpreter", - "revm-precompile", "revm-primitives", "revm-state", "serde", @@ -10232,9 +10231,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "16.0.0-alpha.6" +version = "16.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a86403b3a0ddf4b5aa8da800a73ab500e947150ecd5b453a93b42482dde2c1c" +checksum = "2a97985e55a551d5d86c07a4469ecdd3b8c0d793cb330bb4a4f747e1ee0af864" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -10244,9 +10243,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "17.0.0-alpha.6" +version = "17.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20da0ec6e79a5420d7619e8d5fa900b8632f076fb35579b5463949fe2b328da7" +checksum = "c5d46dad4a7db8e6de9015f2419c160b41fa5e721345c1678a66db6d9f5ef619" dependencies = [ "aurora-engine-modexp", "blst", @@ -10256,7 +10255,6 @@ dependencies = [ "libsecp256k1", "once_cell", "p256", - "revm-context-interface", "revm-primitives", "ripemd", "secp256k1", @@ -10266,9 +10264,9 @@ dependencies = [ [[package]] name = "revm-primitives" -version = "16.0.0-alpha.4" +version = "16.0.0-alpha.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b719ced7ba199ea5e7a18fe62d75537e852dfc6b6afe608aac0c4cdc51af87d" +checksum = "b385df11c27aa339c2d80cb22b8d5621ad95e7464cd319c8b5343448ea8ad673" dependencies = [ "alloy-primitives", "enumn", @@ -10277,9 +10275,9 @@ dependencies = [ [[package]] name = "revm-state" -version = "1.0.0-alpha.4" +version = "1.0.0-alpha.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a268b9798bbaa1e7d52c22d94ef231dae692d66f7c5ef29ff03e0776357156e" +checksum = "217e158f471dd39065b14db956c3d40437f311163efd05254dc9a66b9dc426ba" dependencies = [ "bitflags 2.9.0", "revm-bytecode", diff --git a/Cargo.toml b/Cargo.toml index 479135f3f1..0a76224a48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -436,24 +436,24 @@ reth-ress-protocol = { path = "crates/ress/protocol" } reth-ress-provider = { path = "crates/ress/provider" } # revm -revm = { version = "20.0.0-alpha.6", default-features = false } -revm-bytecode = { version = "1.0.0-alpha.4", default-features = false } -revm-database = { version = "1.0.0-alpha.4", default-features = false } -revm-state = { version = "1.0.0-alpha.4", default-features = false } -revm-primitives = { version = "16.0.0-alpha.4", default-features = false } -revm-interpreter = { version = "16.0.0-alpha.6", default-features = false } -revm-inspector = { version = "1.0.0-alpha.6", default-features = false } -revm-context = { version = "1.0.0-alpha.5", default-features = false } -revm-context-interface = { version = "1.0.0-alpha.5", default-features = false } -revm-database-interface = { version = "1.0.0-alpha.4", default-features = false } -op-revm = { version = "1.0.0-alpha.5", default-features = false } +revm = { version = "20.0.0-alpha.7", default-features = false } +revm-bytecode = { version = "1.0.0-alpha.5", default-features = false } +revm-database = { version = "1.0.0-alpha.5", default-features = false } +revm-state = { version = "1.0.0-alpha.5", default-features = false } +revm-primitives = { version = "16.0.0-alpha.5", default-features = false } +revm-interpreter = { version = "16.0.0-alpha.7", default-features = false } +revm-inspector = { version = "1.0.0-alpha.7", default-features = false } +revm-context = { version = "1.0.0-alpha.6", default-features = false } +revm-context-interface = { version = "1.0.0-alpha.6", default-features = false } +revm-database-interface = { version = "1.0.0-alpha.5", default-features = false } +op-revm = { version = "1.0.0-alpha.6", default-features = false } revm-inspectors = "0.17.0-alpha.1" # eth alloy-chains = { version = "0.1.64", default-features = false } alloy-dyn-abi = "0.8.20" alloy-eip2124 = { version = "0.1.0", default-features = false } -alloy-evm = { version = "0.1.0-alpha.2", default-features = false } +alloy-evm = { version = "0.1.0-alpha.3", default-features = false } alloy-primitives = { version = "0.8.20", default-features = false, features = ["map-foldhash"] } alloy-rlp = { version = "0.3.10", default-features = false, features = ["core-net"] } alloy-sol-types = { version = "0.8.20", default-features = false } @@ -491,7 +491,7 @@ alloy-transport-ipc = { version = "0.12.6", default-features = false } alloy-transport-ws = { version = "0.12.6", default-features = false } # op -alloy-op-evm = { version = "0.1.0-alpha.2", default-features = false } +alloy-op-evm = { version = "0.1.0-alpha.3", default-features = false } alloy-op-hardforks = "0.1" op-alloy-rpc-types = { version = "0.11.2", default-features = false } op-alloy-rpc-types-engine = { version = "0.11.2", default-features = false } diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index 8708b93dc2..41b86b3e85 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -27,7 +27,7 @@ mod tests { use super::*; use alloy_consensus::{constants::ETH_TO_WEI, Header, TxLegacy}; use alloy_eips::{ - eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE}, + eip2935::{HISTORY_SERVE_WINDOW, HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE}, eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE, SYSTEM_ADDRESS}, eip4895::Withdrawal, eip7002::{WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS, WITHDRAWAL_REQUEST_PREDEPLOY_CODE}, @@ -45,7 +45,7 @@ mod tests { use reth_testing_utils::generators::{self, sign_tx_with_key_pair}; use revm::{ database::{CacheDB, EmptyDB, TransitionState}, - primitives::{address, BLOCKHASH_SERVE_WINDOW}, + primitives::address, state::{AccountInfo, Bytecode, EvmState}, Database, }; @@ -461,7 +461,7 @@ mod tests { #[test] fn eip_2935_fork_activation_within_window_bounds() { - let fork_activation_block = (BLOCKHASH_SERVE_WINDOW - 10) as u64; + let fork_activation_block = (HISTORY_SERVE_WINDOW - 10) as u64; let db = create_database_with_block_hashes(fork_activation_block); let chain_spec = Arc::new( @@ -514,7 +514,7 @@ mod tests { // #[test] fn eip_2935_fork_activation_outside_window_bounds() { - let fork_activation_block = (BLOCKHASH_SERVE_WINDOW + 256) as u64; + let fork_activation_block = (HISTORY_SERVE_WINDOW + 256) as u64; let db = create_database_with_block_hashes(fork_activation_block); let chain_spec = Arc::new( diff --git a/crates/optimism/rpc/src/error.rs b/crates/optimism/rpc/src/error.rs index b200acd844..383eba3b2b 100644 --- a/crates/optimism/rpc/src/error.rs +++ b/crates/optimism/rpc/src/error.rs @@ -172,7 +172,6 @@ where }, EVMError::Database(err) => Self::Eth(err.into()), EVMError::Header(err) => Self::Eth(err.into()), - EVMError::Precompile(err) => Self::Eth(EthApiError::EvmPrecompile(err)), EVMError::Custom(err) => Self::Eth(EthApiError::EvmCustom(err)), } } diff --git a/crates/rpc/rpc-eth-types/src/error/mod.rs b/crates/rpc/rpc-eth-types/src/error/mod.rs index 38e3839493..748c84dc54 100644 --- a/crates/rpc/rpc-eth-types/src/error/mod.rs +++ b/crates/rpc/rpc-eth-types/src/error/mod.rs @@ -139,9 +139,6 @@ pub enum EthApiError { /// 7702 bytecode. #[error("Invalid bytecode: {0}")] InvalidBytecode(String), - /// Evm precompile error - #[error("Revm precompile error: {0}")] - EvmPrecompile(String), /// Error encountered when converting a transaction type #[error("Transaction conversion error")] TransactionConversionError, @@ -192,7 +189,6 @@ impl From for jsonrpsee_types::error::ErrorObject<'static> { EthApiError::Internal(_) | EthApiError::TransactionNotFound | EthApiError::EvmCustom(_) | - EthApiError::EvmPrecompile(_) | EthApiError::InvalidRewardPercentiles => internal_rpc_err(error.to_string()), EthApiError::UnknownBlockOrTxIndex => { rpc_error_with_code(EthRpcErrorCode::ResourceNotFound.code(), error.to_string()) @@ -303,7 +299,6 @@ where EVMError::Header(err) => err.into(), EVMError::Database(err) => err.into(), EVMError::Custom(err) => Self::EvmCustom(err), - EVMError::Precompile(err) => Self::EvmPrecompile(err), } } } @@ -540,11 +535,11 @@ impl From for RpcInvalidTransactionError { // tx.gas > block.gas_limit Self::GasTooHigh } - InvalidTransaction::CallGasCostMoreThanGasLimit => { + InvalidTransaction::CallGasCostMoreThanGasLimit { .. } => { // tx.gas < cost Self::GasTooLow } - InvalidTransaction::GasFloorMoreThanGasLimit => { + InvalidTransaction::GasFloorMoreThanGasLimit { .. } => { // Post prague EIP-7623 tx floor calldata gas cost > tx.gas_limit // where floor gas is the minimum amount of gas that will be spent // In other words, the tx's gas limit is lower that the minimum gas requirements of diff --git a/examples/custom-evm/src/main.rs b/examples/custom-evm/src/main.rs index 47f3aab539..e055ca633d 100644 --- a/examples/custom-evm/src/main.rs +++ b/examples/custom-evm/src/main.rs @@ -20,9 +20,7 @@ use reth::{ handler::{EthPrecompiles, PrecompileProvider}, inspector::{Inspector, NoOpInspector}, interpreter::{interpreter::EthInterpreter, InterpreterResult}, - precompile::{ - PrecompileError, PrecompileFn, PrecompileOutput, PrecompileResult, Precompiles, - }, + precompile::{PrecompileFn, PrecompileOutput, PrecompileResult, Precompiles}, primitives::hardfork::SpecId, MainBuilder, MainContext, }, @@ -186,17 +184,17 @@ impl PrecompileProvider for CustomPrecompiles { address: &Address, bytes: &Bytes, gas_limit: u64, - ) -> Result, PrecompileError> { + ) -> Result, String> { self.precompiles.run(context, address, bytes, gas_limit) } - fn contains(&self, address: &Address) -> bool { - self.precompiles.contains(address) - } - fn warm_addresses(&self) -> Box> { self.precompiles.warm_addresses() } + + fn contains(&self, address: &Address) -> bool { + self.precompiles.contains(address) + } } #[tokio::main] diff --git a/examples/precompile-cache/src/main.rs b/examples/precompile-cache/src/main.rs index 3772bf7eb3..220b49ad97 100644 --- a/examples/precompile-cache/src/main.rs +++ b/examples/precompile-cache/src/main.rs @@ -17,7 +17,6 @@ use reth::{ handler::{EthPrecompiles, PrecompileProvider}, inspector::{Inspector, NoOpInspector}, interpreter::{interpreter::EthInterpreter, InterpreterResult}, - precompile::PrecompileError, primitives::hardfork::SpecId, MainBuilder, MainContext, }, @@ -36,7 +35,7 @@ use schnellru::{ByLength, LruMap}; use std::{collections::HashMap, sync::Arc}; /// Type alias for the LRU cache used within the [`PrecompileCache`]. -type PrecompileLRUCache = LruMap<(SpecId, Bytes, u64), Result>; +type PrecompileLRUCache = LruMap<(SpecId, Bytes, u64), Result>; type WrappedEthEvm = EthEvm>; @@ -126,7 +125,7 @@ impl> Pre address: &Address, bytes: &Bytes, gas_limit: u64, - ) -> Result, PrecompileError> { + ) -> Result, String> { let mut cache = self.cache.write(); let key = (self.spec, bytes.clone(), gas_limit); @@ -152,13 +151,13 @@ impl> Pre output } - fn contains(&self, address: &Address) -> bool { - self.precompile.contains(address) - } - fn warm_addresses(&self) -> Box> { self.precompile.warm_addresses() } + + fn contains(&self, address: &Address) -> bool { + self.precompile.contains(address) + } } /// Builds a regular ethereum block executor that uses the custom EVM.