|
| 1 | +# wzrd-rails → wzrd-markets Upgrade Runbook |
| 2 | + |
| 3 | +**Program ID (mutable):** `BdSv824hvYeGAWQZUcypRzAor8yJit2qeqCHty3CSZy9` |
| 4 | +**Current binary:** wzrd-rails (MasterChef CCM staking + listen payout) |
| 5 | +**Target binary:** wzrd-markets (prediction markets CPMM) |
| 6 | +**Date assessed:** 2026-06-23 |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## On-Chain State Audit Summary |
| 11 | + |
| 12 | +| Account | Address | Lamports | Notes | |
| 13 | +|---------|---------|---------|-------| |
| 14 | +| Config PDA | `7pwUU1hv...` | ~1,100 | Orphaned after upgrade | |
| 15 | +| StakePool PDA | `6oQDChd9...` | ~2,200 | Orphaned after upgrade | |
| 16 | +| UserStake (agent-058) | `DZZCvBvoLPc3eJM8jCS6fRW3s52GZZQs7UcnEqZgacE7` | ~2,000 | 449 CCM staked — UNLOCKED | |
| 17 | +| UserStake (seed-cohort) | `HnR59DAGJNiW4q8ZHzgQzWYJcMYPiWrFhb733Tcqxb34` | ~2,000 | 3.1M CCM staked — UNLOCKED | |
| 18 | +| stake_vault | `H8uqT29s3Kc9JLR3s6G2L3ZyF9avz2CJKfhPK1EbcmXr` | — | 3,116,139.77 CCM | |
| 19 | +| reward_vault | `4HnYVcAs...` | — | 99.5 CCM | |
| 20 | + |
| 21 | +Both UserStake positions belong to **internal WZRD wallets** (not external users). |
| 22 | +Both locks have expired as of 2026-06-23. |
| 23 | + |
| 24 | +**Accepted write-offs (internal wallets only):** |
| 25 | +- 3.1M CCM in stake_vault — seed-cohort keypair unavailable; treated as permanent stake |
| 26 | +- 99.5 CCM in reward_vault — negligible |
| 27 | +- ~0.007 SOL across orphaned PDAs — negligible |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Pre-Upgrade Checklist |
| 32 | + |
| 33 | +- [ ] **Optional**: Drain agent-058 position (449 CCM) |
| 34 | + ```bash |
| 35 | + # Keypair: /home/twzrd/security/swarm-keys/agent-058.json |
| 36 | + # Requires read access to that file (root-owned, enter as sudo or via founder terminal) |
| 37 | + # See: ops/scripts/smoke-rails-canary.sh for account addresses |
| 38 | + anchor idl type /home/twzrd/attention-oracle-program/target/idl/wzrd_rails.json |
| 39 | + # Call unstake with pool_id=0, wallet=agent-058.json |
| 40 | + ``` |
| 41 | +- [ ] Ensure upgrade authority wallet has **≥ 5.1 SOL liquid** (5.089 SOL buffer + fees) |
| 42 | + - Buffer wallet is returned after upgrade completes |
| 43 | + - Program data account: `~731,120 bytes → ~5.089 SOL buffer` |
| 44 | +- [ ] Build release binary: |
| 45 | + ```bash |
| 46 | + cd /home/twzrd/attention-oracle-program |
| 47 | + anchor build --program-name wzrd_markets -- --release |
| 48 | + # Binary: target/deploy/wzrd_markets.so |
| 49 | + ``` |
| 50 | +- [ ] Verify binary size is within buffer capacity: |
| 51 | + ```bash |
| 52 | + ls -la target/deploy/wzrd_markets.so |
| 53 | + # Must be ≤ 731,120 bytes to fit current program data account |
| 54 | + # If larger, additional SOL is needed for the expanded buffer |
| 55 | + ``` |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## Upgrade Command (requires founder wallet + SOL) |
| 60 | + |
| 61 | +```bash |
| 62 | +# Step 1: Write buffer account |
| 63 | +solana program write-buffer \ |
| 64 | + target/deploy/wzrd_markets.so \ |
| 65 | + --keypair /path/to/upgrade-authority.json \ |
| 66 | + --url mainnet-beta |
| 67 | + |
| 68 | +# Note the buffer address printed above, then: |
| 69 | + |
| 70 | +# Step 2: Upgrade program |
| 71 | +solana program upgrade \ |
| 72 | + <BUFFER_ADDRESS> \ |
| 73 | + BdSv824hvYeGAWQZUcypRzAor8yJit2qeqCHty3CSZy9 \ |
| 74 | + --keypair /path/to/upgrade-authority.json \ |
| 75 | + --url mainnet-beta |
| 76 | + |
| 77 | +# Buffer SOL is returned to the payer automatically on success. |
| 78 | +``` |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Post-Upgrade Verification |
| 83 | + |
| 84 | +```bash |
| 85 | +# Confirm new program is active |
| 86 | +solana program show BdSv824hvYeGAWQZUcypRzAor8yJit2qeqCHty3CSZy9 |
| 87 | + |
| 88 | +# Smoke test: initialize_markets_config should work with canonical USDC |
| 89 | +# anchor test --skip-local-validator (requires RPC config) |
| 90 | +``` |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## What Changes After Upgrade |
| 95 | + |
| 96 | +| Before | After | |
| 97 | +|--------|-------| |
| 98 | +| wzrd-rails instructions (stake/unstake/claim/listen payout) | wzrd-markets instructions (create/resolve/deposit/redeem) | |
| 99 | +| StakePool/UserStake accounts (owned by program, no close instruction) | Orphaned — ~0.007 SOL permanently locked | |
| 100 | +| stake_vault CCM (3.1M + 449 CCM) | Permanently locked (no instruction to drain) | |
| 101 | +| reward_vault CCM (99.5 CCM) | Permanently locked | |
| 102 | + |
| 103 | +All orphaned amounts are internal WZRD wallets only — no external user funds at risk. |
0 commit comments