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

chore: rm crate reth-rpc-types #11341

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

nkysg
Copy link
Contributor

@nkysg nkysg commented Sep 30, 2024

rm crate reth-rpc-types
do we still need trait ToRpcError, @mattsse

#[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()
}
}

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

I'd like to approach this differently, because this error type is also used as a library error so what you could do instead is move the ToRpcError to reth-rpc-types and retire the rpc-types crate

@nkysg
Copy link
Contributor Author

nkysg commented Sep 30, 2024

I'd like to approach this differently, because this error type is also used as a library error so what you could do instead is move the ToRpcError to reth-rpc-types and retire the rpc-types crate

Actually ToRpcError is in crate reth-rpc-types.

#[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>;
}

so we don't need to move the ToRpcError to reth-rpc-types.
and ToRpcError trait only use in
impl ToRpcError for EthSimulateError {
fn to_rpc_error(&self) -> ErrorObject<'static> {
rpc_err(self.error_code(), self.to_string(), None)
}
}

do you mean move the ToRpcError to crate reth-rpc-eth-types?

Is there an error in my understanding?

@nkysg nkysg requested a review from mattsse September 30, 2024 23:43
@mattsse
Copy link
Collaborator

mattsse commented Oct 1, 2024

do you mean move the ToRpcError to crate reth-rpc-eth-types?

yes I did -.-

let's move the trait there and we can finally remove the rpc-types crate

@nkysg nkysg force-pushed the rm_ToRpcError_rpc-eth-types branch from e1f6646 to cd3af30 Compare October 2, 2024 01:44
@nkysg nkysg changed the title chore(rpc-eth-types): rm ToRpcError usage chore: rm crate reth-rpc-types Oct 2, 2024
@nkysg nkysg force-pushed the rm_ToRpcError_rpc-eth-types branch from f72c0fd to a94a3a7 Compare October 2, 2024 08:16
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

great!

@mattsse mattsse merged commit 64fae4d into paradigmxyz:main Oct 2, 2024
36 checks passed
@mattsse mattsse added the A-rpc Related to the RPC implementation label Oct 2, 2024
@nkysg nkysg deleted the rm_ToRpcError_rpc-eth-types branch October 2, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants