Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature gate jsonrpsee related crates and check features powerset for reth-rpc-types #10141

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -473,4 +473,5 @@ check-features:
--package reth-codecs \
--package reth-primitives-traits \
--package reth-primitives \
--package reth-rpc-types \
--feature-powerset
13 changes: 10 additions & 3 deletions crates/rpc/rpc-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ workspace = true

# ethereum
alloy-primitives = { workspace = true, features = ["rand", "rlp", "serde"] }
alloy-rpc-types = { workspace = true, features = ["jsonrpsee-types"] }
alloy-rpc-types.workspace = true
alloy-rpc-types-admin.workspace = true
alloy-rpc-types-anvil.workspace = true
alloy-rpc-types-beacon.workspace = true
alloy-rpc-types-beacon = { workspace = true, optional = true }
alloy-rpc-types-mev.workspace = true
alloy-rpc-types-trace.workspace = true
alloy-rpc-types-txpool.workspace = true
alloy-serde.workspace = true
alloy-rpc-types-engine = { workspace = true, features = ["jsonrpsee-types"] }
alloy-rpc-types-engine = { workspace = true, features = ["jsonrpsee-types"], optional = true }

# misc
jsonrpsee-types = { workspace = true, optional = true }
Expand All @@ -39,4 +39,11 @@ serde_json.workspace = true

[features]
default = ["jsonrpsee-types"]
jsonrpsee-types = [
"dep:jsonrpsee-types",
"dep:alloy-rpc-types-beacon",
"dep:alloy-rpc-types-engine",
"alloy-rpc-types/jsonrpsee-types",
"alloy-rpc-types-engine/jsonrpsee-types"
]
arbitrary = ["alloy-primitives/arbitrary", "alloy-rpc-types/arbitrary"]
10 changes: 5 additions & 5 deletions crates/rpc/rpc-types/src/eth/error.rs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should also be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, fixed!

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//! Implementation specific Errors for the `eth_` namespace.

use jsonrpsee_types::ErrorObject;

/// A trait to convert an error to an RPC error.
#[cfg(feature = "default")]
pub trait ToRpcError: std::error::Error + Send + Sync + 'static {
/// Converts the error to a JSON-RPC error object.
fn to_rpc_error(&self) -> ErrorObject<'static>;
fn to_rpc_error(&self) -> jsonrpsee_types::ErrorObject<'static>;
}

impl ToRpcError for ErrorObject<'static> {
fn to_rpc_error(&self) -> ErrorObject<'static> {
#[cfg(feature = "default")]
impl ToRpcError for jsonrpsee_types::ErrorObject<'static> {
fn to_rpc_error(&self) -> jsonrpsee_types::ErrorObject<'static> {
self.clone()
}
}
1 change: 1 addition & 0 deletions crates/rpc/rpc-types/src/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pub(crate) mod error;
pub mod transaction;

// re-export
#[cfg(feature = "default")]
pub use alloy_rpc_types_engine as engine;
7 changes: 5 additions & 2 deletions crates/rpc/rpc-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,20 @@ pub use alloy_rpc_types_anvil as anvil;
pub use alloy_rpc_types_mev as mev;

// re-export beacon
#[cfg(feature = "default")]
pub use alloy_rpc_types_beacon as beacon;

// re-export txpool
pub use alloy_rpc_types_txpool as txpool;

// Ethereum specific rpc types related to typed transaction requests and the engine API.
#[cfg(feature = "default")]
pub use eth::error::ToRpcError;
pub use eth::transaction::{self, TransactionRequest, TypedTransactionRequest};
#[cfg(feature = "default")]
pub use eth::{
engine,
engine::{
ExecutionPayload, ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3, PayloadError,
},
error::ToRpcError,
transaction::{self, TransactionRequest, TypedTransactionRequest},
};
Loading