@@ -240,7 +240,14 @@ impl SignerRelay {
240240 . and ( middlewares:: with_aggregator_endpoint (
241241 configuration. aggregator_endpoint . to_string ( ) ,
242242 ) )
243- . and_then ( handlers:: epoch_settings_handler) ) ,
243+ . and_then ( handlers:: epoch_settings_handler) )
244+ . or ( warp:: path!( "protocol-configuration" / u64 )
245+ . and ( warp:: get ( ) )
246+ . and ( middlewares:: with_logger ( & server_logger) )
247+ . and ( middlewares:: with_aggregator_endpoint (
248+ configuration. aggregator_endpoint . to_string ( ) ,
249+ ) )
250+ . and_then ( handlers:: protocol_configuration_handler) ) ,
244251 ( [ 0 , 0 , 0 , 0 ] , * configuration. server_port ) . into ( ) ,
245252 )
246253 }
@@ -496,6 +503,21 @@ mod handlers {
496503 reply_response ( logger, response) . await
497504 }
498505
506+ pub async fn protocol_configuration_handler (
507+ epoch : u64 ,
508+ logger : Logger ,
509+ aggregator_endpoint : String ,
510+ ) -> Result < impl warp:: Reply , Infallible > {
511+ debug ! ( logger, "Serve HTTP route /protocol-configuration/{epoch}" ) ;
512+ let response = reqwest:: Client :: new ( )
513+ . get ( format ! (
514+ "{aggregator_endpoint}/protocol-configuration/{epoch}"
515+ ) )
516+ . send ( )
517+ . await ;
518+ reply_response ( logger, response) . await
519+ }
520+
499521 pub async fn reply_response (
500522 logger : Logger ,
501523 response : Result < Response , Error > ,
@@ -589,6 +611,22 @@ mod tests {
589611 mock. assert ( ) ;
590612 }
591613
614+ #[ tokio:: test]
615+ async fn epoch_protocol_configuration_handler ( ) {
616+ let test_logger = TestLogger :: stdout ( ) ;
617+ let server = MockServer :: start ( ) ;
618+ let mock = server. mock ( |when, then| {
619+ when. method ( GET ) . path ( "/protocol-configuration/42" ) ;
620+ then. status ( 201 ) . body ( "ok" ) ;
621+ } ) ;
622+
623+ handlers:: protocol_configuration_handler ( 42 , test_logger, server. url ( "" ) )
624+ . await
625+ . unwrap ( ) ;
626+
627+ mock. assert ( ) ;
628+ }
629+
592630 #[ tokio:: test]
593631 async fn register_signer_handler_with_passthrough ( ) {
594632 let test_logger = TestLogger :: stdout ( ) ;
0 commit comments