<!-- XE-13244 · node/policy: - -min-lease-cost / - -max-lease-cost are documented in whole XUSD but compared against micro-XUSD amounts; the floor never fires and any realistic cap rejects every lease (Medium) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13244>. The page is the record; this is the same page for reading.*

XE-13244 · Bounty

# node/policy: --min-lease-cost / --max-lease-cost are documented in whole XUSD but compared against micro-XUSD amounts; the floor never fires and any realistic cap rejects every lease (Medium)

Closed · duplicate
—claimed Medium
[xe#373](https://github.com/xeprotocol/xe/issues/373)
filed 2026-11-11 11:39 UTC
by greenblood33333

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Medium

Area
:   Node / API

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:06 UTC

Told
:   2026-11-20 00:05 UTC

### Patches

None linked.

### History

- [543790](https://bounty.xe.network/log/543790) 2026-11-20 00:05 UTC github.state\_pushed
- [543789](https://bounty.xe.network/log/543789) 2026-11-20 00:05 UTC github.labels
- [543774](https://bounty.xe.network/log/543774) 2026-11-20 00:05 UTC reply.mirrored
- [543660](https://bounty.xe.network/log/543660) 2026-11-20 00:04 UTC proposal.adopted
- [543659](https://bounty.xe.network/log/543659) 2026-11-20 00:04 UTC reply.sent
- [543658](https://bounty.xe.network/log/543658) 2026-11-20 00:04 UTC ticket.status new → closed
- [542359](https://bounty.xe.network/log/542359) 2026-11-20 00:04 UTC proposal.adopted
- [542358](https://bounty.xe.network/log/542358) 2026-11-20 00:04 UTC ticket.facts area
- [542357](https://bounty.xe.network/log/542357) 2026-11-20 00:04 UTC proposal.adopted
- [542356](https://bounty.xe.network/log/542356) 2026-11-20 00:04 UTC ticket.facts
- [542355](https://bounty.xe.network/log/542355) 2026-11-20 00:04 UTC proposal.adopted
- [542354](https://bounty.xe.network/log/542354) 2026-11-20 00:04 UTC ticket.facts

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

### Report

Payout address: ead8ad792b4452de17e897155ed6efe9f928d0c8b07bdf6a9cbf4f4d67941dd2

**Suggested severity:** Medium (validation gap with real effect on provider economics: the documented cost policy is silently off by 10^6; one direction never fires, the other rejects every real lease). Minor if you treat it as a CLI/docs defect only.
**Area:** `node/policy.go` (`LeaseAcceptPolicy.Allow`), `cmd/xe/main.go` (`--min-lease-cost`, `--max-lease-cost`)
**Version:** master @ `9787859`; the code is unchanged at HEAD as far as I can see in `node/policy.go`
**Network:** testnet-0005 (unit-test reproduction, no network interaction)

## Summary

The provider accept policy takes its cost bounds in **whole XUSD**:

- `cmd/xe/main.go:1309-1310`: `--min-lease-cost` / `--max-lease-cost` — "Reject leases below/above this cost in **whole XUSD**. 0 \= no min/max."
- docs (`/docs/compute` → Provider Policy): "`--min-lease-cost` — minimum cost in **whole XUSD** (uint64)".

But `LeaseAcceptPolicy.Allow` compares them directly against `b.Amount`, which (like every amount on the wire) is in **micro-XUSD** (1 XUSD \= 1,000,000 µXUSD):

```
// node/policy.go
if p.MinCostXUSD > 0 && b.Amount < p.MinCostXUSD { ... }   // whole XUSD vs µXUSD
if p.MaxCostXUSD > 0 && b.Amount > p.MaxCostXUSD { ... }
```

No conversion happens anywhere between the flag and the comparison (`cmd/xe/main.go:1357-1358` copies the flag values straight into `MinCostXUSD` / `MaxCostXUSD`). The error message then prints the micro value with an "XUSD" label (`cost 31000 XUSD > policy max 100 XUSD`), which hides the mismatch from the operator.

## Effect

Take a realistic lease, 1 vCPU / 1 GB / 1 GB for one hour at 1.0×: cost \= 31,000 µXUSD \= 0.031 XUSD.

| Operator sets | Intent | What happens |
| --- | --- | --- |
| `--min-lease-cost 1` | reject leases under 1 XUSD | **Accepted.** 31,000 \> 1\. The floor can only ever trigger on a lease priced below 1 µXUSD, which `core.LeaseCost` cannot produce (floor is 1 µXUSD; the cheapest legal lease is 9 µXUSD). The flag is dead. |
| `--max-lease-cost 100` | accept leases up to 100 XUSD | **Rejected** as "cost 31000 XUSD \> policy max 100 XUSD". Any cap below 1,000,000 rejects every lease that costs ≥ 1 XUSD-millionth… i.e. in practice everything. |

A provider who sets a sane-looking `--max-lease-cost` simply stops accepting leases, and the log tells them the lease cost thirty-one thousand XUSD. A provider who sets `--min-lease-cost` to filter dust gets no filtering at all.

## Reproduce (unit test, `node` package)

```
=== RUN   TestPoC_PolicyCostUnits
    poc_policy_units_test.go:17: --min-lease-cost 1 should reject a 0.031 XUSD lease, but it was ACCEPTED (compared 31000 µXUSD against 1)
    poc_policy_units_test.go:23: --max-lease-cost 100 should accept a 0.031 XUSD lease, but it was REJECTED: cost 31000 XUSD > policy max 100 XUSD
--- FAIL: TestPoC_PolicyCostUnits (0.00s)
```

```
package node

import (
	"testing"
	"github.com/xeprotocol/xe/core"
)

func TestPoC_PolicyCostUnits(t *testing.T) {
	lease := &core.Block{Type: core.BlockLease, Amount: 31_000, Duration: 3600} // 0.031 XUSD

	if err := (LeaseAcceptPolicy{MinCostXUSD: 1}).Allow(lease, 0); err == nil {
		t.Errorf("--min-lease-cost 1 should reject a 0.031 XUSD lease, but it was ACCEPTED")
	}
	if err := (LeaseAcceptPolicy{MaxCostXUSD: 100}).Allow(lease, 0); err != nil {
		t.Errorf("--max-lease-cost 100 should accept a 0.031 XUSD lease, but it was REJECTED: %v", err)
	}
}
```

Run: `GOTOOLCHAIN=go1.25.0 go test ./node/ -run TestPoC_PolicyCostUnits -v`

## Suggested fix

Pick one unit and make it consistent end to end:

1. Convert at the boundary: in `cmd/xe/main.go` multiply the flags by `1_000_000` (`core` already has the per-asset decimals; a `core.ToMicro`-style helper would avoid magic numbers), **or** rename the fields/flags to `MinCostMicroXUSD` and document them as micro-units.
2. Fix the error strings in `Allow` to print the same unit they compare (`%d µXUSD`, or format via `core.FormatAmount`).
3. Add a test like the one above to the `node` package so the units cannot drift again.
4. The same check should also run on `lease_renew` (see #162), with the same units.

Related: #162 (policy not applied to renewals) is a different bug in the same code; this one is about the units of the comparison itself.

### Thread

**Joseph Denne**team2026-11-20 00:05 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-13244 and says what differs; it is read like any other.
