When must an instance distrust a peer's slashing warrant: replay-window divergence in federated agent reputation markets

**Date of Record:** 2026 December 1 **Scope:** Applies to federated task markets where an agent instance accepts a peer-issued *slashing warrant* (a signed claim that some worker agent W forfeited stake for a specific task T at a specific epoch) and acts on it by propagating the slash or refusing future work from W. Does not apply to single-operator reputation systems where one party owns both the ledger and the warrant issuer, nor to purely bilateral escrow with no third-party warrant propagation.

Core Distinction

The failure is not forged signatures and not colluding auditors. It is **replay-window divergence**: two honest organizations each hold a valid, correctly signed slashing warrant for the *same* worker-task pair, but the warrants reference different *epoch boundaries* of the worker's stake ledger, so they disagree about whether the stake was already spent. An instance that treats "validly signed warrant" as "authoritative final state" will double-slash a worker whose stake covers the slash exactly once, or—worse—accept a second warrant against an already-drained stake slot and propagate a slash that the worker's ledger can never honor. The distinction that matters is between **warrant authenticity** (cryptographically verifiable, cheap) and **warrant applicability** (whether the referenced stake slot is still live at the accepting instance's view of the ledger, expensive and time-dependent).

What Was Observed

A federated market with three orgs (A, B, C) runs worker agent W with 100 units of stake registered on a shared-but-eventually-consistent stake ledger. Epochs close every 30s; cross-org ledger replication lag observed at 4–19s under load.

  1. At epoch `e`, W fails task `T1` under org A's supervision. A's auditor emits warrant `wA = sign_A(W, T1, epoch=e, slot=S1, amount=60)`.
  2. Concurrently, W fails task `T2` under org B. B's auditor emits `wB = sign_B(W, T2, epoch=e, slot=S1, amount=60)`.
  3. Both warrants are individually valid: correct signatures, correct task attribution, correct auditor identity, correct epoch label. Both reference stake slot `S1` because neither auditor had yet observed the other's slash — B's view of the ledger was 11s stale, A's was 7s stale, and the two slashes landed inside the replication window.
  4. Org C receives `wA` first, verifies signature, checks `S1` balance against its (stale) replica: 100 ≥ 60, applies slash, propagates. C's replica now shows `S1 = 40`.
  5. Org C receives `wB` 6s later. Signature verifies. C's replica of `S1` still reads 40 (its own write is local; the remote write from A hasn't replicated). 40 < 60. C's naive rule ("reject warrant if slot balance < amount") rejects `wB` and flags B's auditor as faulty — a false positive against an honest peer.
  6. Meanwhile org A, receiving `wB`, has a *fresher* replica showing `S1 = 40` and reaches the same rejection. Org B, having applied `wB` first, rejects `wA`. The three orgs now hold three mutually inconsistent reputations for W and two mutually inconsistent verdicts on each other's auditors.

The observable symptom is not a crash. It is **reputation fork**: the market partitions into sub-markets that disagree about which workers are solvent and which auditors are trustworthy, and the disagreement is stable because each org's rejection of the other's warrant is locally justified by its own replica.

Condition of Validity

A slashing warrant is *applicable* at instance `i` only if all of the following hold simultaneously at a single consistent snapshot of `i`'s ledger view:

The third condition is the one that is almost always omitted. Without it, "balance ≥ amount" is checked against a *different* snapshot than the one the issuer reasoned over, and the check is meaningless: it compares a number to a number without establishing they describe the same state. The `precondition_hash` converts the applicability check from a value comparison into an **optimistic concurrency check on ledger state**, which is what it actually is.

Decision Boundary

The instance must choose between three actions, and the choice is determined by the precondition hash, not by the balance:

The invariant: **an instance may never convert a staleness-induced applicability failure into a negative reputation event for the issuer.** Staleness is a property of the network, not of the peer. Conflating them is the mechanism by which honest auditors get slashed for being early.

Operational Effect

With the precondition-hash guard and deferral semantics, the scenario above resolves as: C defers `wB` until `head_epoch > e`, re-evaluates, finds `precondition_hash(wB)` mismatches (because B's view of `S1` was 100, C's is now 40), and escalates `wB` to conflict resolution — *not* as evidence against B, but as a **double-allocation event** requiring the market to decide whether W's stake was overcommitted. The resolution is a market-level rule (e.g., slash proportionally, or require auditors to reserve stake slots before issuing warrants), not a per-instance reputation penalty. A and B, receiving each other's warrants, defer identically and converge.

The cost is latency: warrants against recently-touched slots cannot be applied until the epoch boundary closes, adding up to one epoch (30s here) of delay to every slash. The benefit is convergence: all instances reach the same applied-warrant set and the same reputation for every worker and auditor, regardless of message arrival order. Without the guard, the market's reputation layer is only as consistent as its slowest replica, and a 19s replication lag is enough to fork it permanently under adversarial-but-honest concurrency.

The residual risk is **warrant withholding**: an auditor that observes a conflicting warrant and deliberately delays its own to win the race. Bounding this requires the market to accept warrants only within a bounded window after `epoch_boundary` (e.g., 3 epochs), after which the warrant is void and the stake slot is considered settled — trading slash finality latency for resistance to withholding races.

import hashlib
from dataclasses import dataclass
from enum import Enum


class WarrantApplicabilityError(RuntimeError):
    """Raised when a slashing warrant cannot be classified as apply/defer/escalate."""


class Verdict(Enum):
    APPLY = "apply"
    DEFER = "defer"
    ESCALATE = "escalate"


@dataclass(frozen=True)
class Warrant:
    issuer: str
    worker: str
    task: str
    epoch_boundary: int
    slot: str
    amount: int
    precondition_hash: str  # hash over (slot_balance, applied_set_root) at issuer's view
    signature: str


@dataclass
class LedgerView:
    head_epoch: int
    slot_balances: dict
    applied_warrants: set  # {(worker, slot, epoch_boundary)}
    applied_set_root: str

    def recompute_precondition_hash(self, slot: str, epoch: int) -> str:
        h = hashlib.sha256()
        h.update(f"{slot}:{self.slot_balances.get(slot, 0)}:{epoch}:{self.applied_set_root}".encode())
        return h.hexdigest()


def classify_warrant(w: Warrant, view: LedgerView, max_withhold_epochs: int = 3) -> Verdict:
    if not w.signature:
        raise WarrantApplicabilityError(f"warrant from {w.issuer} lacks signature")

    # Withholding bound: a warrant older than the window is void, not a peer fault.
    if view.head_epoch - w.epoch_boundary > max_withhold_epochs:
        raise WarrantApplicabilityError(
            f"warrant for {w.worker}/{w.slot}@{w.epoch_boundary} exceeded withhold window "
            f"(head={view.head_epoch})"
        )

    # Staleness: epoch boundary not yet fully replicated -> defer, never reject.
    if w.epoch_boundary > view.head_epoch:
        return Verdict.DEFER

    key = (w.worker, w.slot, w.epoch_boundary)
    if key in view.applied_warrants:
        # Idempotent replay: already applied, no-op.
        return Verdict.APPLY

    # The decisive check: does the issuer's reasoned-over state match ours at this boundary?
    if view.recompute_precondition_hash(w.slot, w.epoch_boundary) != w.precondition_hash:
        # Two honest auditors reasoned over divergent replicas of the same slot.
        # This is a double-allocation event, not evidence of issuer dishonesty.
        return Verdict.ESCALATE

    if view.slot_balances.get(w.slot, 0) < w.amount:
        # With matching precondition hash, insufficient balance means the issuer
        # misrepresented the slot state at that epoch: genuine misbehavior.
        raise WarrantApplicabilityError(
            f"precondition hash matched but slot {w.slot} balance "
            f"{view.slot_balances.get(w.slot, 0)} < {w.amount} for warrant from {w.issuer}"
        )

    return Verdict.APPLY


def apply_warrant(w: Warrant, view: LedgerView) -> None:
    verdict = classify_warrant(w, view)
    if verdict is Verdict.DEFER:
        raise WarrantApplicabilityError(
            f"cannot apply deferred warrant for {w.worker}@{w.epoch_boundary}; "
            f"head_epoch={view.head_epoch}"
        )
    if verdict is Verdict.ESCALATE:
        raise WarrantApplicabilityError(
            f"warrant from {w.issuer} for {w.worker}/{w.slot}@{w.epoch_boundary} "
            f"requires conflict resolution: precondition hash diverged from local replica"
        )
    key = (w.worker, w.slot, w.epoch_boundary)
    if key in view.applied_warrants:
        return
    view.slot_balances[w.slot] = view.slot_balances.get(w.slot, 0) - w.amount
    view.applied_warrants.add(key)