chore: rm crate reth-rpc-types (#11341)

This commit is contained in:
nk_ysg
2024-10-02 17:16:20 +08:00
committed by GitHub
parent d5bdc1c8c0
commit 64fae4d0f2
18 changed files with 15 additions and 92 deletions

14
Cargo.lock generated
View File

@ -2839,7 +2839,6 @@ dependencies = [
"reth-node-ethereum",
"reth-primitives",
"reth-provider",
"reth-rpc-types",
"tokio",
"tokio-stream",
"tracing",
@ -2858,7 +2857,6 @@ dependencies = [
"reth-node-types",
"reth-primitives",
"reth-provider",
"reth-rpc-types",
]
[[package]]
@ -7032,7 +7030,6 @@ dependencies = [
"reth-primitives",
"reth-provider",
"reth-prune",
"reth-rpc-types",
"reth-stages-api",
"reth-tracing",
"reth-transaction-pool",
@ -7876,7 +7873,6 @@ dependencies = [
"reth-rpc-eth-api",
"reth-rpc-eth-types",
"reth-rpc-server-types",
"reth-rpc-types",
"reth-rpc-types-compat",
"reth-stages-types",
"reth-storage-api",
@ -8143,7 +8139,6 @@ dependencies = [
"reth-rpc",
"reth-rpc-eth-api",
"reth-rpc-eth-types",
"reth-rpc-types",
"reth-rpc-types-compat",
"reth-tracing",
"reth-transaction-pool",
@ -8638,7 +8633,6 @@ dependencies = [
"reth-rpc-eth-types",
"reth-rpc-layer",
"reth-rpc-server-types",
"reth-rpc-types",
"reth-rpc-types-compat",
"reth-tasks",
"reth-tokio-util",
@ -8755,7 +8749,6 @@ dependencies = [
"reth-primitives",
"reth-revm",
"reth-rpc-server-types",
"reth-rpc-types",
"reth-rpc-types-compat",
"reth-storage-api",
"reth-tasks",
@ -8803,13 +8796,6 @@ dependencies = [
"strum",
]
[[package]]
name = "reth-rpc-types"
version = "1.0.7"
dependencies = [
"jsonrpsee-types",
]
[[package]]
name = "reth-rpc-types-compat"
version = "1.0.7"

View File

@ -98,7 +98,6 @@ members = [
"crates/rpc/rpc-server-types/",
"crates/rpc/rpc-testing-util/",
"crates/rpc/rpc-types-compat/",
"crates/rpc/rpc-types/",
"crates/rpc/rpc/",
"crates/stages/api/",
"crates/stages/stages/",
@ -388,7 +387,6 @@ reth-rpc-eth-api = { path = "crates/rpc/rpc-eth-api" }
reth-rpc-eth-types = { path = "crates/rpc/rpc-eth-types", default-features = false }
reth-rpc-layer = { path = "crates/rpc/rpc-layer" }
reth-rpc-server-types = { path = "crates/rpc/rpc-server-types" }
reth-rpc-types = { path = "crates/rpc/rpc-types" }
reth-rpc-types-compat = { path = "crates/rpc/rpc-types-compat" }
reth-stages = { path = "crates/stages/stages" }
reth-stages-api = { path = "crates/stages/api" }

View File

@ -477,5 +477,4 @@ check-features:
--package reth-codecs \
--package reth-primitives-traits \
--package reth-primitives \
--package reth-rpc-types \
--feature-powerset

View File

@ -44,7 +44,6 @@ reth-ethereum-engine-primitives.workspace = true
reth-exex-test-utils.workspace = true
reth-payload-builder = { workspace = true, features = ["test-utils"] }
reth-provider = { workspace = true, features = ["test-utils"] }
reth-rpc-types.workspace = true
reth-tracing.workspace = true
[lints]

View File

@ -24,7 +24,6 @@ reth-network = { workspace = true, features = ["serde"] }
reth-network-p2p.workspace = true
reth-rpc-eth-types.workspace = true
reth-rpc-server-types.workspace = true
reth-rpc-types.workspace = true
reth-rpc-types-compat.workspace = true
reth-rpc-api = { workspace = true, features = ["client"] }
reth-rpc-eth-api = { workspace = true, features = ["client"] }

View File

@ -22,11 +22,6 @@ pub mod primitives {
/// Re-export of `reth_rpc_*` crates.
pub mod rpc {
/// Re-exported from `reth_rpc_types`.
pub mod types {
pub use reth_rpc_types::*;
}
/// Re-exported from `reth_rpc_api`.
pub mod api {
pub use reth_rpc_api::*;

View File

@ -18,7 +18,6 @@ reth-payload-builder.workspace = true
reth-auto-seal-consensus.workspace = true
reth-basic-payload-builder.workspace = true
reth-consensus.workspace = true
reth-rpc-types.workspace = true
reth-rpc-types-compat.workspace = true
reth-node-api.workspace = true
reth-node-builder.workspace = true

View File

@ -62,7 +62,6 @@ reth-payload-builder = { workspace = true, features = ["test-utils"] }
reth-provider = { workspace = true, features = ["test-utils"] }
reth-rpc-api = { workspace = true, features = ["client"] }
reth-rpc-engine-api.workspace = true
reth-rpc-types.workspace = true
reth-tracing.workspace = true
reth-transaction-pool = { workspace = true, features = ["test-utils"] }
reth-tokio-util.workspace = true

View File

@ -11,7 +11,7 @@ pub trait EthPubSubApi<T: RpcObject> {
#[subscription(
name = "subscribe" => "subscription",
unsubscribe = "unsubscribe",
item = reth_rpc_types::pubsub::SubscriptionResult
item = alloy_rpc_types::pubsub::SubscriptionResult
)]
async fn subscribe(
&self,

View File

@ -22,7 +22,6 @@ reth-primitives = { workspace = true, features = ["secp256k1"] }
reth-storage-api.workspace = true
reth-revm.workspace = true
reth-rpc-server-types.workspace = true
reth-rpc-types.workspace = true
reth-rpc-types-compat.workspace = true
reth-tasks.workspace = true
reth-transaction-pool.workspace = true

View File

@ -10,7 +10,6 @@ use reth_primitives::{revm_primitives::InvalidHeader, BlockId};
use reth_rpc_server_types::result::{
block_id_to_str, internal_rpc_err, invalid_params_rpc_err, rpc_err, rpc_error_with_code,
};
use reth_rpc_types::ToRpcError;
use reth_transaction_pool::error::{
Eip4844PoolTransactionError, Eip7702PoolTransactionError, InvalidPoolTransactionError,
PoolError, PoolErrorKind, PoolTransactionError,
@ -19,6 +18,18 @@ use revm::primitives::{EVMError, ExecutionResult, HaltReason, InvalidTransaction
use revm_inspectors::tracing::MuxError;
use tracing::error;
/// A trait to convert an error to an RPC error.
pub trait ToRpcError: core::error::Error + Send + Sync + 'static {
/// Converts the error to a JSON-RPC error object.
fn to_rpc_error(&self) -> jsonrpsee_types::ErrorObject<'static>;
}
impl ToRpcError for jsonrpsee_types::ErrorObject<'static> {
fn to_rpc_error(&self) -> jsonrpsee_types::ErrorObject<'static> {
self.clone()
}
}
/// Result alias
pub type EthResult<T> = Result<T, EthApiError>;

View File

@ -16,7 +16,6 @@ use reth_primitives::{
};
use reth_revm::database::StateProviderDatabase;
use reth_rpc_server_types::result::rpc_err;
use reth_rpc_types::ToRpcError;
use reth_rpc_types_compat::{block::from_block, TransactionCompat};
use reth_storage_api::StateRootProvider;
use reth_trie::{HashedPostState, HashedStorage};
@ -24,7 +23,8 @@ use revm::{db::CacheDB, Database};
use revm_primitives::{keccak256, Address, BlockEnv, Bytes, ExecutionResult, TxKind, B256, U256};
use crate::{
cache::db::StateProviderTraitObjWrapper, EthApiError, RevertError, RpcInvalidTransactionError,
cache::db::StateProviderTraitObjWrapper, error::ToRpcError, EthApiError, RevertError,
RpcInvalidTransactionError,
};
/// Errors which may occur during `eth_simulateV1` execution.

View File

@ -1,24 +0,0 @@
[package]
name = "reth-rpc-types"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
description = "Reth RPC types"
[lints]
workspace = true
[dependencies]
# misc
jsonrpsee-types = { workspace = true, optional = true }
[dev-dependencies]
[features]
default = ["jsonrpsee-types"]
jsonrpsee-types = [
"dep:jsonrpsee-types",
]

View File

@ -1,15 +0,0 @@
//! Implementation specific Errors for the `eth_` namespace.
/// A trait to convert an error to an RPC error.
#[cfg(feature = "jsonrpsee-types")]
pub trait ToRpcError: core::error::Error + Send + Sync + 'static {
/// Converts the error to a JSON-RPC error object.
fn to_rpc_error(&self) -> jsonrpsee_types::ErrorObject<'static>;
}
#[cfg(feature = "jsonrpsee-types")]
impl ToRpcError for jsonrpsee_types::ErrorObject<'static> {
fn to_rpc_error(&self) -> jsonrpsee_types::ErrorObject<'static> {
self.clone()
}
}

View File

@ -1,3 +0,0 @@
//! Ethereum related types
pub(crate) mod error;

View File

@ -1,17 +0,0 @@
//! Reth RPC type definitions.
//!
//! Provides all relevant types for the various RPC endpoints, grouped by namespace.
#![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))]
#[allow(hidden_glob_reexports)]
mod eth;
// Ethereum specific rpc types related to typed transaction requests and the engine API.
#[cfg(feature = "jsonrpsee-types")]
pub use eth::error::ToRpcError;

View File

@ -15,7 +15,6 @@ reth-network-api.workspace = true
reth-node-ethereum.workspace = true
reth-provider = { workspace = true, features = ["test-utils"] }
reth-primitives.workspace = true
reth-rpc-types.workspace = true
reth.workspace = true
tokio-stream.workspace = true
eyre.workspace = true

View File

@ -11,7 +11,6 @@ reth-chainspec.workspace = true
reth-db.workspace = true
reth-primitives.workspace = true
reth-provider.workspace = true
reth-rpc-types.workspace = true
reth-node-ethereum.workspace = true
reth-node-types.workspace = true