From bcc95b1f4fd483963ef8d405da73d4aa1b41b797 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sat, 17 Feb 2024 11:39:02 +0100 Subject: [PATCH] chore: bump revm 6.0 (#6638) --- Cargo.lock | 32 ++++++++++--------- Cargo.toml | 16 +++++----- crates/node-ethereum/src/evm.rs | 2 +- crates/node-optimism/src/evm.rs | 2 +- crates/payload/builder/src/payload.rs | 10 +++--- crates/revm/src/processor.rs | 2 +- crates/rpc/rpc-types-compat/src/block.rs | 10 ++++-- crates/rpc/rpc/src/eth/api/mod.rs | 7 +--- crates/rpc/rpc/src/eth/cache/mod.rs | 2 +- crates/storage/provider/src/traits/evm_env.rs | 2 +- examples/custom-node/src/main.rs | 2 +- 11 files changed, 44 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f3acecf804..640169a773 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,7 +173,7 @@ dependencies = [ [[package]] name = "alloy-eips" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=b9dd518#b9dd518b12efd27ab706ae6ffa9ad6b05df451c7" +source = "git+https://github.com/alloy-rs/alloy?rev=5062eaf#5062eaf1af2733a7115bc0536c9708a42bfb53ca" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -183,7 +183,7 @@ dependencies = [ [[package]] name = "alloy-genesis" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=b9dd518#b9dd518b12efd27ab706ae6ffa9ad6b05df451c7" +source = "git+https://github.com/alloy-rs/alloy?rev=5062eaf#5062eaf1af2733a7115bc0536c9708a42bfb53ca" dependencies = [ "alloy-primitives", "alloy-rpc-types", @@ -205,7 +205,7 @@ dependencies = [ [[package]] name = "alloy-node-bindings" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=b9dd518#b9dd518b12efd27ab706ae6ffa9ad6b05df451c7" +source = "git+https://github.com/alloy-rs/alloy?rev=5062eaf#5062eaf1af2733a7115bc0536c9708a42bfb53ca" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -266,7 +266,7 @@ dependencies = [ [[package]] name = "alloy-rpc-engine-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=b9dd518#b9dd518b12efd27ab706ae6ffa9ad6b05df451c7" +source = "git+https://github.com/alloy-rs/alloy?rev=5062eaf#5062eaf1af2733a7115bc0536c9708a42bfb53ca" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -281,7 +281,7 @@ dependencies = [ [[package]] name = "alloy-rpc-trace-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=b9dd518#b9dd518b12efd27ab706ae6ffa9ad6b05df451c7" +source = "git+https://github.com/alloy-rs/alloy?rev=5062eaf#5062eaf1af2733a7115bc0536c9708a42bfb53ca" dependencies = [ "alloy-primitives", "alloy-rpc-types", @@ -292,7 +292,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=b9dd518#b9dd518b12efd27ab706ae6ffa9ad6b05df451c7" +source = "git+https://github.com/alloy-rs/alloy?rev=5062eaf#5062eaf1af2733a7115bc0536c9708a42bfb53ca" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -7022,9 +7022,9 @@ dependencies = [ [[package]] name = "revm" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266f86bdefa6dac07d92e2f5c37d7d183f2575b2f9e0ee9cba9402dfde912524" +checksum = "8154cec6f8c4f543a379cf00a839cf47c67f405e8a92361a7791c55196c9b7e2" dependencies = [ "auto_impl", "cfg-if", @@ -7037,14 +7037,16 @@ dependencies = [ [[package]] name = "revm-inspectors" version = "0.1.0" -source = "git+https://github.com/paradigmxyz/evm-inspectors?rev=8f17f34#8f17f34da5fec043378e689bb9e4169453371c38" +source = "git+https://github.com/paradigmxyz/evm-inspectors?rev=ac63f06#ac63f069977d04cd68d96fe7ad9dd4b74ceab44e" dependencies = [ "alloy-primitives", "alloy-rpc-trace-types", "alloy-rpc-types", "alloy-sol-types", + "anstyle", "boa_engine", "boa_gc", + "colorchoice", "revm", "serde", "serde_json", @@ -7053,9 +7055,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "2.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a80b516cc706630e604e2fd47c281501d2fb222712be4328921361388b7d2df" +checksum = "dff72cc825a9c44b28749a6181e21fa85ba45ac8d4b5732a7ded165a770ecbd9" dependencies = [ "revm-primitives", "serde", @@ -7063,9 +7065,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6912fafe7f70a264ec5895875ce2f2d0621a39263844280c9ee7f85e35bbb9e" +checksum = "186373108c0a46e47368752372cc721d4b0ab4886d6786d180ef9dbf4dd71865" dependencies = [ "aurora-engine-modexp", "blst", @@ -7081,9 +7083,9 @@ dependencies = [ [[package]] name = "revm-primitives" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b3683a40f1e94e7389c8e81e5f26bb5d30875ed0b48ab07985ec32eb6d6c712" +checksum = "093dc5df253eececaf03ffe0c12d3fd7ce5dea3342bc9de109d1aac2647ffa81" dependencies = [ "alloy-primitives", "auto_impl", diff --git a/Cargo.toml b/Cargo.toml index 04daf60292..e6cf1626d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -170,9 +170,9 @@ reth-transaction-pool = { path = "crates/transaction-pool" } reth-trie = { path = "crates/trie" } # revm -revm = { version = "5.0", features = ["std", "secp256k1"], default-features = false } +revm = { version = "6.0", features = ["std", "secp256k1"], default-features = false } revm-primitives = { version = "2.0", features = ["std"], default-features = false } -revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "8f17f34" } +revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "ac63f06" } # eth alloy-chains = { version = "0.1", feature = ["serde", "rlp", "arbitrary"] } @@ -181,12 +181,12 @@ alloy-dyn-abi = "0.6" alloy-sol-types = "0.6" alloy-rlp = "0.3" alloy-trie = "0.2" -alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" } -alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" } -alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" } -alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" } -alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" } -alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" } +alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" } +alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" } +alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" } +alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" } +alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" } +alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" } ethers-core = { version = "2.0", default-features = false } ethers-providers = { version = "2.0", default-features = false } ethers-signers = { version = "2.0", default-features = false } diff --git a/crates/node-ethereum/src/evm.rs b/crates/node-ethereum/src/evm.rs index b255df36fb..1b5c90213d 100644 --- a/crates/node-ethereum/src/evm.rs +++ b/crates/node-ethereum/src/evm.rs @@ -55,7 +55,7 @@ mod tests { #[test] #[ignore] fn test_fill_cfg_and_block_env() { - let mut cfg_env = CfgEnvWithHandlerCfg::new(CfgEnv::default(), SpecId::LATEST); + let mut cfg_env = CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), SpecId::LATEST); let mut block_env = BlockEnv::default(); let header = Header::default(); let chain_spec = ChainSpec::default(); diff --git a/crates/node-optimism/src/evm.rs b/crates/node-optimism/src/evm.rs index 490f257f73..c1c8f52625 100644 --- a/crates/node-optimism/src/evm.rs +++ b/crates/node-optimism/src/evm.rs @@ -56,7 +56,7 @@ mod tests { #[test] #[ignore] fn test_fill_cfg_and_block_env() { - let mut cfg_env = CfgEnvWithHandlerCfg::new(CfgEnv::default(), SpecId::LATEST); + let mut cfg_env = CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), SpecId::LATEST); let mut block_env = BlockEnv::default(); let header = Header::default(); let chain_spec = ChainSpec::default(); diff --git a/crates/payload/builder/src/payload.rs b/crates/payload/builder/src/payload.rs index c1373a4e83..bfed0b4101 100644 --- a/crates/payload/builder/src/payload.rs +++ b/crates/payload/builder/src/payload.rs @@ -208,14 +208,14 @@ impl PayloadBuilderAttributes for EthPayloadBuilderAttributes { Ok(Self::new(parent, attributes)) } - fn parent(&self) -> B256 { - self.parent - } - fn payload_id(&self) -> PayloadId { self.id } + fn parent(&self) -> B256 { + self.parent + } + fn timestamp(&self) -> u64 { self.timestamp } @@ -279,7 +279,7 @@ impl PayloadBuilderAttributes for EthPayloadBuilderAttributes { blob_excess_gas_and_price, }; - (CfgEnvWithHandlerCfg::new(cfg, spec_id), block_env) + (CfgEnvWithHandlerCfg::new_with_spec_id(cfg, spec_id), block_env) } } diff --git a/crates/revm/src/processor.rs b/crates/revm/src/processor.rs index 5f7c6d894a..f10f375d8c 100644 --- a/crates/revm/src/processor.rs +++ b/crates/revm/src/processor.rs @@ -178,7 +178,7 @@ where self.db_mut().set_state_clear_flag(state_clear_flag); let mut cfg: CfgEnvWithHandlerCfg = - CfgEnvWithHandlerCfg::new(self.evm.cfg().clone(), self.evm.spec_id()); + CfgEnvWithHandlerCfg::new_with_spec_id(self.evm.cfg().clone(), self.evm.spec_id()); EvmConfig::fill_cfg_and_block_env( &mut cfg, self.evm.block_mut(), diff --git a/crates/rpc/rpc-types-compat/src/block.rs b/crates/rpc/rpc-types-compat/src/block.rs index f428b9b763..e2c3bb0dd5 100644 --- a/crates/rpc/rpc-types-compat/src/block.rs +++ b/crates/rpc/rpc-types-compat/src/block.rs @@ -91,6 +91,8 @@ pub fn from_block_full( } /// Converts from a [reth_primitives::SealedHeader] to a [reth_rpc_types::BlockNumberOrTag] +/// +/// Note: This does not set the `totalDifficulty` field. pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader) -> Header { let (header, hash) = primitive_header.split(); let PrimitiveHeader { @@ -138,6 +140,7 @@ pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader) blob_gas_used: blob_gas_used.map(U64::from), excess_blob_gas: excess_blob_gas.map(U64::from), parent_beacon_block_root, + total_difficulty: None, } } @@ -161,7 +164,9 @@ fn from_block_with_transactions( transactions: BlockTransactions, ) -> Block { let uncles = block.ommers.into_iter().map(|h| h.hash_slow()).collect(); - let header = from_primitive_with_hash(block.header.seal(block_hash)); + let mut header = from_primitive_with_hash(block.header.seal(block_hash)); + header.total_difficulty = Some(total_difficulty); + let withdrawals = if header.withdrawals_root.is_some() { block .withdrawals @@ -169,11 +174,11 @@ fn from_block_with_transactions( } else { None }; + Block { header, uncles, transactions, - total_difficulty: Some(total_difficulty), size: Some(U256::from(block_length)), withdrawals, other: Default::default(), @@ -193,7 +198,6 @@ pub fn uncle_block_from_header(header: PrimitiveHeader) -> Block { transactions: BlockTransactions::Uncle, withdrawals: Some(vec![]), size, - total_difficulty: None, other: Default::default(), } } diff --git a/crates/rpc/rpc/src/eth/api/mod.rs b/crates/rpc/rpc/src/eth/api/mod.rs index 86184f67d2..6a20a06644 100644 --- a/crates/rpc/rpc/src/eth/api/mod.rs +++ b/crates/rpc/rpc/src/eth/api/mod.rs @@ -301,12 +301,7 @@ where PendingBlockEnvOrigin::DerivedFromLatest(latest) }; - let mut cfg = CfgEnvWithHandlerCfg::new(CfgEnv::default(), SpecId::LATEST); - - #[cfg(feature = "optimism")] - { - cfg.handler_cfg.is_optimism = self.provider().chain_spec().is_optimism(); - } + let mut cfg = CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), SpecId::LATEST); let mut block_env = BlockEnv::default(); // Note: for the PENDING block we assume it is past the known merge block and thus this will diff --git a/crates/rpc/rpc/src/eth/cache/mod.rs b/crates/rpc/rpc/src/eth/cache/mod.rs index 948d13f132..1d877b4056 100644 --- a/crates/rpc/rpc/src/eth/cache/mod.rs +++ b/crates/rpc/rpc/src/eth/cache/mod.rs @@ -513,7 +513,7 @@ where this.action_task_spawner.spawn_blocking(Box::pin(async move { // Acquire permit let _permit = rate_limiter.acquire().await; - let mut cfg = CfgEnvWithHandlerCfg::new( + let mut cfg = CfgEnvWithHandlerCfg::new_with_spec_id( CfgEnv::default(), SpecId::LATEST, ); diff --git a/crates/storage/provider/src/traits/evm_env.rs b/crates/storage/provider/src/traits/evm_env.rs index f5ce26c9f4..2eb8f3e5d8 100644 --- a/crates/storage/provider/src/traits/evm_env.rs +++ b/crates/storage/provider/src/traits/evm_env.rs @@ -31,7 +31,7 @@ pub trait EvmEnvProvider: Send + Sync { where EvmConfig: ConfigureEvmEnv, { - let mut cfg = CfgEnvWithHandlerCfg::new(CfgEnv::default(), SpecId::LATEST); + let mut cfg = CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), SpecId::LATEST); let mut block_env = BlockEnv::default(); self.fill_env_with_header::(&mut cfg, &mut block_env, header, evm_config)?; Ok((cfg, block_env)) diff --git a/examples/custom-node/src/main.rs b/examples/custom-node/src/main.rs index 1f45629443..e2e5aed188 100644 --- a/examples/custom-node/src/main.rs +++ b/examples/custom-node/src/main.rs @@ -166,7 +166,7 @@ impl PayloadBuilderAttributes for CustomPayloadBuilderAttributes { blob_excess_gas_and_price, }; - (CfgEnvWithHandlerCfg::new(cfg, spec_id), block_env) + (CfgEnvWithHandlerCfg::new_with_spec_id(cfg, spec_id), block_env) } }