Investigate: LocalTerra CL8Y proxy token (EMBER) has 6 decimals; fee-discount contract expects 18-decimal amounts ; blocks FT-3 and FT-4 local QA coverage #383

Closed
opened 2026-06-15 14:18:00 +00:00 by totdking · 12 comments
totdking commented 2026-06-15 14:18:00 +00:00 (Migrated from gitlab.com)
No description provided.
totdking commented 2026-06-15 14:19:04 +00:00 (Migrated from gitlab.com)

Summary

On LocalTerra, VITE_CL8Y_TOKEN_ADDRESS is pointed at the EMBER test token (terra1wl59k23zngj34l7d42y9yltask7rjlnxgccawc7ltrknp6n52fps4umj85), which has 6 decimals and a total supply of 2,000,000,000,000 raw units (2,000,000 EMBER). The fee-discount contract enforces minimum CL8Y balances using 18-decimal amounts -- Tier 1 requires 1,000,000,000,000,000,000 raw units (1 CL8Y at 18 decimals).

The wallet under test held 700,780,084,946 raw EMBER units (700,780 EMBER at 6 decimals), which exceeds the display threshold but is 10^6 times less than what the contract requires for Tier 1 registration. Registration attempts for all tiers fail with:

failed to execute message; message index: 0: Insufficient CL8Y balance: required 1000000000000000000, got 700780084946: execute wasm contract failed

The EMBER total supply (2 × 10^12) cannot be minted up to the required 18-decimal amount (10^18). The mismatch cannot be worked around without redeploying the CL8Y test token.


What this blocked

  • FT-3: Register flow works and updates status; eligibility tied to CL8Y balance -- cannot be verified
  • FT-4: Deregister flow works and is hidden for governance-assigned tiers -- cannot be verified (depends on FT-3)

Reproduction steps

  1. Deploy LocalTerra with the current setup
  2. Navigate to /tiers with a funded Keplr wallet
  3. Attempt to register for Tier 1
  4. Observe: contract rejects with insufficient balance error despite wallet holding CL8Y proxy tokens

Expected behavior

The LocalTerra CL8Y proxy token should have 18 decimals and sufficient supply to allow tier registration testing across all tiers (minimum supply needed: 7,500 × 10^18 for Tier 9 coverage).


Required developer action

  • Deploy a dedicated CL8Y test token on LocalTerra with 18 decimals
  • Set VITE_CL8Y_TOKEN_ADDRESS in frontend-dapp/.env to the new contract address
  • Mint sufficient supply (at least 10,000 × 10^18 raw units) to the QA test wallet
  • Re-run FT-3 and FT-4 after the fix

Environment

  • Chain: localterra
  • LCD: http://localhost:1317
  • Wallet: Keplr (Terra Classic)
  • Browser: Chrome
  • Page: /tiers
  • CL8Y proxy contract: terra1wl59k23zngj34l7d42y9yltask7rjlnxgccawc7ltrknp6n52fps4umj85 (EMBER, 6 decimals, total supply 2,000,000,000,000)
  • Fee-discount contract: terra1tctn9s9hjrfy9ng5h5pdkxefehwaes7h244rvr2kz4qflptfs6psyyxcpg

Severity: Low -- production CL8Y token is expected to have 18 decimals; this is a local environment misconfiguration only.

Affected checklist items: FT-3, FT-4

cc: @PlasticDigits

### Summary On LocalTerra, `VITE_CL8Y_TOKEN_ADDRESS` is pointed at the EMBER test token (`terra1wl59k23zngj34l7d42y9yltask7rjlnxgccawc7ltrknp6n52fps4umj85`), which has 6 decimals and a total supply of `2,000,000,000,000` raw units (2,000,000 EMBER). The fee-discount contract enforces minimum CL8Y balances using 18-decimal amounts -- Tier 1 requires `1,000,000,000,000,000,000` raw units (1 CL8Y at 18 decimals). The wallet under test held `700,780,084,946` raw EMBER units (700,780 EMBER at 6 decimals), which exceeds the display threshold but is 10^6 times less than what the contract requires for Tier 1 registration. Registration attempts for all tiers fail with: > failed to execute message; message index: 0: Insufficient CL8Y balance: required 1000000000000000000, got 700780084946: execute wasm contract failed The EMBER total supply (2 × 10^12) cannot be minted up to the required 18-decimal amount (10^18). The mismatch cannot be worked around without redeploying the CL8Y test token. --- ### What this blocked - **FT-3:** Register flow works and updates status; eligibility tied to CL8Y balance -- cannot be verified - **FT-4:** Deregister flow works and is hidden for governance-assigned tiers -- cannot be verified (depends on FT-3) --- ### Reproduction steps 1. Deploy LocalTerra with the current setup 2. Navigate to `/tiers` with a funded Keplr wallet 3. Attempt to register for Tier 1 4. Observe: contract rejects with insufficient balance error despite wallet holding CL8Y proxy tokens --- ### Expected behavior The LocalTerra CL8Y proxy token should have 18 decimals and sufficient supply to allow tier registration testing across all tiers (minimum supply needed: 7,500 × 10^18 for Tier 9 coverage). --- ### Required developer action - Deploy a dedicated CL8Y test token on LocalTerra with 18 decimals - Set `VITE_CL8Y_TOKEN_ADDRESS` in `frontend-dapp/.env` to the new contract address - Mint sufficient supply (at least 10,000 × 10^18 raw units) to the QA test wallet - Re-run FT-3 and FT-4 after the fix --- ### Environment - Chain: localterra - LCD: [http://localhost:1317](http://localhost:1317) - Wallet: Keplr (Terra Classic) - Browser: Chrome - Page: `/tiers` - CL8Y proxy contract: `terra1wl59k23zngj34l7d42y9yltask7rjlnxgccawc7ltrknp6n52fps4umj85` (EMBER, 6 decimals, total supply 2,000,000,000,000) - Fee-discount contract: `terra1tctn9s9hjrfy9ng5h5pdkxefehwaes7h244rvr2kz4qflptfs6psyyxcpg` --- **Severity:** Low -- production CL8Y token is expected to have 18 decimals; this is a local environment misconfiguration only. **Affected checklist items:** FT-3, FT-4 cc: @PlasticDigits
PlasticDigits commented 2026-06-15 14:20:57 +00:00 (Migrated from gitlab.com)

Correct, we should add a seperate TCL8Y to replace EMBER for this purpose.

Correct, we should add a seperate TCL8Y to replace EMBER for this purpose.
PlasticDigits commented 2026-06-15 14:45:05 +00:00 (Migrated from gitlab.com)

mentioned in merge request !912

mentioned in merge request !912
PlasticDigits commented 2026-06-15 14:51:59 +00:00 (Migrated from gitlab.com)

mentioned in commit aaa610e7ef

mentioned in commit aaa610e7ef96773d0fffd956de6a260107abdfbb
totdking commented 2026-06-15 15:01:09 +00:00 (Migrated from gitlab.com)

mentioned in issue #291

mentioned in issue #291
PlasticDigits commented 2026-06-15 15:12:01 +00:00 (Migrated from gitlab.com)

Verification complete — GitLab #383

Verified on main @ aaa610e7 (merge of fix/issue-383-tcl8y-localnet) after fresh LocalTerra deploy (./scripts/setup-cloud-agent-localterra.sh --fresh --skip-build).

Results

Check Result How
TCL8Y deployed with 18 decimals, symbol TCL8Y, supply ≥ tier-9 minimum (7.5×10²¹) PASS make verify-issue-383 — token_info: decimals=18, symbol=TCL8Y, total_supply=10000000000000000000000000
VITE_CL8Y_TOKEN_ADDRESS ≠ 6-decimal EMBER PASS make verify-issue-383 — env TCL8Y terra19jq6… vs EMBER terra1wl59…
Fee-discount cl8y_token matches VITE_CL8Y_TOKEN_ADDRESS PASS make verify-issue-383 — on-chain config matches env
FT-3 tier-1 self-registration PASS make verify-issue-383 — register tx succeeded, registered=true tier_id=1
FT-4 deregister self-registered tier PASS make verify-issue-383 — deregister tx succeeded, registered=false
Fee-discount tier doc drift guard (I7/I11) PASS make check-fee-discount-tier-docs — 11 tiers aligned
/tiers UI register (Simulated Wallet) PASS Playwright e2e/fee-tier-tx.spec.ts — tier register completes (Deregister/Active visible)

Acceptance criteria from issue

  • Dedicated 18-decimal CL8Y test token (TCL8Y) on LocalTerra — PASS (scripts/deploy-dex-local.sh Phase 2d)
  • VITE_CL8Y_TOKEN_ADDRESS points at TCL8Y — PASS (frontend-dapp/.env.local)
  • Sufficient supply for tier testing — PASS (10²⁵ initial supply to test1; dev wallet mint path in e2e-provision-dev-wallet.sh)
  • FT-3 / FT-4 local QA unblocked — PASS

No repo changes required; fix already on main. Closing as verified.

## Verification complete — GitLab #383 Verified on `main` @ `aaa610e7` (merge of `fix/issue-383-tcl8y-localnet`) after fresh LocalTerra deploy (`./scripts/setup-cloud-agent-localterra.sh --fresh --skip-build`). ### Results | Check | Result | How | |-------|--------|-----| | TCL8Y deployed with **18 decimals**, symbol `TCL8Y`, supply ≥ tier-9 minimum (7.5×10²¹) | **PASS** | `make verify-issue-383` — `token_info`: `decimals=18`, `symbol=TCL8Y`, `total_supply=10000000000000000000000000` | | `VITE_CL8Y_TOKEN_ADDRESS` ≠ 6-decimal EMBER | **PASS** | `make verify-issue-383` — env TCL8Y `terra19jq6…` vs EMBER `terra1wl59…` | | Fee-discount `cl8y_token` matches `VITE_CL8Y_TOKEN_ADDRESS` | **PASS** | `make verify-issue-383` — on-chain config matches env | | **FT-3** tier-1 self-registration | **PASS** | `make verify-issue-383` — register tx succeeded, `registered=true tier_id=1` | | **FT-4** deregister self-registered tier | **PASS** | `make verify-issue-383` — deregister tx succeeded, `registered=false` | | Fee-discount tier doc drift guard (I7/I11) | **PASS** | `make check-fee-discount-tier-docs` — 11 tiers aligned | | `/tiers` UI register (Simulated Wallet) | **PASS** | Playwright `e2e/fee-tier-tx.spec.ts` — tier register completes (Deregister/Active visible) | ### Acceptance criteria from issue - Dedicated 18-decimal CL8Y test token (**TCL8Y**) on LocalTerra — **PASS** (`scripts/deploy-dex-local.sh` Phase 2d) - `VITE_CL8Y_TOKEN_ADDRESS` points at TCL8Y — **PASS** (`frontend-dapp/.env.local`) - Sufficient supply for tier testing — **PASS** (10²⁵ initial supply to test1; dev wallet mint path in `e2e-provision-dev-wallet.sh`) - FT-3 / FT-4 local QA unblocked — **PASS** No repo changes required; fix already on `main`. Closing as verified.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-06-15 15:12:03 +00:00
totdking commented 2026-06-16 13:21:08 +00:00 (Migrated from gitlab.com)

Verification:

make verify-issue-383 passes 6/6 on the CLI. TCL8Y is deployed at terra19jq6mj84cnt9p7sagjxqf8hxtczwc8wlpuwe4sh62w45aheseues8d5g8g (18 decimals, supply 10^25). On-chain registration and deregistration succeed via CLI.

However, the /tiers UI register button fails with:

Transaction needed more gas than estimated. Try again -- gas usage can vary slightly between blocks.

Root cause(code verified):

getGasLimitForTx() in frontend-dapp/src/services/terraclassic/terraGas.ts has no case for register or deregister execute messages. Both fall through to BASE_GAS_LIMIT = 200_000. The CLI auto-estimate returns ~265,770 (1.3x adjusted), meaning the actual gas consumed is ~204,438 -- just above the 200,000 fallback. The deregister message (~160,932 gas) may succeed intermittently but has no dedicated constant.

Required additional fix: Add register and deregister cases to getGasLimitForTx() with a gas constant of at least 250,000 (suggest 300,000 with buffer). Until this is resolved, FT-3/ FT-4 browser verification remains blocked even with TCL8Y correctly deployed.

cc: @PlasticDigits

### Verification: `make verify-issue-383` passes 6/6 on the CLI. TCL8Y is deployed at `terra19jq6mj84cnt9p7sagjxqf8hxtczwc8wlpuwe4sh62w45aheseues8d5g8g` (18 decimals, supply 10^25). On-chain registration and deregistration succeed via CLI. However, the `/tiers` UI register button fails with: > Transaction needed more gas than estimated. Try again -- gas usage can vary slightly between blocks. ### Root cause(code verified): `getGasLimitForTx()` in `frontend-dapp/src/services/terraclassic/terraGas.ts` has no case for `register` or `deregister` execute messages. Both fall through to `BASE_GAS_LIMIT = 200_000`. The CLI auto-estimate returns \~265,770 (1.3x adjusted), meaning the actual gas consumed is \~204,438 -- just above the 200,000 fallback. The deregister message (\~160,932 gas) may succeed intermittently but has no dedicated constant. **Required additional fix:** Add `register` and `deregister` cases to `getGasLimitForTx()` with a gas constant of at least 250,000 (suggest 300,000 with buffer). Until this is resolved, FT-3/ FT-4 browser verification remains blocked even with TCL8Y correctly deployed. cc: @PlasticDigits
totdking commented 2026-06-16 14:17:09 +00:00 (Migrated from gitlab.com)

mentioned in issue #384

mentioned in issue #384
Brouie commented 2026-06-28 23:24:44 +00:00 (Migrated from gitlab.com)

mentioned in issue #337

mentioned in issue #337
PlasticDigits commented 2026-07-12 07:14:20 +00:00 (Migrated from gitlab.com)

mentioned in issue #476

mentioned in issue #476
PlasticDigits commented 2026-08-27 01:00:19 +00:00 (Migrated from gitlab.com)

mentioned in issue #682

mentioned in issue #682
PlasticDigits commented 2026-08-27 01:00:29 +00:00 (Migrated from gitlab.com)

mentioned in issue #683

mentioned in issue #683
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#383
No description provided.