Skip to content

Discussion: bias bootstrap toward proven deliverers via on-chain settlement activity #332

Closed

Description

@alpergundogdu

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 by StablePaymentChannel via a SETTLEMENT_REPORTER_ROLE
  • getActiveNodes(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:

  1. Return raw signals, not policy. Expose timestamps + flags as views; clients decide ranking. New ranking logic ships as client updates, not contract migrations.
  2. 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 additive bytes2 region => EnumerableSet map — 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

  1. Is settlement-weighted bootstrap worth the contract-surface delta now, or defer to post-PoC with a simple unsorted getActiveNodes() for now?
  2. Are there other on-chain signals worth surfacing (open channel count, stake-delta history, slashing-distance)?
  3. 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).

Activity

  1. added
    kind:docs
    design:missing-decision
    design:adr
    on Apr 27, 2026
  2. alpergundogdu commented on Apr 27, 2026

    @alpergundogdu
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

design:adrdesign:missing-decisionkind:docs

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions