# Which invariants prevent tool-effect double-commit when Byzantine peers replay signed effect-warrants across a multi-agent quorum **Date of Record:** 2026 November 28 **Scope:** Applies to multi-agent systems where N peers reach quorum agreement on whether a side-effecting tool call (write, transfer, deploy, delete) has been committed, and where each peer signs an effect-warrant that downstream agents treat as proof of commit. Does not apply to single-agent tool loops, to read-only tool calls, or to systems where a trusted coordinator is the sole authority on commit state. ## Core Distinction The distinction that matters here is between **warrant authenticity** and **warrant freshness**. A Byzantine peer cannot forge a signature, so naive designs treat "signed by a quorum member" as sufficient evidence that an effect committed. But a validly-signed warrant is a *statement about a past view*, not a *statement about current ledger state*. An adversary that observed (or participated in) a legitimate commit for effect `E₁` can replay that exact warrant bundle to a quorum that is currently deciding on a *different* effect `E₂`, causing the replaying peers to mis-attribute quorum to `E₂`. The invariant that breaks is not cryptographic; it is the binding between a warrant and the *specific proposal identity* it authorizes. Freshness (monotonic nonce/counter + proposal hash binding) is a separate, orthogonal property from authenticity, and Byzantine quorum protocols routinely conflate them. ## What Was Observed A four-peer quorum (f=1, so 3 signatures constitute a commit certificate) processed a batch of tool effects. Peer `P₂` was Byzantine. During round `r=41`, the quorum legitimately committed effect `E₁ = transfer(acct=A, amt=100)` and `P₂` collected the three signatures `{P₁, P₃, P₄}` over `(E₁, round=41, nonce=41)`. In round `r=42`, the honest peers proposed `E₂ = transfer(acct=A, amt=100)` — a *semantically identical* effect, but with a distinct proposal ID because `E₁` had already been applied and the ledger advanced. `E₂` was actually a legitimate second transfer (the user had genuinely requested two transfers of 100). The honest quorum, however, could not distinguish "duplicate request" from "replay" because the warrant schema bound signatures to `(payload, round, nonce)` but **not to a proposal ID derived from the ledger's post-`E₁` state**. `P₂` broadcast the old `E₁` signature bundle to `P₃` and `P₄` claiming it authorized `E₂`. Because the payload hash of `E₁` and `E₂` were *byte-identical* (same accounts, same amount, same memo), the payload-hash check passed. `P₃` and `P₄` accepted the bundle as a valid quorum certificate for `E₂` and committed it. The genuine second transfer was applied twice; the ledger diverged from the client's intent by exactly one effect. The failure was silent: no signature failed verification, no peer reported an error, and the divergence was only detected when the client reconciled. The trigger condition is precise: **two distinct proposals with identical payload hashes** (deduplication at the payload layer) **plus** a warrant schema that omits a proposal-ID binding. Neither condition alone is sufficient. Identical payloads are common (retries, batched identical transfers, idempotent-looking writes). Missing proposal binding is common because designers assume the payload hash *is* the proposal identity. ## Condition of Validity A signature over `(payload_hash, round, nonce)` is valid evidence of commit for proposal `P` **if and only if** the verifier can independently establish that `payload_hash` uniquely identifies `P` within the ledger's current epoch. That condition holds only when the ledger enforces payload uniqueness (no two committed proposals share a payload hash). It fails the moment the ledger permits duplicate payloads — which most ledgers do, because enforcing global payload uniqueness requires a global lock that defeats the point of a multi-agent quorum. Therefore the invariant must be stated at the *proposal* layer, not the payload layer: > A commit certificate is valid for proposal `P` only if every signature in the certificate is over `H(P.id ‖ P.payload_hash ‖ P.epoch ‖ P.round)` where `P.id` is drawn from a monotonically increasing, per-agent proposal counter and `P.epoch` is the ledger epoch in which `P` was proposed. The verifier must additionally check that `P.id` is strictly greater than the highest `P.id` it has previously seen *for that agent*, and that `P.epoch` matches the verifier's current epoch. This is the freshness invariant. It is not implied by authenticity. ## Decision Boundary The decision boundary is the point at which a verifier must **reject a warrant that is authentic but not fresh**. Concretely: - **Accept** a certificate iff (a) all signatures verify against the expected quorum members, (b) the signed digest includes `P.id`, `P.epoch`, and `P.round`, (c) `P.id` exceeds the verifier's recorded high-water mark for each signing agent, and (d) `P.epoch` equals the verifier's current epoch. - **Reject and quarantine** a certificate where any signature verifies but `P.id` is at or below the high-water mark. This is a replay attempt (or a buggy peer); it must be treated as adversarial, not as a duplicate. - **Reject and re-propose** a certificate where `P.epoch` lags the verifier's epoch. This is a legitimate stale certificate from a peer that has not yet observed the epoch advance; it is not adversarial, but it cannot authorize a commit in the current epoch. The subtle failure is that condition (c) requires per-signer high-water marks, not a global one. A global high-water mark is insufficient because a Byzantine peer can sign a *future* `P.id` for one proposal and a *past* `P.id` for another, and the global mark will only catch the second. Per-signer marks catch both, at the cost of O(quorum) state per verifier. ## Operational Effect The operational consequence is that quorum certificates must carry a **proposal-identity triple** `(id, epoch, round)` that is *independent of payload content*, and every verifier must maintain per-signer monotonic counters. Systems that bind signatures only to payload hashes will silently double-commit whenever two proposals share a payload — a condition that arises naturally from client retries, from idempotency-key collisions, and from batched identical operations. The failure is undetectable at signature-verification time and only surfaces at reconciliation, by which point the effect has propagated to downstream agents that consumed the warrant as proof. The guardrail is a single architectural change: move the signature's signed digest from `H(payload)` to `H(id ‖ payload ‖ epoch ‖ round)`, and make `id` monotonic per agent. This is cheap (a counter and an extra hash field) and it converts the replay attack from undetectable to rejected-at-verification. ```python import hashlib from dataclasses import dataclass class StaleWarrantError(RuntimeError): """Raised when a warrant is authentic but fails the freshness invariant.""" @dataclass(frozen=True) class Warrant: signer: str proposal_id: int epoch: int round: int payload_hash: str signature: str # verified elsewhere; assumed valid here def signed_digest(w: Warrant) -> str: # The invariant: identity is bound into the digest, not just the payload. material = f"{w.proposal_id}|{w.payload_hash}|{w.epoch}|{w.round}".encode() return hashlib.sha256(material).hexdigest() def verify_warrant( w: Warrant, *, current_epoch: int, high_water: dict[str, int], expected_digest: str, ) -> None: if signed_digest(w) != expected_digest: raise StaleWarrantError( f"digest mismatch for signer={w.signer} id={w.proposal_id}" ) if w.epoch != current_epoch: raise StaleWarrantError( f"epoch lag: warrant epoch={w.epoch} verifier epoch={current_epoch}" ) prior = high_water.get(w.signer, -1) if w.proposal_id <= prior: raise StaleWarrantError( f"replay: signer={w.signer} proposal_id={w.proposal_id} " f"<= high_water={prior}" ) high_water[w.signer] = w.proposal_id def commit_effect( warrants: list[Warrant], *, quorum: int, current_epoch: int, high_water: dict[str, int], expected_digests: dict[str, str], ) -> str: seen_signers: set[str] = set() for w in warrants: verify_warrant( w, current_epoch=current_epoch, high_water=high_water, expected_digest=expected_digests[w.signer], ) seen_signers.add(w.signer) if len(seen_signers) < quorum: raise StaleWarrantError( f"insufficient quorum: {len(seen_signers)} < {quorum}" ) # Effect application happens only after all freshness checks pass. return hashlib.sha256( "|".join(sorted(signed_digest(w) for w in warrants)).encode() ).hexdigest() ```