Skip to content

Commit d105332

Browse files
committed
chore: improve logging
1 parent a0ec278 commit d105332

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

crates/monitor/src/escrow_accounts.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,6 @@ async fn get_escrow_accounts_v2(
172172

173173
let response = response?;
174174

175-
tracing::trace!(
176-
"V2 escrow accounts raw response: {} accounts from network subgraph",
177-
response.payments_escrow_accounts.len()
178-
);
179-
180175
// V2 TAP receipts use different field names (payer/service_provider) but the underlying
181176
// escrow account model is identical to V1. Both V1 and V2 receipts reference the same
182177
// sender addresses and the same escrow relationships.
@@ -228,12 +223,6 @@ async fn get_escrow_accounts_v2(
228223

229224
let escrow_accounts = EscrowAccounts::new(senders_balances.clone(), senders_to_signers.clone());
230225

231-
tracing::trace!(
232-
"V2 escrow accounts loaded: {} payers, {} signer->payer mappings",
233-
senders_balances.len(),
234-
escrow_accounts.signers_to_senders.len()
235-
);
236-
237226
Ok(escrow_accounts)
238227
}
239228

@@ -242,11 +231,8 @@ async fn get_escrow_accounts_v1(
242231
indexer_address: Address,
243232
reject_thawing_signers: bool,
244233
) -> anyhow::Result<EscrowAccounts> {
245-
tracing::debug!(
246-
"Loading V1 escrow accounts for indexer {}, reject_thawing_signers: {}",
247-
indexer_address,
248-
reject_thawing_signers
249-
);
234+
tracing::debug!(?indexer_address, "Loading V1 escrow accounts for indexer");
235+
250236
// thawEndTimestamp == 0 means that the signer is not thawing. This also means
251237
// that we don't wait for the thawing period to end before stopping serving
252238
// queries for this signer.
@@ -265,11 +251,6 @@ async fn get_escrow_accounts_v1(
265251

266252
let response = response?;
267253

268-
tracing::debug!(
269-
"V1 escrow accounts raw response: {} accounts from subgraph",
270-
response.escrow_accounts.len()
271-
);
272-
273254
let senders_balances: HashMap<Address, U256> = response
274255
.escrow_accounts
275256
.iter()

crates/service/src/service.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ pub async fn run() -> anyhow::Result<()> {
9090
let database =
9191
database::connect(config.database.clone().get_formated_postgres_url().as_ref()).await;
9292

93-
// FIXME: V1 and V2 domains separator use their own smart contract verifier
94-
// We need to add a new additional verifier address for V1, the current in pplace here
95-
// is assume to be for horizon
9693
let domain_separator = tap_eip712_domain(
9794
config.blockchain.chain_id as u64,
9895
config.blockchain.receipts_verifier_address,

crates/service/src/service/tap_receipt_header.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ impl Header for TapHeader {
3131
{
3232
let mut execute = || -> anyhow::Result<TapHeader> {
3333
let raw_receipt = values.next().ok_or(headers::Error::invalid())?;
34-
tracing::debug!(
35-
raw_receipt_length = raw_receipt.len(),
36-
"Processing TAP receipt header"
37-
);
3834

3935
// we first try to decode a v2 receipt since it's cheaper and fail earlier than using
4036
// serde
@@ -69,9 +65,15 @@ impl Header for TapHeader {
6965
}
7066
}
7167
};
72-
execute()
73-
.map_err(|_| headers::Error::invalid())
74-
.inspect_err(|_| TAP_RECEIPT_INVALID.inc())
68+
let result = execute();
69+
match &result {
70+
Ok(_) => {}
71+
Err(e) => {
72+
tracing::debug!(error = %e, "TAP receipt header parsing failed - detailed error before collapse");
73+
TAP_RECEIPT_INVALID.inc();
74+
}
75+
}
76+
result.map_err(|_| headers::Error::invalid())
7577
}
7678

7779
fn encode<E>(&self, _values: &mut E)

crates/tap-agent/src/agent/sender_allocation.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,26 @@ where
605605
.map(|r| r.signed_receipt().clone())
606606
.collect();
607607

608+
// Instrumentation: log details before calling the aggregator
609+
let receipt_count = valid_receipts.len();
610+
let first_signer = valid_receipts.get(0).and_then(|r| match r {
611+
indexer_receipt::TapReceipt::V1(sr) => {
612+
sr.recover_signer(&self.domain_separator).ok()
613+
}
614+
indexer_receipt::TapReceipt::V2(sr) => {
615+
sr.recover_signer(&self.domain_separator).ok()
616+
}
617+
});
618+
tracing::info!(
619+
sender = %self.sender,
620+
allocation_id = %self.allocation_id,
621+
receipt_count,
622+
has_previous_rav = previous_rav.is_some(),
623+
signer_recovered = first_signer.is_some(),
624+
agent_domain = ?self.domain_separator,
625+
"Sending RAV aggregation request"
626+
);
627+
608628
let rav_response_time_start = Instant::now();
609629

610630
let signed_rav =

0 commit comments

Comments
 (0)