Repository navigation
Description
Gap
Concurrent streams sharing one (signer, provider) lane are a protocol capability (ADR 005 §Payment lanes and concurrent streams: one aggregate byte counter, one voucher-signing task, cumulative vouchers routed on any stream) with no test that actually crosses an aggregate voucher-interval boundary or handles out-of-order voucher arrival.
What exists today
concurrent_streams_all_finish_before_idle_clock_arms(crates/node/tests/client_loopback.rs:1589) runs two same-lane streams, but with 48 KiB / 64 KiB payloads (well under the 4 MiBVOUCHER_INTERVAL_BYTES) paid sequentially (VoucherTotalsthreaded A→B). It validates lane-cumulative threading + the idle reaper — not aggregate-boundary crossing, interleaved delivery, or reordering.- The coalesce tests (
coalesce_two_clients,node_to_node_coalesce) are about one-upstream-pull / distinct downstream lanes, not shared-lane aggregate accounting.
Why it's currently unreached by any real client
The only client that opens multiple concurrent streams from one process is CLI bundle pull (crates/cli/src/commands/bundle_pull.rs, pull_all → buffer_unordered(jobs)). It deliberately serializes same-lane access with a per-provider async mutex (locks: HashMap<Address, Rc<Mutex<()>>>, provider_lock(); docstring at bundle_pull.rs:15-18) precisely because "vouchers are cumulative per (signer, provider) lane, so two in-flight fetches sharing one lane would race it." Concurrency runs across distinct providers; same-provider entries fall back to the sequential-resume ledger in client-pull (each stream_fetch seeds from the lane's prior cumulative state).
So the node-side aggregate-counter path (serve_leg.rs / voucher.rs, lane state shared under mutex) has a consumer only in theory.
Ask
Two distinct tests, likely both in one PR. Either may fail and reveal a real bug — fix in the same PR.
- Client-side (guards the guard) — higher value. A bundle with ≥2 entries pinned to ONE provider (
--node-id/--provider-address) must yield a correct, monotone, non-double-paid lane watermark. Locks in the invariant that the per-provider serialization holds, so a future refactor can't silently drop it into a race. - Node/protocol-side (forward-looking). A hand-built client opening two genuinely-concurrent same-lane streams that interleave across a 4 MiB aggregate boundary, with out-of-order voucher arrival, asserting the node's lane-shared byte reconstruction + credit-window (collective, lane-wide) stay correct. Needs a synthetic client because the shipped one serializes and won't produce this traffic.
Notes
- Correctness rests on cumulative-monotone vouchers (cumulative
amountis the sole ordering/replay key) + lane-shared watermark under mutex; reconstruction is over cumulative totals, so stream attribution of bytes should wash out — the test is to prove the implementation matches that argument under real interleaving. - Unrelated to feat: delete voucher cadence negotiation outright (no replacement) #1676 (voucher-cadence deletion), which only fixed the interval to
VOUCHER_INTERVAL_BYTES = 4 MiBand left the concurrency machinery untouched.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
test(payments): exercise concurrent same-lane aggregate voucher accou…
fix(node): credit below-frontier reveals from lane headroom so concur…