Skip to content

Commit 9bb0d31

Browse files
committed
fix build
1 parent 12244d7 commit 9bb0d31

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/proxy.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ where
6060
fn call(&mut self, req: HttpRequest<HttpBody>) -> Self::Future {
6161
match req.uri().path() {
6262
"/healthz" => return Box::pin(async { Ok(Self::Response::new(HttpBody::from("OK"))) }),
63+
"/metrics" => {}
6364
_ => {}
6465
};
6566

@@ -91,7 +92,10 @@ where
9192
message = "received json rpc request for",
9293
method = method.method
9394
);
94-
if PROXY_METHODS.iter().any(|&m| method.method.starts_with(m)) {
95+
if MULTIPLEX_METHODS
96+
.iter()
97+
.any(|&m| method.method.starts_with(m))
98+
{
9599
// let rpc server handle engine rpc requests
96100
let res = inner.call(req).await.map_err(|e| e.into())?;
97101
Ok(res)
@@ -136,6 +140,7 @@ mod tests {
136140
proxy_success().await;
137141
proxy_failure().await;
138142
does_not_proxy_engine_method().await;
143+
does_not_proxy_eth_send_raw_transaction_method().await;
139144
health_check().await;
140145
}
141146

@@ -161,6 +166,12 @@ mod tests {
161166
assert_eq!(response.unwrap(), "engine response");
162167
}
163168

169+
async fn does_not_proxy_eth_send_raw_transaction_method() {
170+
let response = send_request("eth_sendRawTransaction").await;
171+
assert!(response.is_ok());
172+
assert_eq!(response.unwrap(), "raw transaction response");
173+
}
174+
164175
async fn health_check() {
165176
let proxy_server = spawn_proxy_server().await;
166177
// Create a new HTTP client
@@ -171,7 +182,13 @@ mod tests {
171182
let health_check_url = format!("http://{ADDR}:{PORT}/healthz");
172183
let health_response = client.get(health_check_url.parse::<Uri>().unwrap()).await;
173184
assert!(health_response.is_ok());
174-
let b = health_response.unwrap().into_body().collect().await.unwrap().to_bytes();
185+
let b = health_response
186+
.unwrap()
187+
.into_body()
188+
.collect()
189+
.await
190+
.unwrap()
191+
.to_bytes();
175192
// Convert the collected bytes to a string
176193
let body_string = String::from_utf8(b.to_vec()).unwrap();
177194
assert_eq!(body_string, "OK");
@@ -234,6 +251,11 @@ mod tests {
234251
module
235252
.register_method("engine_method", |_, _, _| "engine response")
236253
.unwrap();
254+
module
255+
.register_method("eth_sendRawTransaction", |_, _, _| {
256+
"raw transaction response"
257+
})
258+
.unwrap();
237259
module
238260
.register_method("non_existent_method", |_, _, _| "no proxy response")
239261
.unwrap();

0 commit comments

Comments
 (0)