Skip to content

Commit cc93e2d

Browse files
committed
rofl-scheduler: Read offer access policy from on-chain metadata
Move the per-offer allowed_creators and allowed_artifacts access policy out of the scheduler's local node config and into on-chain offer metadata, so a provider can change it with a transaction instead of editing the node config and restarting the machine. The scheduler now reads these well-known offer metadata keys each round: - net.oasis.scheduler.offer.allowed_creators: comma-separated creator addresses; empty or absent means all creators are allowed. - net.oasis.scheduler.offer.allowed_artifacts.<kind>: comma-separated allowed artifact hashes per kind; an absent kind allows all. - net.oasis.scheduler.offer.private: marks an offer private so it can be hidden from normal offer listings. Read but not acted on by the scheduler. The global allowed_creators and allowed_artifacts fields are removed from the local config (no fallback); RawLocalConfig now ignores unknown fields so existing configs still load. Matching metadata-key constants are added to the Go client SDK for use by the CLI.
1 parent 3e00a16 commit cc93e2d

3 files changed

Lines changed: 291 additions & 367 deletions

File tree

client-sdk/go/modules/roflmarket/types.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,25 @@ type Offer struct {
124124
Metadata map[string]string `json:"metadata"`
125125
}
126126

127+
// Well-known offer metadata keys recognized by the ROFL scheduler.
128+
const (
129+
// MetadataKeyOffer is the offer metadata key holding the offer identifier (the value used by
130+
// the scheduler's local config to select which offers it serves).
131+
MetadataKeyOffer = "net.oasis.scheduler.offer"
132+
// MetadataKeyOfferAllowedCreators is the offer metadata key holding a comma-separated list of
133+
// allowed instance creator addresses. When unset or empty, all creators are allowed.
134+
MetadataKeyOfferAllowedCreators = "net.oasis.scheduler.offer.allowed_creators"
135+
// MetadataKeyOfferAllowedArtifactsPrefix is the prefix of the offer metadata keys holding the
136+
// allowed artifact hashes. The artifact kind is the suffix following the prefix (e.g.
137+
// "net.oasis.scheduler.offer.allowed_artifacts.firmware") and the value is a comma-separated
138+
// list of allowed SHA256 hashes. If no key exists for a kind, all artifacts of that kind are
139+
// allowed.
140+
MetadataKeyOfferAllowedArtifactsPrefix = "net.oasis.scheduler.offer.allowed_artifacts."
141+
// MetadataKeyOfferPrivate is the offer metadata key marking an offer as private. Private
142+
// offers are hidden from normal offer listings unless explicitly requested.
143+
MetadataKeyOfferPrivate = "net.oasis.scheduler.offer.private"
144+
)
145+
127146
// Term is the reservation term.
128147
type Term uint8
129148

0 commit comments

Comments
 (0)