{"id":"XE-16872","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"679","source_url":"https://github.com/xeprotocol/xe/issues/679","reporter_id":2920,"title":"[Medium] Lima resource floors not counted in provider capacity accounting; minimal leases bypass CPU/memory caps","area":"leasing-ledger","claimed_tier":"medium","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0119","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T06:53:56.634751+00:00","updated_at":"2026-11-22T23:26:13.201023+00:00","source_created_at":"2026-11-17T06:53:37+00:00","told_at":"2026-11-22T23:26:13.215765+00:00","status_changed_at":"2026-11-22T23:26:13.206138+00:00","url":"https://bounty.xe.network/XE-16872","body":"## Summary\n\nLima 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\").\n\n## Root Cause\n\n- `renderLimaTemplate` (`vm/lima_template.go:58-69`) floors resources: `cpus < 1` → 1, `memMB < 512` → 512, `diskGB < 5` → 5.\n- `Provision` stores the **requested** `res` in the map (`vm/lima_manager.go:150`, `resources: res`).\n- The auto-accept capacity check sums `List()` resources + `reservedRes` — both requested values (`node/node.go:1563-1571`, `exceedsCapacity` `:2420-2422`).\n- `max-concurrent-leases` defaults to 0 (`cmd/xe/main.go:1311`), so the capacity check is the only guard by default.\n- A (0 vCPU, 0 MB, 1 GB) lease is valid: `ValidateLeaseDimensions` only requires one non-zero resource (`core/ledger.go:128-131`).\n- Inconsistent with QEMU, which applies defaults and stores the *effective* values in its map (`vm/qemu_manager.go:183-191`, `:255`).\n\n## Impact\n\nA 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.\n\n## Verification\n\nExecuted in-package test against the real template renderer and accounting logic:\n\n```\nminimal lease (0 vCPU, 0 MB, 1 GB, 60s, mult 1000) cost: 17 uXCU\ntemplate for (0,0,1GB) lease: cpus: 1\ntemplate for (0,0,1GB) lease: memory: \"512MiB\"\ntemplate for (0,0,1GB) lease: disk: \"5GiB\"\n10 minimal leases: accounted usage = 0 vCPU / 0 MB / 10 GB\n10 minimal leases: ACTUAL usage   = 10 vCPU / 5120 MB / 50 GB (floors 1/512MiB/5GiB each)\nprovider cap 4 vCPU: accounted 0 <= 4, all 10 accepted; host actually needs 10 vCPUs\n```\n\n## Note on related reports\n\nSearched \"zero resource minimal lease capacity bypass oversubscribe\", \"Lima minimum resources 1 CPU 512MB floor\", \"capacity accounting resources floor minimum VM\" — no hits.\n\n## Suggested fix\n\nStore 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`.\n","patch_refs":[],"thread":[{"id":18817,"source":"desk","source_ref":"reply:16494","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0119, 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-16872 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:13.201023+00:00"}]}