Report
XE Bounty — Laporan siap file (temuan pass 5 #4)
File issue baru di: https://github.com/xeprotocol/xe/issues/new Paste judul + isi di bawah. Akun GitHub: Gib230223.
Judul
[Low] xe lease renew prints the renewal cost 1,000,000× too large (raw micro-XUSD labelled "XUSD")
Isi
Summary
xe lease renew prints the renewal cost with a raw %v XUSD format, but the value it prints is in micro-XUSD (1 XUSD = 1,000,000 µXUSD). A 40,000 µXUSD renewal prints as cost 40000 XUSD instead of cost 0.04 XUSD. It is the only raw-%v money print in the CLI — every sibling print formats the same kind of value with core.FormatAmount.
Evidence
// cmd/xe/main.go:1145 — the ONLY raw-%v money print in the CLI:
fmt.Printf("Renewed lease %s: +%ss (renew block %v, cost %v XUSD)\n",
shortAddr(hash), secsStr, out["renew_hash"], out["cost"])
// out["cost"] is api/vm.go handleLeaseRenew's "cost": b.Amount,
// b.Amount is core.LeaseCost(...) (node/lease_renew.go:28,63) — MICRO-XUSD.
// api/vm.go:180 — the API returns the raw micro amount:
"cost": b.Amount,
// node/lease_renew.go:28,63 — the amount comes from LeaseCost (micro-XUSD):
cost, err := core.LeaseCost(lease.VCPUs, lease.MemoryMB, lease.DiskGB, additionalSecs, cert.PriceMultiplierMilli)
Amount: cost,
Every sibling print uses core.FormatAmount (cmdLease :1045, cmdMint :861/:863, cmdSend :730, cmdProviders :954). FormatAmount(40000, AssetXUSD) returns "0.04".
Impact (Low, display-only)
The operator is told they just paid 40,000 XUSD for a renewal that cost 0.04 XUSD — display-only, no funds move on the wrong number, but on a money operation, and the exact same 10⁶ units confusion as the policy bug (pass-3 #1 / #493 / #373), at a different site. Impact is operator confusion / false alarm (and a possible wrong manual decision based on a 1e6× cost).
Reproduction (PoC)
Unit test, cmd/xe/poc5_renewcost_test.go, TestPoc5RenewCostUnits, go test ./cmd/xe/ -run TestPoc5RenewCostUnits -v -count=5. It pins both ends: LeaseCost(1, 1024, 10, 3600, 1000) == 40000 (micro) and FormatAmount(40000, AssetXUSD) == "0.04", against the exact %v XUSD expression at main.go:1145.
Coordinator re-run (2026-11-12 ~23:10 WIB), 5/5 PASS:
CLI prints: "cost 40000 XUSD"
Correct value: "cost 0.04 XUSD"
BUG REPRODUCED: `xe lease renew` prints the micro-XUSD cost 40000 as "cost 40000 XUSD" — 1,000,000x the real "cost 0.04 XUSD"
Suggested fix
Format the cost with core.FormatAmount at the print site, matching every sibling print:
fmt.Printf("Renewed lease %s: +%ss (renew block %v, cost %s XUSD)\n",
shortAddr(hash), secsStr, out["renew_hash"], core.FormatAmount(uint64(out["cost"].(float64)), core.AssetXUSD))
(or carry the cost as a typed value instead of through map[string]any so the formatting is type-safe).
Novelty note
No ticket covers a CLI renew-cost display. Closest, all verified: GitHub #373 / #493 (policy cost units — --min/max-lease-cost thresholds compared against micro amounts, i.e. enforcement; this is a fmt.Printf display in cmdLeaseRenew — same units family, different site, mechanism, and fix); GitHub #360 ("Lease Cost Rounding Discrepancy" — rounding in cost computation, not display); XE-4023 (SupplyAuditor omits renew costs — accounting, not display). GitHub live search_issues for the print returns 0 hits. Checked the live bounty board (High+Medium and Minor views) and the GitHub repo issues, 2026-11-12.
Repo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.
Thread
Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-13368 and says what differs; it is read like any other.