From efd4895c487b6e631def905ef4f54825a521ab82 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Fri, 28 Jul 2023 05:39:46 -0400 Subject: [PATCH] chore(rpc-types): remove EngineRpcError (#3975) --- crates/rpc/rpc-types/src/eth/engine/error.rs | 58 -------------------- crates/rpc/rpc-types/src/eth/engine/mod.rs | 3 +- 2 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 crates/rpc/rpc-types/src/eth/engine/error.rs diff --git a/crates/rpc/rpc-types/src/eth/engine/error.rs b/crates/rpc/rpc-types/src/eth/engine/error.rs deleted file mode 100644 index 36feba4dfd..0000000000 --- a/crates/rpc/rpc-types/src/eth/engine/error.rs +++ /dev/null @@ -1,58 +0,0 @@ -//! Commonly used errors for the `engine_` namespace. - -/// List of Engine API errors used in RPC, see -/// -/// Note: These are all errors that can be returned by the `engine_` namespace in the error case. -/// -/// TODO: get rid of this -#[derive(Debug, Copy, PartialEq, Eq, Clone, thiserror::Error)] -pub enum EngineRpcError { - /// Invalid JSON was received by the server. - #[error("Invalid JSON was received by the server")] - ParseError, - /// The JSON sent is not a valid Request object. - #[error("The JSON sent is not a valid Request object")] - InvalidRequest, - /// The method does not exist / is not available. - #[error("The method does not exist / is not available")] - MethodNotFound, - /// Invalid method parameter(s). - #[error("Invalid method parameter(s)")] - InvalidParams, - /// Internal JSON-RPC error. - #[error("Internal JSON-RPC error")] - InternalError, - /// Generic client error while processing request. - #[error("Server error")] - ServerError, - /// Payload does not exist / is not available. - #[error("Unknown payload")] - UnknownPayload, - /// Forkchoice state is invalid / inconsistent. - #[error("Invalid forkchoice state")] - InvalidForkchoiceState, - /// Payload attributes are invalid / inconsistent. - #[error("Invalid payload attributes")] - InvalidPayloadAttributes, - /// Number of requested entities is too large. - #[error("Too large request")] - TooLargeRequest, -} - -impl EngineRpcError { - /// Returns the error code as `i32` - pub const fn code(&self) -> i32 { - match *self { - EngineRpcError::ParseError => -32700, - EngineRpcError::InvalidRequest => -32600, - EngineRpcError::MethodNotFound => -32601, - EngineRpcError::InvalidParams => -32602, - EngineRpcError::InternalError => -32603, - EngineRpcError::ServerError => -32000, - EngineRpcError::UnknownPayload => -38001, - EngineRpcError::InvalidForkchoiceState => -38002, - EngineRpcError::InvalidPayloadAttributes => -38003, - EngineRpcError::TooLargeRequest => -38004, - } - } -} diff --git a/crates/rpc/rpc-types/src/eth/engine/mod.rs b/crates/rpc/rpc-types/src/eth/engine/mod.rs index 5212588dec..2a814374fb 100644 --- a/crates/rpc/rpc-types/src/eth/engine/mod.rs +++ b/crates/rpc/rpc-types/src/eth/engine/mod.rs @@ -2,12 +2,11 @@ #![allow(missing_docs)] -mod error; mod forkchoice; mod payload; mod transition; -pub use self::{error::*, forkchoice::*, payload::*, transition::*}; +pub use self::{forkchoice::*, payload::*, transition::*}; /// The list of supported Engine capabilities pub const CAPABILITIES: [&str; 9] = [