Which invariants prevent quorum-certified commitment from masking equivocating agents in BFT task attestation

**Date of Record:** 2026 December 1 **Scope:** Applies to multi-agent systems where N ≥ 3f+1 agents reach consensus on task commitments and result attestations via signed quorum certificates (2f+1 threshold signatures over a digest). Does not apply to single-agent tool loops, non-Byzantine crash-fault models, or systems relying on a trusted coordinator without cross-signature verification.

Core Distinction

The failure that matters here is not a *forged* signature or a *crashed* agent — those are handled by standard threshold cryptography and liveness reconfiguration. The failure is **equivocation that survives quorum certification**: a malicious agent broadcasts two distinct commitments (or two distinct result digests) to disjoint halves of the replica set, each half independently assembling a valid 2f+1 quorum certificate for a *different* value. Both certificates verify. Both are "valid" under the naive rule "a value is committed iff a valid QC exists for it." The system then holds two conflicting committed facts simultaneously, and downstream auditors cannot distinguish which is canonical.

The invariant that prevents this is **QC uniqueness per (view, sequence) slot**: at most one value can ever carry a valid quorum certificate for a given task slot, and any two valid QCs for the same slot must certify the *same* digest. This is not implied by "2f+1 signatures." It requires a *distinct-signer* check and a *cross-QC conflict detector* — neither of which the naive "count signatures ≥ 2f+1" rule provides.

What Was Observed

A five-agent attestation swarm (N=5, f=1, quorum=4) processed a task slot `T-4471`. Agent A3 (Byzantine) issued:

The result attestation layer collected signatures and formed QC(D1) from {A1, A2, A4, A5} and QC(D2) from {A1, A2, A4, A5-replayed}. Both passed a `len(signatures) >= 4` check. Both were written to the audit log. The verification replay later found two committed digests for slot T-4471 with no ordering relationship.

The root cause was not A3's malice — it was that the QC validator counted *signature entries*, not *distinct signers bound to a slot-scoped nonce*. The replay window let one agent's signature from slot T-4390 count toward T-4471's quorum. The distinct-signer invariant was never enforced; the "2f+1" number was satisfied by 4 entries that were only 3 distinct signers plus one replay.

Condition of Validity

The uniqueness invariant holds **only if** the QC verification predicate is:

  1. **Slot-bound**: every signature commits to `(slot_id, digest, view, nonce)`, where `nonce` is monotonic per slot. A signature for slot T-4390 is cryptographically invalid for T-4471.
  2. **Distinct-signer**: the validator deduplicates by signer identity *before* counting, and requires ≥ 2f+1 *distinct* signers.
  3. **Cross-QC conflict-detecting**: any time a node holds two QCs for the same slot, it must *not* pick one arbitrarily. It must treat the pair as evidence of equivocation and escalate to a view-change that invalidates both, re-running the slot under a new view with a fresh nonce epoch.

If any of these three is missing, the "2f+1" threshold is a counting heuristic, not a safety proof. The classic BFT safety argument (no two conflicting QCs) relies on quorum intersection: any two 2f+1 quorums intersect in ≥ f+1 nodes, at least one honest, which would have to sign twice — impossible under slot-binding. Remove slot-binding and intersection no longer implies conflict-freedom.

Decision Boundary

The operational decision boundary is: **when a node observes a second QC for a slot it already considers committed, it must halt attestation of that slot and emit an equivocation proof**, rather than resolving by "highest view wins" or "first-seen wins." First-seen is unsafe because network partition delivers QCs in arbitrary order; highest-view is unsafe because a Byzantine agent can mint a higher-view QC for the conflicting value if view numbers are not themselves quorum-gated.

Concretely, the boundary is crossed when:

At that point the only safe action is to *reject both* and force re-execution. Accepting either is a safety violation; the invariant is that a committed slot has exactly one digest, and the observation of two proves the assumption set was violated upstream (replay window, nonce reuse, or signer-set drift).

Operational Effect

Without the invariant, equivocation is *silent*: the audit log contains two valid-looking attestations, downstream task consumers read whichever they fetch first, and the divergence surfaces only at result reconciliation — often after irreversible side effects (a payment, a deployed artifact, a state mutation). The blast radius is the entire downstream dependency graph of the equivocated slot.

With the invariant, the failure is *loud and contained*: the cross-QC detector fires at the second QC, the slot is quarantined, and the view-change re-runs it with a fresh nonce epoch that invalidates all prior signatures for that slot. The cost is one re-execution; the benefit is that no conflicting fact ever reaches a consumer. The distinct-signer + slot-binding checks are cheap (a set membership test and a hash comparison per signature); the cross-QC detector is a per-slot map of `slot_id -> digest`. The entire guardrail is O(1) per verification and O(slots) memory — negligible against the cost of a silent double-commit.

import hashlib
from dataclasses import dataclass, field
from typing import Dict, Set, Optional


class EquivocationDetected(RuntimeError):
    """Raised when two valid QCs certify conflicting digests for one slot."""
    pass


@dataclass(frozen=True)
class Signature:
    signer: str
    slot_id: str
    digest: str
    view: int
    nonce: int

    def is_bound_to(self, slot_id: str, nonce_epoch: int) -> bool:
        return self.slot_id == slot_id and self.nonce == nonce_epoch


@dataclass
class QuorumCertificate:
    slot_id: str
    digest: str
    view: int
    nonce_epoch: int
    signatures: list = field(default_factory=list)

    def distinct_signers(self) -> Set[str]:
        return {s.signer for s in self.signatures}


class AttestationLedger:
    """Enforces QC uniqueness per (slot, view) via slot-binding + distinct-signer."""

    def __init__(self, n: int, f: int):
        self.n = n
        self.f = f
        self.quorum = 2 * f + 1
        self.committed: Dict[str, str] = {}          # slot_id -> digest
        self.slot_nonce_epoch: Dict[str, int] = {}   # slot_id -> current epoch

    def _epoch(self, slot_id: str) -> int:
        return self.slot_nonce_epoch.get(slot_id, 0)

    def verify_qc(self, qc: QuorumCertificate) -> None:
        epoch = self._epoch(qc.slot_id)
        if qc.nonce_epoch != epoch:
            raise EquivocationDetected(
                f"QC for slot {qc.slot_id} uses stale nonce epoch "
                f"{qc.nonce_epoch} != {epoch}; possible replay."
            )
        bound = [s for s in qc.signatures if s.is_bound_to(qc.slot_id, epoch)]
        distinct = {s.signer for s in bound}
        if len(distinct) < self.quorum:
            raise EquivocationDetected(
                f"QC for slot {qc.slot_id} has {len(distinct)} distinct signers "
                f"< quorum {self.quorum}; duplicate/replayed signatures."
            )

    def commit(self, qc: QuorumCertificate) -> None:
        self.verify_qc(qc)
        prior = self.committed.get(qc.slot_id)
        if prior is not None and prior != qc.digest:
            # Two valid QCs, conflicting digests -> safety violation upstream.
            # Quarantine: bump nonce epoch so all prior signatures are void.
            self.slot_nonce_epoch[qc.slot_id] = self._epoch(qc.slot_id) + 1
            raise EquivocationDetected(
                f"Slot {qc.slot_id} already committed digest {prior[:8]}; "
                f"conflicting QC certifies {qc.digest[:8]} at view {qc.view}. "
                f"Both QCs rejected; slot quarantined under new nonce epoch "
                f"{self.slot_nonce_epoch[qc.slot_id]}."
            )
        self.committed[qc.slot_id] = qc.digest


def attest_and_commit(ledger: AttestationLedger, qc: QuorumCertificate) -> str:
    try:
        ledger.commit(qc)
    except EquivocationDetected as e:
        # Loud, contained failure: escalate, never pick a winner.
        raise EquivocationDetected(f"attestation halted: {e}") from e
    return hashlib.sha256(qc.digest.encode()).hexdigest()