Skip to content

rate_per_mb should not be hot-reloadable; require drain + cooldown + restart to reprice #1679

Closed

Description

@alpergundogdu

Summary

payment.rate_per_mb is currently a SIGHUP / decdn node reload hot-reloadable field (crates/node/src/runtime/reload.rs:4). It should not be. Changing the price a node charges out from under a running process is a footgun: the correct way to reprice is to drain the node, close it, wait out a cooldown, and restart with the new rate.

Why hot-reloading the served rate is a footgun

The reload swaps a single shared Arc<AtomicU64> that both the probe handler and the client (serve) handler read (runtime/mod.rs:919, runtime/mod.rs:1203). Swapping it live means:

  • Quote/charge skew. A client selects this node from a probe quote at rate R₀ (the selection score is rate_per_mb × rtt × …, ADR 001), then the serve handler charges the swapped-in R₁. The buyer verified a StreamResponse and sized vouchers against one price; the seller now expects another. Best case the pull aborts; worse case it looks like the node quoted one price and billed another.
  • Mid-stream repricing. In-flight paid streams have a quoted_rate_per_mb captured per session (node_origin/resume.rs). A live global swap creates an inconsistency between already-quoted sessions and the global value, which is exactly the kind of state the "drain then restart" lifecycle exists to avoid.
  • No cooldown / commitment window. Repricing at will undercuts any expectation clients (or the selection layer) have that a quoted rate holds for some window. A drain → close → cooldown → restart cycle gives that window for free and makes the price change atomic from the node's perspective.

Unlike security.* (rate limits) or log_level, rate_per_mb is not an operational knob — it's an economic commitment on the wire. It belongs with the restart-required fields.

Proposed change

  • Move payment.rate_per_mb off the reloadable-section set: remove its ReloadableSection impl and drop it from the SIGHUP/admin-reload path in crates/node/src/runtime/reload.rs.
  • Treat it like the other restart-required fields: if the reloaded file changes payment.rate_per_mb, log the standard "requires restart" message (logged on presence/change, not applied).
  • The serve/probe handlers can then read a plain value fixed at startup instead of a shared Arc<AtomicU64>.
  • Document the intended reprice lifecycle: drain → close → cooldown → restart with the new rate.
  • Update ReloadSnapshot / admin_v1_reload reporting and the reload module docs accordingly.

Notes / open questions

  • The "cooldown" is a policy detail — is there an existing drain/cooldown mechanism this should hook into, or is documenting the operator procedure enough for now? [your call]
  • Pre-launch, this is a clean removal — no back-compat shim needed (per CLAUDE.md, change the shape and delete the old path in one PR).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

design:economicsrust

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions