Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(evm): replace reth-primitives with alloy #11232

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2272,7 +2272,6 @@ where
/// Returns `Ok(_)` if computed successfully.
/// Returns `Err(_)` if error was encountered during computation.
/// `Err(ProviderError::ConsistentView(_))` can be safely ignored and fallback computation

/// should be used instead.
fn compute_state_root_async(
&self,
Expand Down
4 changes: 4 additions & 0 deletions crates/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 4 additions & 0 deletions crates/evm/execution-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
9 changes: 6 additions & 3 deletions crates/evm/execution-types/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion crates/evm/execution-types/src/execute.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 4 additions & 6 deletions crates/evm/execution-types/src/execution_outcome.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down Expand Up @@ -371,8 +369,8 @@ impl From<(BlockExecutionOutput<Receipt>, 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]
Expand Down
3 changes: 2 additions & 1 deletion crates/evm/src/either.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions crates/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)]
Expand Down
7 changes: 3 additions & 4 deletions crates/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion crates/evm/src/noop.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion crates/evm/src/provider.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
3 changes: 2 additions & 1 deletion crates/evm/src/system_calls/eip2935.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
3 changes: 2 additions & 1 deletion crates/evm/src/system_calls/eip4788.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/system_calls/eip7002.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/system_calls/eip7251.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion crates/evm/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading