From 42667e1cfdcc34f3a0409d239d0f6662f0455028 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 29 May 2024 18:54:14 +0200 Subject: [PATCH] chore: rm reth-interfaces (#8486) --- Cargo.lock | 15 ------- Cargo.toml | 2 - crates/interfaces/Cargo.toml | 24 ----------- crates/interfaces/src/lib.rs | 41 ------------------ crates/rpc/rpc-builder/Cargo.toml | 1 - crates/storage/db/Cargo.toml | 1 - testing/ef-tests/Cargo.toml | 2 +- testing/ef-tests/src/cases/blockchain_test.rs | 43 ++++++++----------- testing/ef-tests/src/result.rs | 4 +- 9 files changed, 21 insertions(+), 112 deletions(-) delete mode 100644 crates/interfaces/Cargo.toml delete mode 100644 crates/interfaces/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 90277e5b3..1a19e2666 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2700,7 +2700,6 @@ dependencies = [ "rayon", "reth-db", "reth-evm-ethereum", - "reth-interfaces", "reth-primitives", "reth-provider", "reth-stages", @@ -6671,7 +6670,6 @@ dependencies = [ "rand 0.8.5", "reth-codecs", "reth-fs-util", - "reth-interfaces", "reth-libmdbx", "reth-metrics", "reth-nippy-jar", @@ -7107,18 +7105,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "reth-interfaces" -version = "0.2.0-beta.7" -dependencies = [ - "reth-blockchain-tree-api", - "reth-errors", - "reth-execution-errors", - "reth-network-p2p", - "reth-storage-errors", - "reth-testing-utils", -] - [[package]] name = "reth-ipc" version = "0.2.0-beta.7" @@ -7834,7 +7820,6 @@ dependencies = [ "reth-ethereum-engine-primitives", "reth-evm", "reth-evm-ethereum", - "reth-interfaces", "reth-ipc", "reth-metrics", "reth-network-api", diff --git a/Cargo.toml b/Cargo.toml index c64b0def9..4890add70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,6 @@ members = [ "crates/evm/execution-errors", "crates/evm/execution-types", "crates/exex/", - "crates/interfaces/", "crates/metrics/", "crates/metrics/metrics-derive/", "crates/net/common/", @@ -253,7 +252,6 @@ reth-execution-errors = { path = "crates/evm/execution-errors" } reth-execution-types = { path = "crates/evm/execution-types" } reth-exex = { path = "crates/exex" } reth-fs-util = { path = "crates/fs-util" } -reth-interfaces = { path = "crates/interfaces" } reth-ipc = { path = "crates/rpc/ipc" } reth-libmdbx = { path = "crates/storage/libmdbx-rs" } reth-mdbx-sys = { path = "crates/storage/libmdbx-rs/mdbx-sys" } diff --git a/crates/interfaces/Cargo.toml b/crates/interfaces/Cargo.toml deleted file mode 100644 index b12b84a71..000000000 --- a/crates/interfaces/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "reth-interfaces" -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-execution-errors.workspace = true -reth-network-p2p.workspace = true -reth-storage-errors.workspace = true -reth-errors.workspace = true - -reth-testing-utils = { workspace = true, optional = true } - -[features] -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 deleted file mode 100644 index f056e3c92..000000000 --- a/crates/interfaces/src/lib.rs +++ /dev/null @@ -1,41 +0,0 @@ -//! A collection of shared traits and error types used in Reth. -//! -//! ## 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))] - -/// Storage error types -pub use reth_storage_errors::{db, provider}; - -/// Block Execution traits. -pub use reth_execution_errors as executor; - -/// Possible errors when interacting with the chain. -pub use reth_errors::{RethError, RethResult}; - -/// P2P traits. -pub use reth_network_p2p as p2p; - -/// Trie error -pub use reth_execution_errors::trie; - -/// Syncing related traits. -pub use reth_network_p2p::sync; - -/// BlockchainTree related traits. -pub use reth_blockchain_tree_api as blockchain_tree; - -/// Common test helpers for mocking out Consensus, Downloaders and Header Clients. -#[cfg(feature = "test-utils")] -pub mod test_utils { - pub use reth_network_p2p::test_utils::*; - pub use reth_testing_utils::generators; -} diff --git a/crates/rpc/rpc-builder/Cargo.toml b/crates/rpc/rpc-builder/Cargo.toml index e3b5f4766..378df7f3b 100644 --- a/crates/rpc/rpc-builder/Cargo.toml +++ b/crates/rpc/rpc-builder/Cargo.toml @@ -43,7 +43,6 @@ tracing.workspace = true [dev-dependencies] reth-beacon-consensus.workspace = true -reth-interfaces = { workspace = true, features = ["test-utils"] } reth-network-api.workspace = true reth-evm-ethereum.workspace = true reth-ethereum-engine-primitives.workspace = true diff --git a/crates/storage/db/Cargo.toml b/crates/storage/db/Cargo.toml index 34de306f6..3a9ea5be5 100644 --- a/crates/storage/db/Cargo.toml +++ b/crates/storage/db/Cargo.toml @@ -54,7 +54,6 @@ once_cell.workspace = true # reth libs with arbitrary reth-primitives = { workspace = true, features = ["arbitrary"] } reth-codecs.workspace = true -reth-interfaces.workspace = true rand.workspace = true serde_json.workspace = true diff --git a/testing/ef-tests/Cargo.toml b/testing/ef-tests/Cargo.toml index d89baf410..9b4c7f29b 100644 --- a/testing/ef-tests/Cargo.toml +++ b/testing/ef-tests/Cargo.toml @@ -20,10 +20,10 @@ reth-primitives.workspace = true reth-db = { workspace = true, features = ["mdbx", "test-utils"] } reth-provider = { workspace = true, features = ["test-utils"] } reth-stages.workspace = true -reth-interfaces.workspace = true reth-evm-ethereum.workspace = true alloy-rlp.workspace = true + walkdir = "2.3.3" serde.workspace = true serde_json.workspace = true diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 5c1746045..1f1b38ecd 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -87,23 +87,20 @@ impl Case for BlockchainTestCase { db.as_ref(), Arc::new(case.network.clone().into()), static_files_dir_path, - ) - .map_err(|err| Error::RethError(err.into()))? + )? .provider_rw() .unwrap(); // Insert initial test state into the provider. - provider - .insert_historical_block( - SealedBlock::new( - case.genesis_block_header.clone().into(), - BlockBody::default(), - ) - .try_seal_with_senders() - .unwrap(), - None, + provider.insert_historical_block( + SealedBlock::new( + case.genesis_block_header.clone().into(), + BlockBody::default(), ) - .map_err(|err| Error::RethError(err.into()))?; + .try_seal_with_senders() + .unwrap(), + None, + )?; case.pre.write_to_db(provider.tx_ref())?; // Initialize receipts static file with genesis @@ -119,12 +116,10 @@ impl Case for BlockchainTestCase { // Decode and insert blocks, creating a chain of blocks for the test case. let last_block = case.blocks.iter().try_fold(None, |_, block| { let decoded = SealedBlock::decode(&mut block.rlp.as_ref())?; - provider - .insert_historical_block( - decoded.clone().try_seal_with_senders().unwrap(), - None, - ) - .map_err(|err| Error::RethError(err.into()))?; + provider.insert_historical_block( + decoded.clone().try_seal_with_senders().unwrap(), + None, + )?; Ok::, Error>(Some(decoded)) })?; provider @@ -157,13 +152,11 @@ impl Case for BlockchainTestCase { (None, Some(expected_state_root)) => { // Insert state hashes into the provider based on the expected state root. let last_block = last_block.unwrap_or_default(); - provider - .insert_hashes( - 0..=last_block.number, - last_block.hash(), - *expected_state_root, - ) - .map_err(|err| Error::RethError(err.into()))?; + provider.insert_hashes( + 0..=last_block.number, + last_block.hash(), + *expected_state_root, + )?; } _ => return Err(Error::MissingPostState), } diff --git a/testing/ef-tests/src/result.rs b/testing/ef-tests/src/result.rs index 409b273fd..8af57190f 100644 --- a/testing/ef-tests/src/result.rs +++ b/testing/ef-tests/src/result.rs @@ -2,7 +2,7 @@ use crate::Case; use reth_db::DatabaseError; -use reth_interfaces::RethError; +use reth_provider::ProviderError; use std::path::{Path, PathBuf}; use thiserror::Error; @@ -46,7 +46,7 @@ pub enum Error { Assertion(String), /// An error internally in reth occurred. #[error("test failed: {0}")] - RethError(#[from] RethError), + Provider(#[from] ProviderError), /// An error occurred while decoding RLP. #[error("an error occurred deserializing RLP: {0}")] RlpDecodeError(#[from] alloy_rlp::Error),