<!-- XE-13368 · Laporan bug · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13368>. The page is the record; this is the same page for reading.*

XE-13368 · Bounty

# Laporan bug

Closed · duplicate
—
[xe#511](https://github.com/xeprotocol/xe/issues/511)
filed 2026-11-12 16:22 UTC
by Gib230223

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   SDK / docs / web

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:38 UTC

Told
:   2026-11-20 00:34 UTC

### Patches

- [xe#515](https://github.com/xeprotocol/xe/pull/515) open by arturbarszcz78
  fix(cmd/xe): format lease renewal cost with FormatAmount in XUSD (fixes #511)

### History

- [554009](https://bounty.xe.network/log/554009) 2026-11-20 00:34 UTC reply.mirrored
- [553995](https://bounty.xe.network/log/553995) 2026-11-20 00:34 UTC github.state\_pushed
- [553994](https://bounty.xe.network/log/553994) 2026-11-20 00:34 UTC github.labels
- [552434](https://bounty.xe.network/log/552434) 2026-11-20 00:33 UTC proposal.adopted
- [552433](https://bounty.xe.network/log/552433) 2026-11-20 00:33 UTC reply.sent
- [552432](https://bounty.xe.network/log/552432) 2026-11-20 00:33 UTC ticket.status new → closed
- [551819](https://bounty.xe.network/log/551819) 2026-11-20 00:33 UTC proposal.adopted
- [551818](https://bounty.xe.network/log/551818) 2026-11-20 00:33 UTC ticket.facts area
- [551817](https://bounty.xe.network/log/551817) 2026-11-20 00:33 UTC proposal.adopted
- [551816](https://bounty.xe.network/log/551816) 2026-11-20 00:33 UTC ticket.facts
- [551815](https://bounty.xe.network/log/551815) 2026-11-20 00:33 UTC proposal.adopted
- [551814](https://bounty.xe.network/log/551814) 2026-11-20 00:33 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-13368) · [JSON](https://bounty.xe.network/v1/tickets/XE-13368) · [markdown](https://bounty.xe.network/XE-13368.md)

### 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

**Joseph Denne**team2026-11-20 00:34 UTCgithub

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.
