{"id":"XE-13348","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"493","source_url":"https://github.com/xeprotocol/xe/issues/493","reporter_id":1981,"title":"Bug report","area":"node-api","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:10.248267+00:00","updated_at":"2026-11-20T00:38:16.545494+00:00","source_created_at":"2026-11-12T03:08:14+00:00","told_at":"2026-11-20T00:34:58+00:00","status_changed_at":"2026-11-20T00:33:22.249535+00:00","url":"https://bounty.xe.network/XE-13348","body":"# XE Bounty — Laporan siap file (temuan pass 3 #1)\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[Bug] LeaseAcceptPolicy cost thresholds off by 1,000,000× — whole-XUSD flags compared against micro-XUSD amounts\n\n## Isi\n\n## Summary\n\nThe provider `--min-lease-cost` / `--max-lease-cost` flags are documented as \"whole XUSD\", but the values are compared directly against `Block.Amount`, which is in micro-XUSD (1 XUSD = 1,000,000 µXUSD). The thresholds are therefore off by a factor of 1,000,000: a min floor accepts almost everything, and a max cap rejects every lease.\n\n## Evidence\n\n- `cmd/xe/main.go:1309-1310` — flags documented as whole XUSD, passed through raw:\n  ```go\n  provMinCost := flags.Uint64(\"min-lease-cost\", 0, \"Reject leases below this cost in whole XUSD. 0 = no min.\")\n  provMaxCost := flags.Uint64(\"max-lease-cost\", 0, \"Reject leases above this cost in whole XUSD. 0 = no max.\")\n  ```\n- `cmd/xe/main.go:1357-1358` — no conversion:\n  ```go\n  policy := node.LeaseAcceptPolicy{\n      MinCostXUSD: *provMinCost,\n      MaxCostXUSD: *provMaxCost,\n      ...\n  }\n  ```\n- `node/policy.go:40-45` (`Allow`) — compares the raw value against `b.Amount` and prints micro-units as \"XUSD\":\n  ```go\n  if p.MinCostXUSD > 0 && b.Amount < p.MinCostXUSD {\n      return fmt.Errorf(\"cost %d XUSD < policy min %d XUSD\", b.Amount, p.MinCostXUSD)\n  }\n  if p.MaxCostXUSD > 0 && b.Amount > p.MaxCostXUSD {\n      return fmt.Errorf(\"cost %d XUSD > policy max %d XUSD\", b.Amount, p.MaxCostXUSD)\n  }\n  ```\n- `core/amount.go:18`: `AssetXUSD = AssetConfig{Symbol: \"XUSD\", Decimals: 6, UnitsPerToken: 1_000_000}` — `b.Amount` is micro-XUSD. `core/ledger.go:55` `LeaseCost` returns micro-XUSD. No ×10⁶ conversion exists anywhere on the flag → policy → `Allow` path.\n\n## Impact\n\n- `--min-lease-cost 5` (intended 5 XUSD floor) enforces a 5 µXUSD floor — accepts essentially every lease.\n- `--max-lease-cost 100` (intended 100 XUSD cap) enforces a 100 µXUSD cap — rejects every lease, bricking auto-accept for that provider.\n- The duration thresholds in the same policy are correct (seconds vs seconds), which is why the cost bug is easy to miss. The error message also mislabels micro-units as \"XUSD\".\n\n## Reproduction (PoC)\n\nTest against `node.LeaseAcceptPolicy.Allow` with a minimal lease (1 vCPU / 1024 MB / 1 GB / 60 s, multiplier 1000). Minimal lease cost = 517 µXUSD = 0.000517 XUSD:\n```\nBUG: min-cost 5 (whole XUSD) ACCEPTED a 0.000517 XUSD lease (Amount=517 uXUSD)\nBUG: max-cost 100 (whole XUSD) REJECTED a 0.000517 XUSD lease: cost 517 XUSD > policy max 100 XUSD\n```\n\n## Suggested fix\n\nMultiply the flag values by 1,000,000 (or `core.AssetXUSD.UnitsPerToken`) at the flag boundary in `cmd/xe/main.go`, or convert inside `LeaseAcceptPolicy.Allow`. Also fix the error message to print the amount in whole XUSD (or label it µXUSD).\n\n## Novelty note\n\nThis is the cost *units*, not the policy *scope*: XE-0104 covers `LeaseAcceptPolicy` only being consulted for `lease_open` (a unilateral `lease_renew` bypasses it). No bounty-board ticket covers the units mismatch (checked the live board, High+Medium and Minor views, 2026-11-12).\n\nRepo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.\n","patch_refs":[{"id":564,"repo":"xeprotocol/xe","kind":"pr","ref":"518","title":"fix(node): compare LeaseAcceptPolicy cost thresholds against micro-XUSD amounts (fixes #493)","url":"https://github.com/xeprotocol/xe/pull/518","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-11-14T20:42:20.175095+00:00"}],"thread":[{"id":13282,"source":"github","source_ref":"7026489587","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-13348 and says what differs; it is read like any other.","created_at":"2026-11-20T00:34:58+00:00"}]}