@@ -27,7 +27,7 @@ use tap_core::{
2727 signed_message:: EIP712SignedMessage ,
2828} ;
2929use thegraph_core:: Address ;
30- use tracing:: { error, warn} ;
30+ use tracing:: { debug , error, warn} ;
3131
3232use crate :: { agent:: sender_account:: ReceiptFees , lazy_static} ;
3333
@@ -692,6 +692,7 @@ impl SenderAllocationState {
692692 let mut timestamps = Vec :: with_capacity ( reciepts_len) ;
693693 let mut nounces = Vec :: with_capacity ( reciepts_len) ;
694694 let mut values = Vec :: with_capacity ( reciepts_len) ;
695+ let mut error_logs = Vec :: with_capacity ( reciepts_len) ;
695696
696697 for received_receipt in receipts. iter ( ) {
697698 let receipt = received_receipt. signed_receipt ( ) ;
@@ -704,12 +705,19 @@ impl SenderAllocationState {
704705 error ! ( "Failed to recover receipt signer: {}" , e) ;
705706 anyhow ! ( e)
706707 } ) ?;
708+ debug ! (
709+ "Receipt for allocation {} and signer {} failed reason: {}" ,
710+ allocation_id. encode_hex( ) ,
711+ receipt_signer. encode_hex( ) ,
712+ receipt_error
713+ ) ;
707714 reciepts_signers. push ( receipt_signer. encode_hex ( ) ) ;
708715 encoded_signatures. push ( encoded_signature) ;
709716 allocation_ids. push ( allocation_id. encode_hex ( ) ) ;
710717 timestamps. push ( BigDecimal :: from ( receipt. message . timestamp_ns ) ) ;
711718 nounces. push ( BigDecimal :: from ( receipt. message . nonce ) ) ;
712719 values. push ( BigDecimal :: from ( BigInt :: from ( receipt. message . value ) ) ) ;
720+ error_logs. push ( receipt_error) ;
713721 }
714722 sqlx:: query!(
715723 r#"INSERT INTO scalar_tap_receipts_invalid (
@@ -718,21 +726,24 @@ impl SenderAllocationState {
718726 allocation_id,
719727 timestamp_ns,
720728 nonce,
721- value
729+ value,
730+ error_log
722731 ) SELECT * FROM UNNEST(
723732 $1::CHAR(40)[],
724733 $2::BYTEA[],
725734 $3::CHAR(40)[],
726735 $4::NUMERIC(20)[],
727736 $5::NUMERIC(20)[],
728- $6::NUMERIC(40)[]
737+ $6::NUMERIC(40)[],
738+ $7::TEXT[]
729739 )"# ,
730740 & reciepts_signers,
731741 & encoded_signatures,
732742 & allocation_ids,
733743 & timestamps,
734744 & nounces,
735745 & values,
746+ & error_logs
736747 )
737748 . execute ( & self . pgpool )
738749 . await
0 commit comments