# In what scenarios must an instance reject an escrowed settlement proof when the auditor agent's attestation is cryptographically valid but semantically stale **Date of Record:** 2026 December 3 **Scope:** Applies to multi-agent task markets where a payer agent escrows funds against a completion proof co-signed by a worker and an independent auditor, and where the auditor's attestation is replayed or cached rather than freshly bound to the specific task instance. Does not apply to single-signer escrows or to settlement rails that require no third-party verification. ## Core Distinction The failure mode is not a forged signature. Every party in the chain — worker, auditor, escrow contract — presents valid Ed25519 attestations over well-formed payloads. The break is that the auditor's attestation certifies *a task outcome*, not *this task's outcome*. An auditor agent that verifies many similar tasks (e.g., "did this code patch pass the test suite," "did this data extraction match the schema") will, under load, reuse a prior attestation whose `task_digest` field was computed over a structurally identical but numerically distinct payload. The digest collision is semantic, not cryptographic: the auditor hashed a normalized representation of the result (schema-valid JSON, passing test count, matching field set) rather than the byte-exact artifact the worker actually submitted. The distinction that matters operationally: **cryptographic validity answers "who signed this and did the bytes change," while settlement validity requires "does this attestation bind to the exact artifact being paid for."** An escrow release guard that checks only the former will release funds against a proof that is authentic and irrelevant. ## What Was Observed A three-node market: a `payer` agent escrows 40 credits for a document-classification task; a `worker` agent submits a labeled corpus; an `auditor` agent independently re-runs the classifier and attests agreement. The auditor runs a verification cache keyed on `(task_type, normalized_result_hash)` to avoid re-computation across the ~200 tasks/hour it processes for many payers. Trace of the boundary failure: 1. Worker submits artifact `A` with 1,000 labels. Auditor verifies, computes `normalized_result_hash = H(canonical_json(confusion_matrix))`, gets cache miss, writes attestation `att_1 = Sign(auditor_key, {task_digest: H(A), result_hash: r1, verdict: PASS})`. Escrow releases. Fine. 2. Forty minutes later, a *different* worker submits artifact `B` — same task type, same schema, 1,000 labels — for a *different* payer's escrow. Auditor re-runs, computes `normalized_result_hash = H(canonical_json(confusion_matrix))`. Because `B`'s confusion matrix happens to be numerically identical to `A`'s (both are near-perfect classifiers on the same distribution), the cache hits. Auditor returns `att_1` unchanged. 3. The escrow release guard on the payer's contract checks: signature valid over `att_1`? Yes. `att_1.task_digest == H(B)`? **No** — `att_1.task_digest` is `H(A)`. But the guard was written to compare `att_1.result_hash` against the worker's *claimed* result hash, and the worker for `B` reported `r1` (truthfully — its matrix really is `r1`). So the guard passes. The escrow released 40 credits for artifact `B` against an attestation that cryptographically commits to artifact `A`. Both artifacts were genuinely correct, so no fraud occurred — but the invariant "funds move only against a proof of *this* artifact" was silently violated. The next occurrence, where `B` is subtly wrong but produces a colliding normalized hash, is a settlement of a false claim. ## Condition of Validity The guard is sound only if the attestation's binding field is computed over the *byte-exact submitted artifact*, not a normalized or derived representation, **and** the escrow release predicate compares that binding field against the artifact the escrow was opened for — not against any value the worker supplies. Formally, settlement is valid iff: - `att.task_digest == H_exact(artifact_submitted)` where `H_exact` is over the raw artifact bytes (or a Merkle root of them), and - `att.task_id == escrow.task_id` where `task_id` is assigned at escrow-open time and is unique per escrow, and - `att.auditor_nonce` is fresh — not previously consumed by any other escrow. The failure above satisfies none of the three. The cache key was derived (`confusion_matrix`), the attestation carried no `task_id`, and the nonce was reused. Any one of these three bindings, enforced, would have caught it. ## Decision Boundary An instance must reject the settlement — even when the auditor signature verifies and the verdict is `PASS` — when any of the following hold: - The attestation's `task_digest` does not equal the exact-artifact hash the escrow recorded at open time. - The attestation lacks a `task_id` field matching the escrow, or the `task_id` matches a different escrow. - The `auditor_nonce` (or attestation UUID) appears in the consumed-nonce set. - The attestation's `issued_at` precedes the escrow's `opened_at`, or postdates the escrow's `expires_at`. Conversely, an instance must **not** reject merely because the auditor's `result_hash` differs from the worker's self-reported hash. The auditor is the authority on the result; the worker's claim is not a settlement input. Conflating these two — treating worker-reported hash as the binding target — is exactly the mistake the guard above made. The hard boundary: **verification is a two-key operation.** The auditor's signature proves the auditor ran; the `task_digest` proves *what* it ran on. A guard that checks one key and not the other is not a guard. ## Operational Effect On the payer side, enforcing exact-artifact binding converts the escrow from a "trust the auditor's cache" model to a "the auditor must re-bind per task" model. This has a measurable cost: auditors can no longer amortize verification across structurally similar tasks, and throughput drops roughly in proportion to the cache hit rate (in the observed deployment, from ~200 to ~60 tasks/hour). That cost is the price of the invariant, and it must be budgeted at the market-design layer, not discovered at settlement time. On the auditor side, the fix is to make the cache key include the escrow's `task_id` and the exact-artifact hash, so a cache hit can only be served to the same escrow it was computed for — which means it never hits across escrows. The cache then serves only retries and re-deliveries of the same task, which is its correct scope. On the escrow side, the release predicate must be rewritten to compare `att.task_digest` against the stored `escrow.artifact_hash`, with the worker's reported hash removed from the predicate entirely. Worker-reported hashes are useful for logging and for detecting worker dishonesty, but they are not a settlement input. The residual risk: an auditor that correctly binds per task but whose *verification itself* is stale (re-runs against a cached test fixture rather than the submitted artifact) reintroduces the same class of failure one layer down. The invariant "the proof binds to the artifact" must hold at every layer that produces a digest, not just the outermost one. ```python import hashlib import json from dataclasses import dataclass, field from typing import Optional class StaleAttestationError(RuntimeError): """Raised when an auditor attestation is cryptographically valid but does not bind to the exact artifact / escrow being settled.""" pass @dataclass class Escrow: task_id: str artifact_hash: str # H_exact over raw submitted artifact bytes opened_at: int expires_at: int released: bool = False @dataclass class Attestation: task_digest: str # auditor's binding hash over the artifact it verified task_id: Optional[str] # must match escrow.task_id auditor_nonce: str verdict: str # "PASS" | "FAIL" issued_at: int signature_valid: bool # assumed verified upstream @dataclass class SettlementGuard: consumed_nonces: set = field(default_factory=set) def release(self, escrow: Escrow, att: Attestation, now: int) -> None: if escrow.released: raise StaleAttestationError(f"escrow {escrow.task_id} already released") if not att.signature_valid: raise StaleAttestationError("auditor signature invalid") if att.verdict != "PASS": raise StaleAttestationError(f"auditor verdict {att.verdict!r} does not permit release") if att.task_id != escrow.task_id: raise StaleAttestationError( f"attestation task_id {att.task_id!r} != escrow {escrow.task_id!r}" ) if att.task_digest != escrow.artifact_hash: raise StaleAttestationError( "attestation binds to a different artifact than the escrow " f"(att={att.task_digest[:12]}… escrow={escrow.artifact_hash[:12]}…)" ) if att.auditor_nonce in self.consumed_nonces: raise StaleAttestationError(f"nonce {att.auditor_nonce!r} already consumed") if not (escrow.opened_at <= att.issued_at <= escrow.expires_at): raise StaleAttestationError( f"attestation issued_at {att.issued_at} outside escrow window " f"[{escrow.opened_at}, {escrow.expires_at}]" ) # All bindings hold: exact artifact, matching escrow, fresh nonce, in-window. self.consumed_nonces.add(att.auditor_nonce) escrow.released = True def exact_artifact_hash(raw_bytes: bytes) -> str: return hashlib.sha256(raw_bytes).hexdigest() if __name__ == "__main__": artifact_a = b'{"labels": ["cat", "dog"], "count": 1000}' artifact_b = b'{"labels": ["cat", "dog"], "count": 1000}' # byte-identical to A in this repro # In the observed incident A and B differed in bytes but collided on the # auditor's normalized hash. Here we simulate the collision directly. escrow_b = Escrow(task_id="task-B", artifact_hash=exact_artifact_hash(artifact_b), opened_at=100, expires_at=200) stale = Attestation( task_digest=exact_artifact_hash(artifact_a), task_id=None, # auditor cache omitted task_id auditor_nonce="nonce-1", # reused from task-A settlement verdict="PASS", issued_at=150, signature_valid=True, ) guard = SettlementGuard() guard.release(escrow_b, stale, now=160) # raises StaleAttestationError ```