Bounty
XE-13348 · Bounty

Bug report

Closed · duplicate — xe#493 filed 2026-11-12 03:08 UTC by Gib230223

Report

XE Bounty — Laporan siap file (temuan pass 3 #1)

File issue baru di: https://github.com/xeprotocol/xe/issues/new Paste judul + isi di bawah. Akun GitHub: Gib230223.


Judul

[Bug] LeaseAcceptPolicy cost thresholds off by 1,000,000× — whole-XUSD flags compared against micro-XUSD amounts

Isi

Summary

The 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.

Evidence

  • cmd/xe/main.go:1309-1310 — flags documented as whole XUSD, passed through raw:
    provMinCost := flags.Uint64("min-lease-cost", 0, "Reject leases below this cost in whole XUSD. 0 = no min.")
    provMaxCost := flags.Uint64("max-lease-cost", 0, "Reject leases above this cost in whole XUSD. 0 = no max.")
    
  • cmd/xe/main.go:1357-1358 — no conversion:
    policy := node.LeaseAcceptPolicy{
        MinCostXUSD: *provMinCost,
        MaxCostXUSD: *provMaxCost,
        ...
    }
    
  • node/policy.go:40-45 (Allow) — compares the raw value against b.Amount and prints micro-units as "XUSD":
    if p.MinCostXUSD > 0 && b.Amount < p.MinCostXUSD {
        return fmt.Errorf("cost %d XUSD < policy min %d XUSD", b.Amount, p.MinCostXUSD)
    }
    if p.MaxCostXUSD > 0 && b.Amount > p.MaxCostXUSD {
        return fmt.Errorf("cost %d XUSD > policy max %d XUSD", b.Amount, p.MaxCostXUSD)
    }
    
  • 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.

Impact

  • --min-lease-cost 5 (intended 5 XUSD floor) enforces a 5 µXUSD floor — accepts essentially every lease.
  • --max-lease-cost 100 (intended 100 XUSD cap) enforces a 100 µXUSD cap — rejects every lease, bricking auto-accept for that provider.
  • 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".

Reproduction (PoC)

Test 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:

BUG: min-cost 5 (whole XUSD) ACCEPTED a 0.000517 XUSD lease (Amount=517 uXUSD)
BUG: max-cost 100 (whole XUSD) REJECTED a 0.000517 XUSD lease: cost 517 XUSD > policy max 100 XUSD

Suggested fix

Multiply 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).

Novelty note

This 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).

Repo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.

Thread

Joseph Denneteam2026-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-13348 and says what differs; it is read like any other.