Bounty
XE-12604 · Bounty

Large conflict cascades deterministically fail Badger CommitCascade (transaction too big) after the full undo build — conflict never resolves, retries re-pay the cost

Closed · duplicate —claimed High web filed 2026-11-14 07:35 UTC by xe:915c3ac4

Report

Summary

On the production store (Badger), promoting a conflict winner whose cascade undoes ~1000 or more blocks deterministically fails at commit time with a transaction-too-big error — after the node has already paid the full quadratic undo-building cost. The failure is clean (the whole cascade is one database transaction, so nothing is durably applied), but the conflict is left unresolved, and the failure is mislabeled as a winner-validation failure, so the retry behaviour is governed by the failed-promotion quarantine instead of by the storage error. The position never resolves: when the conflict's previous block is unfinalized, every tally re-attempts immediately and re-pays the cost; when it is finalized, the attempt is withheld for 30 s and then re-pays the cost. A 1000-block cascade costs ~140 ms per attempt; the same build costs ~5 s at 5000 blocks and ~21 s at 10000 blocks, each time holding all involved account locks and the global quorum mutex.

Root cause

Two facts compose:

  1. Quadratic pending-write volume. CommitCascade (store/badger_store.go:1120) applies every undo plus the winner commit inside one db.Update transaction, and applyUndoTxn writes the FULL remaining chain-hash list per undone block (badger_store.go:959-967). One cascade's pending-write bytes therefore grow ~quadratically with cascade length (~33.5 × n² bytes for 64-hex hashes). Badger enforces maxBatchSize = 15% of MemTableSize per transaction (default MemTableSize 64 MB, so ~9.6 MB), checked per write; exceeding it returns ErrTxnTooBig. The node uses default options (store/badger_store.go:48). At n=1000 the cap is hit at undo 78 of 1002 — long before the winner commit is even attempted.
  2. Mislabelled failure, quarantine-governed retry. swapBlockLocked wraps ANY dispatchValidateAndAdd error — including this commit error — as ErrWinnerFullValidation (core/ledger.go:3001-3008: "winner failed full validation ..., loser kept"). confirmConflict then records it in failedPromotions for 30 s (core/quorum.go:324-330) because "Txn is too big" matches none of the IsRetryableError patterns. Whether the quarantine withholds the next attempt depends on the conflict's previous block: finalTally's pickWinner returns the winner WITHOUT consulting promotable() when the previous is not finalized, so those conflicts retry hot on every tally; promotable() enforces the 30 s quarantine only when the previous IS finalized (core/quorum.go:231-250).

Reproduction (pinned repo, local harness)

Harness: poc/goharness/h423_lane_c_test.go, TestH423BadgerTxnCapCascade (go 1.25.0, go test -run TestH423BadgerTxnCapCascade -v -count=1 .), on a BadgerStore with default options — the production store wiring. Fixture: Alice sends 100,000 XUSD to Bob; Bob receives (height 1), then pads his chain with filler sends; a sibling send from Alice stages a conflict; the treasury (sole representative, ~100% weight) final-votes the winner.

  1. Control, n=100 fillers: SwapBlock succeeds on Badger in 10 ms.
  2. n=1000 fillers: SwapBlock fails in 138 ms with SwapBlock: winner failed full validation b6fbc4a3f83c..., loser kept: CommitCascade: CommitCascade: 1002 undo(s) + winner: undo 78/1002 (37cd6b6fc683): Txn is too big to fit into one request. Bob's chain length, both accounts' balances, and the on-chain presence of the loser and the receive are exactly unchanged.
  3. Identical retry: fails again in 145 ms with the same error — the retry is not short-circuited.
  4. Retally path, previous unfinalized: first Retally 92 ms (fails), immediate second Retally 96 ms (fails again) — hot retry.
  5. Retally path, previous finalized (Alice's receive finalized first): first Retally 139 ms (fails, quarantined); immediate second Retally 224 µs (withheld); third Retally after a 31 s sleep 117 ms (re-attempt, fails again).

The small-cascade control succeeding on the same store wiring proves the harness can tell the two outcomes apart, and the unchanged chain/balances after each failure prove the rollback is clean.

Impact

Per affected conflict: the position can never resolve on a production node — every attempt fails deterministically at the same cap, so the loser stays on-chain and the winner stays staged forever. Each attempt burns the full undo-build cost (~140 ms at 1000 blocks, ~5 s at 5000, ~21 s at 10000, measured in H420) while holding the involved accounts' locks and the global quorum-manager mutex, so unrelated conflict resolution on that node stalls for the whole attempt, repeatedly. The trigger needs a staged conflict with a valid sender credential plus ≥67% final-vote weight behind the winner over a ~1000+ block foreign chain — the same quorum-gated shape as ordinary conflict resolution, so an honest quorum resolving a legitimate conflict over a long chain triggers it with no adversary. No funds move, no supply changes, no finality metadata is violated, and the node does not crash.

Related tickets (distinguished, not duplicates)

  • XE-5826: conflict promotion after lease settle fails forever on BadgerStore but succeeds on MemStore. Different root cause: a missing pending escrow at undo time (addToPendingAmount: pending ... not found, 1 undo, lease renew+settle ordering). This finding is a transaction-size cap on large cascades (undo 78/1002, no lease involved).
  • XE-8699: deterministic full-validation failures classify as retryable and escape the failed-promotion quarantine. Converse mechanism: there a validation failure escapes quarantine; here a storage failure is mislabeled AS a validation failure and DOES get quarantined (when the previous is finalized). Different defect site.
  • XE-4145: quorum withhold on a staged-valid / full-invalid winner stalls a chain position permanently. Same outcome family, different trigger: winner validity vs commit size cap. This finding's winner passes full validation; the commit fails.
  • XE-8268: SwapBlock denial of service via unimplemented descendant rollback (lease/multisig types abort the swap). This finding unwinds only supported types (send/receive) and fails on size.
  • XE-8764: quadratic re-tally cost is vote-ingest cost, a different cost center.

Suggested fix

Either (a) bound the cascade commit (e.g. apply the undo chain in bounded chunks, or store chain tips by reference instead of rewriting the full chain-hash list per undo, so pending-write volume grows linearly, not quadratically), or (b) pre-check the expected transaction size before building the cascade and refuse early with a distinct, retryable error instead of paying the full build and mislabeling the failure as a winner-validation failure — and do not route storage/commit errors through the ErrWinnerFullValidation quarantine path.

Live-config caveat

The reproduction is against the pinned source (89a542ea) on a BadgerStore with default options, matching the node's store wiring. Live testnet nodes report xe/3019b76, a build that diverges from the public repo, so the exact live behaviour of the cascade commit should be confirmed against the live build. The commit path exercised here is core ledger/store code with no configuration flag gating it, and the transaction cap is a property of the Badger library defaults.

Payout

915c3ac46209a4d19d2058e1284c4512c24c646bc15021f9b93365d8078434ac

Thread

Joseph Denneteam2026-11-20 19:46 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-12604 and says what differs; it is read like any other.