chore(engine): replace reth_primitives with alloy_primitives (#11064)

Signed-off-by: Abhishekkochar <abhishekkochar2@gmail.com>
This commit is contained in:
Abhishek kochar
2024-09-20 11:50:42 +08:00
committed by GitHub
parent b562ea3100
commit a8220791ae
18 changed files with 45 additions and 18 deletions

6
Cargo.lock generated
View File

@ -6951,6 +6951,7 @@ dependencies = [
name = "reth-engine-local" name = "reth-engine-local"
version = "1.0.7" version = "1.0.7"
dependencies = [ dependencies = [
"alloy-primitives",
"eyre", "eyre",
"futures-util", "futures-util",
"reth-beacon-consensus", "reth-beacon-consensus",
@ -6980,6 +6981,7 @@ dependencies = [
name = "reth-engine-primitives" name = "reth-engine-primitives"
version = "1.0.7" version = "1.0.7"
dependencies = [ dependencies = [
"alloy-primitives",
"reth-chainspec", "reth-chainspec",
"reth-execution-types", "reth-execution-types",
"reth-payload-primitives", "reth-payload-primitives",
@ -7020,6 +7022,8 @@ dependencies = [
name = "reth-engine-tree" name = "reth-engine-tree"
version = "1.0.7" version = "1.0.7"
dependencies = [ dependencies = [
"alloy-eips",
"alloy-primitives",
"alloy-rlp", "alloy-rlp",
"assert_matches", "assert_matches",
"futures", "futures",
@ -7065,6 +7069,7 @@ dependencies = [
name = "reth-engine-util" name = "reth-engine-util"
version = "1.0.7" version = "1.0.7"
dependencies = [ dependencies = [
"alloy-primitives",
"eyre", "eyre",
"futures", "futures",
"itertools 0.13.0", "itertools 0.13.0",
@ -7424,6 +7429,7 @@ dependencies = [
name = "reth-invalid-block-hooks" name = "reth-invalid-block-hooks"
version = "1.0.7" version = "1.0.7"
dependencies = [ dependencies = [
"alloy-primitives",
"alloy-rlp", "alloy-rlp",
"alloy-rpc-types-debug", "alloy-rpc-types-debug",
"eyre", "eyre",

View File

@ -23,6 +23,7 @@ reth-tracing.workspace = true
reth-trie = { workspace = true, features = ["serde"] } reth-trie = { workspace = true, features = ["serde"] }
# alloy # alloy
alloy-primitives.workspace = true
alloy-rlp.workspace = true alloy-rlp.workspace = true
alloy-rpc-types-debug.workspace = true alloy-rpc-types-debug.workspace = true

View File

@ -1,5 +1,6 @@
use std::{collections::HashMap, fmt::Debug, fs::File, io::Write, path::PathBuf}; use std::{collections::HashMap, fmt::Debug, fs::File, io::Write, path::PathBuf};
use alloy_primitives::{keccak256, B256, U256};
use alloy_rpc_types_debug::ExecutionWitness; use alloy_rpc_types_debug::ExecutionWitness;
use eyre::OptionExt; use eyre::OptionExt;
use pretty_assertions::Comparison; use pretty_assertions::Comparison;
@ -9,9 +10,7 @@ use reth_evm::{
system_calls::{apply_beacon_root_contract_call, apply_blockhashes_contract_call}, system_calls::{apply_beacon_root_contract_call, apply_blockhashes_contract_call},
ConfigureEvm, ConfigureEvm,
}; };
use reth_primitives::{ use reth_primitives::{Header, Receipt, SealedBlockWithSenders, SealedHeader};
keccak256, Header, Receipt, SealedBlockWithSenders, SealedHeader, B256, U256,
};
use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory}; use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory};
use reth_revm::{ use reth_revm::{
database::StateProviderDatabase, database::StateProviderDatabase,

View File

@ -21,6 +21,9 @@ reth-prune.workspace = true
reth-transaction-pool.workspace = true reth-transaction-pool.workspace = true
reth-stages-api.workspace = true reth-stages-api.workspace = true
# alloy
alloy-primitives.workspace = true
# async # async
tokio.workspace = true tokio.workspace = true
tokio-stream.workspace = true tokio-stream.workspace = true

View File

@ -1,7 +1,7 @@
//! Contains the implementation of the mining mode for the local engine. //! Contains the implementation of the mining mode for the local engine.
use alloy_primitives::TxHash;
use futures_util::{stream::Fuse, StreamExt}; use futures_util::{stream::Fuse, StreamExt};
use reth_primitives::TxHash;
use reth_transaction_pool::TransactionPool; use reth_transaction_pool::TransactionPool;
use std::{ use std::{
future::Future, future::Future,

View File

@ -7,13 +7,13 @@
//! building at a fixed interval. //! building at a fixed interval.
use crate::miner::MiningMode; use crate::miner::MiningMode;
use alloy_primitives::B256;
use reth_beacon_consensus::EngineNodeTypes; use reth_beacon_consensus::EngineNodeTypes;
use reth_engine_tree::persistence::PersistenceHandle; use reth_engine_tree::persistence::PersistenceHandle;
use reth_payload_builder::PayloadBuilderHandle; use reth_payload_builder::PayloadBuilderHandle;
use reth_payload_primitives::{ use reth_payload_primitives::{
BuiltPayload, PayloadAttributesBuilder, PayloadBuilderAttributes, PayloadTypes, BuiltPayload, PayloadAttributesBuilder, PayloadBuilderAttributes, PayloadTypes,
}; };
use reth_primitives::B256;
use reth_provider::ProviderFactory; use reth_provider::ProviderFactory;
use reth_prune::PrunerWithFactory; use reth_prune::PrunerWithFactory;
use reth_stages_api::MetricEventsSender; use reth_stages_api::MetricEventsSender;
@ -157,6 +157,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use alloy_primitives::B256;
use reth_chainspec::MAINNET; use reth_chainspec::MAINNET;
use reth_config::PruneConfig; use reth_config::PruneConfig;
use reth_db::test_utils::{create_test_rw_db, create_test_static_files_dir}; use reth_db::test_utils::{create_test_rw_db, create_test_static_files_dir};
@ -164,7 +165,6 @@ mod tests {
use reth_exex_test_utils::TestNode; use reth_exex_test_utils::TestNode;
use reth_node_types::NodeTypesWithDBAdapter; use reth_node_types::NodeTypesWithDBAdapter;
use reth_payload_builder::test_utils::spawn_test_payload_service; use reth_payload_builder::test_utils::spawn_test_payload_service;
use reth_primitives::B256;
use reth_provider::{providers::StaticFileProvider, BlockReader, ProviderFactory}; use reth_provider::{providers::StaticFileProvider, BlockReader, ProviderFactory};
use reth_prune::PrunerBuilder; use reth_prune::PrunerBuilder;
use reth_transaction_pool::{ use reth_transaction_pool::{

View File

@ -18,5 +18,8 @@ reth-payload-primitives.workspace = true
reth-primitives.workspace = true reth-primitives.workspace = true
reth-trie.workspace = true reth-trie.workspace = true
# alloy
alloy-primitives.workspace = true
# misc # misc
serde.workspace = true serde.workspace = true

View File

@ -1,5 +1,6 @@
use alloy_primitives::B256;
use reth_execution_types::BlockExecutionOutput; use reth_execution_types::BlockExecutionOutput;
use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader, B256}; use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader};
use reth_trie::updates::TrieUpdates; use reth_trie::updates::TrieUpdates;
/// An invalid block hook. /// An invalid block hook.

View File

@ -35,6 +35,10 @@ reth-tasks.workspace = true
reth-trie.workspace = true reth-trie.workspace = true
reth-trie-parallel.workspace = true reth-trie-parallel.workspace = true
# alloy
alloy-primitives.workspace = true
alloy-eips.workspace = true
# common # common
futures.workspace = true futures.workspace = true
tokio = { workspace = true, features = ["macros", "sync"] } tokio = { workspace = true, features = ["macros", "sync"] }

View File

@ -230,11 +230,12 @@ impl<N: ProviderNodeTypes> PipelineState<N> {
mod tests { mod tests {
use super::*; use super::*;
use crate::test_utils::{insert_headers_into_client, TestPipelineBuilder}; use crate::test_utils::{insert_headers_into_client, TestPipelineBuilder};
use alloy_primitives::{BlockNumber, B256};
use assert_matches::assert_matches; use assert_matches::assert_matches;
use futures::poll; use futures::poll;
use reth_chainspec::{ChainSpecBuilder, MAINNET}; use reth_chainspec::{ChainSpecBuilder, MAINNET};
use reth_network_p2p::test_utils::TestFullBlockClient; use reth_network_p2p::test_utils::TestFullBlockClient;
use reth_primitives::{BlockNumber, Header, B256}; use reth_primitives::Header;
use reth_provider::test_utils::MockNodeTypesWithDB; use reth_provider::test_utils::MockNodeTypesWithDB;
use reth_stages::ExecOutput; use reth_stages::ExecOutput;
use reth_stages_api::StageCheckpoint; use reth_stages_api::StageCheckpoint;

View File

@ -1,13 +1,14 @@
//! Handler that can download blocks on demand (e.g. from the network). //! Handler that can download blocks on demand (e.g. from the network).
use crate::{engine::DownloadRequest, metrics::BlockDownloaderMetrics}; use crate::{engine::DownloadRequest, metrics::BlockDownloaderMetrics};
use alloy_primitives::B256;
use futures::FutureExt; use futures::FutureExt;
use reth_consensus::Consensus; use reth_consensus::Consensus;
use reth_network_p2p::{ use reth_network_p2p::{
full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient}, full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient},
BlockClient, BlockClient,
}; };
use reth_primitives::{SealedBlock, SealedBlockWithSenders, B256}; use reth_primitives::{SealedBlock, SealedBlockWithSenders};
use std::{ use std::{
cmp::{Ordering, Reverse}, cmp::{Ordering, Reverse},
collections::{binary_heap::PeekMut, BinaryHeap, HashSet, VecDeque}, collections::{binary_heap::PeekMut, BinaryHeap, HashSet, VecDeque},

View File

@ -5,11 +5,12 @@ use crate::{
chain::{ChainHandler, FromOrchestrator, HandlerEvent}, chain::{ChainHandler, FromOrchestrator, HandlerEvent},
download::{BlockDownloader, DownloadAction, DownloadOutcome}, download::{BlockDownloader, DownloadAction, DownloadOutcome},
}; };
use alloy_primitives::B256;
use futures::{Stream, StreamExt}; use futures::{Stream, StreamExt};
use reth_beacon_consensus::{BeaconConsensusEngineEvent, BeaconEngineMessage}; use reth_beacon_consensus::{BeaconConsensusEngineEvent, BeaconEngineMessage};
use reth_chain_state::ExecutedBlock; use reth_chain_state::ExecutedBlock;
use reth_engine_primitives::EngineTypes; use reth_engine_primitives::EngineTypes;
use reth_primitives::{SealedBlockWithSenders, B256}; use reth_primitives::SealedBlockWithSenders;
use std::{ use std::{
collections::HashSet, collections::HashSet,
fmt::Display, fmt::Display,

View File

@ -1,7 +1,7 @@
use crate::metrics::PersistenceMetrics; use crate::metrics::PersistenceMetrics;
use alloy_eips::BlockNumHash;
use reth_chain_state::ExecutedBlock; use reth_chain_state::ExecutedBlock;
use reth_errors::ProviderError; use reth_errors::ProviderError;
use reth_primitives::BlockNumHash;
use reth_provider::{ use reth_provider::{
providers::ProviderNodeTypes, writer::UnifiedStorageWriter, BlockHashReader, providers::ProviderNodeTypes, writer::UnifiedStorageWriter, BlockHashReader,
DatabaseProviderFactory, ProviderFactory, StaticFileProviderFactory, DatabaseProviderFactory, ProviderFactory, StaticFileProviderFactory,
@ -264,9 +264,9 @@ impl PersistenceHandle {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use alloy_primitives::B256;
use reth_chain_state::test_utils::TestBlockBuilder; use reth_chain_state::test_utils::TestBlockBuilder;
use reth_exex_types::FinishedExExHeight; use reth_exex_types::FinishedExExHeight;
use reth_primitives::B256;
use reth_provider::test_utils::create_test_provider_factory; use reth_provider::test_utils::create_test_provider_factory;
use reth_prune::Pruner; use reth_prune::Pruner;
use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::unbounded_channel;

View File

@ -1,6 +1,7 @@
use alloy_primitives::B256;
use reth_chainspec::ChainSpec; use reth_chainspec::ChainSpec;
use reth_network_p2p::test_utils::TestFullBlockClient; use reth_network_p2p::test_utils::TestFullBlockClient;
use reth_primitives::{BlockBody, SealedHeader, B256}; use reth_primitives::{BlockBody, SealedHeader};
use reth_provider::{ use reth_provider::{
test_utils::{create_test_provider_factory_with_chain_spec, MockNodeTypesWithDB}, test_utils::{create_test_provider_factory_with_chain_spec, MockNodeTypesWithDB},
ExecutionOutcome, ExecutionOutcome,

View File

@ -1,5 +1,6 @@
use alloy_primitives::B256;
use reth_engine_primitives::InvalidBlockHook; use reth_engine_primitives::InvalidBlockHook;
use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader, B256}; use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader};
use reth_provider::BlockExecutionOutput; use reth_provider::BlockExecutionOutput;
use reth_trie::updates::TrieUpdates; use reth_trie::updates::TrieUpdates;

View File

@ -4,6 +4,8 @@ use crate::{
engine::{DownloadRequest, EngineApiEvent, FromEngine}, engine::{DownloadRequest, EngineApiEvent, FromEngine},
persistence::PersistenceHandle, persistence::PersistenceHandle,
}; };
use alloy_eips::BlockNumHash;
use alloy_primitives::{BlockNumber, B256, U256};
use reth_beacon_consensus::{ use reth_beacon_consensus::{
BeaconConsensusEngineEvent, BeaconEngineMessage, ForkchoiceStateTracker, InvalidHeaderCache, BeaconConsensusEngineEvent, BeaconEngineMessage, ForkchoiceStateTracker, InvalidHeaderCache,
OnForkChoiceUpdated, MIN_BLOCKS_FOR_PIPELINE_RUN, OnForkChoiceUpdated, MIN_BLOCKS_FOR_PIPELINE_RUN,
@ -24,8 +26,7 @@ use reth_payload_builder::PayloadBuilderHandle;
use reth_payload_primitives::{PayloadAttributes, PayloadBuilderAttributes}; use reth_payload_primitives::{PayloadAttributes, PayloadBuilderAttributes};
use reth_payload_validator::ExecutionPayloadValidator; use reth_payload_validator::ExecutionPayloadValidator;
use reth_primitives::{ use reth_primitives::{
Block, BlockNumHash, BlockNumber, GotExpected, Header, SealedBlock, SealedBlockWithSenders, Block, GotExpected, Header, SealedBlock, SealedBlockWithSenders, SealedHeader,
SealedHeader, B256, U256,
}; };
use reth_provider::{ use reth_provider::{
providers::ConsistentDbView, BlockReader, DatabaseProviderFactory, ExecutionOutcome, providers::ConsistentDbView, BlockReader, DatabaseProviderFactory, ExecutionOutcome,
@ -2583,13 +2584,13 @@ impl PersistenceState {
mod tests { mod tests {
use super::*; use super::*;
use crate::persistence::PersistenceAction; use crate::persistence::PersistenceAction;
use alloy_primitives::Bytes;
use alloy_rlp::Decodable; use alloy_rlp::Decodable;
use reth_beacon_consensus::{EthBeaconConsensus, ForkchoiceStatus}; use reth_beacon_consensus::{EthBeaconConsensus, ForkchoiceStatus};
use reth_chain_state::{test_utils::TestBlockBuilder, BlockState}; use reth_chain_state::{test_utils::TestBlockBuilder, BlockState};
use reth_chainspec::{ChainSpec, HOLESKY, MAINNET}; use reth_chainspec::{ChainSpec, HOLESKY, MAINNET};
use reth_ethereum_engine_primitives::EthEngineTypes; use reth_ethereum_engine_primitives::EthEngineTypes;
use reth_evm::test_utils::MockExecutorProvider; use reth_evm::test_utils::MockExecutorProvider;
use reth_primitives::Bytes;
use reth_provider::test_utils::MockEthProvider; use reth_provider::test_utils::MockEthProvider;
use reth_rpc_types_compat::engine::{block_to_payload_v1, payload::block_to_payload_v3}; use reth_rpc_types_compat::engine::{block_to_payload_v1, payload::block_to_payload_v3};
use reth_trie::updates::TrieUpdates; use reth_trie::updates::TrieUpdates;

View File

@ -27,6 +27,9 @@ reth-ethereum-forks.workspace = true
revm-primitives.workspace = true revm-primitives.workspace = true
reth-trie.workspace = true reth-trie.workspace = true
# alloy
alloy-primitives.workspace = true
# async # async
tokio = { workspace = true, default-features = false } tokio = { workspace = true, default-features = false }
tokio-util.workspace = true tokio-util.workspace = true

View File

@ -1,5 +1,6 @@
//! Stream wrapper that simulates reorgs. //! Stream wrapper that simulates reorgs.
use alloy_primitives::U256;
use futures::{stream::FuturesUnordered, Stream, StreamExt, TryFutureExt}; use futures::{stream::FuturesUnordered, Stream, StreamExt, TryFutureExt};
use itertools::Either; use itertools::Either;
use reth_beacon_consensus::{BeaconEngineMessage, BeaconOnNewPayloadError, OnForkChoiceUpdated}; use reth_beacon_consensus::{BeaconEngineMessage, BeaconOnNewPayloadError, OnForkChoiceUpdated};
@ -9,7 +10,7 @@ use reth_ethereum_forks::EthereumHardforks;
use reth_evm::{system_calls::apply_beacon_root_contract_call, ConfigureEvm}; use reth_evm::{system_calls::apply_beacon_root_contract_call, ConfigureEvm};
use reth_payload_validator::ExecutionPayloadValidator; use reth_payload_validator::ExecutionPayloadValidator;
use reth_primitives::{ use reth_primitives::{
eip4844::calculate_excess_blob_gas, proofs, Block, Header, Receipt, Receipts, U256, eip4844::calculate_excess_blob_gas, proofs, Block, Header, Receipt, Receipts,
}; };
use reth_provider::{BlockReader, ExecutionOutcome, ProviderError, StateProviderFactory}; use reth_provider::{BlockReader, ExecutionOutcome, ProviderError, StateProviderFactory};
use reth_revm::{ use reth_revm::{