diff --git a/Cargo.lock b/Cargo.lock index 9571e1083e..46a14684c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6887,6 +6887,18 @@ dependencies = [ "thiserror", ] +[[package]] +name = "reth-errors" +version = "0.2.0-beta.7" +dependencies = [ + "reth-blockchain-tree-api", + "reth-consensus", + "reth-execution-errors", + "reth-fs-util", + "reth-storage-errors", + "thiserror", +] + [[package]] name = "reth-eth-wire" version = "0.2.0-beta.7" @@ -7107,13 +7119,11 @@ name = "reth-interfaces" version = "0.2.0-beta.7" dependencies = [ "reth-blockchain-tree-api", - "reth-consensus", + "reth-errors", "reth-execution-errors", - "reth-fs-util", "reth-network-p2p", "reth-storage-errors", "reth-testing-utils", - "thiserror", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 4b34cbb5cb..4726b63e07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "crates/consensus/consensus/", "crates/e2e-test-utils/", "crates/engine-primitives/", + "crates/errors/", "crates/ethereum-forks/", "crates/ethereum/consensus/", "crates/ethereum/engine-primitives/", @@ -236,6 +237,7 @@ reth-downloaders = { path = "crates/net/downloaders" } reth-e2e-test-utils = { path = "crates/e2e-test-utils" } reth-ecies = { path = "crates/net/ecies" } reth-engine-primitives = { path = "crates/engine-primitives" } +reth-errors = { path = "crates/errors" } reth-eth-wire = { path = "crates/net/eth-wire" } reth-eth-wire-types = { path = "crates/net/eth-wire-types" } reth-ethereum-consensus = { path = "crates/ethereum/consensus" } diff --git a/crates/errors/Cargo.toml b/crates/errors/Cargo.toml new file mode 100644 index 0000000000..bb56a8bace --- /dev/null +++ b/crates/errors/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "reth-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-blockchain-tree-api.workspace = true +reth-consensus.workspace = true +reth-execution-errors.workspace = true +reth-fs-util.workspace = true +reth-storage-errors.workspace = true + +# misc +thiserror.workspace = true diff --git a/crates/interfaces/src/error.rs b/crates/errors/src/error.rs similarity index 97% rename from crates/interfaces/src/error.rs rename to crates/errors/src/error.rs index ddb4e151f4..4017be351a 100644 --- a/crates/interfaces/src/error.rs +++ b/crates/errors/src/error.rs @@ -1,4 +1,4 @@ -use crate::blockchain_tree::error::{BlockchainTreeError, CanonicalError}; +use reth_blockchain_tree_api::error::{BlockchainTreeError, CanonicalError}; use reth_consensus::ConsensusError; use reth_execution_errors::BlockExecutionError; use reth_fs_util::FsPathError; diff --git a/crates/errors/src/lib.rs b/crates/errors/src/lib.rs new file mode 100644 index 0000000000..4b8b96fba4 --- /dev/null +++ b/crates/errors/src/lib.rs @@ -0,0 +1,24 @@ +//! High level error types for the reth in general. +//! +//! ## Feature Flags +//! +//! - `test-utils`: Export 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(not(test), warn(unused_crate_dependencies))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + +mod error; +pub use error::{RethError, RethResult}; + +pub use reth_blockchain_tree_api::error::{BlockchainTreeError, CanonicalError}; +pub use reth_consensus::ConsensusError; +pub use reth_execution_errors::BlockExecutionError; +pub use reth_storage_errors::{ + db::DatabaseError, + provider::{ProviderError, ProviderResult}, +}; diff --git a/crates/interfaces/Cargo.toml b/crates/interfaces/Cargo.toml index 1c07af335c..b12b84a71b 100644 --- a/crates/interfaces/Cargo.toml +++ b/crates/interfaces/Cargo.toml @@ -12,17 +12,13 @@ workspace = true [dependencies] reth-blockchain-tree-api.workspace = true -reth-consensus.workspace = true reth-execution-errors.workspace = true -reth-fs-util.workspace = true reth-network-p2p.workspace = true reth-storage-errors.workspace = true +reth-errors.workspace = true reth-testing-utils = { workspace = true, optional = true } -# misc -thiserror.workspace = true - [features] -test-utils = ["reth-consensus/test-utils", "reth-network-p2p/test-utils", "reth-testing-utils"] +test-utils = ["reth-network-p2p/test-utils", "reth-testing-utils"] clap = ["reth-storage-errors/clap"] \ No newline at end of file diff --git a/crates/interfaces/src/lib.rs b/crates/interfaces/src/lib.rs index 0a649e557a..f056e3c92c 100644 --- a/crates/interfaces/src/lib.rs +++ b/crates/interfaces/src/lib.rs @@ -19,8 +19,7 @@ pub use reth_storage_errors::{db, provider}; pub use reth_execution_errors as executor; /// Possible errors when interacting with the chain. -mod error; -pub use error::{RethError, RethResult}; +pub use reth_errors::{RethError, RethResult}; /// P2P traits. pub use reth_network_p2p as p2p;