chore: remove reth-primitives dep from reth-engine-tree (#14019)

This commit is contained in:
Dan Cline
2025-01-27 16:44:21 -05:00
committed by GitHub
parent ddc9375a60
commit 2b44d17d5f
15 changed files with 40 additions and 38 deletions

2
Cargo.lock generated
View File

@ -7191,6 +7191,7 @@ dependencies = [
"reth-errors", "reth-errors",
"reth-ethereum-consensus", "reth-ethereum-consensus",
"reth-ethereum-engine-primitives", "reth-ethereum-engine-primitives",
"reth-ethereum-primitives",
"reth-evm", "reth-evm",
"reth-exex-types", "reth-exex-types",
"reth-metrics", "reth-metrics",
@ -7198,7 +7199,6 @@ dependencies = [
"reth-payload-builder", "reth-payload-builder",
"reth-payload-builder-primitives", "reth-payload-builder-primitives",
"reth-payload-primitives", "reth-payload-primitives",
"reth-primitives",
"reth-primitives-traits", "reth-primitives-traits",
"reth-provider", "reth-provider",
"reth-prune", "reth-prune",

View File

@ -24,7 +24,7 @@ reth-payload-builder-primitives.workspace = true
reth-payload-builder.workspace = true reth-payload-builder.workspace = true
reth-payload-primitives.workspace = true reth-payload-primitives.workspace = true
reth-primitives-traits.workspace = true reth-primitives-traits.workspace = true
reth-primitives.workspace = true reth-ethereum-primitives.workspace = true
reth-provider.workspace = true reth-provider.workspace = true
reth-prune.workspace = true reth-prune.workspace = true
reth-revm.workspace = true reth-revm.workspace = true
@ -110,7 +110,6 @@ test-utils = [
"reth-evm/test-utils", "reth-evm/test-utils",
"reth-network-p2p/test-utils", "reth-network-p2p/test-utils",
"reth-payload-builder/test-utils", "reth-payload-builder/test-utils",
"reth-primitives/test-utils",
"reth-primitives-traits/test-utils", "reth-primitives-traits/test-utils",
"reth-provider/test-utils", "reth-provider/test-utils",
"reth-prune-types", "reth-prune-types",

View File

@ -8,7 +8,7 @@ use proptest::test_runner::TestRunner;
use rand::Rng; use rand::Rng;
use reth_engine_tree::tree::root::{StateRootConfig, StateRootTask}; use reth_engine_tree::tree::root::{StateRootConfig, StateRootTask};
use reth_evm::system_calls::OnStateHook; use reth_evm::system_calls::OnStateHook;
use reth_primitives::{Account as RethAccount, StorageEntry}; use reth_primitives_traits::{Account as RethAccount, StorageEntry};
use reth_provider::{ use reth_provider::{
providers::ConsistentDbView, providers::ConsistentDbView,
test_utils::{create_test_provider_factory, MockNodeTypesWithDB}, test_utils::{create_test_provider_factory, MockNodeTypesWithDB},

View File

@ -237,7 +237,7 @@ mod tests {
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::SealedHeader; use reth_primitives_traits::SealedHeader;
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

@ -9,8 +9,7 @@ use reth_network_p2p::{
full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient}, full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient},
BlockClient, BlockClient,
}; };
use reth_primitives::{RecoveredBlock, SealedBlock}; use reth_primitives_traits::{Block, RecoveredBlock, SealedBlock};
use reth_primitives_traits::Block;
use std::{ use std::{
cmp::{Ordering, Reverse}, cmp::{Ordering, Reverse},
collections::{binary_heap::PeekMut, BinaryHeap, HashSet, VecDeque}, collections::{binary_heap::PeekMut, BinaryHeap, HashSet, VecDeque},
@ -319,11 +318,12 @@ mod tests {
use reth_chainspec::{ChainSpecBuilder, MAINNET}; use reth_chainspec::{ChainSpecBuilder, MAINNET};
use reth_ethereum_consensus::EthBeaconConsensus; use reth_ethereum_consensus::EthBeaconConsensus;
use reth_network_p2p::test_utils::TestFullBlockClient; use reth_network_p2p::test_utils::TestFullBlockClient;
use reth_primitives::SealedHeader; use reth_primitives_traits::SealedHeader;
use std::{future::poll_fn, sync::Arc}; use std::{future::poll_fn, sync::Arc};
struct TestHarness { struct TestHarness {
block_downloader: BasicBlockDownloader<TestFullBlockClient, reth_primitives::Block>, block_downloader:
BasicBlockDownloader<TestFullBlockClient, reth_ethereum_primitives::Block>,
client: TestFullBlockClient, client: TestFullBlockClient,
} }

View File

@ -9,8 +9,8 @@ use alloy_primitives::B256;
use futures::{Stream, StreamExt}; use futures::{Stream, StreamExt};
use reth_chain_state::ExecutedBlockWithTrieUpdates; use reth_chain_state::ExecutedBlockWithTrieUpdates;
use reth_engine_primitives::{BeaconConsensusEngineEvent, BeaconEngineMessage, EngineTypes}; use reth_engine_primitives::{BeaconConsensusEngineEvent, BeaconEngineMessage, EngineTypes};
use reth_primitives::{NodePrimitives, RecoveredBlock}; use reth_ethereum_primitives::EthPrimitives;
use reth_primitives_traits::Block; use reth_primitives_traits::{Block, NodePrimitives, RecoveredBlock};
use std::{ use std::{
collections::HashSet, collections::HashSet,
fmt::Display, fmt::Display,
@ -275,7 +275,7 @@ impl<T: EngineTypes, N: NodePrimitives> From<EngineApiRequest<T, N>>
/// Events emitted by the engine API handler. /// Events emitted by the engine API handler.
#[derive(Debug)] #[derive(Debug)]
pub enum EngineApiEvent<N: NodePrimitives = reth_primitives::EthPrimitives> { pub enum EngineApiEvent<N: NodePrimitives = EthPrimitives> {
/// Event from the consensus engine. /// Event from the consensus engine.
// TODO(mattsse): find a more appropriate name for this variant, consider phasing it out. // TODO(mattsse): find a more appropriate name for this variant, consider phasing it out.
BeaconConsensus(BeaconConsensusEngineEvent<N>), BeaconConsensus(BeaconConsensusEngineEvent<N>),

View File

@ -3,7 +3,8 @@ use alloy_consensus::BlockHeader;
use alloy_eips::BlockNumHash; use alloy_eips::BlockNumHash;
use reth_chain_state::ExecutedBlockWithTrieUpdates; use reth_chain_state::ExecutedBlockWithTrieUpdates;
use reth_errors::ProviderError; use reth_errors::ProviderError;
use reth_primitives::{EthPrimitives, NodePrimitives}; use reth_ethereum_primitives::EthPrimitives;
use reth_primitives_traits::NodePrimitives;
use reth_provider::{ use reth_provider::{
providers::ProviderNodeTypes, writer::UnifiedStorageWriter, BlockHashReader, providers::ProviderNodeTypes, writer::UnifiedStorageWriter, BlockHashReader,
ChainStateBlockWriter, DatabaseProviderFactory, ProviderFactory, StaticFileProviderFactory, ChainStateBlockWriter, DatabaseProviderFactory, ProviderFactory, StaticFileProviderFactory,

View File

@ -1,7 +1,8 @@
use alloy_primitives::B256; use alloy_primitives::B256;
use reth_chainspec::ChainSpec; use reth_chainspec::ChainSpec;
use reth_ethereum_primitives::BlockBody;
use reth_network_p2p::test_utils::TestFullBlockClient; use reth_network_p2p::test_utils::TestFullBlockClient;
use reth_primitives::{BlockBody, SealedHeader}; use reth_primitives_traits::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,8 +1,7 @@
use crate::tree::metrics::BlockBufferMetrics; use crate::tree::metrics::BlockBufferMetrics;
use alloy_consensus::BlockHeader; use alloy_consensus::BlockHeader;
use alloy_primitives::{BlockHash, BlockNumber}; use alloy_primitives::{BlockHash, BlockNumber};
use reth_primitives::RecoveredBlock; use reth_primitives_traits::{Block, RecoveredBlock};
use reth_primitives_traits::Block;
use schnellru::{ByLength, LruMap}; use schnellru::{ByLength, LruMap};
use std::collections::{BTreeMap, HashMap, HashSet}; use std::collections::{BTreeMap, HashMap, HashSet};
@ -196,7 +195,7 @@ mod tests {
use super::*; use super::*;
use alloy_eips::BlockNumHash; use alloy_eips::BlockNumHash;
use alloy_primitives::BlockHash; use alloy_primitives::BlockHash;
use reth_primitives::RecoveredBlock; use reth_primitives_traits::RecoveredBlock;
use reth_testing_utils::generators::{self, random_block, BlockParams, Rng}; use reth_testing_utils::generators::{self, random_block, BlockParams, Rng};
use std::collections::HashMap; use std::collections::HashMap;
@ -205,7 +204,7 @@ mod tests {
rng: &mut R, rng: &mut R,
number: u64, number: u64,
parent: BlockHash, parent: BlockHash,
) -> RecoveredBlock<reth_primitives::Block> { ) -> RecoveredBlock<reth_ethereum_primitives::Block> {
let block = let block =
random_block(rng, number, BlockParams { parent: Some(parent), ..Default::default() }); random_block(rng, number, BlockParams { parent: Some(parent), ..Default::default() });
block.try_recover().unwrap() block.try_recover().unwrap()
@ -228,7 +227,7 @@ mod tests {
/// Assert that the block was removed from all buffer collections. /// Assert that the block was removed from all buffer collections.
fn assert_block_removal<B: Block>( fn assert_block_removal<B: Block>(
buffer: &BlockBuffer<B>, buffer: &BlockBuffer<B>,
block: &RecoveredBlock<reth_primitives::Block>, block: &RecoveredBlock<reth_ethereum_primitives::Block>,
) { ) {
assert!(!buffer.blocks.contains_key(&block.hash())); assert!(!buffer.blocks.contains_key(&block.hash()));
assert!(buffer assert!(buffer

View File

@ -4,7 +4,7 @@ use metrics::Gauge;
use moka::sync::CacheBuilder; use moka::sync::CacheBuilder;
use reth_errors::ProviderResult; use reth_errors::ProviderResult;
use reth_metrics::Metrics; use reth_metrics::Metrics;
use reth_primitives::{Account, Bytecode}; use reth_primitives_traits::{Account, Bytecode};
use reth_provider::{ use reth_provider::{
AccountReader, BlockHashReader, HashedPostStateProvider, StateProofProvider, StateProvider, AccountReader, BlockHashReader, HashedPostStateProvider, StateProofProvider, StateProvider,
StateRootProvider, StorageRootProvider, StateRootProvider, StorageRootProvider,

View File

@ -4,8 +4,7 @@ use alloy_consensus::BlockHeader;
use reth_consensus::ConsensusError; use reth_consensus::ConsensusError;
use reth_errors::{BlockExecutionError, BlockValidationError, ProviderError}; use reth_errors::{BlockExecutionError, BlockValidationError, ProviderError};
use reth_evm::execute::InternalBlockExecutionError; use reth_evm::execute::InternalBlockExecutionError;
use reth_primitives::SealedBlock; use reth_primitives_traits::{Block, BlockBody, SealedBlock};
use reth_primitives_traits::{Block, BlockBody};
use tokio::sync::oneshot::error::TryRecvError; use tokio::sync::oneshot::error::TryRecvError;
/// This is an error that can come from advancing persistence. Either this can be a /// This is an error that can come from advancing persistence. Either this can be a

View File

@ -1,6 +1,6 @@
use alloy_primitives::B256; use alloy_primitives::B256;
use reth_engine_primitives::InvalidBlockHook; use reth_engine_primitives::InvalidBlockHook;
use reth_primitives::{NodePrimitives, RecoveredBlock, SealedHeader}; use reth_primitives_traits::{NodePrimitives, RecoveredBlock, SealedHeader};
use reth_provider::BlockExecutionOutput; use reth_provider::BlockExecutionOutput;
use reth_trie::updates::TrieUpdates; use reth_trie::updates::TrieUpdates;

View File

@ -105,7 +105,7 @@ struct InvalidHeaderCacheMetrics {
mod tests { mod tests {
use super::*; use super::*;
use alloy_consensus::Header; use alloy_consensus::Header;
use reth_primitives::SealedHeader; use reth_primitives_traits::SealedHeader;
#[test] #[test]
fn test_hit_eviction() { fn test_hit_eviction() {

View File

@ -31,6 +31,7 @@ use reth_engine_primitives::{
EngineValidator, ForkchoiceStateTracker, OnForkChoiceUpdated, EngineValidator, ForkchoiceStateTracker, OnForkChoiceUpdated,
}; };
use reth_errors::{ConsensusError, ProviderResult}; use reth_errors::{ConsensusError, ProviderResult};
use reth_ethereum_primitives::EthPrimitives;
use reth_evm::{ use reth_evm::{
execute::BlockExecutorProvider, execute::BlockExecutorProvider,
system_calls::{NoopHook, OnStateHook}, system_calls::{NoopHook, OnStateHook},
@ -38,10 +39,9 @@ use reth_evm::{
use reth_payload_builder::PayloadBuilderHandle; use reth_payload_builder::PayloadBuilderHandle;
use reth_payload_builder_primitives::PayloadBuilder; use reth_payload_builder_primitives::PayloadBuilder;
use reth_payload_primitives::{EngineApiMessageVersion, PayloadBuilderAttributes}; use reth_payload_primitives::{EngineApiMessageVersion, PayloadBuilderAttributes};
use reth_primitives::{ use reth_primitives_traits::{
EthPrimitives, GotExpected, NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader, Block, GotExpected, NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader,
}; };
use reth_primitives_traits::Block;
use reth_provider::{ use reth_provider::{
providers::ConsistentDbView, BlockReader, DBProvider, DatabaseProviderFactory, providers::ConsistentDbView, BlockReader, DBProvider, DatabaseProviderFactory,
ExecutionOutcome, HashedPostStateProvider, ProviderError, StateCommitmentProvider, ExecutionOutcome, HashedPostStateProvider, ProviderError, StateCommitmentProvider,
@ -2817,8 +2817,8 @@ mod tests {
use reth_engine_primitives::ForkchoiceStatus; use reth_engine_primitives::ForkchoiceStatus;
use reth_ethereum_consensus::EthBeaconConsensus; use reth_ethereum_consensus::EthBeaconConsensus;
use reth_ethereum_engine_primitives::{EthEngineTypes, EthereumEngineValidator}; use reth_ethereum_engine_primitives::{EthEngineTypes, EthereumEngineValidator};
use reth_ethereum_primitives::{Block, EthPrimitives};
use reth_evm::test_utils::MockExecutorProvider; use reth_evm::test_utils::MockExecutorProvider;
use reth_primitives::{Block, EthPrimitives};
use reth_primitives_traits::Block as _; use reth_primitives_traits::Block as _;
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};
@ -3021,7 +3021,7 @@ mod tests {
fn insert_block( fn insert_block(
&mut self, &mut self,
block: RecoveredBlock<reth_primitives::Block>, block: RecoveredBlock<reth_ethereum_primitives::Block>,
) -> Result<InsertPayloadOk, InsertBlockError<Block>> { ) -> Result<InsertPayloadOk, InsertBlockError<Block>> {
let execution_outcome = self.block_builder.get_execution_outcome(block.clone()); let execution_outcome = self.block_builder.get_execution_outcome(block.clone());
self.extend_execution_outcome([execution_outcome]); self.extend_execution_outcome([execution_outcome]);
@ -3086,7 +3086,10 @@ mod tests {
} }
} }
async fn send_new_payload(&mut self, block: RecoveredBlock<reth_primitives::Block>) { async fn send_new_payload(
&mut self,
block: RecoveredBlock<reth_ethereum_primitives::Block>,
) {
let payload = block_to_payload_v3(block.clone_sealed_block()); let payload = block_to_payload_v3(block.clone_sealed_block());
self.tree self.tree
.on_new_payload( .on_new_payload(
@ -3101,7 +3104,7 @@ mod tests {
async fn insert_chain( async fn insert_chain(
&mut self, &mut self,
chain: impl IntoIterator<Item = RecoveredBlock<reth_primitives::Block>> + Clone, chain: impl IntoIterator<Item = RecoveredBlock<reth_ethereum_primitives::Block>> + Clone,
) { ) {
for block in chain.clone() { for block in chain.clone() {
self.insert_block(block.clone()).unwrap(); self.insert_block(block.clone()).unwrap();
@ -3123,7 +3126,7 @@ mod tests {
async fn check_fork_chain_insertion( async fn check_fork_chain_insertion(
&mut self, &mut self,
chain: impl IntoIterator<Item = RecoveredBlock<reth_primitives::Block>> + Clone, chain: impl IntoIterator<Item = RecoveredBlock<reth_ethereum_primitives::Block>> + Clone,
) { ) {
for block in chain { for block in chain {
self.check_fork_block_added(block.hash()).await; self.check_fork_block_added(block.hash()).await;
@ -3132,7 +3135,7 @@ mod tests {
async fn check_canon_chain_insertion( async fn check_canon_chain_insertion(
&mut self, &mut self,
chain: impl IntoIterator<Item = RecoveredBlock<reth_primitives::Block>> + Clone, chain: impl IntoIterator<Item = RecoveredBlock<reth_ethereum_primitives::Block>> + Clone,
) { ) {
for block in chain.clone() { for block in chain.clone() {
self.check_canon_block_added(block.hash()).await; self.check_canon_block_added(block.hash()).await;
@ -3164,7 +3167,7 @@ mod tests {
} }
} }
fn persist_blocks(&self, blocks: Vec<RecoveredBlock<reth_primitives::Block>>) { fn persist_blocks(&self, blocks: Vec<RecoveredBlock<reth_ethereum_primitives::Block>>) {
let mut block_data: Vec<(B256, Block)> = Vec::with_capacity(blocks.len()); let mut block_data: Vec<(B256, Block)> = Vec::with_capacity(blocks.len());
let mut headers_data: Vec<(B256, Header)> = Vec::with_capacity(blocks.len()); let mut headers_data: Vec<(B256, Header)> = Vec::with_capacity(blocks.len());
@ -3179,14 +3182,14 @@ mod tests {
fn setup_range_insertion_for_valid_chain( fn setup_range_insertion_for_valid_chain(
&mut self, &mut self,
chain: Vec<RecoveredBlock<reth_primitives::Block>>, chain: Vec<RecoveredBlock<reth_ethereum_primitives::Block>>,
) { ) {
self.setup_range_insertion_for_chain(chain, None) self.setup_range_insertion_for_chain(chain, None)
} }
fn setup_range_insertion_for_invalid_chain( fn setup_range_insertion_for_invalid_chain(
&mut self, &mut self,
chain: Vec<RecoveredBlock<reth_primitives::Block>>, chain: Vec<RecoveredBlock<reth_ethereum_primitives::Block>>,
index: usize, index: usize,
) { ) {
self.setup_range_insertion_for_chain(chain, Some(index)) self.setup_range_insertion_for_chain(chain, Some(index))
@ -3194,7 +3197,7 @@ mod tests {
fn setup_range_insertion_for_chain( fn setup_range_insertion_for_chain(
&mut self, &mut self,
chain: Vec<RecoveredBlock<reth_primitives::Block>>, chain: Vec<RecoveredBlock<reth_ethereum_primitives::Block>>,
invalid_index: Option<usize>, invalid_index: Option<usize>,
) { ) {
// setting up execution outcomes for the chain, the blocks will be // setting up execution outcomes for the chain, the blocks will be

View File

@ -925,7 +925,7 @@ fn extend_multi_proof_targets_ref(targets: &mut MultiProofTargets, other: &Multi
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use reth_primitives::{Account as RethAccount, StorageEntry}; use reth_primitives_traits::{Account as RethAccount, StorageEntry};
use reth_provider::{ use reth_provider::{
providers::ConsistentDbView, test_utils::create_test_provider_factory, HashingWriter, providers::ConsistentDbView, test_utils::create_test_provider_factory, HashingWriter,
}; };