Skip to content

Remove settlement-weighted bootstrap ranking (ADR 016/003) #1434

Closed

Description

@alpergundogdu

Decision (2026-07 ADR simplification audit). Filed under the Protocol simplifications milestone — sibling to #1396, #1394, #1419. Verdict: DROP. A staler proxy than probe-RTT ranking (no on-chain consumer today) that creates a centralisation/herding pull toward incumbents.

Drop Settlement-Weighted Bootstrap Ranking (CapacityBond.recordSettlement on every settlement)

Status: proposal for discussion, not a decision.

Summary

FeeRouter.routeSettlement calls CapacityBond.recordSettlement(operator) on every settlement and every mid-channel withdraw. That call crosses a contract boundary and a role check (SETTLEMENT_REPORTER_ROLE) for one purpose: emit SettlementRecorded(operator) so clients could index the logs and bias bootstrap ordering toward "proven deliverers." This proposal drops that whole mechanism — the cross-contract call, the role, the event, and the ADR 016 §"Settlement-Weighted Bootstrap Ranking" section — and keeps peer ranking on the signals clients already use: the getActiveNodes seed list, gossip NodeAnnounce TTL liveness, and probe-RTT ordering.

The case is scale-independent. It rests on signal quality, not node count: a historical on-chain settlement log is a strictly staler proxy for "will this peer serve me now" than a live probe RTT, which the client already measures on every fetch. This does not get more useful as the network grows.

Verification note — the drop-case is even stronger than distilled. The distilled case says clients index SettlementRecorded and use it to rank. In the actual codebase, no Rust code consumes SettlementRecorded at all. The client's real bootstrap ranker (crates/client-pull/src/discovery.rs) reads getActiveNodes, orders region-first, probes the top-K for liveness + blob-holding, and ranks by probe result. The settlement-recency signal is emitted on the hottest on-chain path and read by nobody. It is pure write-side machinery with zero consumer today.

Motivation

  1. It taxes the single hottest on-chain path for a nicety. routeSettlement runs on every channel close, every settleChannel, and — per ADR 003 § close/withdraw — every mid-channel withdraw. FeeRouter.sol:232 unconditionally appends capacityBond.recordSettlement(operator) after the three USDC transfers. That is an external CALL + onlyRole check + LOG on the most-executed mutating function in the system, to serve an ordering preference. Withdraw-heavy channels pay this repeatedly per channel.

  2. The signal it emits is stale by construction; the fresher signal already exists. ADR 016:474 states the plain truth: the registry "is a cold-start seed list, not a liveness oracle… Clients filter to live peers via gossip (NodeAnnounce TTL) and probe RTT after bootstrap." A SettlementRecorded log says "this operator settled a channel at some past block." A probe RTT says "this operator answered me 40ms ago and holds the blob." The probe strictly dominates for the actual decision — which peer to fetch from now.

  3. Nobody reads it. Grepping crates/ for SettlementRecorded returns zero consumers. The client ranker (discovery.rs) never indexes these logs. So today the mechanism is 100% cost, 0% benefit: it changes on-chain gas and surface but influences no client behavior.

  4. The ADR itself already concedes cold-start nodes aren't excluded. ADR 016:494 says cold-start operators "sink to the bottom by recency but are not excluded — they get probed once early settlers are exhausted." So the ranking is a soft ordering hint, not an admission gate. Gossip + probe produce that same soft ordering from fresher data, without an on-chain event.

  5. It is redundant with a signal the project deliberately kept fresh. Region and liveness already live in signed NodeAnnounce gossip (ADR 016:492). The design principle "return raw signals, not policy" (ADR 016:491) is satisfied by getActiveNodes + gossip alone; settlement events are a third signal source for a decision the first two already make better.

What removal touches

Blast radius:

ADR 016 (canonical contract surface) — rewrites:

  • Delete § "Settlement-Weighted Bootstrap Ranking" entirely (016-contract-interactions.md:476-494), including its contract-surface table and design-principle 1 as it pertains to settlement events.
  • Class diagram: drop the FeeRouter ..> CapacityBond : recordSettlement edge (line 84) and the comment block at 123-124.
  • Deployment/init: remove step 5 "Grant SETTLEMENT_REPORTER_ROLE on CapacityBond to FeeRouter" and its grantRole snippet (lines 339-345).
  • Cross-contract call graph: drop the FR -->|recordSettlement(op)| CBOND edge (line 402) and its row in the call table (line 431); remove recordSettlement from the mutation list in the note at line 452.
  • Roles table (line 588), function-signature table (line 651): delete the recordSettlement / SETTLEMENT_REPORTER_ROLE rows.
  • routeSettlement description (line 678): drop the CapacityBond.recordSettlement(operator) clause.
  • CapacityBond intro surface list (line 238): remove recordSettlement from the enumerated surface.
  • Off-chain read API note (lines 484-487): the getActiveNodes / firstBondedAt seed-list rows stay; only the settlement-event row goes.

ADR 003 — one clause:

  • 003-payments.md:483 (withdraw effects) and the analogous closeChannel/settleChannel prose: delete the "As a side effect, each withdraw (via routeSettlement) also calls CapacityBond.recordSettlement(operator)…" sentence. The firstBondedAt age-ramp and bondOf probe-priority reads (ADR 003 § Admission and Priority) are unaffected — they are separate surfaces.

Contracts:

  • FeeRouter.sol:232 — delete the capacityBond.recordSettlement(operator); call. Fix: also drop the now-unused capacityBond immutable/constructor wiring only if nothing else on FeeRouter references it (confirm — grep shows this is its only use; if so, remove the constructor arg and the DeployProtocol grant).
  • CapacityBond.sol — delete SETTLEMENT_REPORTER_ROLE constant (line 75), the SettlementRecorded event (line 430), and the recordSettlement function (lines 1202-1205). Drop it from the ICapacityBond interface.
  • Deploy script (DeployProtocol): remove the grantRole(SETTLEMENT_REPORTER_ROLE, feeRouter) step.

Rust:

  • No consumer to remove — crates/client-pull/src/discovery.rs never read SettlementRecorded. Client ranking (getActiveNodes seed → region → probe RTT) is untouched. This is the cheapest part of the blast radius, which is itself an argument for the drop.

Tests + gas snapshots:

  • contracts/test/FeeRouter.t.sol: the mock recordSettlement override (line 30) and any SettlementRecorded vm.expectEmit; the routeSettlement distribution/bytes tests keep passing but their gas numbers change.
  • contracts/test/GovernanceLifecycle.t.sol: routeSettlement is called to populate bytesPerEpoch (lines 184+); still works, gas shifts.
  • contracts/.gas-snapshot: regenerate — test_routeSettlement_* rows (430-433) drop by the cost of one external call + LOG + role check. Fix: FOUNDRY_PROFILE=ci forge snapshot.
  • Any CapacityBond test asserting SETTLEMENT_REPORTER_ROLE wiring: delete.

What we keep

The full bootstrap-and-rank pipeline survives intact, because none of it depends on settlement events:

  • getActiveNodes(offset, limit) seed list on CapacityBond — cold-start peer discovery, paginated (ADR 016:461, consumed by crates/client-pull/src/discovery.rs, crates/node/src/dht/*). Unchanged.
  • Gossip NodeAnnounce TTL liveness — the actual "is this peer alive right now" filter (ADR 016:474). Unchanged.
  • Probe-RTT ranking — discovery.rs probes top-K candidates and ranks by liveness + blob-holding + RTT. This is the fresher signal that already does the job. Unchanged.
  • firstBondedAt age-ramp and bondOf probe-acceptance priority (ADR 003 § Admission and Priority) — separate reads, not part of this mechanism. Unchanged.
  • FeeRouter's governance-canonical bytesPerEpoch / totalBytesPerEpoch served-bytes vote-weight accounting (ADR 036) — incremented inline in routeSettlement, entirely independent of the recordSettlement call. Unchanged.

Counter-argument (strongest keep-case) — [your call]

The honest keep-case is eclipse-resistant cold ranking for a fresh client with no gossip yet. Gossip TTL and probe RTT both require the client to have already reached peers. At the very first cold start — before any gossip mesh, before any probe — the client has only the getActiveNodes seed list, which is registration-ordered and includes staked-but-dead nodes. SettlementRecorded logs let a cold client, reading only chain state, rank that seed list by proven delivery before spending a single probe round-trip. Against an adversary who stakes many dead nodes to pad the seed list (Sybil-on-registry), settlement history is expensive to fake (real USDC from a real paying counterparty), so it's a genuinely harder-to-game pre-probe prior than registration order.

Weighing it: this is real but narrow, and it's a first-fetch probe-budget optimization, not a capability. The client still probes; settlement ranking only reorders which peers it probes first. The cost is a permanent tax on the hottest on-chain path plus a role and event on CapacityBond, for a one-time-per-cold-start ordering hint that today no client even reads. If the eclipse-prior turns out to matter, it can come back as a client-only feature: index Settled events already emitted by FeeRouter (line 234) and correlate to operators off-chain — no CapacityBond surface, no second event, no cross-contract call. That path gets the same anti-Sybil prior at zero added on-chain cost. [your call] whether the cold-start eclipse prior is worth keeping any on-chain surface for, given FeeRouter.Settled already carries the operator address.

Open questions

  1. Does FeeRouter.Settled(operator, bytes, amount, epoch) (already emitted, line 234) fully substitute for SettlementRecorded as a client-side settlement-recency index? If yes, the counter-argument's keep-case costs zero on-chain surface and this drop is unambiguous.
  2. Is capacityBond referenced anywhere else in FeeRouter.sol besides line 232? Grep says no — confirm before removing the immutable + constructor arg (and the deploy-time grant).
  3. Was any off-chain indexer / dashboard (outside crates/) planned to consume SettlementRecorded? The ADR implies clients would; nothing in-repo does. Confirm no external tooling depends on it before deleting the event.
  4. Does removing SETTLEMENT_REPORTER_ROLE simplify the DeployProtocol role-grant matrix enough to be worth calling out as a secondary win (one fewer post-deploy grantRole and one fewer cross-contract trust edge)?

Activity

  1. self-assigned this
    on Jul 24, 2026
  2. altanoruc commented on Jul 24, 2026

    @altanoruc
    Contributor

    Automated implementation triage follow-up: dispatch stopped with no PR after current code contradicted the issue's premise that FeeRouter uses CapacityBond only for recordSettlement. FeeRouter's constructor also calls capacityBond_.epochLength() to enforce on-chain equality with the router epoch. Please choose explicitly: (A) retain a CapacityBond epoch-view constructor dependency solely for contract-enforced equality while removing settlement reporting, or (B) remove the dependency and move the equality check to BaseProtocolDeploy, which does not protect direct FeeRouter deployments. Both are defensible; once pinned, the remaining production/ADR diff is about 192 lines excluding tests and gas snapshots.

  3. assigned and unassigned on Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions