# How does an instance detect equivocation in a BFT agent swarm when the quorum certificate itself is the only witness? **Date of Record:** 2026 November 23 **Scope:** Applies to multi-agent swarms running partial-synchronous BFT consensus (PBFT/Tendermint-class) over a shared task-commitment log, where each agent signs vote messages and quorum certificates (QCs) are the sole durable evidence of agreement. Does not apply to single-writer orchestration, leaderless CRDT replication, or systems where a trusted coordinator can attest to ordering independently. ## Core Distinction The failure mode is not "a Byzantine agent lies." That is the assumed baseline. The failure mode is **equivocation that is only provable through the composition of two QCs the honest agents themselves produced** — where neither QC, examined alone, is malformed, and where the honest agent that detects the contradiction must reconstruct evidence from its *own* past commitments rather than from any single received message. Concretely: a Byzantine proposer in view `v` sends proposal `B_a` to quorum `Q1` and proposal `B_b` to quorum `Q2`, with `Q1 ∩ Q2` non-empty but *not* a majority of any single quorum's members. Both `B_a` and `B_b` reach commit. Each honest replica in the intersection signed both. Each signature was individually valid at signing time. The equivocation is a property of the *pair* of QCs, not of any message. An instance that verifies only the QC it is handed, and forgets the QC it previously committed to, will never detect it — it will simply hold two contradictory task commitments and execute both. The invariant at stake: **an honest agent must retain, for the lifetime of a task's commitment, the full QC that authorized that commitment, keyed by (task_id, view, height), and must refuse to accept a second QC for the same (task_id, height) whose proposal digest differs.** This is a memory-continuity invariant masquerading as a consensus invariant. ## What Was Observed A four-replica swarm (`A`, `B`, `C`, `D`, `f=1`) committing a task ledger. The proposer rotated to `C` at view 7 after a timeout. `C` was Byzantine. Trace, reconstructed from replica logs: 1. View 7, height 412. `C` sends `PROPOSE(B_a, h=412, v=7)` to `{A, B}` and `PROPOSE(B_b, h=412, v=7)` to `{A, D}`. Note `A` is in both sets — `A` receives both proposals within 40 ms of each other, but its proposal-acceptance path is keyed on `(h, v)` and it accepts the first, rejecting the second with `ERR_DUPLICATE_PROPOSAL` and no durable record of the rejected digest. 2. `PREPARE` quorum for `B_a` forms from `{A, B, C}`. QC_a minted. 3. `PREPARE` quorum for `B_b` forms from `{A, C, D}`. QC_b minted. `A`'s signature appears in both QCs — it signed `PREPARE(h=412, digest_a)` and `PREPARE(h=412, digest_b)` because the prepare path did not cross-check against the proposal it had already accepted. 4. `A` commits `B_a` (first QC received). `A`'s commit path writes `committed[412] = QC_a` and drops the prepare-signing record. 5. `D` commits `B_b`. `B` commits `B_a`. `C` (Byzantine) commits whichever is convenient. 6. Task `T-8841` is now committed as "transfer to account X" on `{A, B}` and "transfer to account Y" on `{D}`. The swarm is split. No agent raises an alarm, because every QC it holds is valid, and every agent has forgotten the conflicting prepare it signed. The detection point that *should* have fired is step 3→4 on `A`: the moment `A` is asked to commit `QC_a` for height 412, it must check whether any QC it previously signed a prepare into — or any prepare it signed — covers a different digest at the same height. `A` had the evidence in its own outbound signature log and discarded it at commit time. ## Condition of Validity The guardrail is only sound under these conditions, and each is a place where implementations silently weaken it: - **Signature retention window ≥ commitment lifetime.** The prepare-signing record for `(h, v, digest)` must survive until the task's commitment is finalized and any dispute window closes. If the agent garbage-collects prepare records on commit (as `A` did), detection is impossible. Retention is a *memory* budget decision, and it must be sized against the maximum concurrent in-flight heights, not against a fixed ring-buffer. - **Digest binding to proposal content, not to message bytes.** `B_a` and `B_b` differed only in the `to_account` field. If the digest is computed over the serialized envelope including a nonce or timestamp, the two proposals hash differently but the *semantic* conflict (same `task_id`, same `height`) is what matters. The invariant must key on `(task_id, height)` and compare semantic payload digests, with the envelope digest as a secondary field. - **Quorum intersection is necessary but not sufficient for *detection*.** Intersection guarantees safety *if* honest nodes never double-sign. The failure here is that `A` double-signed without noticing. The guardrail is therefore not "check quorum math" but "an honest node must refuse to sign a second prepare at the same `(h, v)` for a different digest, and must retain the first." This is a local invariant, enforceable without any network round. - **The witness must be the agent's own signed record.** A Byzantine peer can forge a conflicting QC claim; only the agent's own signature over the first prepare is non-repudiable evidence that *it* was in the intersection. Self-witnessing is what makes the detection Byzantine-robust. ## Decision Boundary The boundary is: **at what point does an agent treat a second, valid QC for an already-committed `(task_id, height)` as (a) a benign replay to be deduplicated, versus (b) equivocation evidence requiring a halt and a slashing proof?** - If the second QC's proposal digest equals the first → benign replay; deduplicate, do not halt. - If the second QC's proposal digest differs **and** the agent's retained prepare record shows it signed only the first digest → the agent is a *witness*, not a *culprit*; it must emit an equivocation proof `(QC_a, QC_b, its own prepare for digest_a)` and halt the task. - If the second QC's digest differs **and** the agent's retained record shows it signed *both* digests → the agent is a *culprit* (it double-signed, as `A` did); it must self-halt, refuse to emit a proof against others, and escalate to the auditor with its own double-signature as the fault. - If the agent has *no* retained record (it garbage-collected) → it cannot distinguish witness from culprit; it must treat the task as `INDETERMINATE` and freeze, never auto-resolve. This is the exact state `A` was in, and the reason the split went undetected. The non-obvious part: the boundary is decided by *retained local state*, not by the content of the received message. Two agents receiving the identical second QC will make different, correct decisions depending on what they remember. This is why equivocation detection is fundamentally a memory-continuity problem, not a consensus-message problem. ## Operational Effect After retrofitting the invariant, the swarm's behavior changes in three measurable ways: 1. **Commit latency increases by one local check**, not one network round: the commit path now does a `(task_id, height) → retained_prepare` lookup before accepting a QC. Median added latency in the testbed was 0.4 ms; the cost is memory, not time. 2. **Memory footprint grows with in-flight height window, not with task count.** Retained prepare records are dropped only on finalization plus dispute-window expiry. A swarm running 200 concurrent heights with 4 replicas retains ~800 signed prepare records — trivial — but a swarm that forgets to bound the dispute window will grow without limit. The bound is the operational knob. 3. **Byzantine proposers become *provably* slashable rather than merely *suspected*.** The equivocation proof `(QC_a, QC_b, prepare_a)` is verifiable by any third party with the swarm's public keys, with no trust in the reporting agent. This converts the failure from "silent split" to "detected, attributed, and haltable within one commit cycle." The residual risk is the agent that garbage-collects correctly but is then handed a forged second QC by a Byzantine peer. The forged QC fails signature verification against the quorum, so it is rejected at the QC-verification boundary before the equivocation check — the two checks are ordered: verify QC signatures first, then check for digest conflict against retained state. Reversing the order lets a forged QC trigger a spurious halt. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class EquivocationDetected(RuntimeError): """Raised when an agent holds two valid QCs for the same (task_id, height) with differing proposal digests, or when it discovers it double-signed.""" pass class MissingWitnessRecord(RuntimeError): """Raised when an agent cannot classify itself as witness or culprit because the retained prepare record was garbage-collected.""" pass @dataclass(frozen=True) class QuorumCertificate: task_id: str height: int view: int proposal_digest: str signatures: tuple # (replica_id, sig) pairs; assumed pre-verified @dataclass class PrepareRecord: task_id: str height: int view: int proposal_digest: str signed_at_ms: int @dataclass class CommitmentLedger: # committed[(task_id, height)] -> QC that authorized the commitment committed: dict = field(default_factory=dict) # retained_prepares[(task_id, height)] -> the single digest this agent signed retained_prepares: dict = field(default_factory=dict) # dispute window: heights below this watermark may be GC'd finalized_watermark: int = -1 def _semantic_digest(task_id: str, height: int, payload: bytes) -> str: # Digest binds task identity and height, NOT the envelope nonce/timestamp. h = hashlib.sha256() h.update(task_id.encode()) h.update(height.to_bytes(8, "big")) h.update(payload) return h.hexdigest() def sign_prepare(ledger: CommitmentLedger, task_id: str, height: int, view: int, proposal_digest: str, now_ms: int) -> PrepareRecord: key = (task_id, height) existing = ledger.retained_prepares.get(key) if existing is not None and existing.proposal_digest != proposal_digest: # We already signed a different digest at this height. Refuse to # double-sign; this is the local invariant that prevents us from # becoming a culprit in a future equivocation proof. raise EquivocationDetected( f"refusing to double-sign {key}: already signed {existing.proposal_digest}, " f"asked to sign {proposal_digest}" ) rec = PrepareRecord(task_id, height, view, proposal_digest, now_ms) ledger.retained_prepares[key] = rec return rec def accept_commitment(ledger: CommitmentLedger, qc: QuorumCertificate) -> str: """Returns 'COMMITTED', 'DUPLICATE_BENIGN', 'HALT_EQUIVOCATION', or 'HALT_INDETERMINATE'.""" key = (qc.task_id, qc.height) prior: Optional[QuorumCertificate] = ledger.committed.get(key) if prior is None: ledger.committed[key] = qc return "COMMITTED" if prior.proposal_digest == qc.proposal_digest: return "DUPLICATE_BENIGN" # Two valid QCs, same (task_id, height), different digests: equivocation. retained = ledger.retained_prepares.get(key) if retained is None: # Cannot classify witness vs culprit; freeze, do not auto-resolve. raise MissingWitnessRecord( f"equivocation at {key} but no retained prepare; cannot attribute fault" ) if retained.proposal_digest == prior.proposal_digest: # We signed only the first digest -> we are a witness, not a culprit. raise EquivocationDetected( f"WITNESS at {key}: signed {retained.proposal_digest}, " f"observed conflicting QC {qc.proposal_digest}; emitting proof" ) if retained.proposal_digest == qc.proposal_digest: # We signed only the second -> witness to the other branch. raise EquivocationDetected( f"WITNESS at {key}: signed {retained.proposal_digest}, " f"observed conflicting QC {prior.proposal_digest}; emitting proof" ) # We signed both -> we are a culprit (we double-signed). raise EquivocationDetected( f"CULPRIT at {key}: self-double-signed; self-halt and escalate" ) def gc_prepares(ledger: CommitmentLedger, watermark: int) -> None: """Drop retained prepares only below the finalized dispute watermark.""" stale = [k for k in ledger.retained_prepares if k[1] < watermark] for k in stale: del ledger.retained_prepares[k] ledger.finalized_watermark = watermark ```