From b8759733d45052d66ee7f4c6b3d728ea5c2600a5 Mon Sep 17 00:00:00 2001 From: joshieDo <93316087+joshieDo@users.noreply.github.com> Date: Tue, 11 Jun 2024 16:38:26 +0200 Subject: [PATCH] chore: move `primitives/stage` to `reth-stages-types` (#8749) --- Cargo.lock | 26 +++++++++++++++++ Cargo.toml | 2 ++ bin/reth/src/commands/common.rs | 4 +-- .../src/commands/debug_cmd/build_block.rs | 2 +- bin/reth/src/commands/debug_cmd/execution.rs | 4 +-- .../commands/debug_cmd/in_memory_merkle.rs | 3 +- bin/reth/src/commands/debug_cmd/merkle.rs | 4 +-- bin/reth/src/commands/import.rs | 4 +-- bin/reth/src/commands/import_op.rs | 2 +- bin/reth/src/commands/import_receipts_op.rs | 3 +- bin/reth/src/commands/stage/drop.rs | 3 +- bin/reth/src/commands/stage/dump/execution.rs | 3 +- .../commands/stage/dump/hashing_account.rs | 4 +-- .../commands/stage/dump/hashing_storage.rs | 3 +- bin/reth/src/commands/stage/dump/merkle.rs | 4 +-- crates/blockchain-tree/src/blockchain_tree.rs | 2 +- crates/consensus/beacon/src/engine/mod.rs | 10 +++---- crates/consensus/beacon/src/engine/sync.rs | 9 +++--- crates/e2e-test-utils/Cargo.toml | 1 + crates/e2e-test-utils/src/node.rs | 3 +- crates/node-core/Cargo.toml | 1 + crates/node-core/src/node_config.rs | 5 ++-- crates/node/builder/src/launch/common.rs | 4 +-- crates/node/events/src/node.rs | 8 ++---- crates/primitives/src/lib.rs | 1 - crates/stages/api/Cargo.toml | 1 + crates/stages/api/src/lib.rs | 3 ++ crates/stages/api/src/metrics/listener.rs | 8 ++---- crates/stages/api/src/metrics/sync_metrics.rs | 2 +- crates/stages/api/src/pipeline/builder.rs | 4 +-- crates/stages/api/src/pipeline/event.rs | 8 +++--- crates/stages/api/src/pipeline/mod.rs | 7 ++--- crates/stages/api/src/pipeline/set.rs | 3 +- crates/stages/api/src/stage.rs | 7 ++--- crates/stages/api/src/test_utils.rs | 3 +- crates/stages/stages/benches/criterion.rs | 3 +- .../stages/benches/setup/account_hashing.rs | 3 +- crates/stages/stages/src/stages/bodies.rs | 14 ++++------ crates/stages/stages/src/stages/execution.rs | 17 +++++------ crates/stages/stages/src/stages/finish.rs | 5 ++-- .../stages/src/stages/hashing_account.rs | 14 +++++----- .../stages/src/stages/hashing_storage.rs | 11 ++++---- crates/stages/stages/src/stages/headers.rs | 15 ++++------ .../src/stages/index_account_history.rs | 9 +++--- .../src/stages/index_storage_history.rs | 2 +- crates/stages/stages/src/stages/merkle.rs | 13 ++++----- crates/stages/stages/src/stages/mod.rs | 10 ++----- .../stages/src/stages/sender_recovery.rs | 13 ++++----- crates/stages/stages/src/stages/tx_lookup.rs | 13 +++++---- crates/stages/stages/src/test_utils/macros.rs | 8 +++--- crates/stages/stages/src/test_utils/mod.rs | 2 +- crates/stages/types/Cargo.toml | 28 +++++++++++++++++++ .../stage => stages/types/src}/checkpoints.rs | 2 +- .../src/stage => stages/types/src}/id.rs | 0 .../stage/mod.rs => stages/types/src/lib.rs} | 14 ++++++++-- crates/storage/db-api/Cargo.toml | 1 + crates/storage/db-api/src/models/mod.rs | 13 +++++---- crates/storage/db-common/Cargo.toml | 1 + crates/storage/db-common/src/init.rs | 2 +- crates/storage/db/Cargo.toml | 1 + crates/storage/db/src/tables/mod.rs | 5 ++-- crates/storage/provider/Cargo.toml | 1 + .../provider/src/providers/database/mod.rs | 2 +- .../src/providers/database/provider.rs | 2 +- crates/storage/provider/src/providers/mod.rs | 2 +- .../src/providers/static_file/manager.rs | 2 +- .../storage/provider/src/test_utils/noop.rs | 12 ++++---- crates/storage/storage-api/Cargo.toml | 1 + .../storage-api/src/stage_checkpoint.rs | 6 ++-- crates/trie/trie/Cargo.toml | 1 + crates/trie/trie/src/progress.rs | 3 +- 71 files changed, 231 insertions(+), 181 deletions(-) create mode 100644 crates/stages/types/Cargo.toml rename crates/{primitives/src/stage => stages/types/src}/checkpoints.rs (99%) rename crates/{primitives/src/stage => stages/types/src}/id.rs (100%) rename crates/{primitives/src/stage/mod.rs => stages/types/src/lib.rs} (76%) diff --git a/Cargo.lock b/Cargo.lock index c7fae2a44..6b5a686a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6543,6 +6543,7 @@ dependencies = [ "reth-nippy-jar", "reth-primitives", "reth-prune-types", + "reth-stages-types", "reth-storage-errors", "reth-tracing", "reth-trie-types", @@ -6577,6 +6578,7 @@ dependencies = [ "reth-codecs", "reth-primitives", "reth-prune-types", + "reth-stages-types", "reth-storage-errors", "reth-trie-types", "serde", @@ -6596,6 +6598,7 @@ dependencies = [ "reth-etl", "reth-primitives", "reth-provider", + "reth-stages-types", "reth-trie", "serde", "serde_json", @@ -6730,6 +6733,7 @@ dependencies = [ "reth-provider", "reth-rpc", "reth-rpc-layer", + "reth-stages-types", "reth-tokio-util", "reth-tracing", "serde_json", @@ -7383,6 +7387,7 @@ dependencies = [ "reth-rpc-server-types", "reth-rpc-types", "reth-rpc-types-compat", + "reth-stages-types", "reth-storage-errors", "reth-tasks", "reth-tracing", @@ -7648,6 +7653,7 @@ dependencies = [ "reth-nippy-jar", "reth-primitives", "reth-prune-types", + "reth-stages-types", "reth-storage-api", "reth-storage-errors", "reth-testing-utils", @@ -7999,6 +8005,7 @@ dependencies = [ "reth-primitives", "reth-provider", "reth-prune", + "reth-stages-types", "reth-static-file", "reth-testing-utils", "reth-tokio-util", @@ -8008,6 +8015,23 @@ dependencies = [ "tracing", ] +[[package]] +name = "reth-stages-types" +version = "0.2.0-beta.9" +dependencies = [ + "alloy-primitives", + "arbitrary", + "bytes", + "modular-bitfield", + "proptest", + "proptest-derive", + "rand 0.8.5", + "reth-codecs", + "reth-trie-types", + "serde", + "test-fuzz", +] + [[package]] name = "reth-static-file" version = "0.2.0-beta.9" @@ -8049,6 +8073,7 @@ dependencies = [ "reth-execution-types", "reth-primitives", "reth-prune-types", + "reth-stages-types", "reth-storage-errors", "reth-trie", "revm", @@ -8167,6 +8192,7 @@ dependencies = [ "reth-metrics", "reth-primitives", "reth-provider", + "reth-stages-types", "reth-storage-errors", "reth-trie-types", "revm", diff --git a/Cargo.toml b/Cargo.toml index 2d1ac2246..26b48055a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,6 +79,7 @@ members = [ "crates/rpc/rpc/", "crates/stages/api/", "crates/stages/stages/", + "crates/stages/types/", "crates/static-file/types/", "crates/static-file/static-file", "crates/storage/codecs/", @@ -316,6 +317,7 @@ reth-rpc-types = { path = "crates/rpc/rpc-types" } reth-rpc-types-compat = { path = "crates/rpc/rpc-types-compat" } reth-stages = { path = "crates/stages/stages" } reth-stages-api = { path = "crates/stages/api" } +reth-stages-types = { path = "crates/stages/types" } reth-static-file = { path = "crates/static-file/static-file" } reth-static-file-types = { path = "crates/static-file/types" } reth-storage-api = { path = "crates/storage/storage-api" } diff --git a/bin/reth/src/commands/common.rs b/bin/reth/src/commands/common.rs index 0517b5395..5fd81d163 100644 --- a/bin/reth/src/commands/common.rs +++ b/bin/reth/src/commands/common.rs @@ -14,11 +14,11 @@ use reth_node_core::{ }, dirs::{ChainPath, DataDirPath}, }; -use reth_primitives::{stage::PipelineTarget, ChainSpec}; +use reth_primitives::ChainSpec; use reth_provider::{ providers::StaticFileProvider, HeaderSyncMode, ProviderFactory, StaticFileProviderFactory, }; -use reth_stages::{sets::DefaultStages, Pipeline}; +use reth_stages::{sets::DefaultStages, Pipeline, PipelineTarget}; use reth_static_file::StaticFileProducer; use std::{path::PathBuf, sync::Arc}; use tracing::{debug, info, warn}; diff --git a/bin/reth/src/commands/debug_cmd/build_block.rs b/bin/reth/src/commands/debug_cmd/build_block.rs index e74108f44..9acf80cc5 100644 --- a/bin/reth/src/commands/debug_cmd/build_block.rs +++ b/bin/reth/src/commands/debug_cmd/build_block.rs @@ -25,7 +25,6 @@ use reth_payload_builder::database::CachedReads; use reth_primitives::{ constants::eip4844::{LoadKzgSettingsError, MAINNET_KZG_TRUSTED_SETUP}, revm_primitives::KzgSettings, - stage::StageId, Address, BlobTransaction, BlobTransactionSidecar, Bytes, PooledTransactionsElement, SealedBlock, SealedBlockWithSenders, Transaction, TransactionSigned, TxEip4844, B256, U256, }; @@ -36,6 +35,7 @@ use reth_provider::{ }; use reth_revm::database::StateProviderDatabase; use reth_rpc_types::engine::{BlobsBundleV1, PayloadAttributes}; +use reth_stages::StageId; use reth_transaction_pool::{ blobstore::InMemoryBlobStore, BlobStore, EthPooledTransaction, PoolConfig, TransactionOrigin, TransactionPool, TransactionValidationTaskExecutor, diff --git a/bin/reth/src/commands/debug_cmd/execution.rs b/bin/reth/src/commands/debug_cmd/execution.rs index a68716ff7..200f212d0 100644 --- a/bin/reth/src/commands/debug_cmd/execution.rs +++ b/bin/reth/src/commands/debug_cmd/execution.rs @@ -22,7 +22,7 @@ use reth_exex::ExExManagerHandle; use reth_network::{NetworkEvents, NetworkHandle}; use reth_network_api::NetworkInfo; use reth_network_p2p::{bodies::client::BodiesClient, headers::client::HeadersClient}; -use reth_primitives::{stage::StageId, BlockHashOrNumber, BlockNumber, B256}; +use reth_primitives::{BlockHashOrNumber, BlockNumber, B256}; use reth_provider::{ BlockExecutionWriter, ChainSpecProvider, HeaderSyncMode, ProviderFactory, StageCheckpointReader, }; @@ -30,7 +30,7 @@ use reth_prune_types::PruneModes; use reth_stages::{ sets::DefaultStages, stages::{ExecutionStage, ExecutionStageThresholds}, - Pipeline, StageSet, + Pipeline, StageId, StageSet, }; use reth_static_file::StaticFileProducer; use reth_tasks::TaskExecutor; diff --git a/bin/reth/src/commands/debug_cmd/in_memory_merkle.rs b/bin/reth/src/commands/debug_cmd/in_memory_merkle.rs index 37b320096..cfa43a007 100644 --- a/bin/reth/src/commands/debug_cmd/in_memory_merkle.rs +++ b/bin/reth/src/commands/debug_cmd/in_memory_merkle.rs @@ -15,13 +15,14 @@ use reth_errors::BlockValidationError; use reth_evm::execute::{BlockExecutionOutput, BlockExecutorProvider, Executor}; use reth_network::NetworkHandle; use reth_network_api::NetworkInfo; -use reth_primitives::{stage::StageId, BlockHashOrNumber}; +use reth_primitives::BlockHashOrNumber; use reth_provider::{ AccountExtReader, BundleStateWithReceipts, ChainSpecProvider, HashingWriter, HeaderProvider, LatestStateProviderRef, OriginalValuesKnown, ProviderFactory, StageCheckpointReader, StateWriter, StaticFileProviderFactory, StorageReader, }; use reth_revm::database::StateProviderDatabase; +use reth_stages::StageId; use reth_tasks::TaskExecutor; use reth_trie::{updates::TrieKey, StateRoot}; use std::{net::SocketAddr, path::PathBuf, sync::Arc}; diff --git a/bin/reth/src/commands/debug_cmd/merkle.rs b/bin/reth/src/commands/debug_cmd/merkle.rs index 33904d5b0..12916cb5b 100644 --- a/bin/reth/src/commands/debug_cmd/merkle.rs +++ b/bin/reth/src/commands/debug_cmd/merkle.rs @@ -18,7 +18,7 @@ use reth_evm::execute::{BatchExecutor, BlockExecutorProvider}; use reth_network::NetworkHandle; use reth_network_api::NetworkInfo; use reth_network_p2p::full_block::FullBlockClient; -use reth_primitives::{stage::StageCheckpoint, BlockHashOrNumber}; +use reth_primitives::BlockHashOrNumber; use reth_provider::{ BlockNumReader, BlockWriter, ChainSpecProvider, HeaderProvider, LatestStateProviderRef, OriginalValuesKnown, ProviderError, ProviderFactory, StateWriter, @@ -27,7 +27,7 @@ use reth_prune_types::PruneModes; use reth_revm::database::StateProviderDatabase; use reth_stages::{ stages::{AccountHashingStage, MerkleStage, StorageHashingStage}, - ExecInput, Stage, + ExecInput, Stage, StageCheckpoint, }; use reth_tasks::TaskExecutor; use std::{net::SocketAddr, path::PathBuf, sync::Arc}; diff --git a/bin/reth/src/commands/import.rs b/bin/reth/src/commands/import.rs index 201adf53e..156e8f4d2 100644 --- a/bin/reth/src/commands/import.rs +++ b/bin/reth/src/commands/import.rs @@ -22,13 +22,13 @@ use reth_network_p2p::{ headers::downloader::{HeaderDownloader, SyncTarget}, }; use reth_node_events::node::NodeEvent; -use reth_primitives::{stage::StageId, B256}; +use reth_primitives::B256; use reth_provider::{ BlockNumReader, ChainSpecProvider, HeaderProvider, HeaderSyncMode, ProviderError, ProviderFactory, StageCheckpointReader, }; use reth_prune_types::PruneModes; -use reth_stages::{prelude::*, Pipeline, StageSet}; +use reth_stages::{prelude::*, Pipeline, StageId, StageSet}; use reth_static_file::StaticFileProducer; use std::{path::PathBuf, sync::Arc}; use tokio::sync::watch; diff --git a/bin/reth/src/commands/import_op.rs b/bin/reth/src/commands/import_op.rs index 206643b65..646cd4f97 100644 --- a/bin/reth/src/commands/import_op.rs +++ b/bin/reth/src/commands/import_op.rs @@ -16,9 +16,9 @@ use reth_downloaders::file_client::{ ChunkedFileReader, FileClient, DEFAULT_BYTE_LEN_CHUNK_CHAIN_FILE, }; use reth_optimism_primitives::bedrock_import::is_dup_tx; -use reth_primitives::stage::StageId; use reth_provider::StageCheckpointReader; use reth_prune_types::PruneModes; +use reth_stages::StageId; use reth_static_file::StaticFileProducer; use std::{path::PathBuf, sync::Arc}; use tracing::{debug, error, info}; diff --git a/bin/reth/src/commands/import_receipts_op.rs b/bin/reth/src/commands/import_receipts_op.rs index a3be119db..fb29783b8 100644 --- a/bin/reth/src/commands/import_receipts_op.rs +++ b/bin/reth/src/commands/import_receipts_op.rs @@ -11,11 +11,12 @@ use reth_downloaders::{ }; use reth_node_core::version::SHORT_VERSION; use reth_optimism_primitives::bedrock_import::is_dup_tx; -use reth_primitives::{stage::StageId, Receipts, StaticFileSegment}; +use reth_primitives::{Receipts, StaticFileSegment}; use reth_provider::{ BundleStateWithReceipts, OriginalValuesKnown, ProviderFactory, StageCheckpointReader, StateWriter, StaticFileProviderFactory, StaticFileWriter, StatsReader, }; +use reth_stages::StageId; use std::path::{Path, PathBuf}; use tracing::{debug, error, info, trace}; diff --git a/bin/reth/src/commands/stage/drop.rs b/bin/reth/src/commands/stage/drop.rs index 7f9453a24..8297eafef 100644 --- a/bin/reth/src/commands/stage/drop.rs +++ b/bin/reth/src/commands/stage/drop.rs @@ -10,8 +10,9 @@ use itertools::Itertools; use reth_db::{static_file::iter_static_files, tables, DatabaseEnv}; use reth_db_api::transaction::DbTxMut; use reth_db_common::init::{insert_genesis_header, insert_genesis_history, insert_genesis_state}; -use reth_primitives::{stage::StageId, static_file::find_fixed_range, StaticFileSegment}; +use reth_primitives::{static_file::find_fixed_range, StaticFileSegment}; use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory}; +use reth_stages::StageId; /// `reth drop-stage` command #[derive(Debug, Parser)] diff --git a/bin/reth/src/commands/stage/dump/execution.rs b/bin/reth/src/commands/stage/dump/execution.rs index dd9165a4b..b6d6721dc 100644 --- a/bin/reth/src/commands/stage/dump/execution.rs +++ b/bin/reth/src/commands/stage/dump/execution.rs @@ -5,9 +5,8 @@ use reth_db_api::{ cursor::DbCursorRO, database::Database, table::TableImporter, transaction::DbTx, }; use reth_node_core::dirs::{ChainPath, DataDirPath}; -use reth_primitives::stage::StageCheckpoint; use reth_provider::{providers::StaticFileProvider, ChainSpecProvider, ProviderFactory}; -use reth_stages::{stages::ExecutionStage, Stage, UnwindInput}; +use reth_stages::{stages::ExecutionStage, Stage, StageCheckpoint, UnwindInput}; use tracing::info; pub(crate) async fn dump_execution_stage( diff --git a/bin/reth/src/commands/stage/dump/hashing_account.rs b/bin/reth/src/commands/stage/dump/hashing_account.rs index ab5d4fffc..2e50a8ad6 100644 --- a/bin/reth/src/commands/stage/dump/hashing_account.rs +++ b/bin/reth/src/commands/stage/dump/hashing_account.rs @@ -4,9 +4,9 @@ use eyre::Result; use reth_db::{tables, DatabaseEnv}; use reth_db_api::{database::Database, table::TableImporter}; use reth_node_core::dirs::{ChainPath, DataDirPath}; -use reth_primitives::{stage::StageCheckpoint, BlockNumber}; +use reth_primitives::BlockNumber; use reth_provider::{providers::StaticFileProvider, ProviderFactory}; -use reth_stages::{stages::AccountHashingStage, Stage, UnwindInput}; +use reth_stages::{stages::AccountHashingStage, Stage, StageCheckpoint, UnwindInput}; use tracing::info; pub(crate) async fn dump_hashing_account_stage( diff --git a/bin/reth/src/commands/stage/dump/hashing_storage.rs b/bin/reth/src/commands/stage/dump/hashing_storage.rs index c2677d47d..1dfd722f5 100644 --- a/bin/reth/src/commands/stage/dump/hashing_storage.rs +++ b/bin/reth/src/commands/stage/dump/hashing_storage.rs @@ -4,9 +4,8 @@ use eyre::Result; use reth_db::{tables, DatabaseEnv}; use reth_db_api::{database::Database, table::TableImporter}; use reth_node_core::dirs::{ChainPath, DataDirPath}; -use reth_primitives::stage::StageCheckpoint; use reth_provider::{providers::StaticFileProvider, ProviderFactory}; -use reth_stages::{stages::StorageHashingStage, Stage, UnwindInput}; +use reth_stages::{stages::StorageHashingStage, Stage, StageCheckpoint, UnwindInput}; use tracing::info; pub(crate) async fn dump_hashing_storage_stage( diff --git a/bin/reth/src/commands/stage/dump/merkle.rs b/bin/reth/src/commands/stage/dump/merkle.rs index 349a06b50..fa345bb47 100644 --- a/bin/reth/src/commands/stage/dump/merkle.rs +++ b/bin/reth/src/commands/stage/dump/merkle.rs @@ -6,7 +6,7 @@ use reth_db::{tables, DatabaseEnv}; use reth_db_api::{database::Database, table::TableImporter}; use reth_exex::ExExManagerHandle; use reth_node_core::dirs::{ChainPath, DataDirPath}; -use reth_primitives::{stage::StageCheckpoint, BlockNumber}; +use reth_primitives::BlockNumber; use reth_provider::{providers::StaticFileProvider, ProviderFactory}; use reth_prune_types::PruneModes; use reth_stages::{ @@ -14,7 +14,7 @@ use reth_stages::{ AccountHashingStage, ExecutionStage, ExecutionStageThresholds, MerkleStage, StorageHashingStage, MERKLE_STAGE_DEFAULT_CLEAN_THRESHOLD, }, - Stage, UnwindInput, + Stage, StageCheckpoint, UnwindInput, }; use tracing::info; diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index 5fd4af084..0ff6f766c 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -1385,7 +1385,6 @@ mod tests { keccak256, proofs::{calculate_transaction_root, state_root_unhashed}, revm_primitives::AccountInfo, - stage::StageCheckpoint, Account, Address, ChainSpecBuilder, Genesis, GenesisAccount, Header, Signature, Transaction, TransactionSigned, TransactionSignedEcRecovered, TxEip1559, Withdrawals, B256, MAINNET, @@ -1394,6 +1393,7 @@ mod tests { test_utils::{blocks::BlockchainTestData, create_test_provider_factory_with_chain_spec}, ProviderFactory, }; + use reth_stages_api::StageCheckpoint; use reth_trie::StateRoot; use std::collections::HashMap; diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 5a934144d..2badb73f4 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -16,9 +16,8 @@ use reth_payload_builder::PayloadBuilderHandle; use reth_payload_primitives::{PayloadAttributes, PayloadBuilderAttributes}; use reth_payload_validator::ExecutionPayloadValidator; use reth_primitives::{ - constants::EPOCH_SLOTS, - stage::{PipelineTarget, StageId}, - BlockNumHash, BlockNumber, Head, Header, SealedBlock, SealedHeader, B256, + constants::EPOCH_SLOTS, BlockNumHash, BlockNumber, Head, Header, SealedBlock, SealedHeader, + B256, }; use reth_provider::{ BlockIdReader, BlockReader, BlockSource, CanonChainTracker, ChainSpecProvider, ProviderError, @@ -28,7 +27,7 @@ use reth_rpc_types::engine::{ CancunPayloadFields, ExecutionPayload, ForkchoiceState, PayloadStatus, PayloadStatusEnum, PayloadValidationError, }; -use reth_stages_api::{ControlFlow, Pipeline}; +use reth_stages_api::{ControlFlow, Pipeline, PipelineTarget, StageId}; use reth_tasks::TaskSpawner; use reth_tokio_util::EventSender; use std::{ @@ -1985,11 +1984,12 @@ mod tests { BeaconForkChoiceUpdateError, }; use assert_matches::assert_matches; - use reth_primitives::{stage::StageCheckpoint, ChainSpecBuilder, MAINNET}; + use reth_primitives::{ChainSpecBuilder, MAINNET}; use reth_provider::{BlockWriter, ProviderFactory}; use reth_rpc_types::engine::{ForkchoiceState, ForkchoiceUpdated, PayloadStatus}; use reth_rpc_types_compat::engine::payload::block_to_payload_v1; use reth_stages::{ExecOutput, PipelineError, StageError}; + use reth_stages_api::StageCheckpoint; use reth_testing_utils::generators::{self, Rng}; use std::{collections::VecDeque, sync::Arc}; use tokio::sync::oneshot::error::TryRecvError; diff --git a/crates/consensus/beacon/src/engine/sync.rs b/crates/consensus/beacon/src/engine/sync.rs index 74c6ea118..498c59ac6 100644 --- a/crates/consensus/beacon/src/engine/sync.rs +++ b/crates/consensus/beacon/src/engine/sync.rs @@ -11,8 +11,8 @@ use reth_network_p2p::{ full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient}, headers::client::HeadersClient, }; -use reth_primitives::{stage::PipelineTarget, BlockNumber, ChainSpec, SealedBlock, B256}; -use reth_stages_api::{ControlFlow, Pipeline, PipelineError, PipelineWithResult}; +use reth_primitives::{BlockNumber, ChainSpec, SealedBlock, B256}; +use reth_stages_api::{ControlFlow, Pipeline, PipelineError, PipelineTarget, PipelineWithResult}; use reth_tasks::TaskSpawner; use reth_tokio_util::EventSender; use std::{ @@ -431,14 +431,15 @@ mod tests { use reth_db::{mdbx::DatabaseEnv, test_utils::TempDatabase}; use reth_network_p2p::{either::Either, test_utils::TestFullBlockClient}; use reth_primitives::{ - constants::ETHEREUM_BLOCK_GAS_LIMIT, stage::StageCheckpoint, BlockBody, ChainSpecBuilder, - Header, SealedHeader, MAINNET, + constants::ETHEREUM_BLOCK_GAS_LIMIT, BlockBody, ChainSpecBuilder, Header, SealedHeader, + MAINNET, }; use reth_provider::{ test_utils::create_test_provider_factory_with_chain_spec, BundleStateWithReceipts, }; use reth_prune_types::PruneModes; use reth_stages::{test_utils::TestStages, ExecOutput, StageError}; + use reth_stages_api::StageCheckpoint; use reth_static_file::StaticFileProducer; use reth_tasks::TokioTaskExecutor; use std::{collections::VecDeque, future::poll_fn, ops::Range}; diff --git a/crates/e2e-test-utils/Cargo.toml b/crates/e2e-test-utils/Cargo.toml index 19fafd553..77a5676ab 100644 --- a/crates/e2e-test-utils/Cargo.toml +++ b/crates/e2e-test-utils/Cargo.toml @@ -19,6 +19,7 @@ reth-payload-builder = { workspace = true, features = ["test-utils"] } reth-provider.workspace = true reth-node-builder.workspace = true reth-tokio-util.workspace = true +reth-stages-types.workspace = true jsonrpsee.workspace = true diff --git a/crates/e2e-test-utils/src/node.rs b/crates/e2e-test-utils/src/node.rs index 0ae20664a..5c09f09d7 100644 --- a/crates/e2e-test-utils/src/node.rs +++ b/crates/e2e-test-utils/src/node.rs @@ -13,7 +13,8 @@ use reth::{ rpc::types::engine::PayloadStatusEnum, }; use reth_node_builder::NodeTypes; -use reth_primitives::{stage::StageId, BlockHash, BlockNumber, Bytes, B256}; +use reth_primitives::{BlockHash, BlockNumber, Bytes, B256}; +use reth_stages_types::StageId; use std::{marker::PhantomData, pin::Pin}; use tokio_stream::StreamExt; diff --git a/crates/node-core/Cargo.toml b/crates/node-core/Cargo.toml index 1d1b9e0c0..27271cdc4 100644 --- a/crates/node-core/Cargo.toml +++ b/crates/node-core/Cargo.toml @@ -36,6 +36,7 @@ reth-tasks.workspace = true reth-consensus-common.workspace = true reth-beacon-consensus.workspace = true reth-prune-types.workspace = true +reth-stages-types.workspace = true # ethereum alloy-rpc-types-engine.workspace = true diff --git a/crates/node-core/src/node_config.rs b/crates/node-core/src/node_config.rs index 639d68f38..b8b1ebc8b 100644 --- a/crates/node-core/src/node_config.rs +++ b/crates/node-core/src/node_config.rs @@ -15,13 +15,14 @@ use reth_config::config::PruneConfig; use reth_db_api::{database::Database, database_metrics::DatabaseMetrics}; use reth_network_p2p::headers::client::HeadersClient; use reth_primitives::{ - constants::eip4844::MAINNET_KZG_TRUSTED_SETUP, kzg::KzgSettings, stage::StageId, - BlockHashOrNumber, BlockNumber, ChainSpec, Head, SealedHeader, B256, MAINNET, + constants::eip4844::MAINNET_KZG_TRUSTED_SETUP, kzg::KzgSettings, BlockHashOrNumber, + BlockNumber, ChainSpec, Head, SealedHeader, B256, MAINNET, }; use reth_provider::{ providers::StaticFileProvider, BlockHashReader, HeaderProvider, ProviderFactory, StageCheckpointReader, }; +use reth_stages_types::StageId; use reth_storage_errors::provider::ProviderResult; use reth_tasks::TaskExecutor; use std::{net::SocketAddr, path::PathBuf, sync::Arc}; diff --git a/crates/node/builder/src/launch/common.rs b/crates/node/builder/src/launch/common.rs index 4892bb317..395e5e19e 100644 --- a/crates/node/builder/src/launch/common.rs +++ b/crates/node/builder/src/launch/common.rs @@ -15,14 +15,14 @@ use reth_node_core::{ dirs::{ChainPath, DataDirPath}, node_config::NodeConfig, }; -use reth_primitives::{stage::PipelineTarget, BlockNumber, Chain, ChainSpec, Head, B256}; +use reth_primitives::{BlockNumber, Chain, ChainSpec, Head, B256}; use reth_provider::{ providers::StaticFileProvider, HeaderSyncMode, ProviderFactory, StaticFileProviderFactory, }; use reth_prune::{PruneModes, PrunerBuilder}; use reth_rpc_builder::config::RethRpcServerConfig; use reth_rpc_layer::JwtSecret; -use reth_stages::{sets::DefaultStages, Pipeline}; +use reth_stages::{sets::DefaultStages, Pipeline, PipelineTarget}; use reth_static_file::StaticFileProducer; use reth_tasks::TaskExecutor; use reth_tracing::tracing::{debug, error, info, warn}; diff --git a/crates/node/events/src/node.rs b/crates/node/events/src/node.rs index 21c07ebe6..1fc62a9b6 100644 --- a/crates/node/events/src/node.rs +++ b/crates/node/events/src/node.rs @@ -8,14 +8,10 @@ use reth_beacon_consensus::{ use reth_db_api::{database::Database, database_metrics::DatabaseMetadata}; use reth_network::{NetworkEvent, NetworkHandle}; use reth_network_api::PeersInfo; -use reth_primitives::{ - constants, - stage::{EntitiesCheckpoint, StageCheckpoint, StageId}, - BlockNumber, B256, -}; +use reth_primitives::{constants, BlockNumber, B256}; use reth_prune::PrunerEvent; use reth_rpc_types::engine::ForkchoiceState; -use reth_stages::{ExecOutput, PipelineEvent}; +use reth_stages::{EntitiesCheckpoint, ExecOutput, PipelineEvent, StageCheckpoint, StageId}; use reth_static_file::StaticFileProducerEvent; use std::{ fmt::{Display, Formatter}, diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index eb02acc02..d9cb4d326 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -39,7 +39,6 @@ mod receipt; mod request; /// Helpers for working with revm pub mod revm; -pub mod stage; pub use reth_static_file_types as static_file; mod storage; pub mod transaction; diff --git a/crates/stages/api/Cargo.toml b/crates/stages/api/Cargo.toml index e7b6ca70b..cb58818b5 100644 --- a/crates/stages/api/Cargo.toml +++ b/crates/stages/api/Cargo.toml @@ -21,6 +21,7 @@ reth-tokio-util.workspace = true reth-consensus.workspace = true reth-prune.workspace = true reth-errors.workspace = true +reth-stages-types.workspace = true # metrics reth-metrics.workspace = true diff --git a/crates/stages/api/src/lib.rs b/crates/stages/api/src/lib.rs index 084680ce4..ec01876c9 100644 --- a/crates/stages/api/src/lib.rs +++ b/crates/stages/api/src/lib.rs @@ -26,3 +26,6 @@ pub use pipeline::*; pub use stage::*; use aquamarine as _; + +// re-export the stages types for convenience +pub use reth_stages_types::*; diff --git a/crates/stages/api/src/metrics/listener.rs b/crates/stages/api/src/metrics/listener.rs index d92e157ba..408ecab4a 100644 --- a/crates/stages/api/src/metrics/listener.rs +++ b/crates/stages/api/src/metrics/listener.rs @@ -1,9 +1,5 @@ -use crate::metrics::SyncMetrics; -use reth_primitives::{ - constants::MGAS_TO_GAS, - stage::{StageCheckpoint, StageId}, - BlockNumber, -}; +use crate::{metrics::SyncMetrics, StageCheckpoint, StageId}; +use reth_primitives::{constants::MGAS_TO_GAS, BlockNumber}; use std::{ future::Future, pin::Pin, diff --git a/crates/stages/api/src/metrics/sync_metrics.rs b/crates/stages/api/src/metrics/sync_metrics.rs index 3548f6d91..3ee2964ea 100644 --- a/crates/stages/api/src/metrics/sync_metrics.rs +++ b/crates/stages/api/src/metrics/sync_metrics.rs @@ -1,8 +1,8 @@ +use crate::StageId; use reth_metrics::{ metrics::{Counter, Gauge}, Metrics, }; -use reth_primitives::stage::StageId; use std::collections::HashMap; #[derive(Debug, Default)] diff --git a/crates/stages/api/src/pipeline/builder.rs b/crates/stages/api/src/pipeline/builder.rs index 317f7a512..ada5ffd37 100644 --- a/crates/stages/api/src/pipeline/builder.rs +++ b/crates/stages/api/src/pipeline/builder.rs @@ -1,6 +1,6 @@ -use crate::{pipeline::BoxedStage, MetricEventsSender, Pipeline, Stage, StageSet}; +use crate::{pipeline::BoxedStage, MetricEventsSender, Pipeline, Stage, StageId, StageSet}; use reth_db_api::database::Database; -use reth_primitives::{stage::StageId, BlockNumber, B256}; +use reth_primitives::{BlockNumber, B256}; use reth_provider::ProviderFactory; use reth_static_file::StaticFileProducer; use tokio::sync::watch; diff --git a/crates/stages/api/src/pipeline/event.rs b/crates/stages/api/src/pipeline/event.rs index 1dd761d3f..9bbaaa79b 100644 --- a/crates/stages/api/src/pipeline/event.rs +++ b/crates/stages/api/src/pipeline/event.rs @@ -1,8 +1,8 @@ -use crate::stage::{ExecOutput, UnwindInput, UnwindOutput}; -use reth_primitives::{ - stage::{StageCheckpoint, StageId}, - BlockNumber, +use crate::{ + stage::{ExecOutput, UnwindInput, UnwindOutput}, + StageCheckpoint, StageId, }; +use reth_primitives::BlockNumber; use std::fmt::{Display, Formatter}; /// An event emitted by a [Pipeline][crate::Pipeline]. diff --git a/crates/stages/api/src/pipeline/mod.rs b/crates/stages/api/src/pipeline/mod.rs index cc318a132..2b7fcf6cb 100644 --- a/crates/stages/api/src/pipeline/mod.rs +++ b/crates/stages/api/src/pipeline/mod.rs @@ -1,14 +1,13 @@ mod ctrl; mod event; pub use crate::pipeline::ctrl::ControlFlow; +use crate::{PipelineTarget, StageCheckpoint, StageId}; pub use event::*; use futures_util::Future; use reth_db_api::database::Database; use reth_primitives::{ - constants::BEACON_CONSENSUS_REORG_UNWIND_DEPTH, - stage::{PipelineTarget, StageCheckpoint, StageId}, - static_file::HighestStaticFiles, - BlockNumber, B256, + constants::BEACON_CONSENSUS_REORG_UNWIND_DEPTH, static_file::HighestStaticFiles, BlockNumber, + B256, }; use reth_provider::{ providers::StaticFileWriter, FinalizedBlockReader, FinalizedBlockWriter, ProviderFactory, diff --git a/crates/stages/api/src/pipeline/set.rs b/crates/stages/api/src/pipeline/set.rs index af644652f..527d9a99a 100644 --- a/crates/stages/api/src/pipeline/set.rs +++ b/crates/stages/api/src/pipeline/set.rs @@ -1,6 +1,5 @@ -use crate::Stage; +use crate::{Stage, StageId}; use reth_db_api::database::Database; -use reth_primitives::stage::StageId; use std::{ collections::HashMap, fmt::{Debug, Formatter}, diff --git a/crates/stages/api/src/stage.rs b/crates/stages/api/src/stage.rs index f5e431cd0..381acf5f2 100644 --- a/crates/stages/api/src/stage.rs +++ b/crates/stages/api/src/stage.rs @@ -1,9 +1,6 @@ -use crate::error::StageError; +use crate::{error::StageError, StageCheckpoint, StageId}; use reth_db_api::database::Database; -use reth_primitives::{ - stage::{StageCheckpoint, StageId}, - BlockNumber, TxNumber, -}; +use reth_primitives::{BlockNumber, TxNumber}; use reth_provider::{BlockReader, DatabaseProviderRW, ProviderError, TransactionsProvider}; use std::{ cmp::{max, min}, diff --git a/crates/stages/api/src/test_utils.rs b/crates/stages/api/src/test_utils.rs index e2844799e..1495c54b0 100644 --- a/crates/stages/api/src/test_utils.rs +++ b/crates/stages/api/src/test_utils.rs @@ -1,8 +1,7 @@ #![allow(missing_docs)] -use crate::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput}; +use crate::{ExecInput, ExecOutput, Stage, StageError, StageId, UnwindInput, UnwindOutput}; use reth_db_api::database::Database; -use reth_primitives::stage::StageId; use reth_provider::DatabaseProviderRW; use std::collections::VecDeque; diff --git a/crates/stages/stages/benches/criterion.rs b/crates/stages/stages/benches/criterion.rs index 976723dcd..0e1343755 100644 --- a/crates/stages/stages/benches/criterion.rs +++ b/crates/stages/stages/benches/criterion.rs @@ -5,10 +5,11 @@ use pprof::criterion::{Output, PProfProfiler}; use reth_config::config::{EtlConfig, TransactionLookupConfig}; use reth_db::{test_utils::TempDatabase, DatabaseEnv}; -use reth_primitives::{stage::StageCheckpoint, BlockNumber}; +use reth_primitives::BlockNumber; use reth_stages::{ stages::{MerkleStage, SenderRecoveryStage, TransactionLookupStage}, test_utils::TestStageDB, + StageCheckpoint, }; use reth_stages_api::{ExecInput, Stage, StageExt, UnwindInput}; use std::{ops::RangeInclusive, sync::Arc}; diff --git a/crates/stages/stages/benches/setup/account_hashing.rs b/crates/stages/stages/benches/setup/account_hashing.rs index d3d62dda4..86831418e 100644 --- a/crates/stages/stages/benches/setup/account_hashing.rs +++ b/crates/stages/stages/benches/setup/account_hashing.rs @@ -5,10 +5,11 @@ use reth_db::tables; use reth_db_api::{ cursor::DbCursorRO, database::Database, transaction::DbTx, DatabaseError as DbError, }; -use reth_primitives::{stage::StageCheckpoint, BlockNumber}; +use reth_primitives::BlockNumber; use reth_stages::{ stages::{AccountHashingStage, SeedOpts}, test_utils::TestStageDB, + StageCheckpoint, }; use std::{fs, ops::RangeInclusive, path::Path}; diff --git a/crates/stages/stages/src/stages/bodies.rs b/crates/stages/stages/src/stages/bodies.rs index 7c9ced8e4..454ee50bb 100644 --- a/crates/stages/stages/src/stages/bodies.rs +++ b/crates/stages/stages/src/stages/bodies.rs @@ -14,17 +14,15 @@ use reth_db_api::{ transaction::DbTxMut, }; use reth_network_p2p::bodies::{downloader::BodyDownloader, response::BlockResponse}; -use reth_primitives::{ - stage::{EntitiesCheckpoint, StageCheckpoint, StageId}, - StaticFileSegment, TxNumber, -}; +use reth_primitives::{StaticFileSegment, TxNumber}; use reth_provider::{ providers::{StaticFileProvider, StaticFileWriter}, BlockReader, DatabaseProviderRW, HeaderProvider, ProviderError, StatsReader, }; -use reth_stages_api::{ExecInput, ExecOutput, StageError, UnwindInput, UnwindOutput}; - -use reth_stages_api::Stage; +use reth_stages_api::{ + EntitiesCheckpoint, ExecInput, ExecOutput, Stage, StageCheckpoint, StageError, StageId, + UnwindInput, UnwindOutput, +}; use reth_storage_errors::provider::ProviderResult; // TODO(onbjerg): Metrics and events (gradual status for e.g. CLI) @@ -397,8 +395,8 @@ fn stage_checkpoint( mod tests { use assert_matches::assert_matches; - use reth_primitives::stage::StageUnitCheckpoint; use reth_provider::StaticFileProviderFactory; + use reth_stages_api::StageUnitCheckpoint; use test_utils::*; use crate::test_utils::{ diff --git a/crates/stages/stages/src/stages/execution.rs b/crates/stages/stages/src/stages/execution.rs index 373c7993d..4a7624285 100644 --- a/crates/stages/stages/src/stages/execution.rs +++ b/crates/stages/stages/src/stages/execution.rs @@ -5,12 +5,7 @@ use reth_db::{static_file::HeaderMask, tables}; use reth_db_api::{cursor::DbCursorRO, database::Database, transaction::DbTx}; use reth_evm::execute::{BatchExecutor, BlockExecutorProvider}; use reth_exex::{ExExManagerHandle, ExExNotification}; -use reth_primitives::{ - stage::{ - CheckpointBlockRange, EntitiesCheckpoint, ExecutionCheckpoint, StageCheckpoint, StageId, - }, - BlockNumber, Header, StaticFileSegment, -}; +use reth_primitives::{BlockNumber, Header, StaticFileSegment}; use reth_provider::{ providers::{StaticFileProvider, StaticFileProviderRWRefMut, StaticFileWriter}, BlockReader, BundleStateWithReceipts, Chain, DatabaseProviderRW, HeaderProvider, @@ -20,8 +15,9 @@ use reth_provider::{ use reth_prune_types::PruneModes; use reth_revm::database::StateProviderDatabase; use reth_stages_api::{ - BlockErrorKind, ExecInput, ExecOutput, MetricEvent, MetricEventsSender, Stage, StageError, - UnwindInput, UnwindOutput, + BlockErrorKind, CheckpointBlockRange, EntitiesCheckpoint, ExecInput, ExecOutput, + ExecutionCheckpoint, MetricEvent, MetricEventsSender, Stage, StageCheckpoint, StageError, + StageId, UnwindInput, UnwindOutput, }; use std::{ cmp::Ordering, @@ -713,14 +709,15 @@ mod tests { use reth_evm_ethereum::execute::EthExecutorProvider; use reth_execution_errors::BlockValidationError; use reth_primitives::{ - address, hex_literal::hex, keccak256, stage::StageUnitCheckpoint, Account, Address, - Bytecode, ChainSpecBuilder, SealedBlock, StorageEntry, B256, U256, + address, hex_literal::hex, keccak256, Account, Address, Bytecode, ChainSpecBuilder, + SealedBlock, StorageEntry, B256, U256, }; use reth_provider::{ test_utils::create_test_provider_factory, AccountReader, ReceiptProvider, StaticFileProviderFactory, }; use reth_prune_types::{PruneMode, ReceiptsLogPruneConfig}; + use reth_stages_api::StageUnitCheckpoint; use std::collections::BTreeMap; fn stage() -> ExecutionStage { diff --git a/crates/stages/stages/src/stages/finish.rs b/crates/stages/stages/src/stages/finish.rs index bfc2fc91d..9eb3a6d76 100644 --- a/crates/stages/stages/src/stages/finish.rs +++ b/crates/stages/stages/src/stages/finish.rs @@ -1,7 +1,8 @@ use reth_db_api::database::Database; -use reth_primitives::stage::{StageCheckpoint, StageId}; use reth_provider::DatabaseProviderRW; -use reth_stages_api::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput}; +use reth_stages_api::{ + ExecInput, ExecOutput, Stage, StageCheckpoint, StageError, StageId, UnwindInput, UnwindOutput, +}; /// The finish stage. /// diff --git a/crates/stages/stages/src/stages/hashing_account.rs b/crates/stages/stages/src/stages/hashing_account.rs index 4ded60a3d..fe8bc8547 100644 --- a/crates/stages/stages/src/stages/hashing_account.rs +++ b/crates/stages/stages/src/stages/hashing_account.rs @@ -7,13 +7,12 @@ use reth_db_api::{ transaction::{DbTx, DbTxMut}, }; use reth_etl::Collector; -use reth_primitives::{ - keccak256, - stage::{AccountHashingCheckpoint, EntitiesCheckpoint, StageCheckpoint, StageId}, - Account, B256, -}; +use reth_primitives::{keccak256, Account, B256}; use reth_provider::{AccountExtReader, DatabaseProviderRW, HashingWriter, StatsReader}; -use reth_stages_api::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput}; +use reth_stages_api::{ + AccountHashingCheckpoint, EntitiesCheckpoint, ExecInput, ExecOutput, Stage, StageCheckpoint, + StageError, StageId, UnwindInput, UnwindOutput, +}; use reth_storage_errors::provider::ProviderResult; use std::{ fmt::Debug, @@ -296,8 +295,9 @@ mod tests { UnwindStageTestRunner, }; use assert_matches::assert_matches; - use reth_primitives::{stage::StageUnitCheckpoint, Account, U256}; + use reth_primitives::{Account, U256}; use reth_provider::providers::StaticFileWriter; + use reth_stages_api::StageUnitCheckpoint; use test_utils::*; stage_test_suite_ext!(AccountHashingTestRunner, account_hashing); diff --git a/crates/stages/stages/src/stages/hashing_storage.rs b/crates/stages/stages/src/stages/hashing_storage.rs index 77374fb0b..662f1d1a7 100644 --- a/crates/stages/stages/src/stages/hashing_storage.rs +++ b/crates/stages/stages/src/stages/hashing_storage.rs @@ -9,13 +9,12 @@ use reth_db_api::{ transaction::{DbTx, DbTxMut}, }; use reth_etl::Collector; -use reth_primitives::{ - keccak256, - stage::{EntitiesCheckpoint, StageCheckpoint, StageId, StorageHashingCheckpoint}, - BufMut, StorageEntry, B256, -}; +use reth_primitives::{keccak256, BufMut, StorageEntry, B256}; use reth_provider::{DatabaseProviderRW, HashingWriter, StatsReader, StorageReader}; -use reth_stages_api::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput}; +use reth_stages_api::{ + EntitiesCheckpoint, ExecInput, ExecOutput, Stage, StageCheckpoint, StageError, StageId, + StorageHashingCheckpoint, UnwindInput, UnwindOutput, +}; use reth_storage_errors::provider::ProviderResult; use std::{ fmt::Debug, diff --git a/crates/stages/stages/src/stages/headers.rs b/crates/stages/stages/src/stages/headers.rs index fbd956eb7..89b4fe318 100644 --- a/crates/stages/stages/src/stages/headers.rs +++ b/crates/stages/stages/src/stages/headers.rs @@ -10,19 +10,15 @@ use reth_db_api::{ }; use reth_etl::Collector; use reth_network_p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError}; -use reth_primitives::{ - stage::{ - CheckpointBlockRange, EntitiesCheckpoint, HeadersCheckpoint, StageCheckpoint, StageId, - }, - BlockHash, BlockNumber, SealedHeader, StaticFileSegment, -}; +use reth_primitives::{BlockHash, BlockNumber, SealedHeader, StaticFileSegment}; use reth_provider::{ providers::{StaticFileProvider, StaticFileWriter}, BlockHashReader, DatabaseProviderRW, HeaderProvider, HeaderSyncGap, HeaderSyncGapProvider, HeaderSyncMode, }; use reth_stages_api::{ - BlockErrorKind, ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput, + BlockErrorKind, CheckpointBlockRange, EntitiesCheckpoint, ExecInput, ExecOutput, + HeadersCheckpoint, Stage, StageCheckpoint, StageError, StageId, UnwindInput, UnwindOutput, }; use reth_storage_errors::provider::ProviderError; use std::{ @@ -380,12 +376,11 @@ mod tests { stage_test_suite, ExecuteStageTestRunner, StageTestRunner, UnwindStageTestRunner, }; use assert_matches::assert_matches; - use reth_primitives::{ - stage::StageUnitCheckpoint, BlockBody, SealedBlock, SealedBlockWithSenders, B256, - }; + use reth_primitives::{BlockBody, SealedBlock, SealedBlockWithSenders, B256}; use reth_provider::{ BlockWriter, BundleStateWithReceipts, ProviderFactory, StaticFileProviderFactory, }; + use reth_stages_api::StageUnitCheckpoint; use reth_testing_utils::generators::{self, random_header, random_header_range}; use reth_trie::{updates::TrieUpdates, HashedPostState}; use test_runner::HeadersTestRunner; diff --git a/crates/stages/stages/src/stages/index_account_history.rs b/crates/stages/stages/src/stages/index_account_history.rs index d4c77bd24..7f8318527 100644 --- a/crates/stages/stages/src/stages/index_account_history.rs +++ b/crates/stages/stages/src/stages/index_account_history.rs @@ -2,15 +2,14 @@ use super::{collect_history_indices, load_history_indices}; use reth_config::config::{EtlConfig, IndexHistoryConfig}; use reth_db::tables; use reth_db_api::{database::Database, models::ShardedKey, table::Decode, transaction::DbTxMut}; -use reth_primitives::{ - stage::{StageCheckpoint, StageId}, - Address, -}; +use reth_primitives::Address; use reth_provider::{ DatabaseProviderRW, HistoryWriter, PruneCheckpointReader, PruneCheckpointWriter, }; use reth_prune_types::{PruneCheckpoint, PruneMode, PrunePurpose, PruneSegment}; -use reth_stages_api::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput}; +use reth_stages_api::{ + ExecInput, ExecOutput, Stage, StageCheckpoint, StageError, StageId, UnwindInput, UnwindOutput, +}; use std::fmt::Debug; use tracing::info; diff --git a/crates/stages/stages/src/stages/index_storage_history.rs b/crates/stages/stages/src/stages/index_storage_history.rs index 5fcbe1fb4..23332f2d6 100644 --- a/crates/stages/stages/src/stages/index_storage_history.rs +++ b/crates/stages/stages/src/stages/index_storage_history.rs @@ -1,4 +1,5 @@ use super::{collect_history_indices, load_history_indices}; +use crate::{StageCheckpoint, StageId}; use reth_config::config::{EtlConfig, IndexHistoryConfig}; use reth_db::tables; use reth_db_api::{ @@ -7,7 +8,6 @@ use reth_db_api::{ table::Decode, transaction::DbTxMut, }; -use reth_primitives::stage::{StageCheckpoint, StageId}; use reth_provider::{ DatabaseProviderRW, HistoryWriter, PruneCheckpointReader, PruneCheckpointWriter, }; diff --git a/crates/stages/stages/src/stages/merkle.rs b/crates/stages/stages/src/stages/merkle.rs index defe24894..885fc86c5 100644 --- a/crates/stages/stages/src/stages/merkle.rs +++ b/crates/stages/stages/src/stages/merkle.rs @@ -5,16 +5,14 @@ use reth_db_api::{ database::Database, transaction::{DbTx, DbTxMut}, }; -use reth_primitives::{ - stage::{EntitiesCheckpoint, MerkleCheckpoint, StageCheckpoint, StageId}, - BlockNumber, GotExpected, SealedHeader, B256, -}; +use reth_primitives::{BlockNumber, GotExpected, SealedHeader, B256}; use reth_provider::{ DatabaseProviderRW, HeaderProvider, ProviderError, StageCheckpointReader, StageCheckpointWriter, StatsReader, }; use reth_stages_api::{ - BlockErrorKind, ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput, + BlockErrorKind, EntitiesCheckpoint, ExecInput, ExecOutput, MerkleCheckpoint, Stage, + StageCheckpoint, StageError, StageId, UnwindInput, UnwindOutput, }; use reth_trie::{IntermediateStateRootState, StateRoot, StateRootProgress, StoredSubNode}; use std::fmt::Debug; @@ -367,10 +365,9 @@ mod tests { }; use assert_matches::assert_matches; use reth_db_api::cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}; - use reth_primitives::{ - keccak256, stage::StageUnitCheckpoint, SealedBlock, StaticFileSegment, StorageEntry, U256, - }; + use reth_primitives::{keccak256, SealedBlock, StaticFileSegment, StorageEntry, U256}; use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory}; + use reth_stages_api::StageUnitCheckpoint; use reth_testing_utils::{ generators, generators::{ diff --git a/crates/stages/stages/src/stages/mod.rs b/crates/stages/stages/src/stages/mod.rs index c1a8666be..1f7ae1e9b 100644 --- a/crates/stages/stages/src/stages/mod.rs +++ b/crates/stages/stages/src/stages/mod.rs @@ -56,12 +56,8 @@ mod tests { use reth_evm_ethereum::execute::EthExecutorProvider; use reth_exex::ExExManagerHandle; use reth_primitives::{ - address, - hex_literal::hex, - keccak256, - stage::{PipelineTarget, StageCheckpoint, StageId}, - Account, BlockNumber, Bytecode, ChainSpecBuilder, SealedBlock, StaticFileSegment, B256, - U256, + address, hex_literal::hex, keccak256, Account, BlockNumber, Bytecode, ChainSpecBuilder, + SealedBlock, StaticFileSegment, B256, U256, }; use reth_provider::{ providers::StaticFileWriter, AccountExtReader, BlockReader, DatabaseProviderFactory, @@ -69,7 +65,7 @@ mod tests { StaticFileProviderFactory, StorageReader, }; use reth_prune_types::{PruneMode, PruneModes}; - use reth_stages_api::{ExecInput, Stage}; + use reth_stages_api::{ExecInput, PipelineTarget, Stage, StageCheckpoint, StageId}; use reth_testing_utils::generators::{self, random_block, random_block_range, random_receipt}; use std::{io::Write, sync::Arc}; diff --git a/crates/stages/stages/src/stages/sender_recovery.rs b/crates/stages/stages/src/stages/sender_recovery.rs index a60f6bc52..41df7795c 100644 --- a/crates/stages/stages/src/stages/sender_recovery.rs +++ b/crates/stages/stages/src/stages/sender_recovery.rs @@ -6,17 +6,15 @@ use reth_db_api::{ database::Database, transaction::{DbTx, DbTxMut}, }; -use reth_primitives::{ - stage::{EntitiesCheckpoint, StageCheckpoint, StageId}, - Address, StaticFileSegment, TransactionSignedNoHash, TxNumber, -}; +use reth_primitives::{Address, StaticFileSegment, TransactionSignedNoHash, TxNumber}; use reth_provider::{ BlockReader, DatabaseProviderRW, HeaderProvider, ProviderError, PruneCheckpointReader, StatsReader, }; use reth_prune_types::PruneSegment; use reth_stages_api::{ - BlockErrorKind, ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput, + BlockErrorKind, EntitiesCheckpoint, ExecInput, ExecOutput, Stage, StageCheckpoint, StageError, + StageId, UnwindInput, UnwindOutput, }; use std::{fmt::Debug, ops::Range, sync::mpsc}; use thiserror::Error; @@ -282,14 +280,13 @@ struct FailedSenderRecoveryError { mod tests { use assert_matches::assert_matches; use reth_db_api::cursor::DbCursorRO; - use reth_primitives::{ - stage::StageUnitCheckpoint, BlockNumber, SealedBlock, TransactionSigned, B256, - }; + use reth_primitives::{BlockNumber, SealedBlock, TransactionSigned, B256}; use reth_provider::{ providers::StaticFileWriter, PruneCheckpointWriter, StaticFileProviderFactory, TransactionsProvider, }; use reth_prune_types::{PruneCheckpoint, PruneMode}; + use reth_stages_api::StageUnitCheckpoint; use reth_testing_utils::{ generators, generators::{random_block, random_block_range}, diff --git a/crates/stages/stages/src/stages/tx_lookup.rs b/crates/stages/stages/src/stages/tx_lookup.rs index 66fa76810..4cb422e33 100644 --- a/crates/stages/stages/src/stages/tx_lookup.rs +++ b/crates/stages/stages/src/stages/tx_lookup.rs @@ -7,16 +7,16 @@ use reth_db_api::{ transaction::{DbTx, DbTxMut}, }; use reth_etl::Collector; -use reth_primitives::{ - stage::{EntitiesCheckpoint, StageCheckpoint, StageId}, - TxHash, TxNumber, -}; +use reth_primitives::{TxHash, TxNumber}; use reth_provider::{ BlockReader, DatabaseProviderRW, PruneCheckpointReader, PruneCheckpointWriter, StatsReader, TransactionsProvider, TransactionsProviderExt, }; use reth_prune_types::{PruneCheckpoint, PruneMode, PrunePurpose, PruneSegment}; -use reth_stages_api::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput}; +use reth_stages_api::{ + EntitiesCheckpoint, ExecInput, ExecOutput, Stage, StageCheckpoint, StageError, StageId, + UnwindInput, UnwindOutput, +}; use reth_storage_errors::provider::ProviderError; use tracing::*; @@ -242,8 +242,9 @@ mod tests { TestRunnerError, TestStageDB, UnwindStageTestRunner, }; use assert_matches::assert_matches; - use reth_primitives::{stage::StageUnitCheckpoint, BlockNumber, SealedBlock, B256}; + use reth_primitives::{BlockNumber, SealedBlock, B256}; use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory}; + use reth_stages_api::StageUnitCheckpoint; use reth_testing_utils::{ generators, generators::{random_block, random_block_range}, diff --git a/crates/stages/stages/src/test_utils/macros.rs b/crates/stages/stages/src/test_utils/macros.rs index 11fb46cde..90f39e5bb 100644 --- a/crates/stages/stages/src/test_utils/macros.rs +++ b/crates/stages/stages/src/test_utils/macros.rs @@ -36,7 +36,7 @@ macro_rules! stage_test_suite { let mut runner = $runner::default(); let input = reth_stages_api::ExecInput { target: Some(target), - checkpoint: Some(reth_primitives::stage::StageCheckpoint::new(current_checkpoint)), + checkpoint: Some(crate::StageCheckpoint::new(current_checkpoint)), }; let seed = runner.seed_execution(input).expect("failed to seed"); let rx = runner.execute(input); @@ -100,7 +100,7 @@ macro_rules! stage_test_suite { let mut runner = $runner::default(); let execute_input = reth_stages_api::ExecInput { target: Some(target), - checkpoint: Some(reth_primitives::stage::StageCheckpoint::new(current_checkpoint)), + checkpoint: Some(crate::StageCheckpoint::new(current_checkpoint)), }; let seed = runner.seed_execution(execute_input).expect("failed to seed"); @@ -127,7 +127,7 @@ macro_rules! stage_test_suite { // Run stage unwind let unwind_input = reth_stages_api::UnwindInput { unwind_to: current_checkpoint, - checkpoint: reth_primitives::stage::StageCheckpoint::new(target), + checkpoint: crate::StageCheckpoint::new(target), bad_block: None, }; @@ -167,7 +167,7 @@ macro_rules! stage_test_suite_ext { let mut runner = $runner::default(); let input = reth_stages_api::ExecInput { target: Some(current_checkpoint), - checkpoint: Some(reth_primitives::stage::StageCheckpoint::new(current_checkpoint)), + checkpoint: Some(crate::StageCheckpoint::new(current_checkpoint)), }; let seed = runner.seed_execution(input).expect("failed to seed"); diff --git a/crates/stages/stages/src/test_utils/mod.rs b/crates/stages/stages/src/test_utils/mod.rs index 9e6041755..4e5344b22 100644 --- a/crates/stages/stages/src/test_utils/mod.rs +++ b/crates/stages/stages/src/test_utils/mod.rs @@ -1,4 +1,4 @@ -use reth_primitives::stage::StageId; +use reth_stages_api::StageId; #[cfg(test)] mod macros; diff --git a/crates/stages/types/Cargo.toml b/crates/stages/types/Cargo.toml new file mode 100644 index 000000000..ab64a89c9 --- /dev/null +++ b/crates/stages/types/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "reth-stages-types" +version.workspace = true +edition.workspace = true +homepage.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +description = "Commonly used types for stages usage in reth." + +[lints] +workspace = true + +[dependencies] +reth-codecs.workspace = true +reth-trie-types.workspace = true +alloy-primitives.workspace = true + +modular-bitfield.workspace = true +bytes.workspace = true +serde.workspace = true + +[dev-dependencies] +arbitrary = { workspace = true, features = ["derive"] } +proptest.workspace = true +proptest-derive.workspace = true +test-fuzz.workspace = true +rand.workspace = true \ No newline at end of file diff --git a/crates/primitives/src/stage/checkpoints.rs b/crates/stages/types/src/checkpoints.rs similarity index 99% rename from crates/primitives/src/stage/checkpoints.rs rename to crates/stages/types/src/checkpoints.rs index 1ab42c56c..b78751cc6 100644 --- a/crates/primitives/src/stage/checkpoints.rs +++ b/crates/stages/types/src/checkpoints.rs @@ -1,4 +1,4 @@ -use crate::{Address, BlockNumber, B256}; +use alloy_primitives::{Address, BlockNumber, B256}; use bytes::Buf; use reth_codecs::{main_codec, Compact}; use reth_trie_types::{hash_builder::HashBuilderState, StoredSubNode}; diff --git a/crates/primitives/src/stage/id.rs b/crates/stages/types/src/id.rs similarity index 100% rename from crates/primitives/src/stage/id.rs rename to crates/stages/types/src/id.rs diff --git a/crates/primitives/src/stage/mod.rs b/crates/stages/types/src/lib.rs similarity index 76% rename from crates/primitives/src/stage/mod.rs rename to crates/stages/types/src/lib.rs index 6637cb41e..93106bd88 100644 --- a/crates/primitives/src/stage/mod.rs +++ b/crates/stages/types/src/lib.rs @@ -1,7 +1,17 @@ -//! Staged sync primitives. +//! Commonly used types for staged sync usage. + +#![doc( + html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", + html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", + issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" +)] +#![cfg_attr(not(test), warn(unused_crate_dependencies))] +// TODO: remove when https://github.com/proptest-rs/proptest/pull/427 is merged +#![allow(unknown_lints, non_local_definitions)] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] mod id; -use crate::{BlockHash, BlockNumber}; +use alloy_primitives::{BlockHash, BlockNumber}; pub use id::StageId; mod checkpoints; diff --git a/crates/storage/db-api/Cargo.toml b/crates/storage/db-api/Cargo.toml index 7a97075f3..fbbf0ca5d 100644 --- a/crates/storage/db-api/Cargo.toml +++ b/crates/storage/db-api/Cargo.toml @@ -17,6 +17,7 @@ reth-codecs.workspace = true reth-primitives.workspace = true reth-prune-types.workspace = true reth-storage-errors.workspace = true +reth-stages-types.workspace = true reth-trie-types.workspace = true # codecs diff --git a/crates/storage/db-api/src/models/mod.rs b/crates/storage/db-api/src/models/mod.rs index 108095a3c..7438feede 100644 --- a/crates/storage/db-api/src/models/mod.rs +++ b/crates/storage/db-api/src/models/mod.rs @@ -5,8 +5,9 @@ use crate::{ DatabaseError, }; use reth_codecs::{main_codec, Compact}; -use reth_primitives::{stage::StageCheckpoint, Address, B256, *}; +use reth_primitives::{Address, B256, *}; use reth_prune_types::{PruneCheckpoint, PruneSegment}; +use reth_stages_types::StageCheckpoint; use reth_trie_types::{StoredNibbles, StoredNibblesSubKey, *}; pub mod accounts; @@ -298,15 +299,15 @@ add_wrapper_struct!((ClientVersion, CompactClientVersion)); mod tests { use super::*; use reth_primitives::{ - stage::{ - AccountHashingCheckpoint, CheckpointBlockRange, EntitiesCheckpoint, - ExecutionCheckpoint, HeadersCheckpoint, IndexHistoryCheckpoint, StageCheckpoint, - StageUnitCheckpoint, StorageHashingCheckpoint, - }, Account, Header, Receipt, ReceiptWithBloom, SealedHeader, TxEip1559, TxEip2930, TxEip4844, TxLegacy, Withdrawals, }; use reth_prune_types::{PruneCheckpoint, PruneMode, PruneSegment}; + use reth_stages_types::{ + AccountHashingCheckpoint, CheckpointBlockRange, EntitiesCheckpoint, ExecutionCheckpoint, + HeadersCheckpoint, IndexHistoryCheckpoint, StageCheckpoint, StageUnitCheckpoint, + StorageHashingCheckpoint, + }; // each value in the database has an extra field named flags that encodes metadata about other // fields in the value, e.g. offset and length. diff --git a/crates/storage/db-common/Cargo.toml b/crates/storage/db-common/Cargo.toml index b0bf2b84c..0e6a3720d 100644 --- a/crates/storage/db-common/Cargo.toml +++ b/crates/storage/db-common/Cargo.toml @@ -17,6 +17,7 @@ reth-config.workspace = true reth-trie.workspace = true reth-etl.workspace = true reth-codecs.workspace = true +reth-stages-types.workspace = true # misc eyre.workspace = true diff --git a/crates/storage/db-common/src/init.rs b/crates/storage/db-common/src/init.rs index a15c56dfc..05ff49253 100644 --- a/crates/storage/db-common/src/init.rs +++ b/crates/storage/db-common/src/init.rs @@ -6,7 +6,6 @@ use reth_db::tables; use reth_db_api::{database::Database, transaction::DbTxMut, DatabaseError}; use reth_etl::Collector; use reth_primitives::{ - stage::{StageCheckpoint, StageId}, Account, Address, Bytecode, ChainSpec, GenesisAccount, Receipts, StaticFileSegment, StorageEntry, B256, U256, }; @@ -18,6 +17,7 @@ use reth_provider::{ DatabaseProviderRW, HashingWriter, HistoryWriter, OriginalValuesKnown, ProviderError, ProviderFactory, StageCheckpointWriter, StateWriter, StaticFileProviderFactory, }; +use reth_stages_types::{StageCheckpoint, StageId}; use reth_trie::{IntermediateStateRootState, StateRoot as StateRootComputer, StateRootProgress}; use serde::{Deserialize, Serialize}; use std::{ diff --git a/crates/storage/db/Cargo.toml b/crates/storage/db/Cargo.toml index 63c750ce8..ca27a9a40 100644 --- a/crates/storage/db/Cargo.toml +++ b/crates/storage/db/Cargo.toml @@ -23,6 +23,7 @@ reth-libmdbx = { workspace = true, optional = true, features = [ ] } reth-nippy-jar.workspace = true reth-prune-types.workspace = true +reth-stages-types.workspace = true reth-tracing.workspace = true reth-trie-types.workspace = true diff --git a/crates/storage/db/src/tables/mod.rs b/crates/storage/db/src/tables/mod.rs index f94c07d77..5d3c685a5 100644 --- a/crates/storage/db/src/tables/mod.rs +++ b/crates/storage/db/src/tables/mod.rs @@ -32,10 +32,11 @@ use reth_db_api::{ table::{Decode, DupSort, Encode, Table}, }; use reth_primitives::{ - stage::StageCheckpoint, Account, Address, BlockHash, BlockNumber, Bytecode, Header, - IntegerList, Receipt, Requests, StorageEntry, TransactionSignedNoHash, TxHash, TxNumber, B256, + Account, Address, BlockHash, BlockNumber, Bytecode, Header, IntegerList, Receipt, Requests, + StorageEntry, TransactionSignedNoHash, TxHash, TxNumber, B256, }; use reth_prune_types::{PruneCheckpoint, PruneSegment}; +use reth_stages_types::StageCheckpoint; use reth_trie_types::{StorageTrieEntry, StoredBranchNode, StoredNibbles, StoredNibblesSubKey}; use serde::{Deserialize, Serialize}; use std::fmt; diff --git a/crates/storage/provider/Cargo.toml b/crates/storage/provider/Cargo.toml index 14c45ca12..de2fea757 100644 --- a/crates/storage/provider/Cargo.toml +++ b/crates/storage/provider/Cargo.toml @@ -24,6 +24,7 @@ reth-network-p2p.workspace = true reth-db = { workspace = true, features = ["mdbx"] } reth-db-api.workspace = true reth-prune-types.workspace = true +reth-stages-types.workspace = true reth-trie = { workspace = true, features = ["metrics"] } reth-nippy-jar.workspace = true reth-codecs.workspace = true diff --git a/crates/storage/provider/src/providers/database/mod.rs b/crates/storage/provider/src/providers/database/mod.rs index 0fe0eeb6d..8b2b7bd6d 100644 --- a/crates/storage/provider/src/providers/database/mod.rs +++ b/crates/storage/provider/src/providers/database/mod.rs @@ -13,13 +13,13 @@ use reth_db_api::{database::Database, models::StoredBlockBodyIndices}; use reth_errors::{RethError, RethResult}; use reth_evm::ConfigureEvmEnv; use reth_primitives::{ - stage::{StageCheckpoint, StageId}, Address, Block, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, ChainInfo, ChainSpec, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256, U256, }; use reth_prune_types::{PruneCheckpoint, PruneSegment}; +use reth_stages_types::{StageCheckpoint, StageId}; use reth_storage_errors::provider::ProviderResult; use revm::primitives::{BlockEnv, CfgEnvWithHandlerCfg}; use std::{ diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index b8a9beda8..d08f38056 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -32,7 +32,6 @@ use reth_network_p2p::headers::downloader::SyncTarget; use reth_primitives::{ keccak256, revm::{config::revm_spec, env::fill_block_env}, - stage::{StageCheckpoint, StageId}, Account, Address, Block, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, ChainInfo, ChainSpec, GotExpected, Head, Header, Receipt, Requests, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry, TransactionMeta, @@ -40,6 +39,7 @@ use reth_primitives::{ Withdrawal, Withdrawals, B256, U256, }; use reth_prune_types::{PruneCheckpoint, PruneLimiter, PruneModes, PruneSegment}; +use reth_stages_types::{StageCheckpoint, StageId}; use reth_storage_errors::provider::{ProviderResult, RootMismatch}; use reth_trie::{ prefix_set::{PrefixSet, PrefixSetMut, TriePrefixSets}, diff --git a/crates/storage/provider/src/providers/mod.rs b/crates/storage/provider/src/providers/mod.rs index ede69cdf6..3b6b57a4a 100644 --- a/crates/storage/provider/src/providers/mod.rs +++ b/crates/storage/provider/src/providers/mod.rs @@ -18,13 +18,13 @@ use reth_db_api::{ }; use reth_evm::ConfigureEvmEnv; use reth_primitives::{ - stage::{StageCheckpoint, StageId}, Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumber, BlockNumberOrTag, BlockWithSenders, ChainInfo, ChainSpec, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256, U256, }; use reth_prune_types::{PruneCheckpoint, PruneSegment}; +use reth_stages_types::{StageCheckpoint, StageId}; use reth_storage_errors::provider::ProviderResult; use revm::primitives::{BlockEnv, CfgEnvWithHandlerCfg}; use std::{ diff --git a/crates/storage/provider/src/providers/static_file/manager.rs b/crates/storage/provider/src/providers/static_file/manager.rs index 9b41bac09..f0b4234e3 100644 --- a/crates/storage/provider/src/providers/static_file/manager.rs +++ b/crates/storage/provider/src/providers/static_file/manager.rs @@ -23,13 +23,13 @@ use reth_db_api::{ use reth_nippy_jar::NippyJar; use reth_primitives::{ keccak256, - stage::{PipelineTarget, StageId}, static_file::{find_fixed_range, HighestStaticFiles, SegmentHeader, SegmentRangeInclusive}, Address, Block, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, ChainInfo, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256, U256, }; +use reth_stages_types::{PipelineTarget, StageId}; use reth_storage_errors::provider::{ProviderError, ProviderResult}; use std::{ collections::{hash_map::Entry, BTreeMap, HashMap}, diff --git a/crates/storage/provider/src/test_utils/noop.rs b/crates/storage/provider/src/test_utils/noop.rs index 078ef5d3d..3ec551aa4 100644 --- a/crates/storage/provider/src/test_utils/noop.rs +++ b/crates/storage/provider/src/test_utils/noop.rs @@ -9,14 +9,14 @@ use crate::{ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices}; use reth_evm::ConfigureEvmEnv; use reth_primitives::{ - proofs::AccountProof, - stage::{StageCheckpoint, StageId}, - Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId, BlockNumber, BlockWithSenders, - Bytecode, ChainInfo, ChainSpec, Header, Receipt, SealedBlock, SealedBlockWithSenders, - SealedHeader, StorageKey, StorageValue, TransactionMeta, TransactionSigned, - TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256, MAINNET, U256, + proofs::AccountProof, Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId, + BlockNumber, BlockWithSenders, Bytecode, ChainInfo, ChainSpec, Header, Receipt, SealedBlock, + SealedBlockWithSenders, SealedHeader, StorageKey, StorageValue, TransactionMeta, + TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256, + MAINNET, U256, }; use reth_prune_types::{PruneCheckpoint, PruneSegment}; +use reth_stages_types::{StageCheckpoint, StageId}; use reth_storage_errors::provider::ProviderResult; use reth_trie::updates::TrieUpdates; use revm::{ diff --git a/crates/storage/storage-api/Cargo.toml b/crates/storage/storage-api/Cargo.toml index d1806408f..2c6f5bc14 100644 --- a/crates/storage/storage-api/Cargo.toml +++ b/crates/storage/storage-api/Cargo.toml @@ -17,6 +17,7 @@ reth-execution-types.workspace = true reth-db-api.workspace = true reth-primitives.workspace = true reth-prune-types.workspace = true +reth-stages-types.workspace = true reth-storage-errors.workspace = true reth-trie.workspace = true diff --git a/crates/storage/storage-api/src/stage_checkpoint.rs b/crates/storage/storage-api/src/stage_checkpoint.rs index 1eca80763..3815239be 100644 --- a/crates/storage/storage-api/src/stage_checkpoint.rs +++ b/crates/storage/storage-api/src/stage_checkpoint.rs @@ -1,7 +1,5 @@ -use reth_primitives::{ - stage::{StageCheckpoint, StageId}, - BlockNumber, -}; +use reth_primitives::BlockNumber; +use reth_stages_types::{StageCheckpoint, StageId}; use reth_storage_errors::provider::ProviderResult; /// The trait for fetching stage checkpoint related data. diff --git a/crates/trie/trie/Cargo.toml b/crates/trie/trie/Cargo.toml index 665cf51f0..99beeff07 100644 --- a/crates/trie/trie/Cargo.toml +++ b/crates/trie/trie/Cargo.toml @@ -17,6 +17,7 @@ reth-primitives.workspace = true reth-execution-errors.workspace = true reth-db.workspace = true reth-db-api.workspace = true +reth-stages-types.workspace = true reth-trie-types.workspace = true revm.workspace = true diff --git a/crates/trie/trie/src/progress.rs b/crates/trie/trie/src/progress.rs index 916af7f16..1594d7f6e 100644 --- a/crates/trie/trie/src/progress.rs +++ b/crates/trie/trie/src/progress.rs @@ -1,5 +1,6 @@ use crate::{hash_builder::HashBuilder, trie_cursor::CursorSubNode, updates::TrieUpdates}; -use reth_primitives::{stage::MerkleCheckpoint, B256}; +use reth_primitives::B256; +use reth_stages_types::MerkleCheckpoint; /// The progress of the state root computation. #[derive(Debug)]