@@ -10,19 +10,19 @@ use alloy::{
1010use anyhow:: { bail, Ok , Result } ;
1111use rayon:: prelude:: * ;
1212use tap_core:: {
13- rav:: ReceiptAggregateVoucher ,
13+ rav:: { Aggregate , ReceiptAggregateVoucher } ,
1414 receipt:: Receipt ,
1515 signed_message:: { EIP712SignedMessage , SignatureBytes , SignatureBytesExt } ,
1616} ;
1717
1818pub fn check_and_aggregate_receipts (
1919 domain_separator : & Eip712Domain ,
20- receipts : & [ EIP712SignedMessage < Receipt > ] ,
20+ receipts : Vec < EIP712SignedMessage < Receipt > > ,
2121 previous_rav : Option < EIP712SignedMessage < ReceiptAggregateVoucher > > ,
2222 wallet : & PrivateKeySigner ,
2323 accepted_addresses : & HashSet < Address > ,
2424) -> Result < EIP712SignedMessage < ReceiptAggregateVoucher > > {
25- check_signatures_unique ( receipts) ?;
25+ check_signatures_unique ( & receipts) ?;
2626
2727 // Check that the receipts are signed by an accepted signer address
2828 receipts. par_iter ( ) . try_for_each ( |receipt| {
@@ -39,7 +39,7 @@ pub fn check_and_aggregate_receipts(
3939 }
4040
4141 // Check that the receipts timestamp is greater than the previous rav
42- check_receipt_timestamps ( receipts, previous_rav. as_ref ( ) ) ?;
42+ check_receipt_timestamps ( & receipts, previous_rav. as_ref ( ) ) ?;
4343
4444 // Get the allocation id from the first receipt, return error if there are no receipts
4545 let allocation_id = match receipts. first ( ) {
@@ -48,7 +48,7 @@ pub fn check_and_aggregate_receipts(
4848 } ;
4949
5050 // Check that the receipts all have the same allocation id
51- check_allocation_id ( receipts, allocation_id) ?;
51+ check_allocation_id ( & receipts, allocation_id) ?;
5252
5353 // Check that the rav has the correct allocation id
5454 if let Some ( previous_rav) = & previous_rav {
@@ -62,8 +62,10 @@ pub fn check_and_aggregate_receipts(
6262 }
6363 }
6464
65+ let receipts = receipts. into_iter ( ) . map ( Into :: into) . collect :: < Vec < _ > > ( ) ;
66+
6567 // Aggregate the receipts
66- let rav = ReceiptAggregateVoucher :: aggregate_receipts ( allocation_id , receipts, previous_rav) ?;
68+ let rav = ReceiptAggregateVoucher :: aggregate_receipts ( & receipts, previous_rav) ?;
6769
6870 // Sign the rav and return
6971 Ok ( EIP712SignedMessage :: new ( domain_separator, rav, wallet) ?)
0 commit comments