chore: rm reth-primitives from exex crates (#15066)

This commit is contained in:
Matthias Seitz
2025-03-15 15:43:17 +01:00
committed by GitHub
parent 68249bd6e2
commit 04f5a2aafb
16 changed files with 77 additions and 60 deletions

6
Cargo.lock generated
View File

@@ -7985,6 +7985,7 @@ dependencies = [
"reth-chainspec",
"reth-config",
"reth-db-common",
"reth-ethereum-primitives",
"reth-evm",
"reth-evm-ethereum",
"reth-exex-types",
@@ -7993,7 +7994,6 @@ dependencies = [
"reth-node-api",
"reth-node-core",
"reth-payload-builder",
"reth-primitives",
"reth-primitives-traits",
"reth-provider",
"reth-prune-types",
@@ -8024,6 +8024,7 @@ dependencies = [
"reth-consensus",
"reth-db",
"reth-db-common",
"reth-ethereum-primitives",
"reth-evm",
"reth-execution-types",
"reth-exex",
@@ -8033,7 +8034,6 @@ dependencies = [
"reth-node-core",
"reth-node-ethereum",
"reth-payload-builder",
"reth-primitives",
"reth-primitives-traits",
"reth-provider",
"reth-tasks",
@@ -8054,8 +8054,8 @@ dependencies = [
"bincode",
"rand 0.8.5",
"reth-chain-state",
"reth-ethereum-primitives",
"reth-execution-types",
"reth-primitives",
"reth-primitives-traits",
"serde",
"serde_with",

View File

@@ -526,7 +526,7 @@ pub enum ChainSplit<N: NodePrimitives = reth_ethereum_primitives::EthPrimitives>
#[cfg(feature = "serde-bincode-compat")]
pub(super) mod serde_bincode_compat {
use crate::{serde_bincode_compat, ExecutionOutcome};
use alloc::borrow::Cow;
use alloc::{borrow::Cow, collections::BTreeMap};
use alloy_primitives::BlockNumber;
use reth_ethereum_primitives::EthPrimitives;
use reth_primitives_traits::{
@@ -536,7 +536,6 @@ pub(super) mod serde_bincode_compat {
use reth_trie_common::serde_bincode_compat::updates::TrieUpdates;
use serde::{ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer};
use serde_with::{DeserializeAs, SerializeAs};
use std::collections::BTreeMap;
/// Bincode-compatible [`super::Chain`] serde implementation.
///

View File

@@ -401,7 +401,7 @@ impl<T> From<(BlockExecutionOutput<T>, BlockNumber)> for ExecutionOutcome<T> {
#[cfg(feature = "serde-bincode-compat")]
pub(super) mod serde_bincode_compat {
use alloc::borrow::Cow;
use alloc::{borrow::Cow, vec::Vec};
use alloy_eips::eip7685::Requests;
use alloy_primitives::BlockNumber;
use reth_primitives_traits::serde_bincode_compat::SerdeBincodeCompat;

View File

@@ -22,8 +22,8 @@ reth-fs-util.workspace = true
reth-metrics.workspace = true
reth-node-api.workspace = true
reth-node-core.workspace = true
reth-primitives = { workspace = true, features = ["secp256k1"] }
reth-primitives-traits.workspace = true
reth-ethereum-primitives.workspace = true
reth-provider.workspace = true
reth-prune-types.workspace = true
reth-revm.workspace = true

View File

@@ -6,12 +6,12 @@ use std::{
use alloy_consensus::BlockHeader;
use alloy_primitives::BlockNumber;
use reth_ethereum_primitives::Receipt;
use reth_evm::execute::{
BlockExecutionError, BlockExecutionOutput, BlockExecutorProvider, Executor,
};
use reth_node_api::{Block as _, BlockBody as _, NodePrimitives};
use reth_primitives::{Receipt, RecoveredBlock};
use reth_primitives_traits::{format_gas_throughput, SignedTransaction};
use reth_primitives_traits::{format_gas_throughput, RecoveredBlock, SignedTransaction};
use reth_provider::{
BlockReader, Chain, ExecutionOutcome, HeaderProvider, ProviderError, StateProviderFactory,
TransactionVariant,
@@ -194,7 +194,7 @@ where
) -> StreamBackfillJob<
E,
P,
(RecoveredBlock<reth_primitives::Block>, BlockExecutionOutput<Receipt>),
(RecoveredBlock<reth_ethereum_primitives::Block>, BlockExecutionOutput<Receipt>),
> {
self.into()
}

View File

@@ -5,9 +5,10 @@ use futures::{
stream::{FuturesOrdered, Stream},
StreamExt,
};
use reth_ethereum_primitives::EthPrimitives;
use reth_evm::execute::{BlockExecutionError, BlockExecutionOutput, BlockExecutorProvider};
use reth_node_api::NodePrimitives;
use reth_primitives::{EthPrimitives, RecoveredBlock};
use reth_primitives_traits::RecoveredBlock;
use reth_provider::{BlockReader, Chain, StateProviderFactory};
use reth_prune_types::PruneModes;
use reth_stages_api::ExecutionStageThresholds;

View File

@@ -4,11 +4,11 @@ use alloy_consensus::{constants::ETH_TO_WEI, BlockHeader, Header, TxEip2930};
use alloy_genesis::{Genesis, GenesisAccount};
use alloy_primitives::{b256, Address, TxKind, U256};
use reth_chainspec::{ChainSpec, ChainSpecBuilder, EthereumHardfork, MAINNET, MIN_TRANSACTION_GAS};
use reth_ethereum_primitives::{Block, BlockBody, Receipt, Transaction};
use reth_evm::execute::{BlockExecutionOutput, BlockExecutorProvider, Executor};
use reth_evm_ethereum::execute::EthExecutorProvider;
use reth_node_api::FullNodePrimitives;
use reth_primitives::{Block, BlockBody, Receipt, RecoveredBlock, Transaction};
use reth_primitives_traits::Block as _;
use reth_primitives_traits::{Block as _, RecoveredBlock};
use reth_provider::{
providers::ProviderNodeTypes, BlockWriter as _, ExecutionOutcome, LatestStateProviderRef,
ProviderFactory,
@@ -51,14 +51,14 @@ pub(crate) fn chain_spec(address: Address) -> Arc<ChainSpec> {
pub(crate) fn execute_block_and_commit_to_database<N>(
provider_factory: &ProviderFactory<N>,
chain_spec: Arc<ChainSpec>,
block: &RecoveredBlock<reth_primitives::Block>,
block: &RecoveredBlock<reth_ethereum_primitives::Block>,
) -> eyre::Result<BlockExecutionOutput<Receipt>>
where
N: ProviderNodeTypes<
Primitives: FullNodePrimitives<
Block = reth_primitives::Block,
BlockBody = reth_primitives::BlockBody,
Receipt = reth_primitives::Receipt,
Block = reth_ethereum_primitives::Block,
BlockBody = reth_ethereum_primitives::BlockBody,
Receipt = reth_ethereum_primitives::Receipt,
>,
>,
{
@@ -89,8 +89,10 @@ where
fn blocks(
chain_spec: Arc<ChainSpec>,
key_pair: Keypair,
) -> eyre::Result<(RecoveredBlock<reth_primitives::Block>, RecoveredBlock<reth_primitives::Block>)>
{
) -> eyre::Result<(
RecoveredBlock<reth_ethereum_primitives::Block>,
RecoveredBlock<reth_ethereum_primitives::Block>,
)> {
// First block has a transaction that transfers some ETH to zero address
let block1 = Block {
header: Header {
@@ -160,13 +162,15 @@ pub(crate) fn blocks_and_execution_outputs<N>(
provider_factory: ProviderFactory<N>,
chain_spec: Arc<ChainSpec>,
key_pair: Keypair,
) -> eyre::Result<Vec<(RecoveredBlock<reth_primitives::Block>, BlockExecutionOutput<Receipt>)>>
) -> eyre::Result<
Vec<(RecoveredBlock<reth_ethereum_primitives::Block>, BlockExecutionOutput<Receipt>)>,
>
where
N: ProviderNodeTypes<
Primitives: FullNodePrimitives<
Block = reth_primitives::Block,
BlockBody = reth_primitives::BlockBody,
Receipt = reth_primitives::Receipt,
Block = reth_ethereum_primitives::Block,
BlockBody = reth_ethereum_primitives::BlockBody,
Receipt = reth_ethereum_primitives::Receipt,
>,
>,
{
@@ -184,11 +188,13 @@ pub(crate) fn blocks_and_execution_outcome<N>(
provider_factory: ProviderFactory<N>,
chain_spec: Arc<ChainSpec>,
key_pair: Keypair,
) -> eyre::Result<(Vec<RecoveredBlock<reth_primitives::Block>>, ExecutionOutcome)>
) -> eyre::Result<(Vec<RecoveredBlock<reth_ethereum_primitives::Block>>, ExecutionOutcome)>
where
N: ProviderNodeTypes,
N::Primitives:
FullNodePrimitives<Block = reth_primitives::Block, Receipt = reth_primitives::Receipt>,
N::Primitives: FullNodePrimitives<
Block = reth_ethereum_primitives::Block,
Receipt = reth_ethereum_primitives::Receipt,
>,
{
let (block1, block2) = blocks(chain_spec.clone(), key_pair)?;

View File

@@ -3,9 +3,9 @@
use alloy_eips::BlockNumHash;
use reth_chainspec::EthChainSpec;
use reth_ethereum_primitives::EthPrimitives;
use reth_node_api::{FullNodeComponents, HeaderTy, NodePrimitives, NodeTypes, PrimitivesTy};
use reth_node_core::node_config::NodeConfig;
use reth_primitives::EthPrimitives;
use reth_provider::BlockReader;
use std::fmt::Debug;
use tokio::sync::mpsc;

View File

@@ -7,10 +7,11 @@ use futures::StreamExt;
use itertools::Itertools;
use metrics::Gauge;
use reth_chain_state::ForkChoiceStream;
use reth_ethereum_primitives::EthPrimitives;
use reth_evm::execute::BlockExecutorProvider;
use reth_metrics::{metrics::Counter, Metrics};
use reth_node_api::NodePrimitives;
use reth_primitives::{EthPrimitives, SealedHeader};
use reth_primitives_traits::SealedHeader;
use reth_provider::HeaderProvider;
use reth_tracing::tracing::{debug, warn};
use std::{
@@ -664,7 +665,7 @@ mod tests {
use reth_db_common::init::init_genesis;
use reth_evm::test_utils::MockExecutorProvider;
use reth_evm_ethereum::execute::EthExecutorProvider;
use reth_primitives::RecoveredBlock;
use reth_primitives_traits::RecoveredBlock;
use reth_provider::{
providers::BlockchainProvider, test_utils::create_test_provider_factory, BlockReader,
BlockWriter, Chain, DatabaseProviderFactory, StorageLocation, TransactionVariant,
@@ -766,7 +767,7 @@ mod tests {
ExExManager::new((), vec![exex_handle], 10, wal, empty_finalized_header_stream());
// Define the notification for testing
let mut block1: RecoveredBlock<reth_primitives::Block> = Default::default();
let mut block1: RecoveredBlock<reth_ethereum_primitives::Block> = Default::default();
block1.set_hash(B256::new([0x01; 32]));
block1.set_block_number(10);
@@ -784,7 +785,7 @@ mod tests {
assert_eq!(exex_manager.next_id, 1);
// Push another notification
let mut block2: RecoveredBlock<reth_primitives::Block> = Default::default();
let mut block2: RecoveredBlock<reth_ethereum_primitives::Block> = Default::default();
block2.set_hash(B256::new([0x02; 32]));
block2.set_block_number(20);
@@ -827,7 +828,7 @@ mod tests {
);
// Push some notifications to fill part of the buffer
let mut block1: RecoveredBlock<reth_primitives::Block> = Default::default();
let mut block1: RecoveredBlock<reth_ethereum_primitives::Block> = Default::default();
block1.set_hash(B256::new([0x01; 32]));
block1.set_block_number(10);
@@ -1116,11 +1117,11 @@ mod tests {
assert_eq!(exex_handle.next_notification_id, 0);
// Setup two blocks for the chain commit notification
let mut block1: RecoveredBlock<reth_primitives::Block> = Default::default();
let mut block1: RecoveredBlock<reth_ethereum_primitives::Block> = Default::default();
block1.set_hash(B256::new([0x01; 32]));
block1.set_block_number(10);
let mut block2: RecoveredBlock<reth_primitives::Block> = Default::default();
let mut block2: RecoveredBlock<reth_ethereum_primitives::Block> = Default::default();
block2.set_hash(B256::new([0x02; 32]));
block2.set_block_number(11);
@@ -1169,7 +1170,7 @@ mod tests {
// Set finished_height to a value higher than the block tip
exex_handle.finished_height = Some(BlockNumHash::new(15, B256::random()));
let mut block1: RecoveredBlock<reth_primitives::Block> = Default::default();
let mut block1: RecoveredBlock<reth_ethereum_primitives::Block> = Default::default();
block1.set_hash(B256::new([0x01; 32]));
block1.set_block_number(10);

View File

@@ -2,10 +2,10 @@ use crate::{BackfillJobFactory, ExExNotification, StreamBackfillJob, WalHandle};
use alloy_consensus::BlockHeader;
use alloy_eips::BlockNumHash;
use futures::{Stream, StreamExt};
use reth_ethereum_primitives::EthPrimitives;
use reth_evm::execute::BlockExecutorProvider;
use reth_exex_types::ExExHead;
use reth_node_api::NodePrimitives;
use reth_primitives::EthPrimitives;
use reth_provider::{BlockReader, Chain, HeaderProvider, StateProviderFactory};
use reth_tracing::tracing::debug;
use std::{
@@ -463,8 +463,8 @@ mod tests {
use eyre::OptionExt;
use futures::StreamExt;
use reth_db_common::init::init_genesis;
use reth_ethereum_primitives::Block;
use reth_evm_ethereum::execute::EthExecutorProvider;
use reth_primitives::Block;
use reth_primitives_traits::Block as _;
use reth_provider::{
providers::BlockchainProvider, test_utils::create_test_provider_factory, BlockWriter,

View File

@@ -3,8 +3,8 @@
mod cache;
pub use cache::BlockCache;
mod storage;
use reth_ethereum_primitives::EthPrimitives;
use reth_node_api::NodePrimitives;
use reth_primitives::EthPrimitives;
pub use storage::Storage;
mod metrics;
use metrics::Metrics;

View File

@@ -5,9 +5,9 @@ use std::{
};
use crate::wal::{WalError, WalResult};
use reth_ethereum_primitives::EthPrimitives;
use reth_exex_types::ExExNotification;
use reth_node_api::NodePrimitives;
use reth_primitives::EthPrimitives;
use reth_tracing::tracing::debug;
use tracing::instrument;
@@ -188,8 +188,10 @@ mod tests {
#[test]
fn decode_notification_wal() {
let wal = include_bytes!("../../test-data/28.wal");
let notification: reth_exex_types::serde_bincode_compat::ExExNotification<'_> =
rmp_serde::decode::from_slice(wal.as_slice()).unwrap();
let notification: reth_exex_types::serde_bincode_compat::ExExNotification<
'_,
reth_ethereum_primitives::EthPrimitives,
> = rmp_serde::decode::from_slice(wal.as_slice()).unwrap();
let notification: ExExNotification = notification.into();
match notification {
ExExNotification::ChainCommitted { new } => {

View File

@@ -26,8 +26,8 @@ reth-node-api.workspace = true
reth-node-core.workspace = true
reth-node-builder = { workspace = true, features = ["test-utils"] }
reth-node-ethereum.workspace = true
reth-primitives.workspace = true
reth-primitives-traits.workspace = true
reth-ethereum-primitives.workspace = true
reth-provider = { workspace = true, features = ["test-utils"] }
reth-tasks.workspace = true
reth-transaction-pool = { workspace = true, features = ["test-utils"] }

View File

@@ -24,6 +24,7 @@ use reth_db::{
DatabaseEnv,
};
use reth_db_common::init::init_genesis;
use reth_ethereum_primitives::{EthPrimitives, TransactionSigned};
use reth_evm::test_utils::MockExecutorProvider;
use reth_execution_types::Chain;
use reth_exex::{ExExContext, ExExEvent, ExExNotification, ExExNotifications, Wal};
@@ -45,8 +46,7 @@ use reth_node_ethereum::{
EthEngineTypes, EthEvmConfig,
};
use reth_payload_builder::noop::NoopPayloadBuilderService;
use reth_primitives::{EthPrimitives, RecoveredBlock, TransactionSigned};
use reth_primitives_traits::Block as _;
use reth_primitives_traits::{Block as _, RecoveredBlock};
use reth_provider::{
providers::{BlockchainProvider, StaticFileProvider},
BlockReader, EthStorage, ProviderFactory,
@@ -187,7 +187,7 @@ pub type TestExExContext = ExExContext<Adapter>;
#[derive(Debug)]
pub struct TestExExHandle {
/// Genesis block that was inserted into the storage
pub genesis: RecoveredBlock<reth_primitives::Block>,
pub genesis: RecoveredBlock<reth_ethereum_primitives::Block>,
/// Provider Factory for accessing the emphemeral storage of the host node
pub provider_factory: ProviderFactory<NodeTypesWithDBAdapter<TestNode, TmpDB>>,
/// Channel for receiving events from the Execution Extension

View File

@@ -15,7 +15,6 @@ workspace = true
# reth
reth-chain-state.workspace = true
reth-execution-types.workspace = true
reth-primitives = { workspace = true, optional = true }
reth-primitives-traits.workspace = true
# reth
@@ -27,8 +26,8 @@ serde = { workspace = true, optional = true }
serde_with = { workspace = true, optional = true }
[dev-dependencies]
reth-primitives = { workspace = true, features = ["arbitrary"] }
reth-primitives-traits = { workspace = true, features = ["arbitrary"] }
reth-ethereum-primitives = { workspace = true, features = ["arbitrary", "std"] }
arbitrary.workspace = true
bincode.workspace = true
rand.workspace = true
@@ -46,7 +45,7 @@ serde = [
serde-bincode-compat = [
"reth-execution-types/serde-bincode-compat",
"serde_with",
"reth-primitives/serde-bincode-compat",
"alloy-eips/serde-bincode-compat",
"reth-primitives-traits/serde-bincode-compat",
"reth-ethereum-primitives/serde-bincode-compat",
]

View File

@@ -74,7 +74,7 @@ impl<P: NodePrimitives> From<CanonStateNotification<P>> for ExExNotification<P>
#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))]
pub(super) mod serde_bincode_compat {
use reth_execution_types::serde_bincode_compat::Chain;
use reth_primitives::{EthPrimitives, NodePrimitives};
use reth_primitives_traits::NodePrimitives;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_with::{DeserializeAs, SerializeAs};
use std::sync::Arc;
@@ -84,21 +84,22 @@ pub(super) mod serde_bincode_compat {
/// Intended to use with the [`serde_with::serde_as`] macro in the following way:
/// ```rust
/// use reth_exex_types::{serde_bincode_compat, ExExNotification};
/// use reth_primitives_traits::NodePrimitives;
/// use serde::{Deserialize, Serialize};
/// use serde_with::serde_as;
///
/// #[serde_as]
/// #[derive(Serialize, Deserialize)]
/// struct Data {
/// #[serde_as(as = "serde_bincode_compat::ExExNotification")]
/// notification: ExExNotification,
/// struct Data<N: NodePrimitives> {
/// #[serde_as(as = "serde_bincode_compat::ExExNotification<'_, N>")]
/// notification: ExExNotification<N>,
/// }
/// ```
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
#[serde(bound = "")]
#[allow(clippy::large_enum_variant)]
pub enum ExExNotification<'a, N = EthPrimitives>
pub enum ExExNotification<'a, N>
where
N: NodePrimitives,
{
@@ -148,9 +149,12 @@ pub(super) mod serde_bincode_compat {
}
}
impl SerializeAs<super::ExExNotification> for ExExNotification<'_> {
impl<N> SerializeAs<super::ExExNotification<N>> for ExExNotification<'_, N>
where
N: NodePrimitives,
{
fn serialize_as<S>(
source: &super::ExExNotification,
source: &super::ExExNotification<N>,
serializer: S,
) -> Result<S::Ok, S::Error>
where
@@ -160,8 +164,11 @@ pub(super) mod serde_bincode_compat {
}
}
impl<'de> DeserializeAs<'de, super::ExExNotification> for ExExNotification<'de> {
fn deserialize_as<D>(deserializer: D) -> Result<super::ExExNotification, D::Error>
impl<'de, N> DeserializeAs<'de, super::ExExNotification<N>> for ExExNotification<'de, N>
where
N: NodePrimitives,
{
fn deserialize_as<D>(deserializer: D) -> Result<super::ExExNotification<N>, D::Error>
where
D: Deserializer<'de>,
{
@@ -175,7 +182,7 @@ pub(super) mod serde_bincode_compat {
use arbitrary::Arbitrary;
use rand::Rng;
use reth_execution_types::Chain;
use reth_primitives::RecoveredBlock;
use reth_primitives_traits::RecoveredBlock;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use std::sync::Arc;
@@ -185,7 +192,9 @@ pub(super) mod serde_bincode_compat {
#[serde_as]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
struct Data {
#[serde_as(as = "serde_bincode_compat::ExExNotification")]
#[serde_as(
as = "serde_bincode_compat::ExExNotification<'_, reth_ethereum_primitives::EthPrimitives>"
)]
notification: ExExNotification,
}