From 3fb72616c3eb898377ef9e33197b30b7e1b485ff Mon Sep 17 00:00:00 2001 From: Greg Soucy Date: Fri, 20 Mar 2026 16:56:29 -0400 Subject: [PATCH] [runtime] instrument verify path for chain-test triage Why: capture CI-visible progress markers around /verify to pinpoint where the failing chain test stalls. Contract impact: none --- server.mjs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/server.mjs b/server.mjs index d5af7e5..667dcef 100644 --- a/server.mjs +++ b/server.mjs @@ -1732,6 +1732,15 @@ app.post("/verify", async (req, res) => { const proof = receipt?.metadata?.proof; const proofCanonical = String(proof?.canonical_id || proof?.canonical || ""); const runtimeCoreReceipt = normalizeReceiptForRuntimeCoreVerify(receipt); + const verb = String(receipt?.x402?.verb || "").trim(); + + console.error("[verify] entered", { + wantSchema, + wantEns, + verb, + VERIFY_SCHEMA_CACHED_ONLY, + hasValidatorCached: hasValidatorCached(verb), + }); const verifyLogic = async () => { if (!proof?.signature_b64 || !proof?.hash_sha256) { @@ -1754,6 +1763,7 @@ app.post("/verify", async (req, res) => { let ensExpect = null; if (wantEns) { + console.error("[verify] entering ENS resolution", { verb }); const signerForEns = String(proof?.signer_id || runtimeConfig.signerId || "").trim(); const ensOut = await fetchEnsSignerBundle({ signerName: signerForEns, refresh }); @@ -1826,6 +1836,7 @@ app.post("/verify", async (req, res) => { // 2) verify signature/hash via runtime-core let v; try { + console.error("[verify] entering crypto verify", { verb }); v = verifyReceiptEd25519Sha256(runtimeCoreReceipt, { publicKeyPemOrDer: pubPem, allowedCanonicals: [runtimeConfig.canonicalId], @@ -1862,11 +1873,12 @@ app.post("/verify", async (req, res) => { if (wantSchema) { schemaOk = false; - const verb = String(receipt?.x402?.verb || "").trim(); + const validatorCached = hasValidatorCached(verb); if (!verb) { schemaErrors = [{ message: "missing receipt.x402.verb" }]; - } else if (VERIFY_SCHEMA_CACHED_ONLY && !hasValidatorCached(verb)) { + } else if (VERIFY_SCHEMA_CACHED_ONLY && !validatorCached) { + console.error("[verify] returning 202 validator_not_warmed_yet", { verb }); warmQueue.add(verb); startWarmWorker(); @@ -1891,6 +1903,11 @@ app.post("/verify", async (req, res) => { }); } else { try { + console.error("[verify] entering schema validation path", { + verb, + cachedOnly: VERIFY_SCHEMA_CACHED_ONLY, + validatorCached, + }); const validate = VERIFY_SCHEMA_CACHED_ONLY ? validatorCache.get(verb)?.validate : await getValidatorForVerb(verb); if (!validate) { schemaOk = false;