# Which invariants prevent quorum-certificate forgery from surviving a Byzantine agent's view-merge in BFT task-commitment consensus **Date of Record:** 2026 November 23 **Scope:** Applies to multi-agent systems where task commitment and shared-state agreement are secured by a Byzantine fault-tolerant (BFT) consensus protocol (PBFT/Tendermint-style) in which agents exchange signed quorum certificates (QCs) across view changes. Does not apply to single-leader Raft with trusted membership, nor to systems where agents share an append-only log with a sole sequencer and no view-change path. ## Core Distinction The distinction that matters is between **QC validity** (the certificate is cryptographically well-formed and carries ≥ 2f+1 distinct signatures) and **QC soundness** (the certificate actually commits the value it claims, within the view and sequence number it claims). A Byzantine agent can trivially forge a *valid-looking* QC by collecting real signatures from honest agents over a *different* value—e.g., a `PREPARE`-phase vote for value A—and re-presenting those signatures during a `view-change` as if they were `COMMIT` votes for value B at a higher sequence number. The signatures are genuine; the certificate's semantic binding is false. Consensus safety survives only if the view-merge invariant re-derives the committed value from the *signed payload*, not from the certificate's claimed metadata. ## What Was Observed During a task-commitment round across 7 agents (f=2 Byzantine tolerance, quorum=5), agent `B2` (Byzantine) initiated a view change from view 4 to view 5 after the leader `L4` stalled mid-`COMMIT`. `B2` broadcast a `NEW_VIEW` message containing a QC that purported to commit task-assignment `T-8817` to agent `A3` at sequence 12. The QC carried 5 valid ECDSA signatures from honest agents `A1, A2, A4, A5, A6`. However, those agents had signed a `PREPARE` message for `T-8817` at *sequence 11, view 3*—not sequence 12, view 5. `B2` had replayed the signatures, rewritten the sequence/view fields in the unsigned header, and relied on the receiving agents to verify signatures over the canonicalized message *excluding* the sequence/view fields (a canonicalization bug in the signer's domain-separation string). Three honest agents accepted the forged QC and began executing `T-8817`, while the remaining honest set, which had already committed `T-8817` to `A5` at sequence 11, executed the same task on `A5`. Duplicate execution of an idempotent task is benign; the observed failure was that `T-8817` was a *non-idempotent* state mutation (a ledger debit) and was applied twice. The failure trace: 1. `L4` broadcasts `PRE-PREPARE(T-8817, seq=11, view=4)`. 2. Honest agents sign `PREPARE` over `(domain="PREPARE", digest=H(T-8817), seq=11, view=4)`. 3. `L4` stalls before `COMMIT`. 4. `B2` collects the 5 `PREPARE` signatures, strips `seq`/`view` from the signed domain string, and re-emits them inside a `NEW_VIEW` QC claiming `(seq=12, view=5, value=T-8817)`. 5. Receivers verify signatures against `H(T-8817)` only, ignoring `seq`/`view` mismatch → accept. 6. Two disjoint commit sets execute the same non-idempotent task. ## Condition of Validity The safety invariant that prevents this is **QC payload binding**: a quorum certificate is sound only if every signature it aggregates is over a canonical byte string that includes `(protocol_id, phase, view, seq, value_digest)`, and the receiving agent recomputes that byte string from the QC's *claimed* metadata and verifies each signature against it. Formally, for a QC to be admissible at view `v` and sequence `s` for value `x`: ``` ∀ sig_i ∈ QC.sigs: Verify(pk_i, sig_i, Canon(protocol_id, phase, v, s, H(x))) = true |{i : Verify(...) = true}| ≥ 2f+1 ``` The invariant fails if `Canon` omits any of `{protocol_id, phase, v, s}`—domain separation must be *complete*, not merely present. A secondary invariant, **view-merge monotonicity**, requires that during a view change the new leader selects the value with the highest `(view, seq)` among all QCs it receives, and that no QC from a lower view can override a QC from a higher view for the same sequence slot. The forged QC in step 4 violated both: it reused signatures whose canonical string encoded `(view=4, seq=11)` while claiming `(view=5, seq=12)`, and it exploited the omission to appear as the highest-view certificate. ## Decision Boundary The boundary between safe and unsafe view-merge is whether the receiver treats the QC's metadata as *claimed* (must be re-derived and verified) versus *trusted* (accepted as given). Three concrete decision rules bound the failure: - **Reject on canonicalization mismatch.** If the canonical byte string used for signature verification does not include all of `{protocol_id, phase, view, seq, value_digest}`, the QC is inadmissible regardless of signature count. This is a hard reject, not a warning. - **Reject on cross-phase signature reuse.** A signature produced in the `PREPARE` phase must never satisfy a `COMMIT`-phase or `NEW_VIEW`-phase check. Phase must be inside the signed domain string. - **Reject on non-monotonic override.** A QC claiming `(v', s')` where `(v', s') < (v, s)` for an already-committed slot must be rejected even if it is otherwise well-formed; the committed value at `(v, s)` is final. The boundary is crossed the moment any of these three checks is omitted, because the Byzantine agent only needs one gap to replay genuine signatures into a false commitment. ## Operational Effect The operational consequence of the gap is **duplicate non-idempotent execution across disjoint honest commit sets**, which manifests as double-debit, double-claim, or double-dispatch in any task whose effect is not idempotent. Because the signatures are genuine, cryptographic audit trails show no forgery—the failure is invisible to signature-count monitoring and surfaces only as a semantic inconsistency between two honest agents' committed state. The guardrail is architectural: (1) complete domain separation in the canonical string, (2) phase-typed signature verification, (3) monotonic view-merge re-derivation, and (4) an application-level idempotency key derived from `(task_id, seq, view)` so that even a soundness breach cannot double-apply a non-idempotent effect. The last is a defense-in-depth measure, not a substitute for the first three; it bounds blast radius but does not restore consensus safety. ```python import hashlib from dataclasses import dataclass class QCSoundnessError(RuntimeError): """Raised when a quorum certificate fails payload-binding or monotonicity checks.""" pass @dataclass(frozen=True) class QC: protocol_id: str phase: str view: int seq: int value_digest: str signatures: tuple # (signer_pubkey, sig_bytes) pairs def canonical_bytes(protocol_id: str, phase: str, view: int, seq: int, value_digest: str) -> bytes: # Complete domain separation: every field that scopes the commitment is signed. return f"{protocol_id}|{phase}|{view}|{seq}|{value_digest}".encode("utf-8") def verify_qc( qc: QC, verify_sig, committed_slot: dict, f: int, ) -> bool: # Rule 1: phase must match the phase the QC claims to be. if qc.phase not in ("PREPARE", "COMMIT", "NEW_VIEW"): raise QCSoundnessError(f"unknown phase {qc.phase!r}") # Rule 2: monotonic view-merge — a lower (view, seq) cannot override a committed slot. prior = committed_slot.get(qc.seq) if prior is not None and (qc.view, qc.seq) < (prior["view"], prior["seq"]): raise QCSoundnessError( f"non-monotonic override: QC claims (view={qc.view}, seq={qc.seq}) " f"but slot already committed at (view={prior['view']}, seq={prior['seq']})" ) # Rule 3: payload binding — each signature must verify over the FULL canonical string. canon = canonical_bytes( qc.protocol_id, qc.phase, qc.view, qc.seq, qc.value_digest ) valid = 0 for pubkey, sig in qc.signatures: if verify_sig(pubkey, sig, canon): valid += 1 quorum = 2 * f + 1 if valid < quorum: raise QCSoundnessError( f"insufficient bound signatures: {valid} < quorum {quorum} " f"for (view={qc.view}, seq={qc.seq}, phase={qc.phase})" ) return True def merge_view(new_view_qc: QC, committed_slot: dict, verify_sig, f: int) -> dict: # Re-derive committed value from the signed payload; never trust QC metadata alone. try: verify_qc(new_view_qc, verify_sig, committed_slot, f) except QCSoundnessError as exc: # Byzantine replay detected: refuse the view-merge and stay in current view. raise QCSoundnessError( f"view-merge rejected: {exc}; agent must not execute {new_view_qc.value_digest!r}" ) from exc committed_slot[new_view_qc.seq] = { "view": new_view_qc.view, "seq": new_view_qc.seq, "value_digest": new_view_qc.value_digest, } return committed_slot ```