Repository navigation
Closed
Labels
design:adrNeeds a new or updated ADR in adr/design:missing-decisionA decision the ADRs do not record yetkind:docsREADME, docs/, runbook, rustdoc or ADR prose only
Description
Context
ADR 012 §Bootstrap specifies clients query the registry via getActiveNodes() for cold-start peer discovery. As designed, the result is unsorted — any registered staker, including nodes that staked once and never delivered.
For a paid CDN, we have a much stronger on-chain signal of liveness/quality: settlement activity. Every closeChannel / settleChannel is on-chain proof that the node served bytes to a paying client. It's:
- Backward-looking (delivery already happened)
- Expensive to fake (requires a counterparty paying real USDC)
- Already going on-chain via
StablePaymentChannel
Proposal (sketch)
StakingRegistry.lastSettlementAt[operator]updated byStablePaymentChannelvia aSETTLEMENT_REPORTER_ROLEgetActiveNodes(offset, limit)returns(operator, nodeId, lastSettlementAt, stakeMultiple)— clients compose the ranking off-chain- ~5K gas per settlement (sub-cent on Arbitrum)
Result: cold-start clients hit proven deliverers first; staked-but-dead nodes sink. Stake-only nodes still get traffic (they're not excluded), just deprioritized until they build settlement history.
Future-proofing
Two design choices keep us out of corners:
- Return raw signals, not policy. Expose timestamps + flags as views; clients decide ranking. New ranking logic ships as client updates, not contract migrations.
- Region stays off-chain for now. Region lives in signed
NodeAnnounce(gossip). Registry remains globally-flat; clients filter regionally via the gossip peer table after bootstrap. If on-chain regional sharding ever becomes necessary, it's an additivebytes2 region => EnumerableSetmap — non-breaking.
Tradeoffs
- Cold-start nodes (
lastSettlementAt == 0) sink to the bottom. Acceptable: clients tolerate trying a few; first settlement boosts them. Could mitigate with a short "grace period" if it's a problem. - Gas cost: extra SSTORE per settlement, negligible on L2.
- Complexity: minimal — single mapping + role grant + one extra contract call in settlement path.
Questions for the team
- Is settlement-weighted bootstrap worth the contract-surface delta now, or defer to post-PoC with a simple unsorted
getActiveNodes()for now? - Are there other on-chain signals worth surfacing (open channel count, stake-delta history, slashing-distance)?
- Anything that should go on-chain now to avoid later API breaks (e.g. region as
bytes2)?
Related: PR #237 (contract scaffold), #327 (Rust-side registry query).
Metadata
Metadata
Assignees
Labels
design:adrNeeds a new or updated ADR in adr/design:missing-decisionA decision the ADRs do not record yetkind:docsREADME, docs/, runbook, rustdoc or ADR prose only
Type
Fields
Priority
None yet
Activity
docs(adr-016): propose settlement-weighted bootstrap ranking
alpergundogdu commentedon Apr 27, 2026
Formalized as a proposal in PR #333 (ADR 016 amendment). It surfaces the off-chain read API and includes the settlement-weighted ranking sketch. Discussion can move there now.
docs(adr-016): surface off-chain read API for client/node bootstrap (#…