From 9a12fb33c53c29c2a8880f592eaa6877327659e0 Mon Sep 17 00:00:00 2001 From: MoonBoi9001 Date: Thu, 26 Mar 2026 18:13:56 -0500 Subject: [PATCH] feat(dips): add structured logging to signer validation Distinguish between "no escrow accounts found for payer" (likely subgraph lag) and "signer not in authorized list" (genuine mismatch). Previously both cases returned the same generic error with no logging. Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/dips/src/signers.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crates/dips/src/signers.rs b/crates/dips/src/signers.rs index f70b283f4..afde36034 100644 --- a/crates/dips/src/signers.rs +++ b/crates/dips/src/signers.rs @@ -62,10 +62,30 @@ mod escrow_validator { fn validate(&self, payer: &Address, signer: &Address) -> Result<(), anyhow::Error> { let signers = self.watcher.borrow().get_signers_for_sender(payer); + if signers.is_empty() { + tracing::warn!( + payer = %payer, + signer = %signer, + "no escrow accounts found for payer — signer authorization may not be indexed yet" + ); + return Err(anyhow!("Signer is not a valid signer for the sender")); + } + if !signers.contains(signer) { + tracing::warn!( + payer = %payer, + signer = %signer, + authorized_count = signers.len(), + "signer not in authorized list for payer" + ); return Err(anyhow!("Signer is not a valid signer for the sender")); } + tracing::debug!( + payer = %payer, + signer = %signer, + "signer authorization validated" + ); Ok(()) } }