feat(x/mayachain): v133 CACAO recovery store migration

v133 CACAO recovery (v2, re-pinned 2026-09-29)

Aaluxx's per-pool share model, Itz-ratified 2026-09-25, revised after the economic review (2026-09-29). Supersedes the earlier v9 basis (20M preburn + 30% heavy-cut + in-migration treasury swap).

v2 changes (economic review):

  • Common price: all repriced pools land on a single P_ref = $0.10351 / CACAO. This replaces the earlier equal-value variant, where ZEC funded a top-up of the deficit pools and pool prices spread by ~20%.
  • Unmodelled pools: the 8 CACAO-heavy Available pools outside the share model are repriced to the same P_ref with CACAO-only cuts. No asset is removed. Staged pools are never cut; see "Staged pools".
  • Supply: the end-supply increase is ratified as-is: 100M → ~108.85M.
  • ILP: ILP stays on; no ILP mimir is written. Instead, the migration scales every LP record's CacaoDepositValue and AssetDepositValue (the ILP basis) to 70%, rounded down, across all pools. This lowers the insured amount (Itz / model-owner decision).
  • Minimum bond: the migration sets admin mimir MinimumBondInRune = 200,000 CACAO. The key is MsgMimir-valid, so governance can change it. Post-cut, all 40 active nodes stay eligible (lowest ~228.6k) and 14 of 17 standby nodes remain above the minimum.
  • Prices re-pinned 2026-09-29. They must be re-pinned again within 24h of the upgrade tag (see "Before tagging").

Model

Pinned inputs are locked in x/mayachain/v133_pinned_cuts.go and can be regenerated with go run ./tools/v133-cacao-recovery-calc.

Snapshot and prices

  • Price pin: 2026-09-29T18:14:40Z
    • Source: DefiLlama coins.llama.fi/prices/current with CoinGecko ids, fetched 18:16:27Z. The CoinGecko API was rate-limited from the build host.
    • Exception: ARB.TGT (thorwallet) is not on DefiLlama and uses its CoinGecko /simple/price of 2026-09-29.
  • Historic (08-18) prices: CoinGecko /coins/{id}/history?date=18-08-2026 (unchanged)
  • Pre-hack CACAO depths height: 17,977,948
  • Freeze witness height: 17,978,542
  • Halt height (all per-pool HaltBC / HaltBA locked): 18,397,864

Modelled pools (9)

  • share_i = pre-hack CACAO depth × (P_pin / P_0818), normalised.
  • target_usd_i = L × share_i, with L = $5,695,484.60 (set by ARB.USDT).
  • Each pool keeps retained_usd_i = min(curr_usd_i, target_usd_i) of asset. Asset above target is removed.
  • CACAO is sized to retained_usd_i / P_ref, where P_ref = Σ retained_usd / CACAO_after and CACAO_after = Σ halt_bc − 30M.
  • ZEC ends above its halt balance because of its share uplift (price ratio 2.75x). It absorbs only the integer floor residual, which is a few base units.

Unmodelled pools (item 5a)

  • final_cacao_i = asset_usd_i / P_ref wherever that is below the halt BalanceCacao.
  • Prices: DefiLlama current at the same pin.
  • ARB.GLD, ARB.LEO, ARB.YUM and MAYA.MAYA stay pinned at their pre-hack pool price minus 15%, converted to USD via the pre-hack ETH.USDC pool (CACAO_0818 = $0.11551754). These are unchanged by the re-pin.
  • Pools already at or above P_ref are left untouched: ARB.WSTETH. So are all Staged pools: ARB.ARB, ARB.DAI, ARB.LEO, ARB.PEPE, ARB.TGT, ETH.LLD, ETH.PEPE, plus the two empty staged pools.

Headline numbers

P_ref (all repriced pools) $0.10351 / CACAO
Removed asset USD $990,976.85 (cap $1.1M, 9.9% margin)
Pool CACAO cut 31,102,852.93 = 30,000,000 modelled + 1,102,852.93 unmodelled
ARB.LINK ragnarok burn 581,188.64
Physical burn from Asgard 31,684,041.57
Attacker burn (Y) 8,874,269.11
Total supply 100,000,000 → ~108,853,705.73

Modelled cuts

Pool CACAO before CACAO after Asset after
ZEC.ZEC 20,677,940.24 26,895,837.89 1,967.57226440
BTC.BTC 34,018,255.99 13,781,062.67 17.10916393
ETH.ETH 12,686,079.93 5,207,257.18 200.92633838
THOR.RUNE 9,070,054.18 5,362,221.93 740,535.53403436
ETH.USDC 3,993,134.45 1,187,028.42 122,884.38739292
DASH.DASH 943,118.86 813,909.77 1,385.78610887
ARB.ETH 1,145,378.81 445,912.44 17.20590143
ETH.USDT 1,114,831.74 290,850.97 30,114.28635725
ARB.USDT 489,658.91 154,371.83 15,983.43432485

Unmodelled CACAO-only cuts

Pool CACAO before CACAO after Price source
ETH.MOCA 796,186.77 11,541.27 DefiLlama 09-29
ARB.USDC 205,962.19 69,439.31 DefiLlama 09-29
MAYA.MAYA 151,472.99 46,781.27 pre-hack −15%
ADA.ADA 115,468.19 84,060.63 DefiLlama 09-29
ARB.YUM 331,284.09 314,258.16 pre-hack −15%
ARB.WBTC 43,980.01 17,487.28 DefiLlama 09-29
ETH.WSTETH-0X7F39 43,885.58 42,733.90 DefiLlama 09-29
ARB.GLD 17,802.26 16,887.34 pre-hack −15%

Pool list completeness

  • v133Pools holds every pool record carrying CACAO at the halt: 29 pools. This was verified by iterating all 42 pool records in the h18,397,864 snapshot.
  • MAYA.LEO-0X9386… (18.72 CACAO pending) and THOR.THOR.RUNE (2.69 CACAO pending) are Staged records with zero LP units. /mayachain/pools hides them, and they are now included, so their pending deposits are backed with no write-off (+21.408 CACAO to GAP and supply).

Staged pools

  • cyclePools charges StagedPoolCost (0.1 CACAO) to every Staged pool each PoolCycle (43,200 blocks), even under HaltChainGlobal.
  • A pinned Staged pool would therefore drift from its HaltBC and trip the S0 pin check, i.e. os.Exit(10) at the upgrade. Staged pools are never cut or pinned.
  • Only Available pools are pinned. They do not move while halted: on mainnet at h18,603,505, only Staged pools had drifted since the halt.
  • Post-migration, every repriced Available pool stays above MinCacaoPoolDepth (10k CACAO). The smallest is ETH.MOCA at 11.5k.
  • The pool is REMOVED, not merely Suspended.
  • Its halt-snapshot BalanceCacao is burned in the aggregated S5b step.
  • Its BalanceAsset (117,529,941 base, ~1.175 LINK) stays in the Asgard ARB vault as over-solvency, swept by !857 (merged).

Asset outbounds

  • ScheduleAssetOutbounds is locked to false.
  • Removed asset residuals stay in the Asgard L1 vaults as over-solvency and are swept by !857 (merged)'s oversolvency sweeper after unhalt.

M formula

  • M = GAP + LinkBCBurn. The LinkBCBurn term replaces what the ARB.LINK CACAO burn removes from the Asgard side of the S9 invariant.
  • Δsupply = M + K − Y − PoolCut − LinkBCBurn = GAP + K − Y − PoolCut.

Dry-run

Deterministic 2 of 2 against the ~/.mayanode LevelDB snapshot at h=18,397,864. The DB is opened read-only, the cache context is discarded, and application.db is byte-identical before and after.

cache_hash (both runs): af1d65ea6fac591277a082f41fd06c03a87a8629601a18fdcf7eb7a9cae12eb8
pinned pools matched:   17/17 (9 modelled + 8 unmodelled), no other pool changed
S9 invariant:           HOLDS
LP deposit values:      1,834 records ×0.70 (CACAO DV 31.19M → 21.83M)

Key outcomes (base units, 1e10 = 1 CACAO):

BC (29-pool sum)        858,750,020,472,792,140
PEND                        416,648,590,392
asgard_before           370,442,161,690,857,747
GAP                     488,308,275,430,524,785
Y (attacker burn)        88,742,691,052,775,996
pool cut (30M + 5a)     311,028,529,279,696,943
LINK BC burn              5,811,886,391,613,141
physical burn total     316,840,415,671,310,084
K (honest LP)                     2,193,902,667
M mint (GAP+LinkBC)     494,120,161,822,137,926
supply Δ signed         +88,537,057,291,954,513
asgard_after            547,721,907,841,685,589
pool_sum+PEND after     547,721,907,841,685,589  ← S9 match

A local extended harness run (per-LP units and module balances) showed:

  • No LP units changed. The only LP records removed are ARB.LINK's (expected).
  • Only Asgard's CACAO balance moves. Reserve, bond and the other module balances are unchanged.

ILP (S5d)

  • ILP stays on (FullImpLossProtectionBlocks is untouched).
  • S5d scales every LP record's deposit values (the basis ILP coverage is measured from) by V133DepositValueKeepBps = 70%, rounded down, in every pool, not only the cut ones.
  • The pass is deterministic: store-key-ordered iteration, with writes after the iterators close.
  • No event is emitted. Deposit values are not in any event, and Midgard only reads them from genesis.
  • On the halt snapshot: 1,834 of 1,871 LP records changed (37 are already zero). Total CACAO deposit value goes 31,191,301.56 → 21,833,910.94 (−9,357,390.62, ×0.700000). Per-pool asset deposit values also drop to 70% (see the dry-run report).

Minimum bond (S5e)

  • Node bonds are LP value in the cut pools. On mainnet, active bond falls from ~48.8M to ~20.65M CACAO.
  • At the old 320k minimum, 11 of 40 active nodes and 14 of 17 standby nodes would fail the bond check once churn resumes.
  • S5e sets MinimumBondInRune = 200,000 CACAO (admin mimir, with a set_mimir event) in the same pass as the cuts, so it is in place before churn is re-enabled.

Tests

  • x/mayachain/manager_store_v133_test.go seeds the keeper from the halt fixture x/mayachain/testdata/v133_halt_fixture.json: the 27 pools + ARB.LINK, LINK LPs, trade records, Asgard/Reserve/attacker balances, supply and synth supplies. The fixture is generated with dry-run-v133 --export-fixture.
  • A second fixture, x/mayachain/testdata/v133_current_fixture.json, holds current mainnet (h18,603,505, after 5 PoolCycles), built from the mayanode REST API.
  • The test runs the mainnet params through StoreMgr.Iterator(133) on three states: the halt fixture, the current-mainnet fixture, and current mainnet plus 100 simulated PoolCycles of StagedPoolCost. It asserts:
    • every pin
    • untouched pools
    • ARB.LINK removal
    • S9
    • attacker balance zero
    • supply_after == expected and ≤ the ratified bound
    • no ILP mimir written
    • sample LPs in cut, unmodelled-cut and untouched Staged pools have deposit values ×0.70
    • MinimumBondInRune = 200,000 CACAO, with a MsgMimir-valid key
    • withdraw and trade_account_withdraw events for the seized positions, in fixed order
    • every cut pool is Available
  • The extended regtest suite asserts ILP is not switched off, and checks ×0.70 deposit values on a seeded LP.

Shared code path (regtest ↔️ mainnet)

Regtest and mainnet run the SAME S0-S9 body through migrateStoreV133WithParams in x/mayachain/manager_store_v133_shared.go. Mainnet passes the modelled and unmodelled cut rows together, with a burn of V133Burn30MBase + V133UnmodelledBurnBase.

Regtest suites:

  • test/regression/suites/store/v133-cacao-recovery.yaml: minimal fixture.
  • test/regression/suites/store/v133-cacao-recovery-aaluxx.yaml: extended fixture that runs the real cut apply, physical burn and S9 invariants.

Fail-hard semantics preserved

  • Any non-nil return from migrateStoreV133 propagates to os.Exit(10) on every validator.
  • S0 pin-drift asserts fail hard on any drift from the halt-snapshot HaltBC / HaltBA of every pinned pool (modelled and unmodelled) and ARB.LINK.
  • The runbook must keep HaltChainGlobal set, and pools frozen, until the migration height has passed.

Before tagging

  • Re-pin prices within 24h of the upgrade tag. Last pin: 2026-09-29T18:14:40Z.
  • To re-pin:
    • regenerate with go run ./tools/v133-cacao-recovery-calc
    • re-run the dry-run and the Go test
    • update the pins and the test supply bound
  • V133 combined vs !855 (merged)/!856 (merged) merge order: keep a single combined entrypoint.
Edited by Itzamna

Merge request reports

Loading
Loading