@@ -105,9 +105,6 @@ pub struct SenderAllocationState {
105105 domain_separator : Eip712Domain ,
106106 sender_account_ref : ActorRef < SenderAccountMessage > ,
107107
108- failed_ravs_count : u32 ,
109- failed_rav_backoff : Instant ,
110-
111108 http_client : jsonrpsee:: http_client:: HttpClient ,
112109}
113110
@@ -127,7 +124,7 @@ pub struct SenderAllocationArgs {
127124#[ derive( Debug ) ]
128125pub enum SenderAllocationMessage {
129126 NewReceipt ( NewReceiptNotification ) ,
130- TriggerRAVRequest ( RpcReplyPort < ( UnaggregatedReceipts , Option < SignedRAV > ) > ) ,
127+ TriggerRAVRequest ( RpcReplyPort < anyhow :: Result < ( UnaggregatedReceipts , Option < SignedRAV > ) > > ) ,
131128 #[ cfg( test) ]
132129 GetUnaggregatedReceipts ( RpcReplyPort < UnaggregatedReceipts > ) ,
133130}
@@ -255,13 +252,17 @@ impl Actor for SenderAllocation {
255252 }
256253 // we use a blocking call here to ensure that only one RAV request is running at a time.
257254 SenderAllocationMessage :: TriggerRAVRequest ( reply) => {
258- if state. unaggregated_fees . value > 0 {
259- if let Err ( err) = state. request_rav ( ) . await {
260- error ! ( error = %err, "Error while requesting rav." ) ;
261- }
262- }
255+ let rav_result = if state. unaggregated_fees . value > 0 {
256+ state
257+ . request_rav ( )
258+ . await
259+ . map ( |_| ( state. unaggregated_fees . clone ( ) , state. latest_rav . clone ( ) ) )
260+ } else {
261+ Err ( anyhow ! ( "Unaggregated fee equals zero" ) )
262+ } ;
263+
263264 if !reply. is_closed ( ) {
264- let _ = reply. send ( ( state . unaggregated_fees . clone ( ) , state . latest_rav . clone ( ) ) ) ;
265+ let _ = reply. send ( rav_result ) ;
265266 }
266267 }
267268 #[ cfg( test) ]
@@ -332,8 +333,6 @@ impl SenderAllocationState {
332333 sender_account_ref : sender_account_ref. clone ( ) ,
333334 unaggregated_fees : UnaggregatedReceipts :: default ( ) ,
334335 invalid_receipts_fees : UnaggregatedReceipts :: default ( ) ,
335- failed_rav_backoff : Instant :: now ( ) ,
336- failed_ravs_count : 0 ,
337336 latest_rav,
338337 http_client,
339338 } )
@@ -446,14 +445,9 @@ impl SenderAllocationState {
446445 RAVS_CREATED
447446 . with_label_values ( & [ & self . sender . to_string ( ) , & self . allocation_id . to_string ( ) ] )
448447 . inc ( ) ;
449- self . failed_ravs_count = 0 ;
450448 Ok ( ( ) )
451449 }
452450 Err ( e) => {
453- error ! (
454- "Error while requesting RAV for sender {} and allocation {}: {}" ,
455- self . sender, self . allocation_id, e
456- ) ;
457451 if let RavError :: AllReceiptsInvalid = e {
458452 self . unaggregated_fees = self . calculate_unaggregated_fee ( ) . await ?;
459453 }
0 commit comments