33
44use alloy:: dyn_abi:: Eip712Domain ;
55
6- use super :: adapters:: { EscrowHandler , RAVRead , RAVStore , ReceiptDelete , ReceiptRead , ReceiptStore } ;
6+ use super :: adapters:: {
7+ RAVRead , RAVStore , ReceiptDelete , ReceiptRead , ReceiptStore , SignatureChecker ,
8+ } ;
79use crate :: {
810 rav:: { RAVRequest , ReceiptAggregateVoucher , SignedRAV } ,
911 receipt:: {
1012 checks:: { CheckBatch , CheckList , TimestampCheck , UniqueCheck } ,
11- state:: { Failed , Reserved } ,
13+ state:: { Checked , Failed } ,
1214 Context , ReceiptError , ReceiptWithState , SignedReceipt ,
1315 } ,
1416 Error ,
@@ -42,7 +44,7 @@ impl<E> Manager<E> {
4244
4345impl < E > Manager < E >
4446where
45- E : RAVStore + EscrowHandler ,
47+ E : RAVStore + SignatureChecker ,
4648{
4749 /// Verify `signed_rav` matches all values on `expected_rav`, and that `signed_rav` has a valid signer.
4850 ///
5658 signed_rav : SignedRAV ,
5759 ) -> std:: result:: Result < ( ) , Error > {
5860 self . context
59- . check_rav_signature ( & signed_rav, & self . domain_separator )
61+ . check_signature ( & signed_rav, & self . domain_separator )
6062 . await ?;
6163
6264 if signed_rav. message != expected_rav {
9597
9698impl < E > Manager < E >
9799where
98- E : ReceiptRead + EscrowHandler ,
100+ E : ReceiptRead + SignatureChecker ,
99101{
100102 async fn collect_receipts (
101103 & self ,
@@ -105,7 +107,7 @@ where
105107 limit : Option < u64 > ,
106108 ) -> Result <
107109 (
108- Vec < ReceiptWithState < Reserved > > ,
110+ Vec < ReceiptWithState < Checked > > ,
109111 Vec < ReceiptWithState < Failed > > ,
110112 ) ,
111113 Error ,
@@ -126,9 +128,8 @@ where
126128 source_error : anyhow:: Error :: new ( err) ,
127129 } ) ?;
128130
129- let mut awaiting_reserve_receipts = vec ! [ ] ;
131+ let mut checked_receipts = vec ! [ ] ;
130132 let mut failed_receipts = vec ! [ ] ;
131- let mut reserved_receipts = vec ! [ ] ;
132133
133134 // check for timestamp
134135 let ( checking_receipts, already_failed) =
@@ -146,27 +147,18 @@ where
146147 . map_err ( |e| Error :: ReceiptError ( ReceiptError :: RetryableCheck ( e) ) ) ?;
147148
148149 match receipt {
149- Ok ( checked) => awaiting_reserve_receipts. push ( checked) ,
150- Err ( failed) => failed_receipts. push ( failed) ,
151- }
152- }
153- for checked in awaiting_reserve_receipts {
154- match checked
155- . check_and_reserve_escrow ( & self . context , & self . domain_separator )
156- . await
157- {
158- Ok ( reserved) => reserved_receipts. push ( reserved) ,
150+ Ok ( checked) => checked_receipts. push ( checked) ,
159151 Err ( failed) => failed_receipts. push ( failed) ,
160152 }
161153 }
162154
163- Ok ( ( reserved_receipts , failed_receipts) )
155+ Ok ( ( checked_receipts , failed_receipts) )
164156 }
165157}
166158
167159impl < E > Manager < E >
168160where
169- E : ReceiptRead + RAVRead + EscrowHandler ,
161+ E : ReceiptRead + RAVRead + SignatureChecker ,
170162{
171163 /// Completes remaining checks on all receipts up to
172164 /// (current time - `timestamp_buffer_ns`). Returns them in two lists
@@ -210,7 +202,7 @@ where
210202 }
211203
212204 fn generate_expected_rav (
213- receipts : & [ ReceiptWithState < Reserved > ] ,
205+ receipts : & [ ReceiptWithState < Checked > ] ,
214206 previous_rav : Option < SignedRAV > ,
215207 ) -> Result < ReceiptAggregateVoucher , Error > {
216208 if receipts. is_empty ( ) {
0 commit comments