Skip to content

feat(payments): delete voucher_interval_mb negotiation (#1676) - #1688

Merged
alpergundogdu merged 4 commits into
mainfrom
claude/issue-1676-subagents-0d59f8
Aug 14, 2026
Merged

alpergundogdu merged 4 commits into
mainfrom
claude/issue-1676-subagents-0d59f8

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1676.

Deletes the voucher_interval_mb cadence 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_BYTES in crates/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 cumulative amount on 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

  • Wire: voucher_interval_mb on StreamRequestExt + StreamResponse, DEFAULT_/MAX_VOUCHER_INTERVAL_MB, MessageValidationError::VoucherIntervalOutOfRange + both validate() bounds
  • Node: the min()/max(1) interval negotiation in dispatch.rs / window.rs; interval_mb threading through the serve/pull paths
  • Config: the payment.voucher_interval_mb field, resolver, range validation, and its restart-required reload gate
  • Client: the dead voucher_interval_mb: None proposer path in client-pull
  • ADRs: 003 §Voucher Interval Negotiation + §Concurrent Streams rules, 005 wire, 012 cadence, 013 frozen field, 038 framing — rewritten to describe the fixed granularity as present-tense canon

The serve-loop credit-window and group-commit structure is unchanged; interval_bytes simply 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 — clean
  • cargo nextest run --no-fail-fast full workspace: 2765/2765 passed, 0 failed
  • cargo test --no-run -p decdn-e2e --features anvil-e2e — compiles
  • public_api snapshot regenerated

Net diff: +416 / −722 (−306 lines).

🤖 Generated with Claude Code

alpergundogdu and others added 2 commits August 14, 2026 13:11
…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]>
Copilot AI lite review requested due to automatic review settings August 14, 2026 12:13

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.

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_mb from StreamRequestExt/StreamResponse and remove related validation/error variants.
  • Introduce VOUCHER_INTERVAL_BYTES as 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.

Comment thread crates/protocol/src/client.rs Resolved
Comment thread crates/node/src/handlers/client/mod.rs Resolved
…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]>
@github-actions

github-actions Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 80.75% (was 80.79%, ▼ 0.04%) — 59244/73363 lines

File Coverage Lines Δ
crates/cli/src/commands/config.rs 85.76% 530/618 ▲ +0.05%
crates/cli/src/commands/fetch.rs 31.00% 323/1042 ● 0.00%
crates/client-pull/src/lib.rs 89.69% 1462/1630 ▼ 0.07%
crates/client-pull/src/ranged_store.rs 90.10% 974/1081 ● 0.00%
crates/common/src/config/mod.rs 97.11% 6811/7014 ▼ 0.01%
crates/common/src/config/resolved.rs 100.00% 33/33 ● 0.00%
crates/e2e/src/client.rs 0.00% 0/456 ● 0.00%
crates/node/src/handlers/client/delivery.rs 95.37% 206/216 ▼ 0.02%
crates/node/src/handlers/client/dispatch.rs 83.69% 349/417 ▼ 0.07%
crates/node/src/handlers/client/mod.rs 88.35% 690/781 ▼ 0.33%
crates/node/src/handlers/client/serve_leg.rs 86.33% 120/139 ▼ 1.53%
crates/node/src/handlers/client/window.rs 75.42% 316/419 ▼ 0.11%
crates/node/src/handlers/client/wire.rs 97.58% 121/124 ▼ 0.04%
crates/node/src/runtime/mod.rs 46.72% 1090/2333 ● 0.00%
crates/node/src/runtime/reload.rs 96.79% 1419/1466 ● 0.00%
crates/protocol/src/client.rs 99.04% 719/726 ▼ 0.08%
crates/protocol/src/message.rs 100.00% 230/230 ● 0.00%
History
Commit Total Δ vs base
e2d258c 80.76% ▼ 0.04%
9280a21 (HEAD) 80.75% ▼ 0.04%

…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]>
@alpergundogdu
alpergundogdu merged commit c81a079 into main Aug 14, 2026
26 checks passed
@alpergundogdu
alpergundogdu deleted the claude/issue-1676-subagents-0d59f8 branch August 14, 2026 13:37
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.

feat: delete voucher cadence negotiation outright (no replacement)

2 participants