From 1e707251ef558763747c5f37c1bb22f22c9c8ebd Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 17 Oct 2023 00:46:06 -0700 Subject: [PATCH] remove unused things --- web3_proxy/src/jsonrpc/response.rs | 7 ++----- web3_proxy/src/response_cache.rs | 6 +----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/web3_proxy/src/jsonrpc/response.rs b/web3_proxy/src/jsonrpc/response.rs index d53da85b..558fe9b7 100644 --- a/web3_proxy/src/jsonrpc/response.rs +++ b/web3_proxy/src/jsonrpc/response.rs @@ -6,7 +6,6 @@ use axum::body::StreamBody; use axum::response::IntoResponse; use axum::Json; use bytes::{Bytes, BytesMut}; -use derivative::Derivative; use futures_util::stream::{self, StreamExt}; use futures_util::TryStreamExt; use serde::{de, Deserialize, Serialize}; @@ -20,7 +19,7 @@ pub trait JsonRpcResultData = serde::Serialize + serde::de::DeserializeOwned + f /// TODO: borrow values to avoid allocs if possible /// TODO: lots of overlap with `SingleForwardedResponse` -#[derive(Clone, Debug, Serialize)] +#[derive(Debug, Serialize)] pub struct ParsedResponse> { pub jsonrpc: String, pub id: Box, @@ -201,13 +200,11 @@ pub enum ResponsePayload { Error { error: JsonRpcErrorData }, } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct StreamResponse { _t: PhantomData, buffer: Bytes, num_bytes: Option, - #[derivative(Debug = "ignore")] response: reqwest::Response, web3_request: Arc, } diff --git a/web3_proxy/src/response_cache.rs b/web3_proxy/src/response_cache.rs index b1ca9286..50b75e6a 100644 --- a/web3_proxy/src/response_cache.rs +++ b/web3_proxy/src/response_cache.rs @@ -90,7 +90,6 @@ pub type JsonRpcResponseCache = Cache>>; /// TODO: think about this more. there is a lot of overlap with ParsedResponse #[derive(Clone, Debug)] pub enum ForwardedResponse { - NullResult, Result { value: T, num_bytes: u64, @@ -105,7 +104,6 @@ pub enum ForwardedResponse { impl ForwardedResponse { pub fn num_bytes(&self) -> u64 { match self { - Self::NullResult => 1, Self::Result { num_bytes, .. } => *num_bytes, Self::RpcError { num_bytes, .. } => *num_bytes, } @@ -113,7 +111,6 @@ impl ForwardedResponse { pub fn is_error(&self) -> bool { match self { - Self::NullResult => false, Self::Result { .. } => false, Self::RpcError { .. } => true, } @@ -122,14 +119,13 @@ impl ForwardedResponse { impl ForwardedResponse> { pub fn is_null(&self) -> bool { - matches!(self, Self::NullResult | Self::Result { value: None, .. }) + matches!(self, Self::Result { value: None, .. }) } } impl ForwardedResponse> { pub fn is_null(&self) -> bool { match self { - Self::NullResult => true, Self::Result { value, .. } => value.get() == "null", _ => false, }