<!-- XE-16872 · [Medium] Lima resource floors not counted in provider capacity accounting; minimal leases bypass CPU/memory caps · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16872>. The page is the record; this is the same page for reading.*

XE-16872 · Bounty

# \[Medium\] Lima resource floors not counted in provider capacity accounting; minimal leases bypass CPU/memory caps

Closed · duplicate
—claimed Medium
[xe#679](https://github.com/xeprotocol/xe/issues/679)
filed 2026-11-17 06:53 UTC
by kecedanzz77-bit

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Medium

Area
:   Leasing / ledger

Duplicate of
:   [XE-0119](https://bounty.xe.network/XE-0119) triaging

Tracked
:   —

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770264](https://bounty.xe.network/log/770264) 2026-11-22 23:26 UTC reply.mirror\_failed
- [769895](https://bounty.xe.network/log/769895) 2026-11-22 23:26 UTC proposal.adopted
- [769894](https://bounty.xe.network/log/769894) 2026-11-22 23:26 UTC reply.sent
- [769893](https://bounty.xe.network/log/769893) 2026-11-22 23:26 UTC ticket.status new → closed
- [768879](https://bounty.xe.network/log/768879) 2026-11-22 23:25 UTC proposal.adopted
- [768878](https://bounty.xe.network/log/768878) 2026-11-22 23:25 UTC ticket.facts area
- [768877](https://bounty.xe.network/log/768877) 2026-11-22 23:25 UTC proposal.adopted
- [768876](https://bounty.xe.network/log/768876) 2026-11-22 23:25 UTC ticket.facts
- [768875](https://bounty.xe.network/log/768875) 2026-11-22 23:25 UTC proposal.adopted
- [768874](https://bounty.xe.network/log/768874) 2026-11-22 23:25 UTC ticket.facts
- [766564](https://bounty.xe.network/log/766564) 2026-11-22 23:17 UTC note.added
- [766562](https://bounty.xe.network/log/766562) 2026-11-22 23:17 UTC proposal.created

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

### Report

## Summary

Lima VMs are provisioned with floored resources (minimum 1 vCPU / 512 MiB / 5 GiB), but the provider's capacity accounting records the *requested* resources — so a lease requesting 0 vCPU / 0 MB is accounted as consuming nothing while actually consuming a full floored VM. A consumer can drive a provider into CPU/memory oversubscription at trivial cost, because the capacity check is the only guard by default (`max-concurrent-leases` defaults to 0 \= "bounded only by resource capacity").

## Root Cause

- `renderLimaTemplate` (`vm/lima_template.go:58-69`) floors resources: `cpus < 1` → 1, `memMB < 512` → 512, `diskGB < 5` → 5\.
- `Provision` stores the **requested** `res` in the map (`vm/lima_manager.go:150`, `resources: res`).
- The auto-accept capacity check sums `List()` resources \+ `reservedRes` — both requested values (`node/node.go:1563-1571`, `exceedsCapacity` `:2420-2422`).
- `max-concurrent-leases` defaults to 0 (`cmd/xe/main.go:1311`), so the capacity check is the only guard by default.
- A (0 vCPU, 0 MB, 1 GB) lease is valid: `ValidateLeaseDimensions` only requires one non-zero resource (`core/ledger.go:128-131`).
- Inconsistent with QEMU, which applies defaults and stores the *effective* values in its map (`vm/qemu_manager.go:183-191`, `:255`).

## Impact

A minimal (0 vCPU, 0 MB, 1 GB, 60s) lease costs **17 µXCU** yet actually consumes 1 vCPU \+ 512 MiB. Each such lease is accounted as 0/0, so the provider keeps auto-accepting: e.g. 30 one-hour minimal leases cost \~30,000 µXCU and demand 30 vCPUs on a 4-CPU host, all passing the capacity check. The provider ends up oversubscribed, degrading every tenant's VM.

## Verification

Executed in-package test against the real template renderer and accounting logic:

```
minimal lease (0 vCPU, 0 MB, 1 GB, 60s, mult 1000) cost: 17 uXCU
template for (0,0,1GB) lease: cpus: 1
template for (0,0,1GB) lease: memory: "512MiB"
template for (0,0,1GB) lease: disk: "5GiB"
10 minimal leases: accounted usage = 0 vCPU / 0 MB / 10 GB
10 minimal leases: ACTUAL usage   = 10 vCPU / 5120 MB / 50 GB (floors 1/512MiB/5GiB each)
provider cap 4 vCPU: accounted 0 <= 4, all 10 accepted; host actually needs 10 vCPUs
```

## Note on related reports

Searched "zero resource minimal lease capacity bypass oversubscribe", "Lima minimum resources 1 CPU 512MB floor", "capacity accounting resources floor minimum VM" — no hits.

## Suggested fix

Store the floored resources in the Lima map (as QEMU stores its effective values), or apply the floors in the capacity check in `node/node.go`.

### Thread

**Joseph Denne**team2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-0119, 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-16872 and says what differs; it is read like any other.
