Skip to content

feat(oracle): MuzixStreamingOracle — on-chain consumer surface (spec Phase 1)#36

Merged
abhicris merged 1 commit into
mainfrom
feat/streaming-oracle
May 25, 2026
Merged

feat(oracle): MuzixStreamingOracle — on-chain consumer surface (spec Phase 1)#36
abhicris merged 1 commit into
mainfrom
feat/streaming-oracle

Conversation

@abhicris
Copy link
Copy Markdown
Contributor

Summary

Implements the Phase-1 MVP described in oracle/SPECIFICATION.md: the on-chain consumer-facing contract that authorized pushers submit verified streaming-revenue records to, and that downstream MUSD royalty distributors read from. The spec has been merged for ~6 weeks (#15); this PR ships the contract that turns it into something callable.

  • src/MuzixStreamingOracle.sol — Ownable + Pausable, custom errors, matches MuzixAIProvenance style.
  • test/MuzixStreamingOracle.t.sol — 35 new Foundry tests.
  • oracle/README.md — status table + integration snippet now that the contract exists.

Scope (matches IStreamingRevenueOracle from the spec)

  • DSP registry with per-DSP minConfidenceScore override (default 7500 bps).
  • Authorized pusher set + per-pusher 1h cooldown (spec §2 Rate limiting); batches share the cooldown so a single consensus round lands an arbitrary number of records.
  • Period sanity: periodStart < periodEnd, periodEnd <= block.timestamp.
  • Storage: per-(catalog, DSP) latest pointer for cheap on-chain reads; append-only history for off-chain auditability; latest-across-DSPs pointer for getLatestRevenue(catalogId) semantics.
  • getRevenueForPeriod view for off-chain RPC consumers (unbounded — documented; on-chain consumers should use the per-DSP latest pointer or index events).
  • isDataFresh with admin-configurable freshnessWindow (default 24h per spec).
  • subscribeToUpdates emits an event so off-chain indexers can pre-filter their watch list without paying for storage.
  • Pausable circuit breaker (spec §3 Fail-Safes).

Out of scope (tracked for later phases of the spec)

  • On-chain consensus aggregation (Phase 2 — 7-node automated consensus)
  • Node staking + slashing (Phase 2/3)
  • Dispute / challenge window (Phase 2)
  • Chainlink fallback wiring (Phase 2)
  • Cross-chain delivery (Phase 3)

The deployed contract trusts the off-chain node network for consensus and enforces only the focused on-chain invariants above. The node-network reference implementation is the next ship.

Test plan

  • forge build clean (only expected block.timestamp lints in oracle freshness/period checks)
  • forge test50 / 50 passing (35 new + 15 existing across MUSD / MuzixCatalog / MuzixAIProvenance)
  • Coverage: constructor, registry CRUD, pusher auth, all submission validation paths, cooldown across single + batch, period-sum aggregation, freshness, pause/unpause, subscribe, history out-of-bounds
  • Deploy to OP Sepolia (follow-up PR, alongside the off-chain pusher reference impl)

…s spec Phase 1)

Implements the Phase-1 MVP described in oracle/SPECIFICATION.md: the
on-chain consumer-facing contract that authorized pushers submit verified
streaming-revenue records to, and that downstream MUSD royalty
distributors read from.

Scope (matches IStreamingRevenueOracle in the spec):
- Per-DSP registry with per-DSP min-confidence override (default 7500 bps).
- Authorized pusher set + per-pusher 1h cooldown (spec §2 "Rate limiting").
- Period sanity: periodStart < periodEnd, periodEnd <= block.timestamp.
- Append-only history with per-(catalog, dsp) latest pointers for
  cheap on-chain reads, plus a getRevenueForPeriod view for off-chain
  RPC consumers.
- isDataFresh / freshnessWindow (default 24h, admin-configurable).
- Pausable circuit breaker (spec §3 "Fail-Safes").
- subscribeToUpdates emits an event so off-chain indexers can pre-filter
  their watch list without paying for storage.

Out of scope (tracked for later phases): on-chain consensus, node
staking/slashing, dispute window, Chainlink fallback, cross-chain.

35 new Foundry tests cover the registry, pusher auth, confidence floor
(default + per-DSP override), period invariants, cooldown across single
+ batch submissions, freshness, period-sum aggregation, pause/unpause,
and out-of-bounds history access. Full suite: 50/50 passing.
abhicris pushed a commit that referenced this pull request May 25, 2026
… minter (#48)

Introduce LABELTON, the rights-tokenization product of the Muzix protocol.

A `Master` is the canonical rights record for a piece of music — it anchors
industry identifiers (ISRC, UPC, ISWC), commits to off-chain MIR / legal /
financial-ID payloads by content-hash, and pins an immutable cap-table.

A `Variant` is an ERC-1155 token class derived from a master (Master, Single,
Album, Remix, Stem, SyncEdit, Cover, Instrumental, Live, Other). Every variant
mints 10000 units fanned across the master's cap-table proportionally to each
holder's basis-point share. ERC-1155 balance IS the share — no parallel
cap-table mapping needed.

Issuance is wallet-sovereign: the artist or any cap-table member calls
`registerMaster` / `mintVariant` directly. The protocol owner (Muzix DAO) does
not gate issuance — it only configures which variant kinds are mintable, the
verifier addresses, and the pause switch.

The root mint of a master always lands at the same set of wallet holders
defined by the cap-table; variants of that master inherit the cap-table by
construction.

Off-chain payloads (MIR fingerprint, legal-entity dossier, financial-routing
record) are referenced by content-hash; the on-chain record commits to those
hashes at master registration and is immutable thereafter. Replacing a hash
means registering a new master.

Integration with the existing muzix contracts (MUSD, MuzixCatalog,
MuzixRightsOffering #37, MuzixStreamingOracle #36, MuzixAIProvenance) is
documented in docs/labelton-architecture.md and tracked as follow-up issues.

This commit ships:
- src/Labelton.sol (401 LoC) — the contract
- docs/labelton-architecture.md — integration story + open design questions

Out of scope here (tracked as follow-up issues):
- MUSD distribution wired against Labelton.capTableOf
- MuzixCatalog cleanup now that LABELTON owns cap-tables
- MuzixRightsOffering -> Labelton handoff after counter accept
- Oracle consumer rewire
- AIProvenance ERC-1155 owner-check path
- Foundry test suite for Labelton.sol
- Verifier signature enforcement

forge build: clean (13_098 bytes deployed)
forge test: 15/15 existing tests pass — no regressions

Co-authored-by: Pattermesh <173408993+Pattermesh@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@abhicris abhicris merged commit 1e25f3f into main May 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant