feat(thorchain): 3.22.0 bond-slash refunds (migrate20to21)

🔎 Visual review of fa49ce74: ⏳ out of date, newer commits were pushed. Updating it for c4ab1067.

3.22.0 bond-slash refunds (migrate20to21)

Refunds three erroneous bond slashes whose outbounds each paid once on chain. Each event runs in its own cache context (added as steps in migrate20to21Mainnet), so one soft-skip or toggle never blocks the others or the existing tcso reimbursement.

Event Height Pool leg (reverse) Bond refund Providers
TRON h28476980 TRON.TRX: +239,051,149,400 TRX / −111,827,573,715 RUNE 223,655,147,430 182
ETH h28518406 ETH.ETH: +1,600,007,205 ETH / −5,333,813,893,723 RUNE 10,667,627,787,446 180
BTC h28574121 BTC.BTC: +10,296,474 BTC / −1,312,800,440,071 RUNE 2,625,600,880,142 182

Per event: reverse the mis-debited pool leg (credit the asset back, remove the RUNE the slash added, move that freed RUNE Asgard→Reserve), then pay every affected bond provider its pinned pro-rata share of its node's bond_cost as liquid RUNE from the Reserve. For every event bond_cost == 2 × pool RUNE credit ("half pool, half Reserve"). Per-provider rows are pinned from the slashed members' bond_providers at each event's H-1 (pro-rata floor; each node's remainder to its largest-bond provider so every per-node subtotal equals its bond_cost); re-pin at the cut.

⚠️ Divergence from the merged 19to20 refund (!5175 (merged))

  • No vault-solvency gate and no vault coin writes. 19to20 gated the pool-asset credit on unaccounted asset sitting in the vaults, because that slash double-debited the pool while the vault kept the asset. These slashes are different: the asset legitimately left (swap / trade-account withdrawal) and only the pool was mis-debited, so there is no vault headroom to gate on. The premise "the outbound paid exactly once, the slash mis-debited only the pool" is pinned from analysis, not verified by code — true for all three events. The BTC vault books also deducted the dead 045DE30B outbound, which overlaps the re-pay and needs devs' sign-off, so the vault is left strictly untouched.
  • Remaining guards: pool-drift (the pool must still hold the RUNE the slash added) and Reserve coverage (a floor on the network Reserve). Both soft-skip non-silently: a slash_refund_skip_322 event carrying the event height and the RUNE shortfall, plus an error log. Covered by a test.
  • Refunds are liquid RUNE to bond providers (ZEC/TRON 19to20 parity), not re-bonding — slashed nodes are not re-bonded by this migration.

Toggles (both decided ON by Itz, 2026-11-09 16:14Z)

  • tronSlashRefundEnabled322 — ON. The TRON inbound 37A43908 was the ETH-reorg arb bot's swap; Itz confirmed the refund stands.
  • btcSlashRefundEnabled322 — ON. A separate BTC re-pay plan may restore the BTC pool separately; reversing it here too would double-restore. Gates the whole BTC event, not just the pool leg: the two are financially inseparable (the pool half of the refund is funded by the freed pool RUNE), so deferring the pool to that plan would mean deferring the bond refund with it. Itz confirmed the BTC event stays in.

LUVI

luviDeclaredWriteDowns["migration/20to21"] declares only BTC.BTC (−3.2e-6 at current depth); the TRON and ETH reversals gain LP value (+1.68e-4 / +2.75e-4), so neither needs a declaration.

Tests (-tags mainnet)

Per-event exact per-provider amounts + totals, the LUVI migration gate (no undeclared drop), the non-silent soft-skip (event + height + shortfall), and the TRON toggle. All green.


DO NOT MERGE — both toggles decided ON (Itz 16:14Z); still held for Itz's final sign-off. Draft.

Edited by Huginn Ai

Merge request reports

Loading
Loading