From fa57a36a9804c1f09b01991f45b29447db014c83 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Wed, 28 Aug 2024 18:33:56 -0700 Subject: [PATCH 1/2] tests pass when --no-default-features is set --- Cargo.toml | 2 +- crates/ethereum/evm/src/eip6110.rs | 2 +- crates/ethereum/evm/src/execute.rs | 4 +++- crates/ethereum/evm/src/lib.rs | 5 ++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5adb8aa3ef7..d5dc19875b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -321,7 +321,7 @@ reth-ethereum-forks = { path = "crates/ethereum-forks" } reth-ethereum-payload-builder = { path = "crates/ethereum/payload" } reth-etl = { path = "crates/etl" } reth-evm = { path = "crates/evm" } -reth-evm-ethereum = { path = "crates/ethereum/evm" } +reth-evm-ethereum = { path = "crates/ethereum/evm", default-features = false } reth-evm-optimism = { path = "crates/optimism/evm" } reth-execution-errors = { path = "crates/evm/execution-errors" } reth-execution-types = { path = "crates/evm/execution-types" } diff --git a/crates/ethereum/evm/src/eip6110.rs b/crates/ethereum/evm/src/eip6110.rs index 722c38da76d..a73e0c2cee5 100644 --- a/crates/ethereum/evm/src/eip6110.rs +++ b/crates/ethereum/evm/src/eip6110.rs @@ -7,7 +7,7 @@ use reth_primitives::{Receipt, Request}; use revm_primitives::Log; #[cfg(not(feature = "std"))] -use alloc::{string::ToString, vec::Vec}; +use alloc::{string::ToString, vec, vec::Vec}; sol! { #[allow(missing_docs)] diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index 8c15dee9600..03e92ea2153 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -481,7 +481,9 @@ mod tests { use reth_testing_utils::generators::{self, sign_tx_with_key_pair}; use revm_primitives::{b256, fixed_bytes, Bytes, BLOCKHASH_SERVE_WINDOW}; use secp256k1::{Keypair, Secp256k1}; - use std::collections::HashMap; + use revm_primitives::HashMap; + #[cfg(not(feature = "std"))] + use alloc::{vec, boxed::Box, string::ToString}; fn create_state_provider_with_beacon_root_contract() -> StateProviderTest { let mut db = StateProviderTest::default(); diff --git a/crates/ethereum/evm/src/lib.rs b/crates/ethereum/evm/src/lib.rs index 6eda7ca4fc2..ea115fbe17c 100644 --- a/crates/ethereum/evm/src/lib.rs +++ b/crates/ethereum/evm/src/lib.rs @@ -18,7 +18,7 @@ use reth_primitives::{transaction::FillTxEnv, Address, Header, TransactionSigned use revm_primitives::{AnalysisKind, Bytes, CfgEnvWithHandlerCfg, Env, TxEnv, TxKind}; #[cfg(not(feature = "std"))] -use alloc::vec::Vec; +use alloc::{boxed::Box, vec::Vec}; mod config; pub use config::{revm_spec, revm_spec_by_timestamp_after_merge}; @@ -126,8 +126,7 @@ mod tests { inspectors::NoOpInspector, JournaledState, }; - use revm_primitives::{CfgEnvWithHandlerCfg, EnvWithHandlerCfg, HandlerCfg}; - use std::collections::HashSet; + use revm_primitives::{CfgEnvWithHandlerCfg, EnvWithHandlerCfg, HandlerCfg, HashSet}; #[test] fn test_fill_cfg_and_block_env() { From 4c81fbc9058b8d785764136ccb525120f29952c5 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Wed, 28 Aug 2024 18:39:12 -0700 Subject: [PATCH 2/2] fmt --- crates/ethereum/evm/src/execute.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index 03e92ea2153..7c4c4b3f676 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -465,6 +465,8 @@ where #[cfg(test)] mod tests { use super::*; + #[cfg(not(feature = "std"))] + use alloc::{boxed::Box, string::ToString, vec}; use alloy_eips::{ eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE}, eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE, SYSTEM_ADDRESS}, @@ -479,11 +481,8 @@ mod tests { database::StateProviderDatabase, test_utils::StateProviderTest, TransitionState, }; use reth_testing_utils::generators::{self, sign_tx_with_key_pair}; - use revm_primitives::{b256, fixed_bytes, Bytes, BLOCKHASH_SERVE_WINDOW}; + use revm_primitives::{b256, fixed_bytes, Bytes, HashMap, BLOCKHASH_SERVE_WINDOW}; use secp256k1::{Keypair, Secp256k1}; - use revm_primitives::HashMap; - #[cfg(not(feature = "std"))] - use alloc::{vec, boxed::Box, string::ToString}; fn create_state_provider_with_beacon_root_contract() -> StateProviderTest { let mut db = StateProviderTest::default();