@@ -11,54 +11,73 @@ use ethers_core::types::SignatureError;
1111use std:: result:: Result as StdResult ;
1212use thiserror:: Error as ThisError ;
1313
14+ /// Error type for the TAP protocol
1415#[ derive( ThisError , Debug ) ]
1516pub enum Error {
17+ /// Error when trying to aggregate receipts and the result overflows
1618 #[ error( "Aggregating receipt results in overflow" ) ]
1719 AggregateOverflow ,
18- #[ error( "Failed to encode to EIP712 hash:\n {source_error_message}" ) ]
19- EIP712EncodeError { source_error_message : String } ,
20- #[ error(
21- "Unexpected check: \" {check_string}\" . Only checks provided in initial checklist are valid"
22- ) ]
23- InvalidCheckError { check_string : String } ,
24- #[ error( "The requested action is invalid for current receipt state: {state}" ) ]
25- InvalidStateForRequestedAction { state : String } ,
20+ /// Error when Rust fails to get the current system time
2621 #[ error( "Failed to get current system time: {source_error_message} " ) ]
2722 InvalidSystemTime { source_error_message : String } ,
23+ /// `ethers` wallet error
2824 #[ error( transparent) ]
2925 WalletError ( #[ from] WalletError ) ,
26+ /// Error when signature verification fails
3027 #[ error( transparent) ]
3128 SignatureError ( #[ from] SignatureError ) ,
32- # [ error ( "Recovered sender address invalid {address}" ) ]
33- InvalidRecoveredSigner { address : Address } ,
29+
30+ /// Error when the received RAV does not match the expected RAV
3431 #[ error( "Received RAV does not match expexted RAV" ) ]
3532 InvalidReceivedRAV {
3633 received_rav : ReceiptAggregateVoucher ,
3734 expected_rav : ReceiptAggregateVoucher ,
3835 } ,
36+ /// Generic error from the adapter
3937 #[ error( "Error from adapter.\n Caused by: {source_error}" ) ]
4038 AdapterError { source_error : anyhow:: Error } ,
39+ /// Error when no valid receipts are found for a RAV request
4140 #[ error( "Failed to produce rav request, no valid receipts" ) ]
4241 NoValidReceiptsForRAVRequest ,
42+
43+ /// Error when the previous RAV allocation id does not match the allocation id from the new receipt
4344 #[ error( "Previous RAV allocation id ({prev_id}) doesn't match the allocation id from the new receipt ({new_id})." ) ]
4445 RavAllocationIdMismatch { prev_id : String , new_id : String } ,
46+
47+ /// Error when all receipts do not have the same allocation id
48+ ///
49+ /// Used in tap_aggregator
4550 #[ error( "All receipts should have the same allocation id, but they don't" ) ]
4651 RavAllocationIdNotUniform ,
52+ /// Error when the receipt signature is duplicated.
53+ ///
54+ /// Used in tap_aggregator
4755 #[ error( "Duplicate receipt signature: {0}" ) ]
4856 DuplicateReceiptSignature ( String ) ,
4957 #[ error(
5058 "Receipt timestamp ({receipt_ts}) is less or equal than previous rav timestamp ({rav_ts})"
5159 ) ]
5260 ReceiptTimestampLowerThanRav { rav_ts : u64 , receipt_ts : u64 } ,
61+
62+ /// Error when the min timestamp is greater than the max timestamp
63+ /// Used by [`crate::manager::Manager::create_rav_request()`]
5364 #[ error( "Timestamp range error: min_timestamp_ns: {min_timestamp_ns}, max_timestamp_ns: {max_timestamp_ns}. Adjust timestamp buffer." ) ]
5465 TimestampRangeError {
5566 min_timestamp_ns : u64 ,
5667 max_timestamp_ns : u64 ,
5768 } ,
5869
70+ /// Error on the receipt side
5971 #[ error( "Receipt error: {0}" ) ]
6072 ReceiptError ( #[ from] ReceiptError ) ,
6173
74+ /// Error when the recovered signer address is invalid
75+ /// Used by [`crate::manager::adapters::EscrowHandler`]
76+ #[ error( "Recovered sender address invalid {address}" ) ]
77+ InvalidRecoveredSigner { address : Address } ,
78+
79+ /// Indicates a failure while verifying the signer
80+ /// Used by [`crate::manager::adapters::EscrowHandler`]
6281 #[ error( "Failed to check the signer: {0}" ) ]
6382 FailedToVerifySigner ( String ) ,
6483}
0 commit comments