From 242a3ab06befbd06a51cad1602ca80df6930a4cb Mon Sep 17 00:00:00 2001 From: Abhishek kochar Date: Mon, 23 Sep 2024 14:32:01 +0800 Subject: [PATCH] chore(exex): replace reth-primitives with alloy (#11104) Signed-off-by: Abhishekkochar --- Cargo.lock | 3 ++- crates/exex/exex/Cargo.toml | 3 +++ crates/exex/exex/src/backfill/factory.rs | 2 +- crates/exex/exex/src/backfill/job.rs | 3 ++- crates/exex/exex/src/backfill/stream.rs | 3 ++- crates/exex/exex/src/backfill/test_utils.rs | 5 +++-- crates/exex/exex/src/event.rs | 2 +- crates/exex/exex/src/manager.rs | 5 +++-- crates/exex/types/Cargo.toml | 2 +- crates/exex/types/src/head.rs | 2 +- 10 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8ad46cf8d6..f17b923ee4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7360,6 +7360,7 @@ dependencies = [ name = "reth-exex" version = "1.0.7" dependencies = [ + "alloy-primitives", "eyre", "futures", "metrics", @@ -7423,8 +7424,8 @@ dependencies = [ name = "reth-exex-types" version = "1.0.7" dependencies = [ + "alloy-eips", "alloy-primitives", - "reth-primitives", "reth-provider", "serde", ] diff --git a/crates/exex/exex/Cargo.toml b/crates/exex/exex/Cargo.toml index 4e082c4573..08e475a241 100644 --- a/crates/exex/exex/Cargo.toml +++ b/crates/exex/exex/Cargo.toml @@ -30,6 +30,9 @@ reth-stages-api.workspace = true reth-tasks.workspace = true reth-tracing.workspace = true +# alloy +alloy-primitives.workspace = true + ## async futures.workspace = true tokio-util.workspace = true diff --git a/crates/exex/exex/src/backfill/factory.rs b/crates/exex/exex/src/backfill/factory.rs index 3ee2ab5166..c210eda477 100644 --- a/crates/exex/exex/src/backfill/factory.rs +++ b/crates/exex/exex/src/backfill/factory.rs @@ -1,8 +1,8 @@ use crate::BackfillJob; use std::ops::RangeInclusive; +use alloy_primitives::BlockNumber; use reth_node_api::FullNodeComponents; -use reth_primitives::BlockNumber; use reth_prune_types::PruneModes; use reth_stages_api::ExecutionStageThresholds; diff --git a/crates/exex/exex/src/backfill/job.rs b/crates/exex/exex/src/backfill/job.rs index 61b1db86c5..9a88a1a22b 100644 --- a/crates/exex/exex/src/backfill/job.rs +++ b/crates/exex/exex/src/backfill/job.rs @@ -4,10 +4,11 @@ use std::{ time::{Duration, Instant}, }; +use alloy_primitives::BlockNumber; use reth_evm::execute::{ BatchExecutor, BlockExecutionError, BlockExecutionOutput, BlockExecutorProvider, Executor, }; -use reth_primitives::{Block, BlockNumber, BlockWithSenders, Receipt}; +use reth_primitives::{Block, BlockWithSenders, Receipt}; use reth_primitives_traits::format_gas_throughput; use reth_provider::{ BlockReader, Chain, HeaderProvider, ProviderError, StateProviderFactory, TransactionVariant, diff --git a/crates/exex/exex/src/backfill/stream.rs b/crates/exex/exex/src/backfill/stream.rs index 95744d2eb1..07b710b7e3 100644 --- a/crates/exex/exex/src/backfill/stream.rs +++ b/crates/exex/exex/src/backfill/stream.rs @@ -5,12 +5,13 @@ use std::{ task::{ready, Context, Poll}, }; +use alloy_primitives::BlockNumber; use futures::{ stream::{FuturesOrdered, Stream}, StreamExt, }; use reth_evm::execute::{BlockExecutionError, BlockExecutionOutput, BlockExecutorProvider}; -use reth_primitives::{BlockNumber, BlockWithSenders, Receipt}; +use reth_primitives::{BlockWithSenders, Receipt}; use reth_provider::{BlockReader, Chain, HeaderProvider, StateProviderFactory}; use reth_prune_types::PruneModes; use reth_stages_api::ExecutionStageThresholds; diff --git a/crates/exex/exex/src/backfill/test_utils.rs b/crates/exex/exex/src/backfill/test_utils.rs index 72604d09f3..975de1dfe3 100644 --- a/crates/exex/exex/src/backfill/test_utils.rs +++ b/crates/exex/exex/src/backfill/test_utils.rs @@ -1,5 +1,6 @@ use std::sync::Arc; +use alloy_primitives::{b256, Address, TxKind, U256}; use eyre::OptionExt; use reth_chainspec::{ChainSpec, ChainSpecBuilder, EthereumHardfork, MAINNET, MIN_TRANSACTION_GAS}; use reth_evm::execute::{ @@ -7,8 +8,8 @@ use reth_evm::execute::{ }; use reth_evm_ethereum::execute::EthExecutorProvider; use reth_primitives::{ - b256, constants::ETH_TO_WEI, Address, Block, BlockWithSenders, Genesis, GenesisAccount, Header, - Receipt, Requests, SealedBlockWithSenders, Transaction, TxEip2930, TxKind, U256, + constants::ETH_TO_WEI, Block, BlockWithSenders, Genesis, GenesisAccount, Header, Receipt, + Requests, SealedBlockWithSenders, Transaction, TxEip2930, }; use reth_provider::{ providers::ProviderNodeTypes, BlockWriter as _, ExecutionOutcome, LatestStateProviderRef, diff --git a/crates/exex/exex/src/event.rs b/crates/exex/exex/src/event.rs index 47e4225b46..c26c1c5344 100644 --- a/crates/exex/exex/src/event.rs +++ b/crates/exex/exex/src/event.rs @@ -1,4 +1,4 @@ -use reth_primitives::BlockNumber; +use alloy_primitives::BlockNumber; /// Events emitted by an `ExEx`. #[derive(Debug, Clone, Copy, PartialEq, Eq)] diff --git a/crates/exex/exex/src/manager.rs b/crates/exex/exex/src/manager.rs index 5e0e5b215c..f4c1687be6 100644 --- a/crates/exex/exex/src/manager.rs +++ b/crates/exex/exex/src/manager.rs @@ -1,6 +1,7 @@ use crate::{ BackfillJobFactory, ExExEvent, ExExNotification, FinishedExExHeight, StreamBackfillJob, }; +use alloy_primitives::{BlockNumber, U256}; use eyre::OptionExt; use futures::{Stream, StreamExt}; use metrics::Gauge; @@ -8,7 +9,6 @@ use reth_chainspec::Head; use reth_evm::execute::BlockExecutorProvider; use reth_exex_types::ExExHead; use reth_metrics::{metrics::Counter, Metrics}; -use reth_primitives::{BlockNumber, U256}; use reth_provider::{BlockReader, Chain, HeaderProvider, StateProviderFactory}; use reth_tracing::tracing::debug; use std::{ @@ -809,10 +809,11 @@ impl Clone for ExExManagerHandle { #[cfg(test)] mod tests { use super::*; + use alloy_primitives::B256; use futures::StreamExt; use reth_db_common::init::init_genesis; use reth_evm_ethereum::execute::EthExecutorProvider; - use reth_primitives::{Block, BlockNumHash, Header, SealedBlockWithSenders, B256}; + use reth_primitives::{Block, BlockNumHash, Header, SealedBlockWithSenders}; use reth_provider::{ providers::BlockchainProvider2, test_utils::create_test_provider_factory, BlockReader, BlockWriter, Chain, diff --git a/crates/exex/types/Cargo.toml b/crates/exex/types/Cargo.toml index 75cd498cd1..17b8c86343 100644 --- a/crates/exex/types/Cargo.toml +++ b/crates/exex/types/Cargo.toml @@ -13,11 +13,11 @@ workspace = true [dependencies] # reth -reth-primitives.workspace = true reth-provider.workspace = true # reth alloy-primitives.workspace = true +alloy-eips.workspace = true # misc serde = { workspace = true, optional = true } diff --git a/crates/exex/types/src/head.rs b/crates/exex/types/src/head.rs index 3e67b1eca5..730b5724b3 100644 --- a/crates/exex/types/src/head.rs +++ b/crates/exex/types/src/head.rs @@ -1,4 +1,4 @@ -use reth_primitives::BlockNumHash; +use alloy_eips::BlockNumHash; /// A head of the ExEx. It determines the highest block committed to the internal ExEx state. #[derive(Debug, Clone, Copy, PartialEq, Eq)]