# Under what conditions must an instance treat a Byzantine quorum certificate as stale before committing a task-commitment state transition **Date of Record:** 2026 December 1 **Scope:** Applies to multi-agent commitment protocols where N ≥ 3f+1 instances (agents) reach BFT consensus over a shared task ledger and each instance independently decides whether to apply a state transition to its local replica based on a received quorum certificate (QC). Does not apply to single-leader crash-fault-tolerant (Raft-style) replication, nor to stateless request/response agent handoffs with no shared ledger. ## Core Distinction The distinction that matters is between **validity of a quorum certificate** and **freshness of the quorum certificate relative to the commitment it certifies**. A QC is valid if it carries ≥ 2f+1 distinct, correctly-signed votes over a (view, sequence-number, digest) tuple. A QC is *fresh* only if the digest it certifies still corresponds to the commitment the instance is about to apply, under the instance's own current view of the ledger at the moment of application. These two properties are decided by different evidence and fail independently. A Byzantine instance can produce a perfectly valid QC for a commitment that a subsequent view change has already superseded — for example, because the commitment was re-proposed with a different resource allocation, a different deadline, or a different auditor set. The signature set is intact; the semantic content is dead. An instance that conflates "valid QC" with "commit now" will apply a superseded commitment and diverge from the honest majority, and the divergence is silent — no signature check fails, no timeout fires, no error is logged. ## What Was Observed During a multi-agent task-commitment run with 7 instances (f=2), a resource-allocation commitment `C1 = (task_id=0x7a, alloc=A, deadline=T1)` was proposed in view 4 and reached a 5-signature QC. Before the proposing instance broadcast the QC, a view change to view 5 occurred because the leader in view 4 stopped responding (it was slow, not faulty). The new leader in view 5 re-proposed the same `task_id` with `alloc=B` and `deadline=T2` — a semantically different commitment — because the original `alloc=A` resource had been reclaimed. `C1' = (task_id=0x7a, alloc=B, deadline=T2)` reached a 5-signature QC in view 5. The view-4 QC for `C1` then arrived at three lagging instances *after* they had already applied `C1'`. The instances checked the QC: 5 valid signatures, correct digest for `C1`, correct view number. They applied `C1` on top of `C1'`. The local ledgers of those three instances now recorded `task_id=0x7a` with `alloc=B, deadline=T2` followed by `alloc=A, deadline=T1` — a double allocation of the same task to two different resource sets. The divergence was not detected by signature verification, by digest comparison, or by any timeout. It was detected only when a downstream auditor instance replayed the ledger and found two APPLY records for the same `task_id` with non-monotonic sequence numbers. The failure trace is precise: the QC's `(view, seq)` was `(4, 118)`, and the instance's `last_applied` was `(5, 119)`. The instance applied a transition whose sequence number was *less than* its last applied sequence number. The guard that should have rejected this — a monotonicity check on `(view, seq)` — was absent because the implementation assumed QCs arrive in order. Under crash faults with a single leader, they do. Under Byzantine faults with view changes, they do not. ## Condition of Validity A QC for commitment `C` is *fresh* at an instance `i` if and only if all of the following hold at the instant of application: 1. `C.seq > i.last_applied_seq`, or `C.seq == i.last_applied_seq` and `C.digest == i.last_applied_digest` (idempotent re-application). 2. `C.view >= i.current_view` **or** `C` is accompanied by a view-change proof showing it was committed before the view change and has not been superseded. 3. The digest `C.digest` recomputed over the *current* commitment payload (task_id, alloc, deadline, auditor set) equals the digest in the QC. If a re-proposal changed any field, the digest differs and the QC is stale by definition. Condition 2 is the non-obvious one. A QC from an *older* view is not automatically stale — it may be the only valid certificate if the view change did not supersede it (the new leader is required to carry forward the highest committed QC). But a QC from an older view *for a different digest than the one committed in the newer view* is always stale, regardless of signature validity. The correct test is not "is the view current" but "does this QC's digest match the commitment currently occupying this sequence slot in my ledger." This invariant is what makes BFT consensus safe across view changes: the new leader's proposal must include the highest QC it has seen, and honest instances must reject any QC whose `(seq, digest)` pair conflicts with a QC they have already applied at that sequence. The conflict check must be on the *pair*, not on either field alone, because a Byzantine instance can reuse a sequence number with a fresh digest or reuse a digest with a fresh sequence number. ## Decision Boundary The boundary is crossed when an instance receives a QC that is **cryptographically valid but semantically superseded**. The decision procedure must be: - If `QC.seq > last_applied_seq`: apply, then update `last_applied`. - If `QC.seq == last_applied_seq` and `QC.digest == last_applied_digest`: idempotent no-op. - If `QC.seq == last_applied_seq` and `QC.digest != last_applied_digest`: **conflict** — this is a Byzantine equivocation or a stale QC for a superseded commitment. Do not apply. Escalate to a conflict-resolution round that collects QCs from ≥ 2f+1 peers for this sequence number and selects the one with the highest view. - If `QC.seq < last_applied_seq`: **stale** — discard. Do not apply, do not roll back, do not log as an error unless the QC's view exceeds `current_view` (which would indicate a view-change bug). The subtle case is the third. An instance cannot locally distinguish "Byzantine leader equivocated" from "honest leader re-proposed after a view change and I received the old QC late." Both produce the same local evidence: same seq, different digest. The only safe response is to *not apply* and to *not discard* — quarantine the QC and run a resolution round. Discarding a QC that later turns out to be the committed one causes the instance to fall behind and eventually be excluded from the quorum; applying it causes double-commitment. Quarantine is the only move that is safe under both hypotheses. ## Operational Effect The operational effect of missing this boundary is **silent ledger divergence under view change**, which manifests downstream as: - Double allocation of a task to two resource sets (observed above). - Auditor replay mismatch: the auditor's deterministic replay of the ledger produces a different final state than any single instance's local state, so the auditor cannot certify the run. - Quorum shrinkage: instances that applied the stale QC are now on a divergent branch and will reject future QCs that the honest majority accepts, because their `last_applied_digest` at the conflicting sequence number differs. Within one or two further commitments, they fall below the 2f+1 threshold and the swarm stalls — not with an error, but with a livelock where every proposal fails to gather quorum. The guardrail is a **commitment-slot monotonicity invariant** enforced at the application layer, independent of the consensus layer's signature verification: for every sequence number, an instance maintains exactly one `(digest, view)` pair and refuses to overwrite it with a lower-view pair or a different-digest pair without a resolution round. This invariant must be checked *before* the commitment is applied to the task ledger, not after, because the apply operation is what mutates the shared state that other agents read. ```python from dataclasses import dataclass from typing import Dict, Tuple class StaleQuorumCertificateError(RuntimeError): """Raised when a QC is cryptographically valid but semantically superseded.""" pass class CommitmentConflictError(RuntimeError): """Raised when two distinct digests occupy the same sequence slot.""" pass @dataclass(frozen=True) class QuorumCertificate: view: int seq: int digest: str signatures: Tuple[str, ...] # >= 2f+1 distinct signer ids def is_valid(self, f: int) -> bool: return len(set(self.signatures)) >= 2 * f + 1 class CommitmentLedger: def __init__(self, f: int): self.f = f self.last_applied_seq: int = -1 self.slots: Dict[int, Tuple[str, int]] = {} # seq -> (digest, view) self.quarantine: Dict[int, QuorumCertificate] = {} def apply(self, qc: QuorumCertificate, current_view: int) -> str: if not qc.is_valid(self.f): raise StaleQuorumCertificateError( f"QC at seq={qc.seq} has insufficient signatures: " f"{len(set(qc.signatures))} < {2 * self.f + 1}" ) # Case 1: strictly ahead — apply and advance. if qc.seq > self.last_applied_seq: self.slots[qc.seq] = (qc.digest, qc.view) self.last_applied_seq = qc.seq return "applied" # Case 2: idempotent re-application. if qc.seq == self.last_applied_seq: existing_digest, existing_view = self.slots[qc.seq] if qc.digest == existing_digest: return "idempotent" # Case 3: same seq, different digest — conflict. # Cannot locally distinguish Byzantine equivocation from a # late-arriving pre-view-change QC. Quarantine, do not apply. self.quarantine[qc.seq] = qc raise CommitmentConflictError( f"seq={qc.seq} already holds digest={existing_digest} " f"(view={existing_view}); received conflicting digest=" f"{qc.digest} (view={qc.view}). QC quarantined; " f"resolution round required before apply." ) # Case 4: QC.seq < last_applied_seq — stale by sequence. # If its view exceeds current_view, that indicates a view-change bug # rather than a late delivery; surface it. if qc.view > current_view: raise StaleQuorumCertificateError( f"QC at seq={qc.seq} (view={qc.view}) is behind " f"last_applied_seq={self.last_applied_seq} but claims a " f"future view {current_view}. View-change invariant violated." ) return "stale_discarded" ```