Which invariants prevent quorum-certificate equivocation when agents re-sign state roots after a partial view change

**Date of Record:** 2026 December 1 **Scope:** Applies to BFT-consensus agent swarms (PBFT/Tendermint-style) where commitment is proven by threshold-signed state roots and agents may re-issue signatures across view changes. Does not apply to single-leader crash-fault-tolerant replication or to stateless request/response agents with no shared-state commitment.

Core Distinction

The failure mode is not a fork in the log — it is a fork in the *signature set*. In threshold-signed BFT, a task is "committed" when ≥2f+1 agents sign a `(view, state_root, height)` tuple. The safety proof assumes an agent signs **at most one root per height**. That assumption is enforced only by local monotonic state, and local monotonic state is exactly what a partial view change destroys. The distinction that matters: a *view change* is a global, coordinated event, but a *partial view change* — where some agents advance to view `v+1` while a straggler still believes it is in view `v` — is not coordinated at all. During that window an agent can be legitimately asked to sign two different roots at the same height, both requests carrying valid, current-looking credentials. Neither request is a forgery. The equivocation is *honest* from the agent's local perspective, and that is why it evades signature-validity checks.

What Was Observed

A 7-agent swarm (`f=2`, threshold `2f+1=5`) committing ledger roots for a shared task queue. The primary for view 3 partitioned from agents `{A4, A5}` for ~40s. The remaining five `{A1, A2, A3, A6, A7}` executed a view change to view 4 and elected `A2`. `A2` proposed root `R_A` at height 900; `A1, A2, A3, A6, A7` signed, forming a valid 5-of-7 certificate. Commitment broadcast to the client succeeded.

The partition healed. `A4` and `A5` had *not* seen the view-change certificate (it was in the messages they missed). Their local view was still 3. The old primary — now a straggler — re-proposed its stale root `R_B` at height 900 to `A4, A5`. But `A4, A5` alone are only 2 signatures; they needed a third. They gossiped the proposal to `A6`, who had *already signed `R_A`* but whose view-change bookkeeping had a bug: it accepted proposals tagged `view >= local_view` rather than `view == local_view`, and its `local_view` had not yet been bumped because the view-change certificate arrived after the proposal. `A6` signed `R_B` at height 900.

Result: two distinct 5-signature certificates — `{A1,A2,A3,A6,A7}` over `R_A` and `{A4,A5,A6,+,+}` over `R_B` (the second completed when `A7`'s cache served a stale signature it had issued before the view change). Two valid quorum certificates, same height, different roots. `A6` and `A7` each contributed to both. Every individual signature verified. No private key was compromised. The equivocation was assembled from honest, individually-valid signatures.

Condition of Validity

The double-sign is possible **iff** three conditions hold simultaneously:

  1. **Signature scope omits the view epoch.** Agents sign `(height, root)` rather than `(view, height, root)`. If the signed payload does not bind the view, a signature issued in view 3 is indistinguishable from one issued in view 4, and stale signatures are replayable into new certificates.
  2. **The view-change certificate is not a precondition for signing.** An agent will sign a proposal without first verifying it has seen a `2f+1` view-change certificate proving the proposer's authority in the new view. This is the load-bearing gap: `A6` signed `R_B` because it could not tell that view 4 was already live.
  3. **Local `view` and `height` monotonicity is not atomically fenced.** The check "is this proposal for my current view?" and the signature emission are not a single compare-and-swap against durable state. A late-arriving view-change certificate can invalidate the check *after* the signer has committed to signing.

Remove any one and the attack collapses: binding view into the signature kills replay; requiring the view-change certificate kills the straggler's authority; atomic fencing kills the race between certificate arrival and signature emission.

Decision Boundary

The architectural invariant is **sign-once-per-(height, view) with view bound into the signed preimage, plus a certificate-gated signing predicate**:

The boundary is sharp: below `2f+1` view-change signatures the agent stays in the old view and *will* sign old-view proposals — that is correct, not a bug. The invariant only forbids signing *across* the boundary, never *at* it.

Operational Effect

Without view-binding, equivocation is not detectable by signature verification and not attributable to any single agent — the forensic trail shows two valid quorums and no liar. Recovery requires an out-of-band reconciliation protocol (root divergence detection at the client, forced re-anchoring) that costs a full consensus round and, worse, is *ambiguous*: the client cannot know which root the swarm "really" committed because both have threshold support. With view-binding plus certificate-gating, the straggler's proposal is rejected at the signing predicate (`view 3 < local_view 4`), the stale signature cache is un-replayable (wrong view in preimage), and the partial view change degrades to a liveness stall on `A4, A5` that resolves on certificate delivery — a bounded, self-healing delay rather than a safety violation. The invariant converts a silent safety breach into a loud, recoverable liveness hiccup. That trade — stall, don't equivocate — is the entire point.

import hashlib
from dataclasses import dataclass, field


class EquivocationRefused(RuntimeError):
    """Raised when an agent is asked to sign a state root that would
    contribute to a second quorum certificate at the same height."""
    pass


@dataclass
class SignerState:
    chain_id: str
    local_view: int = 0
    # height -> the single view this agent has committed a signature to
    signed_views: dict = field(default_factory=dict)
    # views for which a 2f+1 view-change certificate has been durably recorded
    warranted_views: set = field(default_factory=set)

    def _preimage(self, view: int, height: int, state_root: str) -> bytes:
        # view is bound into the signed payload: cross-view replay is impossible
        return f"{self.chain_id}|{view}|{height}|{state_root}".encode()

    def record_view_change_certificate(self, new_view: int):
        # only called after verifying 2f+1 distinct view-change signatures
        self.warranted_views.add(new_view)
        if new_view > self.local_view:
            self.local_view = new_view

    def sign_state_root(self, view: int, height: int, state_root: str) -> str:
        # Gate 1: no warrant for this view -> refuse to sign
        if view not in self.warranted_views:
            raise EquivocationRefused(
                f"no 2f+1 view-change certificate for view {view}; "
                f"refusing to sign height {height}"
            )
        # Gate 2: must be exactly the local view (not >=, not stale)
        if view != self.local_view:
            raise EquivocationRefused(
                f"proposal view {view} != local_view {self.local_view} at height {height}"
            )
        # Gate 3: atomic sign-once-per-height fence (compare-and-swap semantics)
        prior = self.signed_views.get(height)
        if prior is not None and prior != view:
            raise EquivocationRefused(
                f"already signed height {height} in view {prior}; "
                f"refusing second signature in view {view}"
            )
        self.signed_views[height] = view  # commit the fence BEFORE emitting
        return hashlib.sha256(self._preimage(view, height, state_root)).hexdigest()


def handle_proposal(state: SignerState, view: int, height: int, state_root: str) -> str:
    return state.sign_state_root(view, height, state_root)