chore: stages crates touchups (#7742)

This commit is contained in:
Matthias Seitz
2024-04-19 14:25:11 +02:00
committed by GitHub
parent f4dda95cbd
commit 8a0f8cf835
18 changed files with 47 additions and 48 deletions

11
Cargo.lock generated
View File

@ -7400,41 +7400,32 @@ name = "reth-stages"
version = "0.2.0-beta.5"
dependencies = [
"alloy-rlp",
"aquamarine",
"assert_matches",
"auto_impl",
"criterion",
"futures-util",
"itertools 0.12.1",
"metrics",
"num-traits",
"paste",
"pprof",
"rand 0.8.5",
"rayon",
"reth-blockchain-tree",
"reth-codecs",
"reth-config",
"reth-db",
"reth-downloaders",
"reth-eth-wire",
"reth-etl",
"reth-evm-ethereum",
"reth-interfaces",
"reth-metrics",
"reth-node-ethereum",
"reth-node-optimism",
"reth-primitives",
"reth-provider",
"reth-revm",
"reth-stages-api",
"reth-static-file",
"reth-tokio-util",
"reth-trie",
"serde_json",
"tempfile",
"thiserror",
"tokio",
"tokio-stream",
"tracing",
]

View File

@ -298,6 +298,7 @@ alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "188c4f8" }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "188c4f8" }
# misc
auto_impl = "1"
aquamarine = "0.5"
bytes = "1.5"
bitflags = "2.4"

View File

@ -21,7 +21,7 @@ futures.workspace = true
tokio = { workspace = true, features = ["sync"] }
# misc
auto_impl = "1.0"
auto_impl.workspace = true
thiserror.workspace = true
tracing.workspace = true
secp256k1 = { workspace = true, default-features = false, features = [

View File

@ -7,7 +7,6 @@ rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
exclude.workspace = true
[lints]
workspace = true

View File

@ -51,7 +51,7 @@ reth-metrics = { workspace = true, features = ["common"] }
metrics.workspace = true
# misc
auto_impl = "1"
auto_impl.workspace = true
aquamarine.workspace = true
tracing.workspace = true
fnv = "1.0"

View File

@ -6,7 +6,9 @@ rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
exclude.workspace = true
[lints]
workspace = true
[dependencies]
# reth
@ -15,7 +17,6 @@ reth-provider.workspace = true
reth-db.workspace = true
reth-interfaces.workspace = true
reth-static-file.workspace = true
assert_matches.workspace = true
reth-tokio-util.workspace = true
# metrics
@ -28,13 +29,15 @@ tokio-stream.workspace = true
futures-util.workspace = true
# misc
aquamarine.workspace = true
thiserror.workspace = true
tracing.workspace = true
auto_impl = "1"
aquamarine.workspace = true
auto_impl.workspace = true
[dev-dependencies]
assert_matches.workspace = true
reth-provider = { workspace = true, features = ["test-utils"] }
reth-interfaces = { workspace = true, features = ["test-utils"] }
[features]
test-utils = []
[lints]
workspace = true

View File

@ -1,9 +1,21 @@
//! Staged syncing primitives for reth.
//!
//! ## Feature Flags
//!
//! - `test-utils`: Utilities for testing
#![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(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
mod error;
mod metrics;
mod pipeline;
mod stage;
#[allow(missing_docs)]
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;
mod util;
@ -12,3 +24,5 @@ pub use crate::metrics::*;
pub use error::*;
pub use pipeline::*;
pub use stage::*;
use aquamarine as _;

View File

@ -2,7 +2,6 @@ mod ctrl;
mod event;
pub use crate::pipeline::ctrl::ControlFlow;
pub use event::*;
use futures_util::Future;
use reth_db::database::Database;
use reth_interfaces::RethResult;

View File

@ -1,9 +1,14 @@
#![allow(missing_docs)]
use crate::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput};
use reth_db::database::Database;
use reth_primitives::stage::StageId;
use reth_provider::DatabaseProviderRW;
use std::collections::VecDeque;
/// A test stage that can be used for testing.
///
/// This can be used to mock expected outputs of [Stage::execute] and [Stage::unwind]
#[derive(Debug)]
pub struct TestStage {
id: StageId,

View File

@ -1,2 +0,0 @@
mod stage;
pub use stage::TestStage;

View File

@ -19,46 +19,33 @@ reth-db.workspace = true
reth-codecs.workspace = true
reth-provider.workspace = true
reth-trie = { workspace = true, features = ["metrics"] }
reth-tokio-util.workspace = true
reth-etl.workspace = true
reth-static-file.workspace = true
reth-config.workspace = true
reth-stages-api = {workspace = true , features = ["test-utils"]}
# async
tokio = { workspace = true, features = ["sync"] }
tokio-stream.workspace = true
futures-util.workspace = true
# observability
tracing.workspace = true
# io
tempfile.workspace = true
# metrics
reth-metrics.workspace = true
metrics.workspace = true
# misc
thiserror.workspace = true
aquamarine.workspace = true
itertools.workspace = true
rayon.workspace = true
num-traits = "0.2.15"
auto_impl = "1"
tempfile = { workspace = true, optional = true}
[dev-dependencies]
# reth
reth-primitives = { workspace = true, features = ["test-utils", "arbitrary"] }
reth-db = { workspace = true, features = ["test-utils", "mdbx"] }
reth-evm-ethereum.workspace = true
reth-interfaces = { workspace = true, features = ["test-utils"] }
reth-downloaders.workspace = true
reth-eth-wire.workspace = true # TODO(onbjerg): We only need this for [BlockBody]
reth-node-ethereum.workspace = true
reth-node-optimism.workspace = true
reth-blockchain-tree.workspace = true
reth-revm.workspace = true
reth-static-file.workspace = true
reth-trie = { workspace = true, features = ["test-utils"] }
reth-provider = { workspace = true, features = ["test-utils"] }
@ -68,6 +55,7 @@ tokio = { workspace = true, features = ["rt", "sync", "macros"] }
assert_matches.workspace = true
rand.workspace = true
paste.workspace = true
tempfile.workspace = true
# Stage benchmarks
criterion = { workspace = true, features = ["async_futures"] }
@ -79,7 +67,7 @@ serde_json.workspace = true
pprof = { workspace = true, features = ["flamegraph", "frame-pointer", "criterion"] }
[features]
test-utils = ["reth-interfaces/test-utils", "reth-db/test-utils", "reth-provider/test-utils", "reth-stages-api/test-utils"]
test-utils = ["reth-interfaces/test-utils", "reth-db/test-utils", "reth-provider/test-utils", "reth-stages-api/test-utils", "dep:tempfile"]
[[bench]]
name = "criterion"

View File

@ -22,7 +22,7 @@
//! # use reth_stages::Pipeline;
//! # use reth_stages::sets::DefaultStages;
//! # use tokio::sync::watch;
//! # use reth_node_ethereum::EthEvmConfig;
//! # use reth_evm_ethereum::EthEvmConfig;
//! # use reth_provider::ProviderFactory;
//! # use reth_provider::HeaderSyncMode;
//! # use reth_provider::test_utils::create_test_provider_factory;
@ -76,6 +76,7 @@
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#[allow(missing_docs)]
#[cfg(any(test, feature = "test-utils"))]

View File

@ -14,7 +14,7 @@
//! # use reth_stages::sets::{OfflineStages};
//! # use reth_revm::EvmProcessorFactory;
//! # use reth_primitives::{PruneModes, MAINNET};
//! # use reth_node_ethereum::EthEvmConfig;
//! # use reth_evm_ethereum::EthEvmConfig;
//! # use reth_provider::test_utils::create_test_provider_factory;
//! # use reth_static_file::StaticFileProducer;
//! # use reth_config::config::EtlConfig;

View File

@ -622,8 +622,8 @@ mod tests {
use alloy_rlp::Decodable;
use assert_matches::assert_matches;
use reth_db::models::AccountBeforeTx;
use reth_evm_ethereum::EthEvmConfig;
use reth_interfaces::executor::BlockValidationError;
use reth_node_ethereum::EthEvmConfig;
use reth_primitives::{
address, hex_literal::hex, keccak256, stage::StageUnitCheckpoint, Account, Address,
Bytecode, ChainSpecBuilder, PruneMode, ReceiptsLogPruneConfig, SealedBlock, StorageEntry,

View File

@ -50,8 +50,8 @@ mod tests {
transaction::{DbTx, DbTxMut},
AccountsHistory, DatabaseEnv,
};
use reth_evm_ethereum::EthEvmConfig;
use reth_interfaces::test_utils::generators::{self, random_block};
use reth_node_ethereum::EthEvmConfig;
use reth_primitives::{
address, hex_literal::hex, keccak256, Account, Bytecode, ChainSpecBuilder, PruneMode,
PruneModes, SealedBlock, StaticFileSegment, U256,

View File

@ -35,7 +35,7 @@ reth-metrics.workspace = true
metrics.workspace = true
# misc
auto_impl = "1.0"
auto_impl.workspace = true
itertools.workspace = true
pin-project.workspace = true
parking_lot.workspace = true

View File

@ -39,7 +39,7 @@ schnellru.workspace = true
serde = { workspace = true, features = ["derive", "rc"], optional = true }
fnv = "1.0.7"
bitflags.workspace = true
auto_impl = "1.0"
auto_impl.workspace = true
smallvec.workspace = true
itertools.workspace = true

View File

@ -27,7 +27,7 @@ tracing.workspace = true
# misc
thiserror.workspace = true
derive_more.workspace = true
auto_impl = "1"
auto_impl.workspace = true
# `metrics` feature
reth-metrics = { workspace = true, optional = true }