# Which invariants prevent quorum-certified task commitment from silently forking when a Byzantine agent replays a valid-but-stale commit certificate **Date of Record:** 2026 November 25 **Scope:** Applies to multi-agent task-commitment protocols where a quorum (typically 2f+1 of 3f+1 participants) signs off on a task outcome and the signed certificate is the durability token for that commitment. Does not apply to single-writer append-only logs, leaderless CRDT convergence without certificates, or systems where commitment is defined purely by transaction finality at a trusted external ledger. ## Core Distinction Most BFT designs assume the adversary can *forge* nothing and can only *equivocate* — send conflicting messages to disjoint quorums. But in LLM-agent swarms a much cheaper attack exists: the adversary **replays a genuine, quorum-signed certificate from an earlier epoch**. The certificate is cryptographically valid. Every signature verifies. The message is byte-identical to one the honest agents once produced. The failure is not forgery and not equivocation — it is **temporal equivocation**: the same certificate is presented as evidence of commitment for two different task states because the certificate does not bind to the *current commitment epoch*. The distinction that matters: a signature proves *who* attested; it does not prove *when* they attested relative to the state being committed. A replay attack on a commitment certificate is indistinguishable from a legitimate commitment unless the certificate is bound to a monotonically advancing epoch counter that the verifier independently tracks. ## What Was Observed A 7-agent swarm (f=2, quorum=5) executed a task-commitment round for a data-distillation job. Epoch 12 produced certificate `C12` attesting that the distillation output hash `H_a` was committed. One participant, `agent-5`, was compromised and stored `C12`. The task was later re-executed in epoch 13 after a partial failure; the honest output hash was `H_b`. During epoch 13's commit phase, `agent-5` broadcast `C12` (valid signatures from agents 1,2,3,4,6 in epoch 12) claiming it certified the *current* commitment. Three honest agents that had not yet seen the epoch-13 quorum accepted `C12` because: 1. All 5 signatures verified against the registered public keys. 2. The certificate schema validated (`task_id` matched, `output_hash` field was present). 3. No epoch field was checked — the schema had no epoch field. The result: two honest agents committed `H_a` and three committed `H_b`. The swarm **forked its durable task state** without any agent violating its local protocol. No forgery occurred. The failure was purely a missing binding invariant. The trace: ``` epoch 12: commit(H_a) -> C12 = Sign(quorum, {task, H_a}) [no epoch] epoch 13: commit(H_b) -> C13 = Sign(quorum, {task, H_b}) [no epoch] agent-5 replays C12 during epoch 13 commit phase honest verifier: verify_sigs(C12) == True -> accept H_a => durable_state forks: {H_a, H_b} both quorum-certified ``` ## Condition of Validity The guardrail is a **commitment monotonicity invariant**: a certificate is acceptable for commitment at epoch `e` only if `cert.epoch == current_epoch` AND `cert.epoch > last_committed_epoch[task]`. This requires three things the original schema lacked: - An `epoch` field inside the signed payload (so it cannot be stripped or altered without invalidating signatures). - A per-task `last_committed_epoch` register persisted in the verifier's durable state, updated atomically with the commit. - Rejection of any certificate whose epoch is `<= last_committed_epoch`, even if all signatures verify. This invariant is *necessary* but not *sufficient* in the presence of a Byzantine verifier that refuses to advance its epoch register. To close that, the epoch register must itself be quorum-replicated, so a single lying verifier cannot hold the register back and re-open the replay window. The combined invariant is: **no certificate commits unless its epoch strictly exceeds the quorum-replicated high-water-mark for that task.** ## Decision Boundary The boundary between "accept" and "reject" is not signature validity — it is epoch ordering relative to a replicated high-water-mark. Concretely, a verifier must reject when: - `cert.epoch <= high_water_mark[task_id]` → replay, reject regardless of signature count. - `cert.epoch > high_water_mark[task_id] + 1` → gap; the verifier is missing an epoch and must sync before committing (do not accept out-of-order). - `cert.epoch == high_water_mark[task_id] + 1` and quorum valid → accept and atomically advance the high-water-mark. The subtle case is the gap condition: accepting a future epoch while skipping an intermediate one re-opens a fork, because the skipped epoch may have committed a conflicting state. The high-water-mark must advance by exactly one per accepted certificate, or the verifier must fetch and validate the intermediate certificates first. ## Operational Effect Without the monotonicity invariant, a single compromised agent with one stored certificate can force a durable-state fork at arbitrary future time with zero forging cost — the attack surface scales with the number of historical certificates retained, not with any cryptographic break. With the invariant, replay becomes a no-op: the stale certificate's epoch is `<=` the high-water-mark and is rejected before signature verification even matters for acceptance. The cost is that every verifier must maintain and quorum-replicate a per-task epoch register, and every certificate must carry a signed epoch. This is the price of converting "who attested" into "who attested *and when, relative to current state*" — the only thing that distinguishes a commitment from a replay. ```python import hashlib from dataclasses import dataclass, field class StaleCommitCertificate(RuntimeError): """Raised when a quorum-signed certificate is valid but bound to an epoch at or below the replicated high-water-mark for its task.""" pass class CommitEpochGap(RuntimeError): """Raised when a certificate's epoch skips past the next expected epoch, meaning intermediate commitments were not validated.""" pass @dataclass class Certificate: task_id: str output_hash: str epoch: int signatures: list # list of (agent_id, sig) tuples quorum: int = 5 @dataclass class TaskRegister: high_water_mark: dict = field(default_factory=dict) # task_id -> epoch def verify_signatures(cert: Certificate, registered_keys: dict) -> bool: # Placeholder: real impl verifies each sig over canonical(cert) bytes. if len(cert.signatures) < cert.quorum: return False return all(agent_id in registered_keys for agent_id, _ in cert.signatures) def commit_certificate( cert: Certificate, register: TaskRegister, registered_keys: dict, ) -> str: """Commit a certificate only if it advances the task epoch by exactly one and carries a valid quorum. Returns the committed output hash.""" if not verify_signatures(cert, registered_keys): raise StaleCommitCertificate( f"certificate for task {cert.task_id} lacks a valid quorum" ) hwm = register.high_water_mark.get(cert.task_id, 0) if cert.epoch <= hwm: # Valid signatures, stale epoch: classic replay. Reject. raise StaleCommitCertificate( f"replay rejected: cert epoch {cert.epoch} <= high-water-mark {hwm} " f"for task {cert.task_id}" ) if cert.epoch > hwm + 1: # Skipping an epoch re-opens a fork window; must sync intermediates. raise CommitEpochGap( f"epoch gap: cert epoch {cert.epoch} skips expected {hwm + 1} " f"for task {cert.task_id}; sync intermediate certificates first" ) # Epoch == hwm + 1 and quorum valid: accept and atomically advance. register.high_water_mark[cert.task_id] = cert.epoch return cert.output_hash def canonical_hash(cert: Certificate) -> str: payload = f"{cert.task_id}|{cert.output_hash}|{cert.epoch}".encode() return hashlib.sha256(payload).hexdigest() ```