@@ -85,6 +85,12 @@ pub trait Rpc {
8585 #[ method( name = "eip712domain_info" ) ]
8686 fn eip712_domain_info ( & self ) -> JsonRpcResult < Eip712Domain > ;
8787
88+ /// Returns the v2 EIP-712 domain separator information used by this server.
89+ /// The client is able to verify the signatures of the receipts and receipt aggregate vouchers.
90+ #[ cfg( feature = "v2" ) ]
91+ #[ method( name = "eip712domain_info_v2" ) ]
92+ fn eip712_domain_info_v2 ( & self ) -> JsonRpcResult < Eip712Domain > ;
93+
8894 /// Aggregates the given receipts into a receipt aggregate voucher.
8995 /// Returns an error if the user expected API version is not supported.
9096 #[ method( name = "aggregate_receipts" ) ]
@@ -112,6 +118,8 @@ struct RpcImpl {
112118 wallet : PrivateKeySigner ,
113119 accepted_addresses : HashSet < Address > ,
114120 domain_separator : Eip712Domain ,
121+ #[ cfg( feature = "v2" ) ]
122+ domain_separator_v2 : Eip712Domain ,
115123 kafka : Option < rdkafka:: producer:: ThreadedProducer < rdkafka:: producer:: DefaultProducerContext > > ,
116124}
117125
@@ -340,7 +348,7 @@ impl v2::tap_aggregator_server::TapAggregator for RpcImpl {
340348 let receipts_count: u64 = receipts. len ( ) as u64 ;
341349
342350 match aggregator:: v2:: check_and_aggregate_receipts (
343- & self . domain_separator ,
351+ & self . domain_separator_v2 ,
344352 receipts. as_slice ( ) ,
345353 previous_rav,
346354 & self . wallet ,
@@ -381,6 +389,11 @@ impl RpcServer for RpcImpl {
381389 Ok ( JsonRpcResponse :: ok ( self . domain_separator . clone ( ) ) )
382390 }
383391
392+ #[ cfg( feature = "v2" ) ]
393+ fn eip712_domain_info_v2 ( & self ) -> JsonRpcResult < Eip712Domain > {
394+ Ok ( JsonRpcResponse :: ok ( self . domain_separator_v2 . clone ( ) ) )
395+ }
396+
384397 fn aggregate_receipts (
385398 & self ,
386399 api_version : String ,
@@ -435,7 +448,7 @@ impl RpcServer for RpcImpl {
435448 api_version,
436449 & self . wallet ,
437450 & self . accepted_addresses ,
438- & self . domain_separator ,
451+ & self . domain_separator_v2 ,
439452 receipts,
440453 previous_rav,
441454 ) {
@@ -468,6 +481,7 @@ pub async fn run_server(
468481 wallet : PrivateKeySigner ,
469482 accepted_addresses : HashSet < Address > ,
470483 domain_separator : Eip712Domain ,
484+ domain_separator_v2 : Eip712Domain ,
471485 max_request_body_size : u32 ,
472486 max_response_body_size : u32 ,
473487 max_concurrent_connections : u32 ,
@@ -478,6 +492,7 @@ pub async fn run_server(
478492 wallet,
479493 accepted_addresses,
480494 domain_separator,
495+ domain_separator_v2,
481496 kafka,
482497 } ;
483498 let ( json_rpc_service, _) = create_json_rpc_service (
@@ -661,6 +676,10 @@ mod tests {
661676 fn domain_separator ( ) -> Eip712Domain {
662677 tap_eip712_domain ( 1 , Address :: from ( [ 0x11u8 ; 20 ] ) , TapVersion :: V1 )
663678 }
679+ #[ fixture]
680+ fn domain_separator_v2 ( ) -> Eip712Domain {
681+ tap_eip712_domain ( 1 , Address :: from ( [ 0x22u8 ; 20 ] ) , TapVersion :: V2 )
682+ }
664683
665684 #[ fixture]
666685 fn http_request_size_limit ( ) -> u32 {
@@ -681,6 +700,7 @@ mod tests {
681700 #[ tokio:: test]
682701 async fn protocol_version (
683702 domain_separator : Eip712Domain ,
703+ domain_separator_v2 : Eip712Domain ,
684704 http_request_size_limit : u32 ,
685705 http_response_size_limit : u32 ,
686706 http_max_concurrent_connections : u32 ,
@@ -694,6 +714,7 @@ mod tests {
694714 keys_main. wallet ,
695715 HashSet :: from ( [ keys_main. address ] ) ,
696716 domain_separator,
717+ domain_separator_v2,
697718 http_request_size_limit,
698719 http_response_size_limit,
699720 http_max_concurrent_connections,
@@ -720,6 +741,7 @@ mod tests {
720741 #[ tokio:: test]
721742 async fn signed_rav_is_valid_with_no_previous_rav (
722743 domain_separator : Eip712Domain ,
744+ domain_separator_v2 : Eip712Domain ,
723745 http_request_size_limit : u32 ,
724746 http_response_size_limit : u32 ,
725747 http_max_concurrent_connections : u32 ,
@@ -746,6 +768,7 @@ mod tests {
746768 keys_main. wallet . clone ( ) ,
747769 HashSet :: from ( [ keys_main. address , keys_0. address , keys_1. address ] ) ,
748770 domain_separator. clone ( ) ,
771+ domain_separator_v2. clone ( ) ,
749772 http_request_size_limit,
750773 http_response_size_limit,
751774 http_max_concurrent_connections,
@@ -803,6 +826,7 @@ mod tests {
803826 #[ tokio:: test]
804827 async fn signed_rav_is_valid_with_previous_rav (
805828 domain_separator : Eip712Domain ,
829+ domain_separator_v2 : Eip712Domain ,
806830 http_request_size_limit : u32 ,
807831 http_response_size_limit : u32 ,
808832 http_max_concurrent_connections : u32 ,
@@ -829,6 +853,7 @@ mod tests {
829853 keys_main. wallet . clone ( ) ,
830854 HashSet :: from ( [ keys_main. address , keys_0. address , keys_1. address ] ) ,
831855 domain_separator. clone ( ) ,
856+ domain_separator_v2. clone ( ) ,
832857 http_request_size_limit,
833858 http_response_size_limit,
834859 http_max_concurrent_connections,
@@ -893,6 +918,7 @@ mod tests {
893918 #[ tokio:: test]
894919 async fn invalid_api_version (
895920 domain_separator : Eip712Domain ,
921+ domain_separator_v2 : Eip712Domain ,
896922 http_request_size_limit : u32 ,
897923 http_response_size_limit : u32 ,
898924 http_max_concurrent_connections : u32 ,
@@ -907,6 +933,7 @@ mod tests {
907933 keys_main. wallet . clone ( ) ,
908934 HashSet :: from ( [ keys_main. address ] ) ,
909935 domain_separator. clone ( ) ,
936+ domain_separator_v2. clone ( ) ,
910937 http_request_size_limit,
911938 http_response_size_limit,
912939 http_max_concurrent_connections,
@@ -976,6 +1003,7 @@ mod tests {
9761003 #[ tokio:: test]
9771004 async fn request_size_limit (
9781005 domain_separator : Eip712Domain ,
1006+ domain_separator_v2 : Eip712Domain ,
9791007 http_response_size_limit : u32 ,
9801008 http_max_concurrent_connections : u32 ,
9811009 allocation_ids : Vec < Address > ,
@@ -999,6 +1027,7 @@ mod tests {
9991027 keys_main. wallet . clone ( ) ,
10001028 HashSet :: from ( [ keys_main. address ] ) ,
10011029 domain_separator. clone ( ) ,
1030+ domain_separator_v2. clone ( ) ,
10021031 http_request_size_limit,
10031032 http_response_size_limit,
10041033 http_max_concurrent_connections,
0 commit comments