diff --git a/Cargo.lock b/Cargo.lock index 1f8160c45..fa7dc0077 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7030,7 +7030,6 @@ name = "reth-interfaces" version = "0.2.0-beta.7" dependencies = [ "auto_impl", - "clap", "futures", "parking_lot 0.12.2", "rand 0.8.5", @@ -7040,6 +7039,7 @@ dependencies = [ "reth-network-api", "reth-network-types", "reth-primitives", + "reth-storage-errors", "secp256k1 0.28.2", "thiserror", "tokio", @@ -7939,6 +7939,16 @@ dependencies = [ "strum", ] +[[package]] +name = "reth-storage-errors" +version = "0.2.0-beta.7" +dependencies = [ + "clap", + "reth-fs-util", + "reth-primitives", + "thiserror", +] + [[package]] name = "reth-tasks" version = "0.2.0-beta.7" diff --git a/Cargo.toml b/Cargo.toml index b7d65b0a7..7b872c795 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,6 +64,7 @@ members = [ "crates/storage/codecs/", "crates/storage/codecs/derive/", "crates/storage/db/", + "crates/storage/errors/", "crates/storage/libmdbx-rs/", "crates/storage/libmdbx-rs/mdbx-sys/", "crates/storage/nippy-jar/", @@ -275,6 +276,7 @@ reth-stages = { path = "crates/stages" } reth-stages-api = { path = "crates/stages-api" } reth-static-file = { path = "crates/static-file" } reth-static-file-types = { path = "crates/static-file-types" } +reth-storage-errors = { path = "crates/storage/errors" } reth-tasks = { path = "crates/tasks" } reth-testing-utils = { path = "testing/testing-utils" } reth-tokio-util = { path = "crates/tokio-util" } diff --git a/crates/interfaces/Cargo.toml b/crates/interfaces/Cargo.toml index 27e2d8f39..4dd845314 100644 --- a/crates/interfaces/Cargo.toml +++ b/crates/interfaces/Cargo.toml @@ -17,6 +17,7 @@ reth-network-api.workspace = true reth-eth-wire-types.workspace = true reth-consensus.workspace = true reth-network-types.workspace = true +reth-storage-errors.workspace = true # async futures.workspace = true @@ -31,7 +32,6 @@ secp256k1 = { workspace = true, default-features = false, features = [ "recovery", "rand", ], optional = true } -clap = { workspace = true, features = ["derive"], optional = true } parking_lot = { workspace = true, optional = true } rand = { workspace = true, optional = true } @@ -45,5 +45,5 @@ secp256k1 = { workspace = true, features = ["alloc", "recovery", "rand"] } [features] test-utils = ["reth-consensus/test-utils", "secp256k1", "rand", "parking_lot"] -cli = ["clap"] +clap = ["reth-storage-errors/clap"] optimism = ["reth-eth-wire-types/optimism"] diff --git a/crates/interfaces/src/lib.rs b/crates/interfaces/src/lib.rs index e60d4a621..a5d38965e 100644 --- a/crates/interfaces/src/lib.rs +++ b/crates/interfaces/src/lib.rs @@ -12,8 +12,8 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -/// Database error -pub mod db; +/// Storage error types +pub use reth_storage_errors::{db, provider}; /// Block Execution traits. pub mod executor; @@ -28,9 +28,6 @@ pub mod p2p; /// Trie error pub mod trie; -/// Provider error -pub mod provider; - /// Syncing related traits. pub mod sync; diff --git a/crates/storage/errors/Cargo.toml b/crates/storage/errors/Cargo.toml new file mode 100644 index 000000000..c1ce595ea --- /dev/null +++ b/crates/storage/errors/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "reth-storage-errors" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true + +[lints] +workspace = true + +[dependencies] +reth-primitives.workspace = true +reth-fs-util.workspace = true + +thiserror.workspace = true +clap = { workspace = true, features = ["derive"], optional = true } + +[features] +clap = ["dep:clap"] \ No newline at end of file diff --git a/crates/interfaces/src/db.rs b/crates/storage/errors/src/db.rs similarity index 100% rename from crates/interfaces/src/db.rs rename to crates/storage/errors/src/db.rs diff --git a/crates/storage/errors/src/lib.rs b/crates/storage/errors/src/lib.rs new file mode 100644 index 000000000..6bab8f051 --- /dev/null +++ b/crates/storage/errors/src/lib.rs @@ -0,0 +1,15 @@ +//! Commonly used error types used when interacting with storage. + +#![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))] + +/// Database error +pub mod db; + +/// Provider error +pub mod provider; diff --git a/crates/interfaces/src/provider.rs b/crates/storage/errors/src/provider.rs similarity index 100% rename from crates/interfaces/src/provider.rs rename to crates/storage/errors/src/provider.rs