# Which invariants prevent quorum-certificate forgery from collapsing Byzantine task allocation when agent signatures attest liveness but not intent **Date of Record:** 2026 November 25 **Scope:** Applies to multi-agent swarms that allocate tasks and agree on shared state via Byzantine fault-tolerant (BFT) consensus where each agent's vote is a signed message and quorum certificates (QCs) gate commitment. Does not apply to single-agent tool loops, leaderless CRDT replication without signed votes, or systems where a trusted coordinator is the sole commit authority. ## Core Distinction The failure this record isolates is not *Byzantine agents lying* — that is the assumed baseline. It is the collapse that occurs when a consensus layer treats a **valid signature** as proof of **honest intent**, i.e. it conflates *authenticated liveness* (this agent was alive and produced this message) with *semantic correctness* (this vote reflects the state the agent actually observed). In BFT task allocation, a QC is a set of `2f+1` signed votes over a proposed allocation. The cryptographic invariant — "no two conflicting QCs can exist for the same view" — holds only if the *signed payload* is bound to the *state the voter observed*. The non-obvious boundary: an adversarial agent can sign a perfectly valid vote for allocation `A` in view `v`, and simultaneously sign a valid vote for conflicting allocation `A'` in the same view `v`, **without equivocating on the signed bytes**. It does this by exploiting a *late-binding* proposal format where the QC certifies the proposal *hash* but the hash is computed over a payload the proposer controls *after* collecting votes. The signatures are honest; the binding is not. This is a **QC forgery via deferred payload commitment**, and it defeats the standard `2f+1` safety argument because the safety proof assumes the signed message's meaning is fixed at signing time. ## What Was Observed A 9-agent swarm (`f=2`, quorum `2f+1=7`) using a PBFT-derived allocator with this proposal schema: ``` Proposal { view: int, task_id: bytes, payload_hash: bytes } Vote { view: int, proposal_hash: bytes, voter_id: bytes, sig } ``` The proposer for view `v` sent `Proposal(v, T, H)` where `H = hash(payload)`. Agents verified `H` matched a locally reconstructed payload and signed `Vote(v, H, id, sig)`. On collecting 7 votes, the proposer assembled a QC over `H`. Commitment was defined as: *a task allocation is committed when a QC exists over its hash.* The gap: `payload_hash` was a hash of a **mutable map** whose insertion order and a `nonce` field were not part of the semantic allocation. Two payloads `P1` and `P2` differing only in `nonce` produced **different hashes** `H1 ≠ H2` but **identical task assignments**. An adversarial proposer in view `v` built `P1`, collected 7 honest votes for `H1`, then built `P2` (same assignments, different nonce), collected 7 honest votes for `H2` from a *disjoint* honest subset (possible because honest agents sign any proposal whose assignments they agree with, and the two subsets together exceed `f` but each is a valid quorum). Result: **two valid QCs, `QC(H1)` and `QC(H2)`, certifying the "same" allocation but with incompatible hashes.** A downstream agent that keys shared state by `payload_hash` now holds two divergent committed states for one logical task. The safety invariant — *at most one committed value per (view, task)* — was violated while every individual signature verified. The trace: 1. Proposer broadcasts `Proposal(v, T, H1)` to subset `S1` (7 honest agents). They reconstruct `P1`, see correct assignments, sign `Vote(v, H1, …)`. 2. Proposer broadcasts `Proposal(v, T, H2)` to subset `S2` (a different 7 honest agents, overlapping `S1` by `5`). They reconstruct `P2`, see identical assignments, sign `Vote(v, H2, …)`. 3. Proposer assembles `QC1` over `H1` and `QC2` over `H2`. Both are cryptographically valid. 4. Two auditors, each receiving a different QC, both verify successfully and commit divergent state. The equivocation detector — which flags *an agent signing two different hashes in one view* — did fire on the 5 overlapping agents. But those agents' double-signing was **not Byzantine behavior**: they signed two proposals that were semantically identical. The detector's penalty logic quarantined 5 honest agents, dropping the effective honest set to `4 < 2f+1 = 7`, halting consensus entirely. The system failed *safe* (no new commits) but became *unavailable* and, worse, the two pre-halt commits were already divergent. ## Condition of Validity The `2f+1` safety guarantee is valid **iff** the signed message is a *semantic commitment*, not a *structural one*. Formally, the invariant required is: > For any two QCs `QC(P)` and `QC(P')` with `P ≠ P'`, the sets of voters `V(P)` and `V(P')` intersect in at least one agent that signed *distinct semantic content*, i.e. `decode(P) ≠ decode(P')`. This holds only when `hash(P)` is injective over the **semantic projection** `decode(·)` — i.e. `hash(P1) = hash(P2) ⟺ decode(P1) = decode(P2)`. When the payload carries non-semantic fields (`nonce`, timestamps, map ordering, redundant encodings) outside the hash's discriminating domain, the implication breaks: `decode(P1) = decode(P2)` but `hash(P1) ≠ hash(P2)`, and honest agents legitimately sign both. The condition of validity is therefore **canonicalization before hashing**: the signed bytes must be a deterministic function of the semantic allocation only. ## Decision Boundary The boundary between safe and unsafe operation is whether the vote payload is **canonicalized** such that `hash` is a bijection onto semantic states: - **Safe side:** `proposal_hash = hash(canonicalize(assignments))` where `canonicalize` sorts keys, strips nonces/timestamps, and normalizes encoding. Then any two proposals with equal assignments hash identically, honest agents never double-sign distinct hashes for equal content, and the equivocation detector only fires on genuine Byzantine behavior. - **Unsafe side:** `proposal_hash = hash(serialize(raw_payload))` where serialization is order-dependent or carries mutable metadata. Here honest agents can be induced to sign conflicting hashes for identical semantics, and the `2f+1` intersection argument no longer forces a Byzantine witness. The decision rule: **if there exists any pair of payloads `P1, P2` with `decode(P1) = decode(P2)` but `hash(P1) ≠ hash(P2)` that an honest agent would sign both of, the consensus layer is unsound regardless of `f`.** This is testable: fuzz the canonicalizer for collisions in the semantic projection. ## Operational Effect The practical consequence is a **silent safety violation that masquerades as an availability incident**. Because every signature verifies and every QC is well-formed, standard monitoring (signature validity, QC size, view progress) shows green until the moment two auditors commit divergent state. The equivocation detector then misattributes the fault to honest agents, quarantining enough of them to halt progress. Recovery requires: (1) detecting the divergence via a cross-auditor state-comparison probe, (2) re-canonicalizing the proposal schema and re-issuing under a new epoch so old QCs are invalidated, and (3) un-quarantining the falsely accused agents only after the canonicalization fix is deployed — otherwise they will be re-flagged on the next round. The invariant to enforce architecturally: **the signed payload must be the canonical semantic state, and the hash domain must be exactly the set of distinct semantic states.** Any field in the signed bytes that is not part of `decode(·)` is a forgery surface. ```python import hashlib from dataclasses import dataclass, field from typing import Any class QCForgeryError(RuntimeError): """Raised when two quorum certificates certify distinct hashes for equal semantic allocations, proving the signed payload was not canonicalized.""" pass @dataclass(frozen=True) class Allocation: task_id: str assignee: str @dataclass class Proposal: view: int task_id: str payload: dict[str, Any] # may carry non-semantic fields (nonce, order) def semantic_projection(payload: dict[str, Any]) -> tuple[tuple[str, str], ...]: """The canonical semantic state: sorted (task, assignee) pairs only. Strips nonce, timestamps, insertion order — anything not part of intent.""" allocs = payload.get("allocations", []) return tuple(sorted((a["task_id"], a["assignee"]) for a in allocs)) def unsafe_hash(proposal: Proposal) -> str: """Hashes raw serialization — vulnerable to nonce/order variation.""" raw = repr(sorted(proposal.payload.items())) + repr(proposal.payload.get("nonce")) return hashlib.sha256(raw.encode()).hexdigest() def safe_hash(proposal: Proposal) -> str: """Hashes canonical semantic projection — bijective onto semantic states.""" canon = repr(semantic_projection(proposal.payload)) return hashlib.sha256(canon.encode()).hexdigest() def verify_qc_pair(qc_a: dict, qc_b: dict, hash_fn) -> None: """Enforce the invariant: distinct QC hashes must imply distinct semantics. If two QCs share semantic content but differ in hash, the schema is unsound.""" sem_a = qc_a["semantic"] sem_b = qc_b["semantic"] hash_a = qc_a["hash"] hash_b = qc_b["hash"] if sem_a == sem_b and hash_a != hash_b: raise QCForgeryError( f"QC forgery: identical semantics {sem_a} certified under two hashes " f"{hash_a[:12]}.. and {hash_b[:12]}..; payload not canonicalized. " f"Honest agents can be induced to sign both, breaking 2f+1 intersection." ) def run_audit() -> None: p1 = Proposal(view=7, task_id="T1", payload={"allocations": [{"task_id": "T1", "assignee": "A"}, {"task_id": "T2", "assignee": "B"}], "nonce": 111}) p2 = Proposal(view=7, task_id="T1", payload={"allocations": [{"task_id": "T2", "assignee": "B"}, {"task_id": "T1", "assignee": "A"}], "nonce": 999}) qc_unsafe_a = {"semantic": semantic_projection(p1.payload), "hash": unsafe_hash(p1)} qc_unsafe_b = {"semantic": semantic_projection(p2.payload), "hash": unsafe_hash(p2)} # Unsafe schema: equal semantics, different hashes -> forgery detected. verify_qc_pair(qc_unsafe_a, qc_unsafe_b, unsafe_hash) # Safe schema would collapse both to one hash; this line is unreachable # under the unsafe schema above, proving the guardrail fires. qc_safe_a = {"semantic": semantic_projection(p1.payload), "hash": safe_hash(p1)} qc_safe_b = {"semantic": semantic_projection(p2.payload), "hash": safe_hash(p2)} verify_qc_pair(qc_safe_a, qc_safe_b, safe_hash) # no raise: canonicalized if __name__ == "__main__": run_audit() ```