Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/rproxy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rproxy"
version = "0.0.7"
version = "0.0.8"
edition = "2024"
default-run = "rproxy"

Expand Down
16 changes: 10 additions & 6 deletions crates/rproxy/src/jrpc/jrpc_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ const JRPC_METHOD_FCUV2_WITH_PAYLOAD: Cow<'static, str> =
const JRPC_METHOD_FCUV3_WITH_PAYLOAD: Cow<'static, str> =
Cow::Borrowed("engine_forkchoiceUpdatedV3_withPayload");

const EMPTY_PARAMS: &Vec<serde_json::Value> = &Vec::new();

pub(crate) struct JrpcRequestMeta {
id: Id,

method: Cow<'static, str>,
method_enriched: Cow<'static, str>,

params: Vec<serde_json::Value>,
params: serde_json::Value,
}

impl JrpcRequestMeta {
Expand All @@ -39,7 +41,7 @@ impl JrpcRequestMeta {

#[inline]
pub(crate) fn params(&self) -> &Vec<serde_json::Value> {
&self.params
self.params.as_array().unwrap_or(EMPTY_PARAMS)
}
}

Expand All @@ -52,15 +54,17 @@ impl<'a> Deserialize<'a> for JrpcRequestMeta {
struct JrpcRequestMetaWire {
id: Id,
method: Cow<'static, str>,
params: Vec<serde_json::Value>,
params: serde_json::Value,
}

let wire = JrpcRequestMetaWire::deserialize(deserializer)?;

let mut params_count = 0;
for param in wire.params.iter() {
if !param.is_null() {
params_count += 1;
if let Some(params) = wire.params.as_array() {
for param in params.iter() {
if !param.is_null() {
params_count += 1;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/rproxy/src/server/proxy/http/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ where
request_id = %req_id,
connection_id = %conn_id,
worker_id = %this.id,
http_request = if this.shared.config().log_proxied_responses() { str::from_utf8(&decompressed_body).unwrap_or_default() } else { "" },
error = ?err,
"Failed to parse json-rpc request",
);
Expand Down Expand Up @@ -619,6 +620,7 @@ where
request_id = %clnt_req.info.req_id,
connection_id = %clnt_req.info.conn_id,
worker_id = %worker_id,
http_request = if inner.config().log_proxied_responses() { str::from_utf8(&clnt_req.decompressed_body).unwrap_or_default() } else { "" },
error = ?err,
"Failed to parse json-rpc request",
);
Expand Down