Deploy/migrate #529: pair wasm human-scale limit price band (columbus-5) #532

Closed
opened 2026-08-16 08:43:16 +00:00 by PlasticDigits · 3 comments
PlasticDigits commented 2026-08-16 08:43:16 +00:00 (Migrated from gitlab.com)

Why this issue exists

#529 is the code fix (human-scale [1e-9, 1e9] band). Limits on UST1/USTR stay impossible on columbus-5 until every live pair that should accept mixed-decimal limits is migrated to the new pair wasm, factory pair_code_id is updated, and the dApp that scales human→raw is shipped.

Code MR: !1060 (feat/529-limit-price-decimals-normalized, SHA 91d90ddb at open).

Playbook: skills/AGENTS_LIMIT_PRICE_DECIMALS.md (L529-1–L529-5). Runbook: docs/runbooks/wasm-admin-migration.md. Trace template: docs/templates/deploy-trace.md (also comment on #391).

Blocker before store/migrate

Pair CONTRACT_VERSION in !1060 is still 1.12.0. Live pairs from #514 / fee-treasury rotate are already 1.12.0. cw2::ensure_from_older_version rejects same-version migrate.

Must bump pair to 1.13.0 (or next unused) on the same MR or a tiny follow-up before wasm store + wasm migrate. Factory-only store/migrate is not enough and does not need a version bump for this fix (validation lives on pair).

What changes on-chain (and what does not)

Item Action
Pair wasm Store + migrate every registered pair
Factory No factory migrate required. After store, UpdateConfig { pair_code_id } so new pairs instantiate the new code
Fee-discount / router / wrap Unchanged
Pair storage No schema migrate. Migrate {} is empty. C14: preserve book, fees, escrow, treasuries
Indexer No migrate. Book price stays raw (L529-5)
Frontend Must ship with or before pair migrate for the dApp path (see order below)

New pairs after factory pair_code_id update get the new wasm automatically. Live UST1/USTR must be pair-migrated or it keeps the raw [1e-9, 1e9] reject.

Permissions

Step Who
make build-optimized + wasm store cl8ydeploy (permissionless store)
wasm migrate each pair Wasm admin 2-of-3 terra1zlmv2xydxcusurtr6rl78wsvytdc6mfex6hep7
Factory UpdateConfig { pair_code_id } Same 2-of-3 (factory governance)

Host helper: scripts/multisig-2of3-host-tx.sh wasm migrate "$PAIR" <code_id> '{}'

Do not use cl8ydeploy for migrate. Bare terrad defaults --node to localhost — use columbus-5 RPC (https://terra-classic-rpc.publicnode.com:443) as in docs/runbooks/rotate-fee-treasury.md.

Script pattern

Use the #514 pair-loop pattern, not #518.

Factory pairs query is paginated (limit 60). Confirm all addresses, including UST1/USTR, before signing.

Last known columbus-5 IDs (re-query before store)

As of 2026-08-15 fee-treasury rotate: pair code 11577, factory code 11578, pair_code_id 11577. Do not assume these are still current — query factory config and each pair contract_info immediately before store.

Factory (soft-launch): terra1ejpgvv7g3hj0u6fpcnxhflqp84g0w3cnaskqkg5733ygwlmf963sfchsea

Frontend coupling (order matters)

On-chain price stays raw token1 units / token0 units. After migrate, a 6/18 pair accepts raw ~7.9e13 and rejects human 79 (human-scale 79 × 10^(6−18) = 7.9e-11 is below 1e-9).

Client After pair migrate, before new dApp After both
New dApp (!1060 scaleHumanLimitPriceForChain) Sends raw; works Works
Old dApp (sends human 79) Place still fails (now under MIN) N/A
Bots already sending raw Start working as soon as the pair is migrated Works

Ship frontend with or immediately after pair migrate. Indexer LCD/book strings stay raw; UI converts with scaleRawLimitPriceForDisplay.

  1. Land !1060 and pair CONTRACT_VERSION 1.13.0.
  2. make build-optimized only (not debug wasm). Record SHA + smartcontracts/artifacts/wasm-checksums.txt.
  3. Preflight: make verify-issue-529 and make verify-issue-467; make test-contracts / pair migration_tests if not already on the MR.
  4. wasm store pair artifact → new code_id.
  5. 2-of-3 wasm migrate every registered pair with '{}'.
  6. 2-of-3 factory UpdateConfig { pair_code_id: <new> } (leave other config fields unset).
  7. Deploy frontend from the same git SHA (Coolify / dex.cl8y.com).
  8. Smoke (below). Paste a deploy-trace comment here and on #391.

Post-migrate smoke

  • Place UST1(6)/USTR(18) limit at ~79 human. Must succeed (was Invalid hybrid parameters).
  • Book / Trade ticket shows ~79, not 7.9e13.
  • Reverse orientation (~0.0127 human) places.
  • Like-decimal pair still rejects Decimal::raw(1) (#467 / L529-3).
  • Existing open limits still cancel/fill (C14; prices were already raw).
  • Optional local: make verify-issue-529 / make verify-issue-467.

Rollback

Prior pair code_id (last known 11577) remains on-chain if store succeeded. Admin must still be the 2-of-3. Migrate back to the previous code ID if the new wasm misbehaves. Pause pairs if needed: docs/runbooks/rollback-decision.md, skills/AGENTS_WASM_MIGRATION_ROLLBACK.md.

Same-version migrate cannot be used as a no-op; rolling back also requires the older CONTRACT_VERSION on that wasm (already true for 1.12.0 code 11577).

Out of scope (do not block this migrate)

  • Indexer price_human field
  • WalletIndexerHistoryPanel fill-price scale
  • limitLadderDepth still comparing unscaled book price (deep ladder on 6/18 can mis-measure)

Acceptance

  • Pair version bumped above 1.12.0 and merged
  • Optimized pair wasm stored; new code ID recorded
  • Every factory-registered pair migrated (UST1/USTR confirmed)
  • Factory pair_code_id points at the new code
  • Frontend from !1060 live
  • Smoke place ~79 human on UST1/USTR; display human; #467 still holds
  • Deploy trace (SHA, checksums, code IDs, tx hashes) on this issue and #391
## Why this issue exists [#529](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/529) is the **code fix** (human-scale `[1e-9, 1e9]` band). Limits on **UST1/USTR** stay impossible on columbus-5 until **every live pair** that should accept mixed-decimal limits is **migrated** to the new pair wasm, factory `pair_code_id` is updated, and the dApp that scales human→raw is shipped. Code MR: [!1060](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/342) (`feat/529-limit-price-decimals-normalized`, SHA `91d90ddb` at open). Playbook: [`skills/AGENTS_LIMIT_PRICE_DECIMALS.md`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/blob/feat/529-limit-price-decimals-normalized/skills/AGENTS_LIMIT_PRICE_DECIMALS.md) (L529-1–L529-5). Runbook: [`docs/runbooks/wasm-admin-migration.md`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/blob/main/docs/runbooks/wasm-admin-migration.md). Trace template: [`docs/templates/deploy-trace.md`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/blob/main/docs/templates/deploy-trace.md) (also comment on [#391](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/391)). ## Blocker before store/migrate Pair `CONTRACT_VERSION` in !1060 is still **`1.12.0`**. Live pairs from #514 / fee-treasury rotate are already **1.12.0**. `cw2::ensure_from_older_version` **rejects same-version migrate**. **Must bump pair to `1.13.0` (or next unused) on the same MR or a tiny follow-up before `wasm store` + `wasm migrate`.** Factory-only store/migrate is not enough and does not need a version bump for this fix (validation lives on pair). ## What changes on-chain (and what does not) | Item | Action | |------|--------| | Pair wasm | **Store + migrate every registered pair** | | Factory | **No factory migrate required.** After store, `UpdateConfig { pair_code_id }` so **new** pairs instantiate the new code | | Fee-discount / router / wrap | Unchanged | | Pair storage | **No schema migrate.** `Migrate {}` is empty. C14: preserve book, fees, escrow, treasuries | | Indexer | **No migrate.** Book `price` stays **raw** (L529-5) | | Frontend | **Must ship with or before pair migrate** for the dApp path (see order below) | New pairs after factory `pair_code_id` update get the new wasm automatically. **Live UST1/USTR must be pair-migrated** or it keeps the raw `[1e-9, 1e9]` reject. ## Permissions | Step | Who | |------|-----| | `make build-optimized` + `wasm store` | `cl8ydeploy` (permissionless store) | | `wasm migrate` each pair | Wasm admin **2-of-3** `terra1zlmv2xydxcusurtr6rl78wsvytdc6mfex6hep7` | | Factory `UpdateConfig { pair_code_id }` | Same 2-of-3 (factory `governance`) | Host helper: `scripts/multisig-2of3-host-tx.sh wasm migrate "$PAIR" <code_id> '{}'` Do **not** use `cl8ydeploy` for migrate. Bare `terrad` defaults `--node` to localhost — use columbus-5 RPC (`https://terra-classic-rpc.publicnode.com:443`) as in [`docs/runbooks/rotate-fee-treasury.md`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/blob/main/docs/runbooks/rotate-fee-treasury.md). ## Script pattern **Use the #514 pair-loop pattern**, not #518. - [`scripts/upgrade-514-limit-discount.sh`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/blob/main/scripts/upgrade-514-limit-discount.sh) — stores pair wasm and `wasm migrate`s **each** factory-registered pair. Copy/adapt (pair-only; skip fee-discount). - [`scripts/upgrade-518-lp-symbol.sh`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/blob/main/scripts/upgrade-518-lp-symbol.sh) — stores factory+pair but **does not migrate existing pairs** (instantiate-only). **Wrong** for #529. Factory `pairs` query is paginated (`limit` 60). Confirm **all** addresses, including UST1/USTR, before signing. ## Last known columbus-5 IDs (re-query before store) As of **2026-08-15** fee-treasury rotate: pair code **11577**, factory code **11578**, `pair_code_id` **11577**. **Do not assume these are still current** — query factory `config` and each pair `contract_info` immediately before store. Factory (soft-launch): `terra1ejpgvv7g3hj0u6fpcnxhflqp84g0w3cnaskqkg5733ygwlmf963sfchsea` ## Frontend coupling (order matters) On-chain `price` stays **raw** token1 units / token0 units. After migrate, a 6/18 pair **accepts** raw `~7.9e13` and **rejects** human `79` (human-scale `79 × 10^(6−18) = 7.9e-11` is below `1e-9`). | Client | After pair migrate, before new dApp | After both | |--------|--------------------------------------|------------| | New dApp (!1060 `scaleHumanLimitPriceForChain`) | Sends raw; works | Works | | Old dApp (sends human `79`) | Place **still fails** (now under MIN) | N/A | | Bots already sending raw | Start working as soon as the pair is migrated | Works | **Ship frontend with or immediately after pair migrate.** Indexer LCD/book strings stay raw; UI converts with `scaleRawLimitPriceForDisplay`. ## Recommended sequence 1. Land !1060 **and** pair `CONTRACT_VERSION` **1.13.0**. 2. `make build-optimized` only (not debug wasm). Record SHA + `smartcontracts/artifacts/wasm-checksums.txt`. 3. Preflight: `make verify-issue-529` and `make verify-issue-467`; `make test-contracts` / pair `migration_tests` if not already on the MR. 4. `wasm store` pair artifact → new `code_id`. 5. 2-of-3 `wasm migrate` **every** registered pair with `'{}'`. 6. 2-of-3 factory `UpdateConfig { pair_code_id: <new> }` (leave other config fields unset). 7. Deploy frontend from the same git SHA (Coolify / `dex.cl8y.com`). 8. Smoke (below). Paste a deploy-trace comment here and on #391. ## Post-migrate smoke - Place UST1(6)/USTR(18) limit at **~79 human**. Must succeed (was `Invalid hybrid parameters`). - Book / Trade ticket shows **~79**, not `7.9e13`. - Reverse orientation (~0.0127 human) places. - Like-decimal pair still rejects `Decimal::raw(1)` (#467 / L529-3). - Existing open limits still cancel/fill (C14; prices were already raw). - Optional local: `make verify-issue-529` / `make verify-issue-467`. ## Rollback Prior pair `code_id` (last known **11577**) remains on-chain if store succeeded. Admin must still be the 2-of-3. Migrate back to the previous code ID if the new wasm misbehaves. Pause pairs if needed: [`docs/runbooks/rollback-decision.md`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/blob/main/docs/runbooks/rollback-decision.md), [`skills/AGENTS_WASM_MIGRATION_ROLLBACK.md`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/blob/main/skills/AGENTS_WASM_MIGRATION_ROLLBACK.md). Same-version migrate cannot be used as a no-op; rolling back also requires the **older** `CONTRACT_VERSION` on that wasm (already true for 1.12.0 code 11577). ## Out of scope (do not block this migrate) - Indexer `price_human` field - `WalletIndexerHistoryPanel` fill-price scale - `limitLadderDepth` still comparing unscaled book `price` (deep ladder on 6/18 can mis-measure) ## Acceptance - [ ] Pair version bumped above 1.12.0 and merged - [ ] Optimized pair wasm stored; new code ID recorded - [ ] Every factory-registered pair migrated (UST1/USTR confirmed) - [ ] Factory `pair_code_id` points at the new code - [ ] Frontend from !1060 live - [ ] Smoke place ~79 human on UST1/USTR; display human; #467 still holds - [ ] Deploy trace (SHA, checksums, code IDs, tx hashes) on this issue and #391
PlasticDigits commented 2026-08-16 08:43:17 +00:00 (Migrated from gitlab.com)

marked as related to #529

marked as related to #529
PlasticDigits commented 2026-08-16 08:43:22 +00:00 (Migrated from gitlab.com)

mentioned in issue #529

mentioned in issue #529
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-08-17 00:46:32 +00:00
PlasticDigits commented 2026-08-17 00:46:33 +00:00 (Migrated from gitlab.com)

deploy confirmed

deploy confirmed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#532
No description provided.