chore: rm reth-interfaces (#8486)

This commit is contained in:
Matthias Seitz
2024-05-29 18:54:14 +02:00
committed by GitHub
parent bab8aaa29f
commit 42667e1cfd
9 changed files with 21 additions and 112 deletions

15
Cargo.lock generated
View File

@ -2700,7 +2700,6 @@ dependencies = [
"rayon", "rayon",
"reth-db", "reth-db",
"reth-evm-ethereum", "reth-evm-ethereum",
"reth-interfaces",
"reth-primitives", "reth-primitives",
"reth-provider", "reth-provider",
"reth-stages", "reth-stages",
@ -6671,7 +6670,6 @@ dependencies = [
"rand 0.8.5", "rand 0.8.5",
"reth-codecs", "reth-codecs",
"reth-fs-util", "reth-fs-util",
"reth-interfaces",
"reth-libmdbx", "reth-libmdbx",
"reth-metrics", "reth-metrics",
"reth-nippy-jar", "reth-nippy-jar",
@ -7107,18 +7105,6 @@ dependencies = [
"thiserror", "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]] [[package]]
name = "reth-ipc" name = "reth-ipc"
version = "0.2.0-beta.7" version = "0.2.0-beta.7"
@ -7834,7 +7820,6 @@ dependencies = [
"reth-ethereum-engine-primitives", "reth-ethereum-engine-primitives",
"reth-evm", "reth-evm",
"reth-evm-ethereum", "reth-evm-ethereum",
"reth-interfaces",
"reth-ipc", "reth-ipc",
"reth-metrics", "reth-metrics",
"reth-network-api", "reth-network-api",

View File

@ -22,7 +22,6 @@ members = [
"crates/evm/execution-errors", "crates/evm/execution-errors",
"crates/evm/execution-types", "crates/evm/execution-types",
"crates/exex/", "crates/exex/",
"crates/interfaces/",
"crates/metrics/", "crates/metrics/",
"crates/metrics/metrics-derive/", "crates/metrics/metrics-derive/",
"crates/net/common/", "crates/net/common/",
@ -253,7 +252,6 @@ reth-execution-errors = { path = "crates/evm/execution-errors" }
reth-execution-types = { path = "crates/evm/execution-types" } reth-execution-types = { path = "crates/evm/execution-types" }
reth-exex = { path = "crates/exex" } reth-exex = { path = "crates/exex" }
reth-fs-util = { path = "crates/fs-util" } reth-fs-util = { path = "crates/fs-util" }
reth-interfaces = { path = "crates/interfaces" }
reth-ipc = { path = "crates/rpc/ipc" } reth-ipc = { path = "crates/rpc/ipc" }
reth-libmdbx = { path = "crates/storage/libmdbx-rs" } reth-libmdbx = { path = "crates/storage/libmdbx-rs" }
reth-mdbx-sys = { path = "crates/storage/libmdbx-rs/mdbx-sys" } reth-mdbx-sys = { path = "crates/storage/libmdbx-rs/mdbx-sys" }

View File

@ -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"]

View File

@ -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;
}

View File

@ -43,7 +43,6 @@ tracing.workspace = true
[dev-dependencies] [dev-dependencies]
reth-beacon-consensus.workspace = true reth-beacon-consensus.workspace = true
reth-interfaces = { workspace = true, features = ["test-utils"] }
reth-network-api.workspace = true reth-network-api.workspace = true
reth-evm-ethereum.workspace = true reth-evm-ethereum.workspace = true
reth-ethereum-engine-primitives.workspace = true reth-ethereum-engine-primitives.workspace = true

View File

@ -54,7 +54,6 @@ once_cell.workspace = true
# reth libs with arbitrary # reth libs with arbitrary
reth-primitives = { workspace = true, features = ["arbitrary"] } reth-primitives = { workspace = true, features = ["arbitrary"] }
reth-codecs.workspace = true reth-codecs.workspace = true
reth-interfaces.workspace = true
rand.workspace = true rand.workspace = true
serde_json.workspace = true serde_json.workspace = true

View File

@ -20,10 +20,10 @@ reth-primitives.workspace = true
reth-db = { workspace = true, features = ["mdbx", "test-utils"] } reth-db = { workspace = true, features = ["mdbx", "test-utils"] }
reth-provider = { workspace = true, features = ["test-utils"] } reth-provider = { workspace = true, features = ["test-utils"] }
reth-stages.workspace = true reth-stages.workspace = true
reth-interfaces.workspace = true
reth-evm-ethereum.workspace = true reth-evm-ethereum.workspace = true
alloy-rlp.workspace = true alloy-rlp.workspace = true
walkdir = "2.3.3" walkdir = "2.3.3"
serde.workspace = true serde.workspace = true
serde_json.workspace = true serde_json.workspace = true

View File

@ -87,14 +87,12 @@ impl Case for BlockchainTestCase {
db.as_ref(), db.as_ref(),
Arc::new(case.network.clone().into()), Arc::new(case.network.clone().into()),
static_files_dir_path, static_files_dir_path,
) )?
.map_err(|err| Error::RethError(err.into()))?
.provider_rw() .provider_rw()
.unwrap(); .unwrap();
// Insert initial test state into the provider. // Insert initial test state into the provider.
provider provider.insert_historical_block(
.insert_historical_block(
SealedBlock::new( SealedBlock::new(
case.genesis_block_header.clone().into(), case.genesis_block_header.clone().into(),
BlockBody::default(), BlockBody::default(),
@ -102,8 +100,7 @@ impl Case for BlockchainTestCase {
.try_seal_with_senders() .try_seal_with_senders()
.unwrap(), .unwrap(),
None, None,
) )?;
.map_err(|err| Error::RethError(err.into()))?;
case.pre.write_to_db(provider.tx_ref())?; case.pre.write_to_db(provider.tx_ref())?;
// Initialize receipts static file with genesis // 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. // Decode and insert blocks, creating a chain of blocks for the test case.
let last_block = case.blocks.iter().try_fold(None, |_, block| { let last_block = case.blocks.iter().try_fold(None, |_, block| {
let decoded = SealedBlock::decode(&mut block.rlp.as_ref())?; let decoded = SealedBlock::decode(&mut block.rlp.as_ref())?;
provider provider.insert_historical_block(
.insert_historical_block(
decoded.clone().try_seal_with_senders().unwrap(), decoded.clone().try_seal_with_senders().unwrap(),
None, None,
) )?;
.map_err(|err| Error::RethError(err.into()))?;
Ok::<Option<SealedBlock>, Error>(Some(decoded)) Ok::<Option<SealedBlock>, Error>(Some(decoded))
})?; })?;
provider provider
@ -157,13 +152,11 @@ impl Case for BlockchainTestCase {
(None, Some(expected_state_root)) => { (None, Some(expected_state_root)) => {
// Insert state hashes into the provider based on the expected state root. // Insert state hashes into the provider based on the expected state root.
let last_block = last_block.unwrap_or_default(); let last_block = last_block.unwrap_or_default();
provider provider.insert_hashes(
.insert_hashes(
0..=last_block.number, 0..=last_block.number,
last_block.hash(), last_block.hash(),
*expected_state_root, *expected_state_root,
) )?;
.map_err(|err| Error::RethError(err.into()))?;
} }
_ => return Err(Error::MissingPostState), _ => return Err(Error::MissingPostState),
} }

View File

@ -2,7 +2,7 @@
use crate::Case; use crate::Case;
use reth_db::DatabaseError; use reth_db::DatabaseError;
use reth_interfaces::RethError; use reth_provider::ProviderError;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use thiserror::Error; use thiserror::Error;
@ -46,7 +46,7 @@ pub enum Error {
Assertion(String), Assertion(String),
/// An error internally in reth occurred. /// An error internally in reth occurred.
#[error("test failed: {0}")] #[error("test failed: {0}")]
RethError(#[from] RethError), Provider(#[from] ProviderError),
/// An error occurred while decoding RLP. /// An error occurred while decoding RLP.
#[error("an error occurred deserializing RLP: {0}")] #[error("an error occurred deserializing RLP: {0}")]
RlpDecodeError(#[from] alloy_rlp::Error), RlpDecodeError(#[from] alloy_rlp::Error),