From a7152eda379b7e6764d6d88da8978d22da0193cd Mon Sep 17 00:00:00 2001 From: joshieDo <93316087+joshieDo@users.noreply.github.com> Date: Fri, 7 Jun 2024 18:31:24 +0200 Subject: [PATCH] chore: move `primitives/exex` to `reth-exex-types` (#8677) --- Cargo.lock | 10 ++++++++++ Cargo.toml | 2 ++ crates/consensus/beacon/Cargo.toml | 1 + crates/consensus/beacon/src/engine/test_utils.rs | 3 ++- crates/exex/exex/Cargo.toml | 1 + crates/exex/exex/src/lib.rs | 4 ++++ crates/exex/exex/src/manager.rs | 4 ++-- crates/exex/types/Cargo.toml | 15 +++++++++++++++ .../src/exex/mod.rs => exex/types/src/lib.rs} | 12 +++++++++++- crates/primitives/src/lib.rs | 2 -- crates/prune/prune/Cargo.toml | 1 + crates/prune/prune/src/builder.rs | 3 ++- crates/prune/prune/src/pruner.rs | 6 ++++-- 13 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 crates/exex/types/Cargo.toml rename crates/{primitives/src/exex/mod.rs => exex/types/src/lib.rs} (64%) diff --git a/Cargo.lock b/Cargo.lock index 7b0a570d6..9f311dd6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6304,6 +6304,7 @@ dependencies = [ "reth-ethereum-engine-primitives", "reth-evm", "reth-evm-ethereum", + "reth-exex-types", "reth-metrics", "reth-network-p2p", "reth-payload-builder", @@ -6918,6 +6919,7 @@ dependencies = [ "eyre", "metrics", "reth-config", + "reth-exex-types", "reth-metrics", "reth-network", "reth-node-api", @@ -6958,6 +6960,13 @@ dependencies = [ "tokio", ] +[[package]] +name = "reth-exex-types" +version = "0.2.0-beta.9" +dependencies = [ + "alloy-primitives", +] + [[package]] name = "reth-fs-util" version = "0.2.0-beta.9" @@ -7584,6 +7593,7 @@ dependencies = [ "reth-db", "reth-db-api", "reth-errors", + "reth-exex-types", "reth-metrics", "reth-primitives", "reth-provider", diff --git a/Cargo.toml b/Cargo.toml index 1d69e5644..fafd46902 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ members = [ "crates/evm/execution-types", "crates/exex/exex/", "crates/exex/test-utils/", + "crates/exex/types/", "crates/metrics/", "crates/metrics/metrics-derive/", "crates/net/common/", @@ -269,6 +270,7 @@ reth-execution-errors = { path = "crates/evm/execution-errors" } reth-execution-types = { path = "crates/evm/execution-types" } reth-exex = { path = "crates/exex/exex" } reth-exex-test-utils = { path = "crates/exex/test-utils" } +reth-exex-types = { path = "crates/exex/types" } reth-fs-util = { path = "crates/fs-util" } reth-ipc = { path = "crates/rpc/ipc" } reth-libmdbx = { path = "crates/storage/libmdbx-rs" } diff --git a/crates/consensus/beacon/Cargo.toml b/crates/consensus/beacon/Cargo.toml index 01a705d5c..7693890cc 100644 --- a/crates/consensus/beacon/Cargo.toml +++ b/crates/consensus/beacon/Cargo.toml @@ -66,6 +66,7 @@ reth-evm-ethereum.workspace = true reth-ethereum-engine-primitives.workspace = true reth-config.workspace = true reth-testing-utils.workspace = true +reth-exex-types.workspace = true reth-prune-types.workspace = true assert_matches.workspace = true diff --git a/crates/consensus/beacon/src/engine/test_utils.rs b/crates/consensus/beacon/src/engine/test_utils.rs index 173828f5c..67afe5fc7 100644 --- a/crates/consensus/beacon/src/engine/test_utils.rs +++ b/crates/consensus/beacon/src/engine/test_utils.rs @@ -16,12 +16,13 @@ use reth_downloaders::{ use reth_ethereum_engine_primitives::EthEngineTypes; use reth_evm::{either::Either, test_utils::MockExecutorProvider}; use reth_evm_ethereum::execute::EthExecutorProvider; +use reth_exex_types::FinishedExExHeight; use reth_network_p2p::{ bodies::client::BodiesClient, headers::client::HeadersClient, sync::NoopSyncStateUpdater, test_utils::NoopFullBlockClient, }; use reth_payload_builder::test_utils::spawn_test_payload_service; -use reth_primitives::{BlockNumber, ChainSpec, FinishedExExHeight, B256}; +use reth_primitives::{BlockNumber, ChainSpec, B256}; use reth_provider::{ providers::BlockchainProvider, test_utils::create_test_provider_factory_with_chain_spec, BundleStateWithReceipts, HeaderSyncMode, diff --git a/crates/exex/exex/Cargo.toml b/crates/exex/exex/Cargo.toml index d16cb53f7..4df59b3fc 100644 --- a/crates/exex/exex/Cargo.toml +++ b/crates/exex/exex/Cargo.toml @@ -14,6 +14,7 @@ workspace = true [dependencies] ## reth reth-config.workspace = true +reth-exex-types.workspace = true reth-metrics.workspace = true reth-node-api.workspace = true reth-node-core.workspace = true diff --git a/crates/exex/exex/src/lib.rs b/crates/exex/exex/src/lib.rs index cb246dc6a..a7661d855 100644 --- a/crates/exex/exex/src/lib.rs +++ b/crates/exex/exex/src/lib.rs @@ -45,3 +45,7 @@ pub use manager::*; mod notification; pub use notification::*; + +// Re-export exex types +#[doc(inline)] +pub use reth_exex_types::*; diff --git a/crates/exex/exex/src/manager.rs b/crates/exex/exex/src/manager.rs index 053f320e9..ce4994c34 100644 --- a/crates/exex/exex/src/manager.rs +++ b/crates/exex/exex/src/manager.rs @@ -1,7 +1,7 @@ -use crate::{ExExEvent, ExExNotification}; +use crate::{ExExEvent, ExExNotification, FinishedExExHeight}; use metrics::Gauge; use reth_metrics::{metrics::Counter, Metrics}; -use reth_primitives::{BlockNumber, FinishedExExHeight}; +use reth_primitives::BlockNumber; use reth_tracing::tracing::debug; use std::{ collections::VecDeque, diff --git a/crates/exex/types/Cargo.toml b/crates/exex/types/Cargo.toml new file mode 100644 index 000000000..8797376da --- /dev/null +++ b/crates/exex/types/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "reth-exex-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 exex usage in reth." + +[lints] +workspace = true + +[dependencies] +alloy-primitives.workspace = true \ No newline at end of file diff --git a/crates/primitives/src/exex/mod.rs b/crates/exex/types/src/lib.rs similarity index 64% rename from crates/primitives/src/exex/mod.rs rename to crates/exex/types/src/lib.rs index a0836c1fc..b76530df0 100644 --- a/crates/primitives/src/exex/mod.rs +++ b/crates/exex/types/src/lib.rs @@ -1,4 +1,14 @@ -use crate::BlockNumber; +//! Commonly used types for exex 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))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + +use alloy_primitives::BlockNumber; /// The finished height of all `ExEx`'s. #[derive(Debug, Clone, Copy)] diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index c077c1e89..9bbb7aa39 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -29,7 +29,6 @@ mod compression; pub mod constants; pub mod eip4844; mod error; -mod exex; pub mod genesis; mod header; mod integer_list; @@ -65,7 +64,6 @@ pub use constants::{ KECCAK_EMPTY, MAINNET_DEPOSIT_CONTRACT, MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH, }; pub use error::{GotExpected, GotExpectedBoxed}; -pub use exex::FinishedExExHeight; pub use genesis::{ChainConfig, Genesis, GenesisAccount}; pub use header::{Header, HeaderValidationError, HeadersDirection, SealedHeader}; pub use integer_list::IntegerList; diff --git a/crates/prune/prune/Cargo.toml b/crates/prune/prune/Cargo.toml index 274056b78..016265e1b 100644 --- a/crates/prune/prune/Cargo.toml +++ b/crates/prune/prune/Cargo.toml @@ -13,6 +13,7 @@ workspace = true [dependencies] # reth +reth-exex-types.workspace = true reth-primitives.workspace = true reth-db.workspace = true reth-db-api.workspace = true diff --git a/crates/prune/prune/src/builder.rs b/crates/prune/prune/src/builder.rs index 83fabeb4c..a91a0faa6 100644 --- a/crates/prune/prune/src/builder.rs +++ b/crates/prune/prune/src/builder.rs @@ -1,7 +1,8 @@ use crate::{segments::SegmentSet, Pruner}; use reth_config::PruneConfig; use reth_db_api::database::Database; -use reth_primitives::{FinishedExExHeight, MAINNET}; +use reth_exex_types::FinishedExExHeight; +use reth_primitives::MAINNET; use reth_provider::ProviderFactory; use reth_prune_types::PruneModes; use std::time::Duration; diff --git a/crates/prune/prune/src/pruner.rs b/crates/prune/prune/src/pruner.rs index dbc3bae26..da805c77f 100644 --- a/crates/prune/prune/src/pruner.rs +++ b/crates/prune/prune/src/pruner.rs @@ -6,7 +6,8 @@ use crate::{ Metrics, PrunerError, PrunerEvent, }; use reth_db_api::database::Database; -use reth_primitives::{BlockNumber, FinishedExExHeight, StaticFileSegment}; +use reth_exex_types::FinishedExExHeight; +use reth_primitives::{BlockNumber, StaticFileSegment}; use reth_provider::{ DatabaseProviderRW, ProviderFactory, PruneCheckpointReader, StaticFileProviderFactory, }; @@ -332,7 +333,8 @@ mod tests { use crate::Pruner; use reth_db::test_utils::{create_test_rw_db, create_test_static_files_dir}; - use reth_primitives::{FinishedExExHeight, MAINNET}; + use reth_exex_types::FinishedExExHeight; + use reth_primitives::MAINNET; use reth_provider::{providers::StaticFileProvider, ProviderFactory}; #[test]