Skip to content

x/resources — Resources module

The x/resources module defines the vocabulary of the marketplace: what a unit of CPU, memory, storage, or GPU means, how capacity is expressed, and how resource requirements are compared for matching. Every module that talks about capacity — deployments, orders, bids, usage records — uses these shared definitions.

Centralizing the resource model prevents drift: a bid can be checked against an order, and a usage record against a lease, because all three quantify resources identically.

The module fixes the units and records how capacity moves:

  • Units are defined once. CPU, memory, storage, and accelerator capacity are quantified identically everywhere in the protocol.
  • Capacity and demand share them. Providers express inventory and deployments express requirements in the same shared units, so matching compares specifications with no translation layer.
  • Reservations track commitments. Lease creation in x/market reserves capacity idempotently, keyed per lease, with lineage linking order, bid, lease, and escrow payment.

Consumption is recorded and settled in the units capacity was leased in, with benchmarks qualifying abstract units by measured performance.

Marketplaces fail on ambiguity. If tenant and provider disagree on what “one unit of compute” means, matching and settlement both break. A single, consensus-maintained resource model is what makes cross-provider price comparison and automated settlement possible.

ConceptDefinition
Resource unitThe canonical quantification of CPU, memory, storage, or accelerator capacity.
CapacityA provider’s leasable inventory, expressed in resource units for matching.
  1. Define — Units are defined once. The module fixes what each unit of CPU, memory, storage, or accelerator capacity means.
  2. Express — Capacity and demand use them. Providers express inventory and deployments express requirements in the same shared units.
  3. Match — Orders meet bids. Matching compares specifications written in the shared vocabulary — no translation layer, no ambiguity.
  4. Settle — Usage bills in kind. Consumption is recorded and settled in the units it was leased in, with benchmarks qualifying abstract units by measured performance.
MessagePurpose
MsgAllocateResourcesAllocates capacity for a matched order, bid, or lease.
MsgActivateAllocationActivates an allocation so its capacity is in use.
MsgReleaseAllocationReleases an allocation back to available capacity.
MsgProviderHeartbeatReports a provider’s continuing capacity liveness.
MsgUpdateParamsGovernance-only update of module parameters.
QueryPurpose
Allocation / AllocationHistoryA single allocation and its recorded history.
AllocationsByProviderAll allocations belonging to one provider.
AvailableResourcesCapacity not currently committed.
ReservationA single reserved-capacity record.
ReservationByBid / ReservationByConsumer / ReservationByJob / ReservationByLease / ReservationByOrderReservations looked up by their originating bid, consumer, job, lease, or order.
ReservationLineageLineage linking order, bid, lease, and escrow payment.
ReservationsByProviderEvery reservation held by one provider.
ParamsCurrent module parameters.
ModuleHow they interact
x/deploymentDeployment groups express requirements in shared resource units.
x/marketOrder/bid matching compares resource specifications from this module.
x/settlementUsage records quantify consumption in the same units they were leased in.
x/benchmarkBenchmarks ground abstract units in measured hardware performance.

Marketplaces fail on ambiguity: if tenant and provider disagree on what one unit of compute means, matching and settlement both break. A single consensus-maintained model makes cross-provider comparison and automated settlement possible.

They ground abstract units in measured hardware performance — the same unit of compute qualified by what the underlying hardware actually measures. See the x/benchmark module.

Every module that talks about capacity: deployments express requirements in them, orders and bids match on them, and usage records and settlement bill in them.