fix(lux): nLUX is 10^9, not 10^6 — every LUX figure was 1000x too large

LUX_DECIMALS was 6 in four separate files, each dividing a value the code
itself names nanoLux. Nano is 10^-9. Every staking and balance figure the Lux
explorer rendered was inflated by 1000.

The validators page reported 2,500,000,000,000 LUX staked — against a total
supply of ~2T. An impossible number, and it is reached from lux.cloud's own
"View on explorer" link: an investor reads 2.5B on the dashboard, clicks
through, and sees 2.5T. lux.cloud was right; this was wrong.

Verified against live chain state (platform.getCurrentValidators):
  500000000000000000  nLUX -> 500,000,000 LUX   per validator
  2500000000000000000 nLUX -> 2,500,000,000 LUX total across 5

Four copies of one constant, so the bug shipped four times:
  ui/validators/lux/utils.ts · ui/chains/ChainDetailPage.tsx
  ui/pages/NetworkOverview.tsx · ui/stats/lux/NetworkStats.tsx
Each still owns its own copy; they should share one, which is the follow-up.

Typecheck shows no new errors in these files (the existing _app.tsx and *.pw.tsx
failures predate this change).
This commit is contained in:
2026-07-26 20:11:27 -07:00
parent 608243e03a
commit 3849ae2407
4 changed files with 15 additions and 4 deletions
+3 -1
View File
@@ -16,7 +16,9 @@ import PageTitle from 'ui/shared/Page/PageTitle';
import PrimaryNetworkGuard from 'ui/shared/PrimaryNetworkGuard';
const PRIMARY_NETWORK_ID = '11111111111111111111111111111111LpoYY';
const LUX_DECIMALS = 6;
// nLUX is NANO-LUX: 10^9 nLUX = 1 LUX. This read 6, inflating every LUX figure
// by 1000 — the validators page showed 2.5T LUX staked against a ~2T supply.
const LUX_DECIMALS = 9;
// Primary-network VM identity (name / vm / vmId / description / view) comes from
// the single source of truth in configs/app/primaryChains.ts.
+3 -1
View File
@@ -16,7 +16,9 @@ import Stats from 'ui/home/Stats';
import Transactions from 'ui/home/Transactions';
const PRIMARY_NETWORK_ID = '11111111111111111111111111111111LpoYY';
const LUX_DECIMALS = 6;
// nLUX is NANO-LUX: 10^9 nLUX = 1 LUX. This read 6, inflating every LUX figure
// by 1000 — the validators page showed 2.5T LUX staked against a ~2T supply.
const LUX_DECIMALS = 9;
const PRIMARY_CHAINS = [
{ id: 'C', name: 'C-Chain', fullName: 'Contract Chain', vm: 'EVM', href: '/' },
+3 -1
View File
@@ -11,7 +11,9 @@ import { useBlockchains, useCurrentValidators } from 'lib/api/pchain';
const PRIMARY_NETWORK_ID = '11111111111111111111111111111111LpoYY';
const PRIMARY_CHAIN_COUNT = 14;
const LUX_DECIMALS = 6;
// nLUX is NANO-LUX: 10^9 nLUX = 1 LUX. This read 6, inflating every LUX figure
// by 1000 — the validators page showed 2.5T LUX staked against a ~2T supply.
const LUX_DECIMALS = 9;
// ── Helpers ──
+6 -1
View File
@@ -1,6 +1,11 @@
// Formatting helpers for Lux P-chain validator data.
const LUX_DECIMALS = 6;
// nLUX is NANO-LUX: 10^9 nLUX = 1 LUX. This was 6, which multiplied every
// staking figure on the page by 1000 — the validators page reported
// 2,500,000,000,000 LUX staked against a ~2T total supply, i.e. an
// arithmetically impossible number, reached from lux.cloud's own
// "View on explorer" link. The parameter below is named nanoLux; trust it.
const LUX_DECIMALS = 9;
const TRUNCATE_PREFIX_LEN = 12;
const TRUNCATE_SUFFIX_LEN = 6;
const UPTIME_FRACTION_DIGITS = 2;