Skip to content

refactor(node,common)!: drop the seller-side rate-floor quote clamp - #2037

Merged
alpergundogdu merged 2 commits into
mainfrom
claude/probe-response-rate-floor-a1c7c6
Sep 15, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
claude/probe-response-rate-floor-a1c7c6

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Why

The delivery floor is a redemption-time credit clamp, not a quote gate. PaymentPool.redeem already settles a sub-floor voucher in full and clamps only the byte count it credits toward ADR-036 vote weight. So a node that sells below the floor keeps its money and simply earns less vote weight — raising the floor never obliges a node to raise its price.

The node-side machinery that forced a node's own quote up to the floor before signing therefore protected nobody:

  • No buyer checks the floor. The client-pull path rejects only rate == 0 and rates above the buyer's own ceiling — a cheap quote is welcome.
  • It only bound the honest. A node that wants to underprice just patches it out (open-source binary); the clamp taxed only nodes running the reference code.
  • It was redundant with the on-chain soft clamp, and rested on the false premise that "a seller never wants to charge less".

Its only real effect was, during a governance floor-raise, to charge an operator's clients more than the operator configured — overriding their price on a premise that isn't true.

What changed

Cut the clamp and the whole subsystem behind it:

  • delete rate_bounds (the shared clamp handle) and rate_bounds_watcher (the RateBoundsUpdated follower + hourly getRateBounds() re-read)
  • drop the startup getRateBounds() read — the node no longer reads the floor at all
  • quote payment.rate_per_mb verbatim in ProbeResponse / StreamResponse
  • remove the payment.delivery_floor and blockchain.rate_bounds_poll_interval_sec config knobs, the DECDN_DELIVERY_FLOOR env var, and the decdn_rate_bounds_* metrics + their Prometheus alert / Grafana panel / observability-appendix rows
  • rework ADR 003 (§ Rate-floor enforcement, § Rate Bounds Refresh), ADR 005 (§ Rate bounds), and ADR 019 (Phase 3 startup) to describe the floor as a soft vote-weight credit clamp only, never a wire quote gate
  • delete g_gov_02_rate_bounds (it validated the deleted governance→daemon reprice)

What is deliberately unchanged

The contract: deliveryFloor, getRateBounds(), setRateBounds, RateBoundsUpdated, and the redeem credit clamp all stay, along with the [MIN_RATE_FLOOR, MAX_RATE_PER_MB] bound. The MAX_RATE_PER_MB wire ceiling and the buyer-side max_rate_per_mb ceiling are untouched.

Verification

cargo build --workspace --all-targets, cargo clippy --workspace --all-targets --all-features (clean), cargo fmt --check, RUSTDOCFLAGS=-D warnings cargo doc, cargo nextest run (common/node/cli/incentive green), and cargo test --no-run -p decdn-e2e --features anvil-e2e all pass. Net −1979 / +92 lines.

🤖 Generated with Claude Code

The delivery floor is a redemption-time credit clamp, not a quote gate.
`PaymentPool.redeem` already settles a sub-floor voucher in full and clamps
only the byte count it credits toward ADR-036 vote weight, so a node that
sells below the floor keeps its money and simply earns less vote weight.
Raising the floor never obliges a node to raise its price.

The node-side machinery that forced a node's own quote up to the floor before
signing therefore protected nobody: no buyer checks the floor, and a node that
wants to underprice just patches it out. It was redundant with the on-chain
soft clamp and rested on the false premise that "a seller never wants to charge
less". Cut it and the whole subsystem behind it:

- delete `rate_bounds` (the shared clamp) and `rate_bounds_watcher` (the
  `RateBoundsUpdated` follower + hourly `getRateBounds()` re-read)
- drop the startup `getRateBounds()` read; the node never reads the floor now
- quote `payment.rate_per_mb` verbatim in `ProbeResponse` / `StreamResponse`
- remove the `payment.delivery_floor` and `blockchain.rate_bounds_poll_interval_sec`
  config knobs, the `DECDN_DELIVERY_FLOOR` env var, and the
  `decdn_rate_bounds_*` metrics + their alert/dashboard/appendix rows

The contract is unchanged: `deliveryFloor`, `getRateBounds()`, `setRateBounds`,
`RateBoundsUpdated`, and the redemption credit clamp all stay. ADR 003 /
005 / 019 are reworded to describe the floor as a soft vote-weight credit
clamp only, never a wire quote gate.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 15, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It removes a cross-cutting runtime/on-chain watcher subsystem and changes economic/wire semantics across node + config + ADRs, so it warrants final human review despite only minor nits found.

Pull request overview

This PR removes the node-side “rate floor” quote clamping subsystem and redefines the delivery floor as a redemption-time (vote-weight credit) clamp only, aligning node/client behavior with PaymentPool.redeem semantics and simplifying node runtime wiring and observability.

Changes:

  • Deletes seller-side rate floor clamping (rate_bounds, watcher, startup read) and quotes payment.rate_per_mb verbatim in probe and stream responses.
  • Removes related config knobs/env vars/metrics and updates monitoring artifacts accordingly.
  • Updates ADRs and e2e/unit tests to drop “floor as quote gate” assumptions and remove the rate-bounds governance→daemon journey.
File summaries
File Description
monitoring/prometheus-alerts.yml Removes the rate-bounds clamp alert tied to the deleted clamp metric.
monitoring/grafana-dashboard.json Removes the rate-clamp panel query and updates the panel title accordingly.
crates/node/tests/support/mod.rs Updates handler test wiring to no longer construct RateBounds.
crates/node/tests/sighup_signal.rs Removes resolved-config fields that no longer exist (rate_bounds_poll_interval_sec, delivery_floor).
crates/node/tests/probe_warm_reconnect.rs Updates probe handler construction to drop RateBounds.
crates/node/tests/probe_loopback.rs Removes floor plumbing and deletes the probe “raised to floor” test.
crates/node/tests/node_origin_pull.rs Updates node-origin config wiring to remove sell_rate_bounds.
crates/node/tests/client_loopback.rs Updates floor-related comments and removes clamp-metric invariant tests.
crates/node/tests/anvil_bringup_shutdown_e2e.rs Removes resolved-config fields that no longer exist (rate_bounds_poll_interval_sec, delivery_floor).
crates/node/src/runtime/reload.rs Removes restart-required messaging and seed config fields for the deleted floor plumbing.
crates/node/src/runtime/mod.rs Removes the on-chain getRateBounds() startup read and the rate-bounds watcher route; updates handler wiring.
crates/node/src/rate_bounds.rs Deletes the RateBounds clamp implementation and its tests.
crates/node/src/rate_bounds_watcher.rs Deletes the RateBoundsUpdated watcher and its route construction/tests.
crates/node/src/node_origin/mod.rs Makes buy-side profitability gating use configured sell rate directly (no floor-derived sell rate).
crates/node/src/metrics.rs Removes clamp/watcher metrics and recorders tied to rate-bounds.
crates/node/src/lib.rs Drops module exports for the deleted rate-bounds components.
crates/node/src/handlers/probe.rs Stops raising rate_per_mb to a floor before signing probe responses.
crates/node/src/handlers/client/wire.rs Removes clamped_rate() and updates refusal-rate documentation to match new semantics.
crates/node/src/handlers/client/voucher.rs Updates comments to reflect that the floor is not checked on the node wire path.
crates/node/src/handlers/client/mod.rs Removes rate_bounds from handler deps/struct and updates test harness wiring.
crates/node/src/handlers/client/dispatch.rs Prices requests with the configured rate_per_mb directly (no clamp).
crates/node/src/fee_shares.rs Updates module docs after removing the “mirrors rate_bounds” reference.
crates/node/src/fee_shares_watcher.rs Adjusts comments that previously referenced rate-bounds watcher behavior.
crates/incentive/src/payment_pool.rs Updates binding/docs for getRateBounds()/RateBoundsUpdated to describe floor as redemption-time state.
crates/e2e/tests/smoke.rs Removes the deleted rate-bounds governance journey from the smoke-test overview.
crates/e2e/tests/g_node_01_onboarding.rs Updates onboarding journey commentary around probe quoting vs the floor.
crates/e2e/tests/g_gov_02_rate_bounds.rs Deletes the governance→daemon repricing journey now that the daemon no longer follows the floor.
crates/e2e/src/timeout.rs Updates heavy-tier documentation after removing the long poll ladder from the deleted journey.
crates/common/src/config/types.rs Removes config fields for rate-bounds polling and payment delivery-floor seed; updates related docs.
crates/common/src/config/resolved.rs Removes resolved-config fields for rate-bounds polling and delivery-floor seed; updates docs.
crates/common/src/config/mod.rs Removes defaults/validation for deleted config knobs and updates resolver plumbing/tests.
crates/common/src/cli/run.rs Removes the --delivery-floor CLI flag / env var.
crates/cli/tests/config_validate.rs Updates CLI config validation fixtures to match the new resolved config shape.
crates/cli/src/commands/config.rs Removes printing of deleted config values and updates default config comments/tests.
adr/architecture.md Removes rate-bounds clamp metric from the architecture observability vocabulary.
adr/appendix-observability.md Removes clamp metric and readiness field references from observability appendix.
adr/019-node-onboarding.md Removes floor-fetch step and re-numbers phase steps; updates rate configuration semantics.
adr/012-client.md Updates cross-reference to renumbered onboarding step.
adr/005-protocol.md Replaces “rate bounds validation” with “rate bounds” semantics describing no wire quote gating.
adr/003-payments.md Removes rate-bounds refresh mechanism section and redefines floor as redemption-time clamp only.
Review details

Suppressed comments (1)

crates/node/src/runtime/mod.rs:1074

  • This comment still references a “rate-bounds read”, but the rate-bounds startup read and watcher were removed in this PR. That makes the explanation confusing/misleading for future readers.
    // Live operator fee-share seed (ADR 041 / ADR 016 § Tunable Economics).
    // A fail-fast on-chain self-check at startup — `PaymentPool.feeRouter()`
    // resolves the router address, then `FeeRouter.getShares()` reads the current
    // 3-way split, narrowed to the operator's bps. Unlike the rate-bounds read,
    // NO leg of this chain is fatal to boot: an RPC failure or an unnarrowable
    // split falls back to `FEE_ROUTER_OPERATOR_BPS_FLOOR` and the node still comes
  • Files reviewed: 40/40 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/e2e/src/timeout.rs Resolved
@github-actions

Copy link
Copy Markdown

Coverage report

Total: 82.95% (was 82.79%, ▲ +0.15%) — 79525/95876 lines

File Coverage Lines Δ
crates/cli/src/commands/config.rs 87.13% 792/909 ▼ 0.03%
crates/common/src/config/mod.rs 97.12% 7177/7390 ▼ 0.01%
crates/common/src/config/resolved.rs 100.00% 42/42 ● 0.00%
crates/common/src/config/types.rs 100.00% 18/18 ● 0.00%
crates/incentive/src/payment_pool.rs 98.75% 79/80 ● 0.00%
crates/node/src/fee_shares.rs 88.10% 37/42 ● 0.00%
crates/node/src/fee_shares_watcher.rs 83.33% 135/162 ● 0.00%
crates/node/src/handlers/client/dispatch.rs 82.16% 479/583 ● 0.00%
crates/node/src/handlers/client/mod.rs 94.80% 2058/2171 ▼ 0.02%
crates/node/src/handlers/client/voucher.rs 93.72% 537/573 ● 0.00%
crates/node/src/handlers/client/wire.rs 91.71% 387/422 ▼ 0.17%
crates/node/src/handlers/probe.rs 86.83% 290/334 ▼ 0.02%
crates/node/src/metrics.rs 94.76% 904/954 ▲ +0.08%
crates/node/src/node_origin/mod.rs 92.00% 1081/1175 ▼ 0.02%
crates/node/src/rate_bounds.rs — — deleted
crates/node/src/rate_bounds_watcher.rs — — deleted
crates/node/src/runtime/mod.rs 48.18% 1168/2424 ▲ +0.45%
crates/node/src/runtime/reload.rs 96.59% 1560/1615 ▼ 0.01%
History
Commit Total Δ vs base
f43ea1b (HEAD) 82.95% ▲ +0.15%

@alpergundogdu
alpergundogdu merged commit 17999a8 into main Sep 15, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the claude/probe-response-rate-floor-a1c7c6 branch September 15, 2026 14:12
alpergundogdu added a commit that referenced this pull request Sep 15, 2026
Resolve ADR 003/005 rate-floor conflicts: keep #2037's no-seller-clamp
behavior (floor is redemption-time only, node reads it for no wire
decision) and fold in #2036's MAX_RATE_PER_MB=1000 value + the
vote-weight-suppression rationale.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants