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

Signed-off-by: Abhishekkochar <abhishekkochar2@gmail.com>
This commit is contained in:
Abhishek kochar
2024-09-26 15:38:03 +08:00
committed by GitHub
parent ece0944070
commit 20d695031a
16 changed files with 43 additions and 26 deletions

1
Cargo.lock generated
View File

@ -7283,6 +7283,7 @@ name = "reth-evm"
version = "1.0.7"
dependencies = [
"alloy-eips",
"alloy-primitives",
"auto_impl",
"futures-util",
"metrics",

View File

@ -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 }

View File

@ -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]

View File

@ -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]

View File

@ -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.

View File

@ -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<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]

View File

@ -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;

View File

@ -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)]

View File

@ -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;

View File

@ -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;

View File

@ -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};

View File

@ -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.
///

View File

@ -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.
///

View File

@ -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.

View File

@ -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.

View File

@ -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;