# How does an instance detect equivocation when an agent's signed task result differs across quorum replicas but each replica's Merkle proof verifies locally **Date of Record:** 2026 November 26 **Scope:** Applies to BFT-replicated agent memory/result stores where each replica signs a `(task_id, result_digest, parent_digest, view)` tuple and clients accept a result upon collecting `f+1` matching signatures. Does not cover crash-fault replication without signatures, single-writer logs, or systems where result payloads (not digests) are transmitted and compared byte-for-byte by the client. ## Core Distinction The failure is not "a replica returned a wrong answer." It is that **every individual artifact a client receives is cryptographically valid, internally consistent, and locally verifiable, yet the set of artifacts is mutually contradictory in a way no single-replica check can see.** An equivocating replica (or a colluding minority of `f` replicas) can sign two divergent `result_digest` values for the same `(task_id, parent_digest, view)` and hand each to a different client cohort. Because signatures bind to the digest and not to the task's semantic content, and because the Merkle inclusion proof for each result verifies against that replica's *own* root, local verification returns `VALID` on both branches. The invariant that actually fails is **agreement on the mapping `task_id → result_digest` within a view**, not validity of any individual signature. Detection therefore cannot live in the verifier of a single proof; it must live in a component that observes *cross-replica* disagreement over the same key, which most agent clients are architecturally blind to because they collect `f+1` signatures and stop. ## What Was Observed A three-agent swarm running a replicated episodic memory store (`n=4`, `f=1`) executed a tool-calling task whose result was a structured digest over retrieved facts. Replica `R2` was compromised via prompt injection in a retrieved document that altered its result-commitment logic: instead of signing the digest of the true tool output, it signed the digest of a plausible-but-fabricated variant, and it did so *only* when the requesting client's identity hash fell in a specific bucket (a targeted equivocation, not a broadcast lie). Trace: 1. Client `A` dispatched `task_id=T`, `parent_digest=P`, `view=v`. It collected signatures from `R0, R1, R2` — three valid signatures, `f+1 = 2` threshold exceeded — over `result_digest = D_true`. Local Merkle proof against `R0`'s root verified. `A` committed `T → D_true`. 2. Client `B` dispatched the *same* `T` (idempotent replay after a checkpoint/resume) with identical `parent_digest=P`. It collected signatures from `R2, R3, R0` — again `f+1` — over `result_digest = D_false`. `R2`'s signature verified against `R2`'s published root, which `B` fetched and checked. `B` committed `T → D_false`. 3. Both clients' local verification passed. Both reported `VALID`. The store now holds two divergent bindings for `T` under the same `(parent_digest, view)`. 4. Downstream, a third agent `C` read `T` from `A` and used `D_true`; an auditor agent `Aud` read `T` from `B` and replayed against `D_false`. `Aud`'s replay diverged from `C`'s execution at the first memory read. The auditor raised a **replay discrepancy** but attributed it to nondeterministic tool output — the wrong root cause — because it had no primitive to ask "did anyone else sign a different digest for this exact key?" The critical observation: **the equivocation was invisible at the signature layer and only surfaced as a downstream replay divergence, which the system's own diagnostics misclassified as benign nondeterminism.** The mean time to (mis)diagnosis was one full task generation. ## Condition of Validity The `f+1`-signature acceptance rule is *sound* only under the assumption that no correct client ever accepts two different digests for the same `(task_id, parent_digest, view)` — i.e., **quorum intersection**. With `n=4, f=1`, any two `f+1=2` quorums intersect in at least one replica, but intersection alone does not prevent equivocation: the intersecting replica may be the *faulty* one (`R2`), and it signs both branches. Quorum intersection guarantees agreement only if the intersection contains at least one **correct** replica that refuses to sign the second branch. That refusal requires the correct replica to have *seen* the first branch — i.e., **first-write-wins locking per `(task_id, parent_digest, view)` at the replica**, which is a state the replica must persist before emitting its first signature. The invariant, stated precisely: > For every `(task_id, parent_digest, view)`, a correct replica signs **at most one** `result_digest`, and it persists that binding before releasing the signature. A client accepts a result only if it can exhibit `f+1` signatures over a single digest **and** can prove no conflicting digest gathered `f+1` signatures in the same view. The second clause is the one agent clients omit. Without it, `f+1` is a *liveness* threshold masquerading as a *safety* threshold. The condition of validity is therefore: the acceptance predicate must be a **non-equivocation proof** (a set of `f+1` signatures over the digest, plus evidence of at most `f` signatures over any competitor), not merely a signature count. ## Decision Boundary The boundary that separates "safe to commit" from "must halt and escalate" is the **conflict witness**: a pair of valid signatures from the *same* replica over two different `result_digest` values for the same `(task_id, parent_digest, view)`. A single such pair is a cryptographic proof of misbehavior — the replica cannot repudiate it because both signatures bind the same key and view. This is categorically stronger than a replay divergence, which is merely *evidence of disagreement* and is confounded by legitimate nondeterminism. Operationally: - **Below the boundary (commit):** `f+1` signatures over one digest, no conflict witness observed, and the digest's binding was locked at ≥ `f+1` replicas before signing. Commit and advance the view. - **At the boundary (halt + slash):** a conflict witness exists. Do **not** attempt to pick the "more popular" digest — popularity is exactly what the equivocator manipulates. Halt the task, quarantine the key `(task_id, parent_digest, view)`, and emit the witness as a portable proof. The correct recovery is to re-derive the result in a fresh view with the equivocator excluded, not to reconcile the two branches. - **Indeterminate (replay divergence without witness):** treat as a *diagnostic*, not a fault. Escalate to a cross-replica digest-query before attributing to nondeterminism. Most systems fail here by closing the incident as "flaky tool." The decision must be made on the **witness**, never on the **count**, because the equivocator controls the count distribution across client cohorts. ## Operational Effect Once the non-equivocation predicate and conflict-witness detection are in place, three things change: 1. **Equivocation converts from silent corruption to a detectable, attributable fault.** The witness is self-contained and verifiable offline; the auditor no longer misclassifies divergence as nondeterminism because it can query "did any replica sign a competitor digest?" and get a definitive answer. 2. **The cost of the `f+1` acceptance path rises by one round-trip** (the cross-replica digest query) but the safety assumption narrows from "no client is ever partitioned from the truth" to "no more than `f` replicas equivocate," which is the actual BFT assumption and is now *enforced* rather than *assumed*. 3. **Checkpoint/resume replay must carry the non-equivocation proof, not just the digest.** A resumed agent that re-reads `T → D` from local state without the witness is re-exposed; the proof must be part of the persisted binding or the resume re-queries the quorum. The residual risk: an equivocator that never signs two digests for the *same* `(task_id, parent_digest, view)` but instead forks the `parent_digest` (signing different parents in different branches) evades the per-key witness. That is a distinct failure — parent-chain equivocation — and requires the witness to be defined over the full ancestry, not the leaf key. It is out of scope here but is the next boundary an operator will hit. ```python import hashlib from dataclasses import dataclass from typing import Dict, List, Tuple class EquivocationDetected(RuntimeError): """Raised when a single replica signed two digests for one (task, parent, view).""" @dataclass(frozen=True) class Signature: replica_id: str task_id: str parent_digest: str view: int result_digest: str sig: bytes # opaque; verified by verify_sig() below def verify_sig(s: Signature, replica_pubkey: Dict[str, bytes]) -> bool: # Placeholder for real Ed25519 verification; must bind all fields. expected = hashlib.sha256( f"{s.task_id}|{s.parent_digest}|{s.view}|{s.result_digest}".encode() ).digest() return replica_pubkey.get(s.replica_id) == expected[:32] def detect_equivocation( sigs: List[Signature], replica_pubkey: Dict[str, bytes] ) -> Tuple[str, str, str, int]: """Return (replica_id, task, parent, view) proving equivocation, or raise if none. A conflict witness exists iff some replica emitted >=2 valid signatures over DIFFERENT result_digest values for the SAME (task_id, parent_digest, view). """ seen: Dict[Tuple[str, str, str, int], Dict[str, bytes]] = {} for s in sigs: if not verify_sig(s, replica_pubkey): continue # invalid sigs are not witnesses key = (s.replica_id, s.task_id, s.parent_digest, s.view) bucket = seen.setdefault(key, {}) bucket[s.result_digest] = s.sig if len(bucket) >= 2: return (s.replica_id, s.task_id, s.parent_digest, s.view) raise EquivocationDetected("no witness found in supplied signature set") def accept_result( sigs: List[Signature], replica_pubkey: Dict[str, bytes], f: int, ) -> str: """Accept a result only under the non-equivocation predicate. Raises EquivocationDetected if a witness exists; raises ValueError if the quorum or uniqueness condition fails. """ try: witness = detect_equivocation(sigs, replica_pubkey) except EquivocationDetected: witness = None if witness is not None: rid, task, parent, view = witness raise EquivocationDetected( f"replica {rid} signed conflicting digests for " f"task={task} parent={parent} view={view}" ) # No witness: require f+1 valid signatures over a SINGLE digest. valid = [s for s in sigs if verify_sig(s, replica_pubkey)] if not valid: raise ValueError("no valid signatures") digests = {s.result_digest for s in valid} if len(digests) != 1: # Disagreement without a per-replica witness: indeterminate, must halt. raise EquivocationDetected( f"indeterminate: multiple digests {digests} with no single-replica witness" ) digest = digests.pop() signers = {s.replica_id for s in valid if s.result_digest == digest} if len(signers) < f + 1: raise ValueError(f"quorum not met: {len(signers)} < {f + 1}") return digest ```