Repository navigation
fix(node): make payment.rate_per_mb restart-required, not hot-reloadable - #1684
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes payment.rate_per_mb restart-required rather than hot-reloadable, aligning the served price with the “economic commitment on the wire” model and avoiding quote/charge skew across probe vs serve legs.
Changes:
- Remove
[payment]from the hot-reloadable set and emit “requires restart” notices for[payment]presence on reload/SIGHUP. - Update probe/client handlers to hold a startup-fixed
rate_per_mb: u64(no sharedArc<AtomicU64>). - Remove
rate_per_mbfrom reload snapshots / admin reload responses and adjust CLI + e2e/tests accordingly.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/node/tests/support/mod.rs | Update test wiring to pass rate_per_mb by value into handler deps. |
| crates/node/tests/sighup_signal.rs | Adjust SIGHUP/reload integration tests to treat [payment] as restart-required and stop asserting atomic rate swaps. |
| crates/node/tests/self_hosted_discovery.rs | Update ProbeHandler::new call sites for by-value rate_per_mb. |
| crates/node/tests/probe_warm_reconnect.rs | Remove atomic rate plumbing in probe server helper. |
| crates/node/tests/probe_loopback.rs | Remove atomic rate plumbing in probe loopback helpers. |
| crates/node/src/runtime/reload.rs | Delete PaymentSection, drop rate from snapshot, and make [payment] restart-required with presence-based notices. |
| crates/node/src/runtime/mod.rs | Wire handlers with cfg.payment.rate_per_mb directly instead of a reload-state atomic. |
| crates/node/src/handlers/probe.rs | Store rate_per_mb as a startup-fixed u64 and remove atomic loads. |
| crates/node/src/handlers/client/wire.rs | Clamp against startup-fixed rate_per_mb rather than loading from an atomic. |
| crates/node/src/handlers/client/mod.rs | Change ClientHandlerDeps/ClientHandler to hold rate_per_mb: u64 with updated docs/tests. |
| crates/node/src/commands/mod.rs | Stop passing PaymentArgs into RuntimeReloadState::new. |
| crates/node/src/admin.rs | Remove rate_per_mb from admin reload response path and update tests. |
| crates/e2e/tests/g_gov_03_real_evidence.rs | Update evidence narrative and flow to restart daemon to apply repricing. |
| crates/e2e/src/node.rs | Change NodeFixture::set_rate_per_mb to rewrite config and restart instead of hot-reload. |
| crates/common/src/cli/node.rs | Update CLI docs to reflect current reloadable set (excluding payment rate). |
| crates/common/src/admin.rs | Remove rate_per_mb from ReloadResponse and update RPC docs. |
| crates/cli/src/commands/rotate_key/mod.rs | Update docs to reflect reload set no longer includes payment rate. |
| crates/cli/src/commands/node.rs | Remove plain-text rate_per_mb= output from decdn node reload; keep log_level= only. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
alpergundogdu
force-pushed
the
claude/rate-per-mb-hot-reload-937f8b
branch
from
August 14, 2026 09:21
116c988 to
a60e926
Compare
…ble (#1679) The served per-MB rate was in the SIGHUP / admin_v1_reload hot-reload set, sharing one Arc<AtomicU64> between the probe and client handlers. Swapping it under a running node is a footgun: a client selects the node from a probe quote at the old rate, then the serve leg charges the swapped-in rate — skewing already-quoted probes against in-flight vouchers — with no cooldown or commitment window. The rate is an economic commitment on the wire, not an operational knob. Move it off the reload path entirely: - Delete PaymentSection; the whole [payment] section is now restart-required and earns a presence-based "requires restart" notice like network/blockchain/etc. - ProbeHandler and ClientHandler hold rate_per_mb as a plain u64 fixed at startup (read from cfg.payment.rate_per_mb) instead of a shared atomic. - Drop rate_per_mb from ReloadSnapshot / ReloadResponse and the `decdn node reload` plain output — a reload never changes it, so reporting it misled. - e2e: NodeFixture::set_rate_per_mb now rewrites the config and restarts the daemon (drain→stop→restart is the reprice path); the G-GOV-03 rate-challenge evidence pair is unaffected since the judge only sees two signed messages in the 30s window. Repricing is now: drain, close, cooldown, restart with the new rate. Co-Authored-By: Claude Opus 4.8 <[email protected]>
alpergundogdu
force-pushed
the
claude/rate-per-mb-hot-reload-937f8b
branch
from
August 14, 2026 09:25
a60e926 to
f241ece
Compare
Coverage reportTotal: 80.79% (was 80.83%, ▼ 0.04%) — 59400/73525 lines
History
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1679.
Problem
payment.rate_per_mbwas in the SIGHUP /admin_v1_reloadhot-reload set, sharing oneArc<AtomicU64>between the probe and client handlers. Swapping the served price under a running node is a footgun:quoted_rate_per_mb.The rate is an economic commitment on the wire, not an operational knob like a rate limit or log level. The correct way to reprice is: drain → close → cooldown → restart with the new rate.
Change
PaymentSectionfromruntime::reload. The whole[payment]section is now restart-required and earns a presence-based "requires restart" notice, likenetwork/blockchain/etc. (delivery_flooris governed on-chain viagetRateBounds(); the other serve knobs are read once at handler construction.)ProbeHandler/ClientHandlerholdrate_per_mb: u64fixed at startup (fromcfg.payment.rate_per_mb) instead of a shared atomic.rate_per_mbfromReloadSnapshot/ReloadResponseand thedecdn node reloadplain output — a reload never changes it, so echoing it in a reload response was misleading.NodeFixture::set_rate_per_mbnow rewrites the config and restarts the daemon instead of hot-reloading. The G-GOV-03 rate-challenge evidence pair is unaffected — theSlashJudgeonly sees two operator-signed messages inside the 30s window and does not care how the rate moved between them; a restart is fast relative to that window.Verification
cargo build/cargo clippy --all-targets(incl.-p decdn-e2e --features anvil-e2e) — cleancargo fmt --check— cleancargo nextest run -p decdn-nodereload / sighup / probe / client_loopback suites — green (rewritten unit + integration tests assert the new "rate change ignored, notice emitted, log_level still applies" contract)🤖 Generated with Claude Code