60
60
fn call ( & mut self , req : HttpRequest < HttpBody > ) -> Self :: Future {
61
61
match req. uri ( ) . path ( ) {
62
62
"/healthz" => return Box :: pin ( async { Ok ( Self :: Response :: new ( HttpBody :: from ( "OK" ) ) ) } ) ,
63
+ "/metrics" => { }
63
64
_ => { }
64
65
} ;
65
66
91
92
message = "received json rpc request for" ,
92
93
method = method. method
93
94
) ;
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
+ {
95
99
// let rpc server handle engine rpc requests
96
100
let res = inner. call ( req) . await . map_err ( |e| e. into ( ) ) ?;
97
101
Ok ( res)
@@ -136,6 +140,7 @@ mod tests {
136
140
proxy_success ( ) . await ;
137
141
proxy_failure ( ) . await ;
138
142
does_not_proxy_engine_method ( ) . await ;
143
+ does_not_proxy_eth_send_raw_transaction_method ( ) . await ;
139
144
health_check ( ) . await ;
140
145
}
141
146
@@ -161,6 +166,12 @@ mod tests {
161
166
assert_eq ! ( response. unwrap( ) , "engine response" ) ;
162
167
}
163
168
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
+
164
175
async fn health_check ( ) {
165
176
let proxy_server = spawn_proxy_server ( ) . await ;
166
177
// Create a new HTTP client
@@ -171,7 +182,13 @@ mod tests {
171
182
let health_check_url = format ! ( "http://{ADDR}:{PORT}/healthz" ) ;
172
183
let health_response = client. get ( health_check_url. parse :: < Uri > ( ) . unwrap ( ) ) . await ;
173
184
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 ( ) ;
175
192
// Convert the collected bytes to a string
176
193
let body_string = String :: from_utf8 ( b. to_vec ( ) ) . unwrap ( ) ;
177
194
assert_eq ! ( body_string, "OK" ) ;
@@ -234,6 +251,11 @@ mod tests {
234
251
module
235
252
. register_method ( "engine_method" , |_, _, _| "engine response" )
236
253
. unwrap ( ) ;
254
+ module
255
+ . register_method ( "eth_sendRawTransaction" , |_, _, _| {
256
+ "raw transaction response"
257
+ } )
258
+ . unwrap ( ) ;
237
259
module
238
260
. register_method ( "non_existent_method" , |_, _, _| "no proxy response" )
239
261
. unwrap ( ) ;
0 commit comments