Skip to content

Commit 212e06a

Browse files
authored
fix: Store receipt error into db (#322)
1 parent c693f0e commit 212e06a

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

.sqlx/query-56c3678866ffe0ec2eed7290394d07007990cc244f598b763ec5470515efe019.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-a6f746e408a9c77e6025495dbc41a5d989c8b5c5b6d364b61767a67085deaf8a.json renamed to .sqlx/query-6c365bc1b0728ec8d9f1239d7bffe7861ff17c6b8de4365a39f28099f5711613.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

migrations/20230912220523_tap_receipts.up.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ CREATE TABLE IF NOT EXISTS scalar_tap_receipts_invalid (
3737
allocation_id CHAR(40) NOT NULL,
3838
timestamp_ns NUMERIC(20) NOT NULL,
3939
nonce NUMERIC(20) NOT NULL,
40-
value NUMERIC(39) NOT NULL
40+
value NUMERIC(39) NOT NULL,
41+
error_log TEXT NOT NULL DEFAULT ''
4142
);

tap-agent/src/agent/sender_allocation.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use tap_core::{
2727
signed_message::EIP712SignedMessage,
2828
};
2929
use thegraph_core::Address;
30-
use tracing::{debug, error, warn};
30+
use tracing::{error, warn};
3131

3232
use crate::{agent::sender_account::ReceiptFees, lazy_static};
3333

@@ -687,12 +687,6 @@ impl SenderAllocationState {
687687
error!("Failed to recover receipt signer: {}", e);
688688
anyhow!(e)
689689
})?;
690-
debug!(
691-
"Receipt for allocation {} and signer {} failed reason: {}",
692-
allocation_id.encode_hex(),
693-
receipt_signer.encode_hex(),
694-
receipt_error
695-
);
696690
sqlx::query!(
697691
r#"
698692
INSERT INTO scalar_tap_receipts_invalid (
@@ -701,16 +695,18 @@ impl SenderAllocationState {
701695
allocation_id,
702696
timestamp_ns,
703697
nonce,
704-
value
698+
value,
699+
error_log
705700
)
706-
VALUES ($1, $2, $3, $4, $5, $6)
701+
VALUES ($1, $2, $3, $4, $5, $6, $7)
707702
"#,
708703
receipt_signer.encode_hex(),
709704
encoded_signature,
710705
allocation_id.encode_hex(),
711706
BigDecimal::from(receipt.message.timestamp_ns),
712707
BigDecimal::from(receipt.message.nonce),
713708
BigDecimal::from(BigInt::from(receipt.message.value)),
709+
receipt_error
714710
)
715711
.execute(&self.pgpool)
716712
.await

0 commit comments

Comments
 (0)