From f425a4dbcd36527dd41e832b072e143b4393d5da Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 13 Feb 2025 11:00:00 +0100 Subject: [PATCH] chore: phase out reth-primitives from storage-api (#14462) --- Cargo.lock | 2 +- crates/storage/storage-api/Cargo.toml | 4 ++-- crates/storage/storage-api/src/block.rs | 2 +- crates/storage/storage-api/src/chain.rs | 10 +++++----- crates/storage/storage-api/src/hashing.rs | 2 +- crates/storage/storage-api/src/noop.rs | 6 ++++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe533b7c1..d6b7e24eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9420,8 +9420,8 @@ dependencies = [ "reth-db", "reth-db-api", "reth-db-models", + "reth-ethereum-primitives", "reth-execution-types", - "reth-primitives", "reth-primitives-traits", "reth-prune-types", "reth-stages-types", diff --git a/crates/storage/storage-api/Cargo.toml b/crates/storage/storage-api/Cargo.toml index 5bbe2fa87..cd3bb6763 100644 --- a/crates/storage/storage-api/Cargo.toml +++ b/crates/storage/storage-api/Cargo.toml @@ -17,7 +17,6 @@ reth-chainspec.workspace = true reth-db-models.workspace = true reth-db-api.workspace = true reth-execution-types.workspace = true -reth-primitives.workspace = true reth-primitives-traits.workspace = true reth-prune-types.workspace = true reth-stages-types.workspace = true @@ -26,6 +25,7 @@ reth-trie.workspace = true reth-trie-db.workspace = true reth-db.workspace = true revm.workspace = true +reth-ethereum-primitives.workspace = true # ethereum alloy-eips.workspace = true @@ -43,7 +43,7 @@ std = [ "alloy-eips/std", "alloy-primitives/std", "alloy-rpc-types-engine/std", - "reth-primitives/std", + "reth-ethereum-primitives/std", "reth-primitives-traits/std", "revm/std", "reth-stages-types/std", diff --git a/crates/storage/storage-api/src/block.rs b/crates/storage/storage-api/src/block.rs index 5f0e35700..4f0211321 100644 --- a/crates/storage/storage-api/src/block.rs +++ b/crates/storage/storage-api/src/block.rs @@ -6,7 +6,7 @@ use alloc::{sync::Arc, vec::Vec}; use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag}; use alloy_primitives::{BlockNumber, B256}; use core::ops::RangeInclusive; -use reth_primitives::{RecoveredBlock, SealedBlock, SealedHeader}; +use reth_primitives_traits::{RecoveredBlock, SealedBlock, SealedHeader}; use reth_storage_errors::provider::ProviderResult; /// A helper enum that represents the origin of the requested block. diff --git a/crates/storage/storage-api/src/chain.rs b/crates/storage/storage-api/src/chain.rs index dba4428d6..ffb4214c7 100644 --- a/crates/storage/storage-api/src/chain.rs +++ b/crates/storage/storage-api/src/chain.rs @@ -11,7 +11,7 @@ use reth_db::{ transaction::{DbTx, DbTxMut}, DbTxUnwindExt, }; -use reth_primitives::TransactionSigned; +use reth_ethereum_primitives::TransactionSigned; use reth_primitives_traits::{ Block, BlockBody, FullBlockHeader, FullNodePrimitives, SignedTransaction, }; @@ -93,7 +93,7 @@ impl Default for EthStorage { } } -impl BlockBodyWriter> +impl BlockBodyWriter> for EthStorage where Provider: DBProvider, @@ -103,7 +103,7 @@ where fn write_block_bodies( &self, provider: &Provider, - bodies: Vec<(u64, Option>)>, + bodies: Vec<(u64, Option>)>, _write_to: StorageLocation, ) -> ProviderResult<()> { let mut ommers_cursor = provider.tx_ref().cursor_write::>()?; @@ -150,7 +150,7 @@ where T: SignedTransaction, H: FullBlockHeader, { - type Block = reth_primitives::Block; + type Block = alloy_consensus::Block; fn read_block_bodies( &self, @@ -182,7 +182,7 @@ where provider.ommers(header.number().into())?.unwrap_or_default() }; - bodies.push(reth_primitives::BlockBody { transactions, ommers, withdrawals }); + bodies.push(alloy_consensus::BlockBody { transactions, ommers, withdrawals }); } Ok(bodies) diff --git a/crates/storage/storage-api/src/hashing.rs b/crates/storage/storage-api/src/hashing.rs index c6753e554..73969cad2 100644 --- a/crates/storage/storage-api/src/hashing.rs +++ b/crates/storage/storage-api/src/hashing.rs @@ -3,7 +3,7 @@ use alloy_primitives::{map::HashMap, Address, BlockNumber, B256}; use auto_impl::auto_impl; use core::ops::{RangeBounds, RangeInclusive}; use reth_db::models::{AccountBeforeTx, BlockNumberAddress}; -use reth_primitives::{Account, StorageEntry}; +use reth_primitives_traits::{Account, StorageEntry}; use reth_storage_errors::provider::ProviderResult; /// Hashing Writer diff --git a/crates/storage/storage-api/src/noop.rs b/crates/storage/storage-api/src/noop.rs index e3321dfb4..fac4e74fa 100644 --- a/crates/storage/storage-api/src/noop.rs +++ b/crates/storage/storage-api/src/noop.rs @@ -21,8 +21,10 @@ use core::{ }; use reth_chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec, MAINNET}; use reth_db_models::{AccountBeforeTx, StoredBlockBodyIndices}; -use reth_primitives::{EthPrimitives, RecoveredBlock, SealedBlock}; -use reth_primitives_traits::{Account, Bytecode, NodePrimitives, SealedHeader}; +use reth_ethereum_primitives::EthPrimitives; +use reth_primitives_traits::{ + Account, Bytecode, NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader, +}; use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_stages_types::{StageCheckpoint, StageId}; use reth_storage_errors::provider::{ProviderError, ProviderResult};