Repository navigation
test(node): two-hop node-to-node paid pull-through integration test (#746) - #813
Conversation
…746) Adds the first multi-hop integration test for the cdn/client/v1 paid pull-through path, composing the existing ClientHandler (server) and stream_fetch (requester) halves into a real two-hop chain over in-process iroh endpoints on localhost, off-chain vouchers only (no anvil): - Hop 1 (A -> B): mid-node B paid-pulls a 1.5 MiB blob from upstream node A; asserts bytes match and the A<->B channel advances. - Step 2: B's cache is built from the pulled bytes (explicit stand-in for the deferred NodeOrigin / cache-miss->upstream-channel runtime wiring, which depends on provider discovery, ADR 001/022). - Hop 2 (B -> client): a leaf client paid-pulls from B; asserts bytes survive both hops intact end-to-end and the B<->client channel advances. Distinct per-hop rates (10 vs 13) with exact rate-derived amount checks, exactly-one-channel-per-store, and a cross-hop isolation re-check prove pricing is per-server with no cross-talk between B's buyer and seller roles. The single-hop loopback suite only covered client -> one node. Closes the in-scope portion of #746; the automatic runtime orchestration remains deferred on DHT provider discovery. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces a new integration test, node_to_node_pull_through_two_hops, to verify a two-hop node-to-node paid pull-through flow. The test simulates an upstream node, a mid-node, and a client to ensure data integrity and proper payment channel progression across both hops. Feedback on the test suggests propagating the join results of the background server tasks rather than ignoring them, ensuring that any background panics or failures are properly caught and fail the test.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
Adds a new multi-hop integration test covering the cdn/client/v1 paid pull-through path by composing the existing requester (stream_fetch) and server handler (ClientHandler) across two in-process iroh hops (A→B, then B→client), validating end-to-end bytes and per-hop off-chain channel accounting.
Changes:
- Introduces a two-hop paid pull-through integration test (A→B paid pull, B→client paid serve) over real localhost iroh endpoints.
- Asserts per-hop channel advancement (nonce/bytes/amount) with distinct rates, and verifies cross-hop isolation (B serving the client doesn’t mutate A↔B channel state).
- Manually populates B’s cache from hop-1 bytes via the existing test helper (
cache_with_blob) to stand in for not-yet-implemented runtime orchestration.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportTotal: 87.16% (was 87.15%, ● 0.00%) — 28094/32234 lines No coverage data for changed Rust files. History
|
Await the spawned accept-loop tasks with `?` instead of `let _ =` so a panic in either background server task fails the test rather than being silently swallowed. After `close()` the loops exit cleanly, so this only surfaces genuine panics. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…own (#814) Await the spawned accept-loop task with `?` instead of `let _ =` across the loopback suite so a panic in the background server task fails the test rather than being silently swallowed. After `close()` the accept loop exits cleanly, so this only surfaces genuine panics. Follow-up to the same fix in the two-hop test (#813). Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Summary
Adds the first multi-hop integration test for the
cdn/client/v1paid pull-through path (#746). It composes the existing protocol halves —ClientHandler(server) andstream_fetch(requester), both shipped in #733 — into a real two-hop chain over in-process iroh endpoints on localhost, off-chain vouchers only (no anvil):NodeOrigin/ cache-miss→upstream-channel runtime wiring (CacheEnginehas no public ingest API; only origin pull-through).Distinct per-hop rates (10 vs 13) with exact rate-derived amount checks, exactly-one-channel-per-store, and a cross-hop isolation re-check prove pricing is per-server with no cross-talk between B's buyer and seller roles (sharing one endpoint). The existing single-hop loopback suite (
client_loopback.rs) only covered client → one node.Scope / boundary
This closes the in-scope portion of #746. The full automatic flow #746 describes — a node auto-opening an upstream channel on cache miss and streaming through — does not exist in the runtime yet: there is no
NodeOrigin, and the cache-engine hook that would callopen_or_reuse_channelis deferred on provider discovery (ADR 001/022; the bootstrappedBuyerChannelServiceis intentionally bound to_buyer_channel_service). That orchestration is follow-up work alongside the DHT effort and is not asserted here. No production code changed.Verification
cargo fmt -- --check: cleancargo clippy -p decdn-node --tests: no warnings (anti-panic policy satisfied)cargo nextest run -p decdn-node: 450/450 pass🤖 Generated with Claude Code