diff --git a/Cargo.lock b/Cargo.lock index 9a21d2188ed3..d8974302abc4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7290,6 +7290,7 @@ name = "reth-evm" version = "1.0.7" dependencies = [ "alloy-eips", + "alloy-primitives", "auto_impl", "futures-util", "metrics", diff --git a/crates/evm/Cargo.toml b/crates/evm/Cargo.toml index f520c75eeaa9..20070d421e97 100644 --- a/crates/evm/Cargo.toml +++ b/crates/evm/Cargo.toml @@ -23,7 +23,11 @@ reth-storage-errors.workspace = true reth-execution-types.workspace = true revm.workspace = true + +# alloy +alloy-primitives.workspace = true alloy-eips.workspace = true + auto_impl.workspace = true futures-util.workspace = true metrics = { workspace = true, optional = true } diff --git a/crates/evm/execution-types/Cargo.toml b/crates/evm/execution-types/Cargo.toml index cf50b47a03b2..352eeb79f12e 100644 --- a/crates/evm/execution-types/Cargo.toml +++ b/crates/evm/execution-types/Cargo.toml @@ -18,6 +18,10 @@ reth-trie.workspace = true revm.workspace = true +# alloy +alloy-primitives.workspace = true +alloy-eips.workspace = true + serde = { workspace = true, optional = true } [dev-dependencies] diff --git a/crates/evm/execution-types/src/chain.rs b/crates/evm/execution-types/src/chain.rs index 4d0dc694a05f..588bc832e688 100644 --- a/crates/evm/execution-types/src/chain.rs +++ b/crates/evm/execution-types/src/chain.rs @@ -2,11 +2,13 @@ use crate::ExecutionOutcome; use alloc::{borrow::Cow, collections::BTreeMap}; +use alloy_eips::{eip1898::ForkBlock, BlockNumHash}; +use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash}; use core::{fmt, ops::RangeInclusive}; use reth_execution_errors::{BlockExecutionError, InternalBlockExecutionError}; use reth_primitives::{ - Address, BlockHash, BlockNumHash, BlockNumber, ForkBlock, Receipt, SealedBlock, - SealedBlockWithSenders, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, TxHash, + Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, TransactionSigned, + TransactionSignedEcRecovered, }; use reth_trie::updates::TrieUpdates; use revm::db::BundleState; @@ -508,7 +510,8 @@ pub enum ChainSplit { #[cfg(test)] mod tests { use super::*; - use reth_primitives::{Receipt, Receipts, TxType, B256}; + use alloy_primitives::B256; + use reth_primitives::{Receipt, Receipts, TxType}; use revm::primitives::{AccountInfo, HashMap}; #[test] diff --git a/crates/evm/execution-types/src/execute.rs b/crates/evm/execution-types/src/execute.rs index 2933fd59815f..0cf5d7050793 100644 --- a/crates/evm/execution-types/src/execute.rs +++ b/crates/evm/execution-types/src/execute.rs @@ -1,4 +1,5 @@ -use reth_primitives::{Request, U256}; +use alloy_primitives::U256; +use reth_primitives::Request; use revm::db::BundleState; /// A helper type for ethereum block inputs that consists of a block and the total difficulty. diff --git a/crates/evm/execution-types/src/execution_outcome.rs b/crates/evm/execution-types/src/execution_outcome.rs index 8996ac9959e3..47caa3b101f0 100644 --- a/crates/evm/execution-types/src/execution_outcome.rs +++ b/crates/evm/execution-types/src/execution_outcome.rs @@ -1,8 +1,6 @@ use crate::BlockExecutionOutput; -use reth_primitives::{ - logs_bloom, Account, Address, BlockNumber, Bloom, Bytecode, Log, Receipt, Receipts, Requests, - StorageEntry, B256, U256, -}; +use alloy_primitives::{Address, BlockNumber, Bloom, Log, B256, U256}; +use reth_primitives::{logs_bloom, Account, Bytecode, Receipt, Receipts, Requests, StorageEntry}; use reth_trie::HashedPostState; use revm::{ db::{states::BundleState, BundleAccount}, @@ -371,8 +369,8 @@ impl From<(BlockExecutionOutput, BlockNumber)> for ExecutionOutcome { mod tests { use super::*; use alloy_eips::{eip6110::DepositRequest, eip7002::WithdrawalRequest}; - use alloy_primitives::{FixedBytes, LogData}; - use reth_primitives::{Address, Receipts, Request, Requests, TxType, B256}; + use alloy_primitives::{Address, FixedBytes, LogData, B256}; + use reth_primitives::{Receipts, Request, Requests, TxType}; use std::collections::HashMap; #[test] diff --git a/crates/evm/src/either.rs b/crates/evm/src/either.rs index fde316da9f5b..a3fca50ec7ee 100644 --- a/crates/evm/src/either.rs +++ b/crates/evm/src/either.rs @@ -3,9 +3,10 @@ use core::fmt::Display; use crate::execute::{BatchExecutor, BlockExecutorProvider, Executor}; +use alloy_primitives::BlockNumber; use reth_execution_errors::BlockExecutionError; use reth_execution_types::{BlockExecutionInput, BlockExecutionOutput, ExecutionOutcome}; -use reth_primitives::{BlockNumber, BlockWithSenders, Receipt}; +use reth_primitives::{BlockWithSenders, Receipt}; use reth_prune_types::PruneModes; use reth_storage_errors::provider::ProviderError; use revm_primitives::db::Database; diff --git a/crates/evm/src/execute.rs b/crates/evm/src/execute.rs index 60a29d4de9fc..ffc08469dc8d 100644 --- a/crates/evm/src/execute.rs +++ b/crates/evm/src/execute.rs @@ -5,8 +5,9 @@ pub use reth_execution_errors::{BlockExecutionError, BlockValidationError}; pub use reth_execution_types::{BlockExecutionInput, BlockExecutionOutput, ExecutionOutcome}; pub use reth_storage_errors::provider::ProviderError; +use alloy_primitives::BlockNumber; use core::fmt::Display; -use reth_primitives::{BlockNumber, BlockWithSenders, Receipt}; +use reth_primitives::{BlockWithSenders, Receipt}; use reth_prune_types::PruneModes; use revm::State; use revm_primitives::db::Database; @@ -151,8 +152,8 @@ pub trait BlockExecutorProvider: Send + Sync + Clone + Unpin + 'static { #[cfg(test)] mod tests { use super::*; + use alloy_primitives::U256; use revm::db::{CacheDB, EmptyDBTyped}; - use revm_primitives::U256; use std::marker::PhantomData; #[derive(Clone, Default)] diff --git a/crates/evm/src/lib.rs b/crates/evm/src/lib.rs index 569491a1b02c..6fcb3d9f8c3d 100644 --- a/crates/evm/src/lib.rs +++ b/crates/evm/src/lib.rs @@ -14,12 +14,11 @@ extern crate alloc; use core::ops::Deref; use crate::builder::RethEvmBuilder; -use reth_primitives::{Address, TransactionSigned, TransactionSignedEcRecovered, B256, U256}; +use alloy_primitives::{Address, Bytes, B256, U256}; +use reth_primitives::{TransactionSigned, TransactionSignedEcRecovered}; use reth_primitives_traits::BlockHeader; use revm::{Database, Evm, GetInspector}; -use revm_primitives::{ - BlockEnv, Bytes, CfgEnvWithHandlerCfg, Env, EnvWithHandlerCfg, SpecId, TxEnv, -}; +use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, Env, EnvWithHandlerCfg, SpecId, TxEnv}; pub mod builder; pub mod either; diff --git a/crates/evm/src/noop.rs b/crates/evm/src/noop.rs index ae6171a506a9..392bfd0bd722 100644 --- a/crates/evm/src/noop.rs +++ b/crates/evm/src/noop.rs @@ -1,9 +1,10 @@ //! A no operation block executor implementation. +use alloy_primitives::BlockNumber; use core::fmt::Display; use reth_execution_errors::BlockExecutionError; use reth_execution_types::{BlockExecutionInput, BlockExecutionOutput, ExecutionOutcome}; -use reth_primitives::{BlockNumber, BlockWithSenders, Receipt}; +use reth_primitives::{BlockWithSenders, Receipt}; use reth_prune_types::PruneModes; use reth_storage_errors::provider::ProviderError; use revm::State; diff --git a/crates/evm/src/provider.rs b/crates/evm/src/provider.rs index fc3d4ff94f79..8db828ec4a00 100644 --- a/crates/evm/src/provider.rs +++ b/crates/evm/src/provider.rs @@ -1,7 +1,8 @@ //! Provider trait for populating the EVM environment. use crate::ConfigureEvmEnv; -use reth_primitives::{BlockHashOrNumber, Header}; +use alloy_eips::eip1898::BlockHashOrNumber; +use reth_primitives::Header; use reth_storage_errors::provider::ProviderResult; use revm::primitives::{BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, SpecId}; diff --git a/crates/evm/src/system_calls/eip2935.rs b/crates/evm/src/system_calls/eip2935.rs index 4a1ec14a467e..7b09a4813079 100644 --- a/crates/evm/src/system_calls/eip2935.rs +++ b/crates/evm/src/system_calls/eip2935.rs @@ -4,12 +4,13 @@ use alloc::{boxed::Box, string::ToString}; use alloy_eips::eip2935::HISTORY_STORAGE_ADDRESS; use crate::ConfigureEvm; +use alloy_primitives::B256; use core::fmt::Display; use reth_chainspec::EthereumHardforks; use reth_execution_errors::{BlockExecutionError, BlockValidationError}; use reth_primitives::Header; use revm::{interpreter::Host, Database, DatabaseCommit, Evm}; -use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState, B256}; +use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState}; /// Apply the [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) pre block contract call. /// diff --git a/crates/evm/src/system_calls/eip4788.rs b/crates/evm/src/system_calls/eip4788.rs index d1148f6cdc74..a1f97bf5e908 100644 --- a/crates/evm/src/system_calls/eip4788.rs +++ b/crates/evm/src/system_calls/eip4788.rs @@ -3,11 +3,12 @@ use alloc::{boxed::Box, string::ToString}; use crate::ConfigureEvm; use alloy_eips::eip4788::BEACON_ROOTS_ADDRESS; +use alloy_primitives::B256; use reth_chainspec::EthereumHardforks; use reth_execution_errors::{BlockExecutionError, BlockValidationError}; use reth_primitives::Header; use revm::{interpreter::Host, Database, DatabaseCommit, Evm}; -use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState, B256}; +use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState}; /// Apply the [EIP-4788](https://eips.ethereum.org/EIPS/eip-4788) pre block contract call. /// diff --git a/crates/evm/src/system_calls/eip7002.rs b/crates/evm/src/system_calls/eip7002.rs index 9b770cfceb55..d03268254f43 100644 --- a/crates/evm/src/system_calls/eip7002.rs +++ b/crates/evm/src/system_calls/eip7002.rs @@ -4,12 +4,12 @@ use core::fmt::Display; use crate::ConfigureEvm; use alloy_eips::eip7002::{WithdrawalRequest, WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS}; +use alloy_primitives::{Address, Bytes, FixedBytes}; use reth_execution_errors::{BlockExecutionError, BlockValidationError}; use reth_primitives::{Buf, Header, Request}; use revm::{interpreter::Host, Database, DatabaseCommit, Evm}; use revm_primitives::{ - Address, BlockEnv, Bytes, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, FixedBytes, - ResultAndState, + BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, ResultAndState, }; /// Apply the [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) post block contract call. diff --git a/crates/evm/src/system_calls/eip7251.rs b/crates/evm/src/system_calls/eip7251.rs index 8a7049671028..8247f06b1841 100644 --- a/crates/evm/src/system_calls/eip7251.rs +++ b/crates/evm/src/system_calls/eip7251.rs @@ -4,12 +4,12 @@ use core::fmt::Display; use crate::ConfigureEvm; use alloy_eips::eip7251::{ConsolidationRequest, CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS}; +use alloy_primitives::{Address, Bytes, FixedBytes}; use reth_execution_errors::{BlockExecutionError, BlockValidationError}; use reth_primitives::{Buf, Header, Request}; use revm::{interpreter::Host, Database, DatabaseCommit, Evm}; use revm_primitives::{ - Address, BlockEnv, Bytes, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, FixedBytes, - ResultAndState, + BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, ResultAndState, }; /// Apply the [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) post block contract call. diff --git a/crates/evm/src/test_utils.rs b/crates/evm/src/test_utils.rs index f30262c281e0..cf45930aece9 100644 --- a/crates/evm/src/test_utils.rs +++ b/crates/evm/src/test_utils.rs @@ -3,10 +3,11 @@ use crate::execute::{ BatchExecutor, BlockExecutionInput, BlockExecutionOutput, BlockExecutorProvider, Executor, }; +use alloy_primitives::BlockNumber; use parking_lot::Mutex; use reth_execution_errors::BlockExecutionError; use reth_execution_types::ExecutionOutcome; -use reth_primitives::{BlockNumber, BlockWithSenders, Receipt}; +use reth_primitives::{BlockWithSenders, Receipt}; use reth_prune_types::PruneModes; use reth_storage_errors::provider::ProviderError; use revm::State;