Repository navigation
feat(payments): delete voucher_interval_mb negotiation (#1676) - #1688
Merged
Merged
Conversation
…g to a fixed 4 MiB constant The voucher cadence was only a performance optimization for amortizing per-voucher cost. The credit window is the sole mid-stream enforcement the seller needs, so payment granularity is emergent buyer behavior, not a protocol parameter. Replace the negotiated/configured interval with a single internal constant VOUCHER_INTERVAL_BYTES = 4 * MB_BYTES. Buyer and seller both derive cumulative voucher byte counts from it, so signature reconstruction stays exact with no wire field and nothing to negotiate. Removes the voucher_interval_mb fields on StreamRequestExt/StreamResponse, DEFAULT_/MAX_VOUCHER_INTERVAL_MB, VoucherIntervalOutOfRange and its validate bounds, the payment.voucher_interval_mb config knob + resolver + validation + restart-required reload gate, the dispatch/window negotiation, and the dead client proposer path. The serve-loop credit-window and group-commit structure is unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…unting granularity Rewrite ADR 003/005/012/013/038 (and incidental references) so the voucher byte-accounting granularity reads as a fixed 4 MiB constant that buyer and node both derive from, with no negotiation, no wire field, and no config surface. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Removes voucher_interval_mb as a negotiated/configurable protocol parameter and instead standardizes voucher byte-accounting around a single shared constant, propagating that change through protocol types, node/client implementations, tests, and ADR documentation.
Changes:
- Delete
voucher_interval_mbfromStreamRequestExt/StreamResponseand remove related validation/error variants. - Introduce
VOUCHER_INTERVAL_BYTESas the shared voucher-accounting granularity and thread it through node/client logic. - Remove the config surface (
payment.voucher_interval_mb) and update tests/ADRs to match the new fixed-granularity model.
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/protocol/tests/snapshots/public_api__public_api.snap | Updates public API snapshot for removed interval fields and new VOUCHER_INTERVAL_BYTES. |
| crates/protocol/src/message.rs | Removes VoucherIntervalOutOfRange validation error. |
| crates/protocol/src/lib.rs | Adjusts protocol re-exports to drop interval MB constants and export VOUCHER_INTERVAL_BYTES. |
| crates/protocol/src/client.rs | Removes interval negotiation fields/validation and adds VOUCHER_INTERVAL_BYTES. |
| crates/node/tests/support/mod.rs | Updates handler test wiring to remove the interval parameter. |
| crates/node/tests/sighup_signal.rs | Removes config seeding of voucher_interval_mb. |
| crates/node/tests/origin_range_pull.rs | Switches range-pull tests to use VOUCHER_INTERVAL_BYTES. |
| crates/node/tests/node_to_node_pull_through.rs | Removes interval usage in node-to-node pull-through tests. |
| crates/node/tests/node_origin_pull.rs | Updates origin pull tests/docs and interval computations to the fixed interval. |
| crates/node/tests/client_loopback.rs | Updates loopback tests to use fixed voucher interval; adjusts payload sizes/cost derivations. |
| crates/node/tests/anvil_settlement_e2e.rs | Updates settlement assertions/docs to not assume a specific voucher cadence. |
| crates/node/tests/anvil_bringup_shutdown_e2e.rs | Removes config seeding of voucher_interval_mb. |
| crates/node/src/runtime/reload.rs | Removes voucher_interval_mb from runtime reload state and restart-required warning text. |
| crates/node/src/runtime/mod.rs | Removes voucher_interval_mb threading during handler construction. |
| crates/node/src/handlers/client/wire.rs | Removes voucher_interval_mb from response signing helper and response construction. |
| crates/node/src/handlers/client/window.rs | Drops interval negotiation from windowed serve logic; uses VOUCHER_INTERVAL_BYTES. |
| crates/node/src/handlers/client/serve_leg.rs | Replaces per-stream interval-derived bytes with VOUCHER_INTERVAL_BYTES. |
| crates/node/src/handlers/client/mod.rs | Removes interval fields from deps/handler; updates imports/docs to fixed interval. |
| crates/node/src/handlers/client/dispatch.rs | Removes interval negotiation and uses VOUCHER_INTERVAL_BYTES for deposit/window pricing. |
| crates/node/src/handlers/client/delivery.rs | Uses VOUCHER_INTERVAL_BYTES for interval accounting in delivery loop. |
| crates/e2e/tests/smoke.rs | Updates e2e commentary to reference VOUCHER_INTERVAL_BYTES. |
| crates/e2e/tests/cli_fetch_topup.rs | Updates test rationale/docs to reflect fixed voucher granularity (and removes restart/interval config commentary). |
| crates/e2e/src/client.rs | Removes voucher_interval_mb: None from constructed request extensions. |
| crates/common/src/config/types.rs | Deletes payment.voucher_interval_mb config field and updates credit-window docs. |
| crates/common/src/config/resolved.rs | Removes resolved voucher_interval_mb and updates docs to reference fixed voucher interval. |
| crates/common/src/config/mod.rs | Removes config resolution/validation for voucher_interval_mb and updates related docs. |
| crates/client-pull/src/ranged_store.rs | Updates checkpoint-cadence docs to align with fixed voucher interval terminology. |
| crates/client-pull/src/lib.rs | Removes interval negotiation comments and switches interval bytes derivation to VOUCHER_INTERVAL_BYTES. |
| crates/cli/tests/config_validate.rs | Removes expected resolved voucher_interval_mb from CLI config validation tests. |
| crates/cli/src/commands/fetch.rs | Updates CLI error-annotation commentary to reference fixed interval. |
| crates/cli/src/commands/config.rs | Removes printing/default-config mention of voucher_interval_mb and updates comments/tests. |
| adr/appendix-operator-key-rotation.md | Updates operational text to reference fixed 4 MiB voucher granularity. |
| adr/039-multi-source-parallel-fetch.md | Updates protocol references away from voucher-interval negotiation. |
| adr/038-bao-verified-range-streaming.md | Updates framing description to fixed 4 MiB voucher pieces. |
| adr/037-regional-proxy-warming.md | Updates references from “voucher cadence” to “voucher granularity”. |
| adr/024-account-abstraction.md | Updates signing-frequency discussion for fixed 4 MiB granularity. |
| adr/017-privacy.md | Updates volume-leakage analysis for fixed 4 MiB increments. |
| adr/014-on-chain-verification.md | Removes voucher_interval_mb from StreamResponse wire summary. |
| adr/013-schema-evolution.md | Removes voucher_interval_mb examples and updates signed/unsigned field tables. |
| adr/012-client.md | Updates client configuration narrative to fixed protocol constant (no cadence config). |
| adr/005-protocol.md | Removes wire field and negotiation section; rewrites to fixed 4 MiB granularity + credit window. |
| adr/003-payments.md | Removes voucher interval negotiation section; rewrites key parameters and lane rules for fixed granularity. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…oucher interval Two test-harness fixtures (serve_with_deposit_ceiling, serve_wire_paced) still demanded a voucher from the simulated buyer at the old 1 MiB cadence; step them at VOUCHER_INTERVAL_BYTES. Re-derive payload/deposit sizes and the exact-wire watermark assertion in terms of VOUCHER_INTERVAL_BYTES (window-paced legs meter each open's vouchers independently), and track the window floor that now sits at one 4 MiB interval. Correct two config doc-comments that called the 1 MiB pull-ahead default 'one voucher interval'. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Coverage reportTotal: 80.75% (was 80.79%, ▼ 0.04%) — 59244/73363 lines
History
|
…er-interval pause The serve loop pauses on the credit window (delivered − paid), pipelining several VOUCHER_INTERVAL_BYTES intervals ahead of payment, not stopping at each interval boundary. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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 #1676.
Deletes the
voucher_interval_mbcadence mechanism outright. The credit window is the only mid-stream enforcement the seller needs, so payment granularity is emergent buyer behavior, not a protocol parameter.Approach
Voucher byte-accounting is pinned to a fixed internal constant
VOUCHER_INTERVAL_BYTES = 4 * MB_BYTESincrates/protocol. Buyer and seller both derive cumulative voucher byte counts from it, so EIP-712 signature reconstruction stays exact with no wire field and nothing to negotiate. (Vouchers carry only cumulativeamounton the wire, not bytes — both sides must agree on the byte-accounting clock, which is why the interval becomes a shared constant rather than being removed entirely.)Deleted
voucher_interval_mbonStreamRequestExt+StreamResponse,DEFAULT_/MAX_VOUCHER_INTERVAL_MB,MessageValidationError::VoucherIntervalOutOfRange+ bothvalidate()boundsmin()/max(1)interval negotiation indispatch.rs/window.rs;interval_mbthreading through the serve/pull pathspayment.voucher_interval_mbfield, resolver, range validation, and its restart-required reload gatevoucher_interval_mb: Noneproposer path inclient-pullThe serve-loop credit-window and group-commit structure is unchanged;
interval_bytessimply sources from the constant. Test fixtures that stepped the simulated buyer at the old 1 MiB cadence were re-derived against the 4 MiB constant.Verification
cargo fmt --check,cargo clippy --all-targets -D warnings,cargo doc,cargo deny— cleancargo nextest run --no-fail-fastfull workspace: 2765/2765 passed, 0 failedcargo test --no-run -p decdn-e2e --features anvil-e2e— compilespublic_apisnapshot regeneratedNet diff: +416 / −722 (−306 lines).
🤖 Generated with Claude Code