{"id":"XE-13368","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"511","source_url":"https://github.com/xeprotocol/xe/issues/511","reporter_id":1981,"title":"Laporan bug","area":"sdk-docs-web","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T20:42:12.243757+00:00","updated_at":"2026-11-20T00:38:14.484038+00:00","source_created_at":"2026-11-12T16:22:03+00:00","told_at":"2026-11-20T00:34:47+00:00","status_changed_at":"2026-11-20T00:33:18.510946+00:00","url":"https://bounty.xe.network/XE-13368","body":"# XE Bounty — Laporan siap file (temuan pass 5 #4)\n\nFile issue baru di: https://github.com/xeprotocol/xe/issues/new\nPaste judul + isi di bawah. Akun GitHub: Gib230223.\n\n---\n\n## Judul\n\n[Low] `xe lease renew` prints the renewal cost 1,000,000× too large (raw micro-XUSD labelled \"XUSD\")\n\n## Isi\n\n## Summary\n\n`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`.\n\n## Evidence\n\n```go\n// cmd/xe/main.go:1145 — the ONLY raw-%v money print in the CLI:\nfmt.Printf(\"Renewed lease %s: +%ss (renew block %v, cost %v XUSD)\\n\",\n    shortAddr(hash), secsStr, out[\"renew_hash\"], out[\"cost\"])\n// out[\"cost\"] is api/vm.go handleLeaseRenew's \"cost\": b.Amount,\n// b.Amount is core.LeaseCost(...) (node/lease_renew.go:28,63) — MICRO-XUSD.\n```\n\n```go\n// api/vm.go:180 — the API returns the raw micro amount:\n\"cost\":       b.Amount,\n\n// node/lease_renew.go:28,63 — the amount comes from LeaseCost (micro-XUSD):\ncost, err := core.LeaseCost(lease.VCPUs, lease.MemoryMB, lease.DiskGB, additionalSecs, cert.PriceMultiplierMilli)\nAmount:          cost,\n```\n\nEvery sibling print uses `core.FormatAmount` (`cmdLease` :1045, `cmdMint` :861/:863, `cmdSend` :730, `cmdProviders` :954). `FormatAmount(40000, AssetXUSD)` returns `\"0.04\"`.\n\n## Impact (Low, display-only)\n\nThe 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).\n\n## Reproduction (PoC)\n\nUnit 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.\n\nCoordinator re-run (2026-11-12 ~23:10 WIB), 5/5 PASS:\n\n```\nCLI prints:    \"cost 40000 XUSD\"\nCorrect value: \"cost 0.04 XUSD\"\nBUG REPRODUCED: `xe lease renew` prints the micro-XUSD cost 40000 as \"cost 40000 XUSD\" — 1,000,000x the real \"cost 0.04 XUSD\"\n```\n\n## Suggested fix\n\nFormat the cost with `core.FormatAmount` at the print site, matching every sibling print:\n\n```go\nfmt.Printf(\"Renewed lease %s: +%ss (renew block %v, cost %s XUSD)\\n\",\n    shortAddr(hash), secsStr, out[\"renew_hash\"], core.FormatAmount(uint64(out[\"cost\"].(float64)), core.AssetXUSD))\n```\n\n(or carry the cost as a typed value instead of through `map[string]any` so the formatting is type-safe).\n\n## Novelty note\n\nNo 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.\n\nRepo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.\n","patch_refs":[{"id":561,"repo":"xeprotocol/xe","kind":"pr","ref":"515","title":"fix(cmd/xe): format lease renewal cost with FormatAmount in XUSD (fixes #511)","url":"https://github.com/xeprotocol/xe/pull/515","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-11-14T20:42:20.139314+00:00"}],"thread":[{"id":13213,"source":"github","source_ref":"7026485510","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-13368 and says what differs; it is read like any other.","created_at":"2026-11-20T00:34:47+00:00"}]}