Skip to content

feat(payments): shared payment pool — capped delegated signers + node-addressed cumulative vouchers - #1667

Merged
alpergundogdu merged 81 commits into
mainfrom
claude/decdn-shared-payment-pool-5dd28e
Aug 13, 2026
Merged

alpergundogdu merged 81 commits into
mainfrom
claude/decdn-shared-payment-pool-5dd28e

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Replaces the pairwise PaymentChannel payment subsystem with a shared PaymentPool: one owner-funded deposit backs off-chain vouchers from many capped delegated signers to many provider nodes. Implements ADR 003/005/016 (already merged; this brings the code in line). Pre-launch, so the old shapes are deleted rather than shimmed.

Net −12.8k lines (149 files, +21.1k/−33.9k) — the pool model is materially simpler than pairwise.

What changed

  • Contract (PaymentPool.sol): 2D sharded register — authorized[pool][signer]={cap,expiry,spent} + watermark[pool][signer][provider]={amount,bytesDelivered}. Capability register-once (owner-signed, EIP-712, SignatureChecker), redeem pays min(cumulative−paid, cap−spent, deposit−totalRedeemed) with partial-on-drain retry, owner-only close + grace-window reclaim. PaymentChannel.sol deleted.
  • Wire (decdn-protocol): voucher is {signature, amount} (cumulative is the ordering/replay key — no nonce); channel_id→pool_id; VoucherAck deleted (acceptance is implicit; only rejection is signaled); reject-reason set reshaped; StreamRequestExt carries the owner capability at session start.
  • incentive / client-pull / node / cli: EIP-712 voucher {poolId,signer,provider,amount,bytesDelivered} + owner-signed Capability; per-(pool,signer,provider) lane acceptance + PoolStateStore; near-stateless self-signing client (regenerates its capability, prices cumulative = received_bytes × rate); node redeem/redeemMany + register-once + PoolRedeemed watermark watcher + close monitor; refundable floor M serving policy; decdn pool open/top-up/close/reclaim CLI.

Two design refinements (agreed during implementation, canonized in ADR 003/016)

  • redeemMany(capabilities[], vouchers[]) — two arrays (register a batch, then redeem a batch), decoupling registration from any single voucher; uncovered-signer vouchers skip. Single redeem keeps its inline capability.
  • On-chain bytes regression settles the money, credits zero bytes — a voucher whose bytesDelivered regresses still pays (the signer signed the cumulative amount; the node can't renegotiate), forfeiting only the served-bytes/vote-weight for that delta, which recovers on a later voucher. Money axis independent of the vote axis; no bytes-regression DoS.

Validation

  • anvil-e2e paid path validated end-to-end on a real chain: anvil_pool_redeem (pool open → capability delivery → serve → voucher → on-chain redeem: capability-registration-on-first-use then voucher-only), plus coalesce_two_clients, cli_fetch_topup/resume, cli_bundle_pull_pool_id, smoke.
  • All CI gates green: contracts 808 tests; Rust nextest 2753; clippy 0 warnings; fmt; cargo deny; anvil-e2e compiles; pre-commit.
  • Final whole-branch review confirmed fund conservation, EIP-712 interop, and the key invariant node-accepts ⊆ contract-redeems (the node never serves what the contract would reject — rate floor is the exact same integer inequality on both sides).

Deferred follow-ups (non-blocking; tracked)

  • ERC-1271/Safe owner capability verification is EOA-only off-chain (fail-closed; the contract still honors ERC-1271 owners) — matches the deferred-Safe-signer stance.

🤖 Generated with Claude Code

alpergundogdu and others added 30 commits August 12, 2026 15:19
…er scaffold

Adds PaymentPool (ADR 003 / ADR 016) as the shared-pool replacement for the
pairwise PaymentChannel: Pool/Authorization/Lane storage, the EIP-712
Capability/Voucher typehashes, and the openPool/topUp lifecycle with
measured-balance-delta crediting. redeem/redeemMany/close/reclaim land in
later tasks. Deletes PaymentChannel.sol and its test file per the pre-launch
no-compat-shim policy.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… NatSpec

Removes governance setters (setDisputeWindow, setRateBounds), views
(getAuthorization, getRateBounds), and their events (FeeRouterUpdated,
DisputeWindowUpdated, RateBoundsUpdated) that leaked into the Task 1
skeleton — they belong to Task 4 with their own tests. Also drops a
dangling PaymentChannel cross-reference and a stale settleChannel/
SignatureChecker mention from NatSpec now that PaymentChannel.sol is
deleted and SignatureChecker isn't imported yet.
…lative min(desired,capRoom,remaining) + rate floor

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… register-batch then redeem-batch

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…docs sweep

Verify BaseProtocolDeploy/DeployProtocol wiring for PaymentPool is complete
(construction args, governed-targets set, peer role grants, manifest key),
regenerate .gas-snapshot for the pool surface, and sweep residual
PaymentChannel/channel vocabulary in NatSpec, comments, and README to
present-tense PaymentPool vocabulary.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Replaces the pairwise per-provider BuyerChannelState/BuyerChannelStore with
BuyerPoolState/BuyerPoolStore: one pool (primary-keyed by pool_id, owner as
the reuse index) fans out across per-(signer,provider) lane progress
{last_amount, last_bytes} — no voucher nonce, since the buyer prices
cumulative = received_bytes x rate from its own verified bytes. The redb
table (buyer_pool_table.rs) and buyer-only store (buyer_pool_redb.rs) carry
the same atomic-RMW shape (advance_progress/add_deposit/forget_if_pool CAS)
as before, re-keyed to pool/lane vocabulary, with lanes encoded as a
deterministically-sorted postcard Vec so the golden on-disk bytes stay
stable.
…ias, lane-key activity, pool docs)

Removes the transitional `pub type ChannelId = B256` alias from lane.rs in
favor of `PoolId`; re-keys voucher_activity.rs's per-channel clock to
LaneKey (pool_id, signer, provider); rewrites lib.rs's module doc in
present-tense pool vocabulary (openPool/topUp/redeem/redeemMany/
closePool/reclaim) and updates its re-exports; and renames
channel_open_error.rs -> pool_open_error.rs
(ChannelOpenFailureReason -> PoolOpenFailureReason), retargeting the
openChannel revert-classification doc/metrics to openPool. StoreError's
`channel_id` field renames to `pool_id` (PoolId) since the buyer table is
its only user.
Cumulative drops nonce; PoolLedger commits optimistically on send (the send
is the commit) and rewinds one step on resolve_reject. Deletes resolve_ack
and the ack-driven pipeline model.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
PoolContext replaces ChannelContext (pool_id/provider/signer, no nonce/token).
receive_and_pay + UpstreamPull drop the VoucherAck arm: a mid-stream StreamError
is the only feedback (VoucherRejected -> resolve_reject + self-heal bundle, else
UpstreamRefused). send_voucher signs the pool voucher; resumable_watermark /
genuine_exhaustion re-typed to amount + CapExceeded. driver/source re-typed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
buyer_channel.rs -> buyer_pool.rs: open_pool(deposit) names no provider/signer,
decodes PoolOpened, issues a self-owned SignedCapability; top_up(contract,
pool_id, additional); ensure_allowance/refill_amount kept. Deletes
cooperative_close.rs (no cooperative close).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
alpergundogdu and others added 3 commits August 13, 2026 03:37
Renames the admin RPC surface from channel- to pool/lane-era vocabulary:
`ChannelSnapshot`/`ChannelsResponse` -> `LaneSnapshot`/`LanesResponse`,
`channel_id` -> `pool_id` (it always held the pool id, never a per-lane
id), `ChannelStatusHandles` -> `LaneStatusHandles`, the `channels` RPC
method/CLI command -> `lanes`, across decdn-common's AdminRpc trait, the
node handler impl, and the `decdn node lanes` CLI command + tests +
e2e fixtures. Drops the two DTO fields (`last_nonce`, `deposit_micro_usdc`)
down to accurate always-zero docs, since the shared-pool model tracks
neither per lane.

Renames the deployment manifest key `PaymentChannel` -> `PaymentPool`
(matching what DeployProtocol.s.sol emits) in both copies of
deployments/421614.json and the CLI's known_chains.rs reader/renderer.

Sweeps remaining `PaymentChannel`/pairwise-channel prose in doc comments,
config docs, CLI help text, and operator-facing rotate-key output to
present-tense pool/lane vocabulary, including two comments that pointed at
retired contract internals (`_advanceClaimWatermark` -> `_redeemVoucher`,
`Channel` struct -> `Pool` struct) and several "unlike the pre-pool
model" changelog-voice comments rewritten to plain present tense.

Leaves untouched: stream_sig.rs's `channelId` (ADR-014-FROZEN SlashJudge
EIP-712 field), QUIC/transport and Rust channel-primitive uses of
"channel", swap-venue `poolId`, and crates/node/src/channel_store.rs's
module/type names (storage-layer internals, a separate rename surface).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ader rename

Missed in the prior vocabulary-sweep commit: two test assertions still
checked for the literal "CHANNEL" header string after the table column
was renamed to LANE.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…name

cargo doc --document-private-items -D warnings (the pre-commit cargo-doc
hook) flags several links this branch's payment-pool rewrite left stale:
BuyerChannelService -> BuyerPoolService (the type was renamed but this
doc link wasn't), a channel-era top-up doc block in client-pull/source.rs
rewritten in present tense with a working reference, and delinked
mentions of private items (CAPABILITY_TABLE, WatcherHandle) that only
resolved locally under --document-private-items. Also fully-qualifies
two LaneState doc links in payment_settlement.rs that were unresolvable
without decdn_incentive in scope.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 13, 2026 06:47

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

alpergundogdu and others added 5 commits August 13, 2026 08:04
Add CapabilityGrant, a self-contained transferable encoding of a pool
owner's SignedCapability: dcap1: + base64url(postcard(grant)). The owner
issues it; a delegated client decodes it, rebuilds the SignedCapability,
and presents it to the serving node for signer registration.

Make postcard a non-optional incentive dependency (the codec runs on
every build; decdn-protocol already links it) and add the base64
workspace dependency.

Pre-commit skipped: the tree carries an unrelated concurrent-session
node-crate refactor (unformatted metrics.rs) that fails the workspace-wide
cargo fmt hook; this commit stages only incentive/codec files.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…cabulary

Renames the shared-pool-era Prometheus metric names in crates/node/src/metrics.rs
and their emit call sites to pool/lane vocabulary: decdn_channels_open ->
decdn_lanes_open (it counts open (pool, signer, provider) serve lanes),
decdn_channel_deposit_usdc -> decdn_pool_deposit_usdc, the
decdn_channel_open_failures_* family -> decdn_pool_open_failures_* (plus the
aggregate decdn_node_pull_channel_open_failures_total ->
decdn_node_pull_pool_open_failures_total), decdn_node_pull_channel_open_pending_total
-> decdn_node_pull_pool_open_pending_total, decdn_node_pull_channel_wedged_total ->
decdn_node_pull_pool_wedged_total, decdn_buyer_channel_store_skipped_undecodable_records_total
-> decdn_buyer_pool_store_skipped_undecodable_records_total, and
decdn_serve_stream_rejected_unknown_channel_total ->
decdn_serve_stream_rejected_unknown_lane_total.

Removes decdn_node_pull_channel_retired_total and
decdn_node_pull_channel_retire_failure_total: both described a channel-retirement
behavior (dropping a buyer row on a settled CooperativeClose) that has no emit
site under the pool model, where a pool is owner-closed and the node never
retires a row on settle.

Updates the metric-name assertion tests in metrics.rs, client_loopback.rs, and
node_origin_pull.rs, the monitoring/grafana-dashboard.json panels and queries,
and the metric catalog in adr/appendix-observability.md and
adr/appendix-operator-key-rotation.md to match. No external dashboards consume
these names, so this is a clean rename with no compatibility shim.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… pool+capability

Add `decdn pool assign`: the pool owner signs an EIP-712 Capability
delegating a bounded spend to a delegate signer key and prints the
`dcap1:` token to hand off (human summary + token line; best-effort
on-chain owner warning; offline-capable).

Teach `decdn fetch` / `bundle pull` to adopt a delegated pool via
`--capability`/`--capability-file`: decode the token, hard-require the
loaded key to be the authorized signer, build the PoolContext against the
named pool with the owner capability attached (no open, no self-cap), and
disable reactive top-up (a delegate cannot topUp an owner's pool). A
terminal CapExceeded is reconnected to the owner-side remedy. The
self-owned path is unchanged.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.61% (2528/2821 lines)
▼ -0.45pp vs base (90.07% → 89.61%)
Run: 31716784101

alpergundogdu and others added 5 commits August 13, 2026 10:00
… clippy in e2e tests

- public-api snapshot picks up StreamRequestExt.capability + WireCapability.
- all-features clippy compiles the anvil-e2e-gated e2e tests that --all-targets
  skipped: inline format! args, doc backticks, and #[allow(similar_names)] on the
  a/b per-client coalesce bindings.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ll clock

The reclaim sweep's grace-window pre-check compared `pool.disputeDeadline`
(chain time, set by `closePool` from `block.timestamp`) against the node's
wall clock (`unix_now()`). The two clocks agree on a live L2, but they diverge
whenever chain time is warped independently of wall time, so the pre-check
could skip a reclaim whose on-chain grace window has in fact elapsed. Read the
chain head timestamp via the provider instead, matching the
`block.timestamp >= disputeDeadline` gate the contract enforces on `reclaim`.
A head-read failure leaves the check optimistic (attempt the reclaim; the
contract is the authoritative backstop).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ean pull

The serve leg's coherent encoder reads leaf data through `AwaitingDataReader`,
which awaits the concurrent pull filling the cache and races the pull's terminal
signal for the no-hang guarantee. A session goes "not live" the instant its pull
records a terminal outcome (`is_dead() == outcome().is_some()`), so when a pull
ends the reader takes the terminal branch and, after a SINGLE present-range
re-check, fails any leaf it still finds missing.

That single re-check is a TOCTOU. A clean pull admits every byte before it marks
ended, but the store's observed bitfield (read via the iroh-blobs store actor)
can lag the admit's completion by a scheduler hop. Under a slow schedule
(contended cores, coverage instrumentation) both present-range checks can miss
the just-admitted final leaf, so a serve whose bytes are in fact cached aborts
mid-stream and the client sees an early eof. Two disjoint concurrent own-origin
misses each own their fill, so each hits this on its own final leaf.

Gate the terminal decision on the outcome: a clean pull (`Ok`) provably admitted
the bytes, so re-poll presence over a bounded settle window before concluding
absence; a failed / abandoned pull (`Err` / `None`) can never make the byte
present, so keep failing fast with no settle. No hang (the settle is bounded) and
no delay on the happy path (the first present check still short-circuits).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…instead of a tight settle

The serve leg's coherent encoder reads leaf data through `AwaitingDataReader`,
which awaits the concurrent pull and races the pull's terminal signal for the
no-hang guarantee. A session goes not-live the instant its pull records a
terminal outcome (`is_dead() == outcome().is_some()`), so on a clean pull the
reader takes the terminal branch and, previously, failed any leaf the observed
bitfield did not yet show present (a single re-check, then a short bounded
settle). That settle was timing-tuned: under the coverage-instrumented workspace
run the store actor's observed bitfield can lag the admit completion past any
fixed millisecond window, so a serve whose bytes are in fact cached aborted
mid-stream and the client saw `early eof`.

Make it timing-INDEPENDENT. A clean outcome GUARANTEES the pulled range was
admitted to the store, so a not-yet-present read is only the observed bitfield
lagging the admit — never a missing byte. On a clean outcome, WAIT for the
observed range to appear (await the present-range watch, re-opening it when it
closes on completion) instead of giving up after a fixed window; this resolves
under any scheduler speed. Bound it by a generous ceiling
(`CLEAN_PULL_PRESENT_CEILING`, 15s) a clean pull is never expected to reach, so a
pathological permanent lag still surfaces an error rather than hanging. A failed
or abandoned pull (`Err` / `None`) can never make the byte present, so it keeps
failing fast with no wait.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…lagging present bitfield

The serve leg's coherent encoder reads leaf data through `AwaitingDataReader`.
When the covering pull ends and the reader still finds the range not-present, it
decides on the pull's outcome. On a CLEAN outcome the range was admitted to the
store before the pull marked ended, so the bytes are durably stored — the
authoritative ranged read (`export_range`) returns them.

The reader instead re-gated that clean case on `present_covers`
(`missing_ranges` → the store actor's `observe` bitfield) and waited for it to
show present, bounded by a 15s wall clock. That bitfield is a separate
notification from the durable write: when the single per-cache store-actor thread
is starved of CPU — a slow, coverage-instrumented run — the observed bitfield
lags the admit past the ceiling, so the serve aborts mid-stream on bytes that are
in fact readable and the paying client sees an early eof. Every prior attempt
tuned that same present-poll (a 100ms settle, then a 15s await) and stayed on the
lagging bitfield.

Read straight from the store on a clean outcome. The decision now rests on the
pull's terminal outcome, never a wall clock, so it is timing-independent: a clean
pull is proof the range is readable, and the durable read has no observe lag. The
no-hang guarantee is unchanged — a failed or abandoned pull still fails fast, and
the live-fill path still races the present-range watch against the pull ending.
This deletes `await_present_after_clean_pull` and `CLEAN_PULL_PRESENT_CEILING`,
superseding the 100ms-settle and 15s-await attempts.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
alpergundogdu added a commit that referenced this pull request Aug 13, 2026
…early-eof (#1673) (#1674)

* diag(node): capture-on-failure logging at serve-miss close/teardown sites (#1673)

Local reproduction of the flaky serve-miss coalescing tests is effectively
impossible (they need the CI runner's coverage slowdown + full-workspace actor
starvation), so instrument first and read the failure site from CI evidence
rather than tune another timeout — three prior timeout-axis attempts on PR #1667
prove that axis is wrong.

Adds `eprintln!("DIAG#1673 …")` at every abnormal serve-miss exit. `nextest`
surfaces a FAILING test's captured stderr, so these stay silent on green runs and
fire only on the failing CI job, pinning the exact server-side close site + reason
behind the client's `read frame: early eof`:

- serve_leg.rs — first-frame fault, mid-stream write failure, mid-range
  next_frame fault, voucher-collect error, voucher-rejected stop, takedown
  termination, the no-progress guard (prime suspect: stops WITHOUT StreamEnd),
  and the clean StreamEnd marker (so a failing job shows which leg reached the
  end and which closed early). Each records hash + delivered/paid + pull outcome
  + observer count + cancelled.
- serve_encoder.rs — the AwaitingDataReader dead-range close (the deepest leaf
  coverage failure that becomes the serve leg's next_frame error).
- fill_session.rs — the outboard-reader dead-range close, and the last-out lease
  cancelling a still-running pull (unexpected teardown ordering under starvation).
- pull_leg.rs — how the paid and local pull legs terminated (cancelled / refused
  / origin fault), to correlate a serve close with a pull that died vs stayed live.
- window.rs — the owner-without-target and pull-thread spawn/runtime-build
  failure mark_ended(Err) paths.

Diagnostic only; no behavior change. Remove once #1673 is root-caused from CI.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(node): close the window-pause lost-wakeup that wedged the pull leg (#1673)

The peer/local pull leg's `ServedPaidWait` is edge-triggered on the shared
`served_paid_advanced` `Notify`. The driver reads the served-paid frontier when it
builds `PaceState`, the `WindowPacer` decides `Wait`, and only THEN does the driver
call `hook.wait()` to register the `notified()` waiter. `Notify::notify_waiters`
stores no permit, so a serve-leg `served_advanced().notify_waiters()` that lands in
the gap between the decision's frontier read and the park wakes nobody — the pull
parks forever and the whole serve wedges. Wider scheduling gaps under CI
coverage-starvation are exactly what open that window, which is why
`window_pull_through_serves_and_caches_full_blob` (a 1.5 MiB blob that pauses at the
~1 MiB window) hangs on the runner but never on fast local cores — the second
flaky-test class in #1673.

Fix (register-before-recheck, the canonical edge-trigger pattern already used by the
serve encoder's outboard/data readers): `PacingWait::wait` now takes the frontier
value the decision was computed from, and `ServedPaidWait` arms the `notified()`
waiter, THEN re-reads the live frontier — if it already moved past `observed`, the
advance we would wait for has already happened, so re-decide at once instead of
parking on a notify that will never repeat. Any advance after the arm wakes the
registered waiter. No timeout tuning.

- crates/client-pull/src/driver.rs — `PacingWait::wait(&self, observed: u64)`; the
  `Wait` arm passes `state.served_paid_frontier`. Test hooks updated.
- crates/node/src/node_origin/pull_leg.rs — `ServedPaidWait` gains the live
  `served_paid` atomic and the arm-then-recheck body; both construction sites pass
  `session.served_frontier()`. Adds `served_paid_wait_tests`: a deterministic
  regression that fires the advance+notify BEFORE the park (wedges on the old code,
  returns on the fix) plus the ordinary park-then-wake path.
- .config/nextest.toml — slow-timeout terminate-after 600s, so a residual hang
  surfaces as a readable per-test TIMEOUT failure carrying its captured stderr (the
  `DIAG#1673` close-site logging), instead of silently wedging the whole job until
  the runner-level timeout kills it with no attribution.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* ci: re-trigger CI run (#1673, #1674)

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* ci: TEMPORARY — run on github-hosted ubuntu-24.04 (Blacksmith capacity stall)

Blacksmith (`blacksmith-4vcpu-ubuntu-2404`) is not picking up jobs — every job,
including trivial ones, wedges in `queued`. Swap all `runs-on` to github-hosted
`ubuntu-24.04` so the #1673/#1674 CI (window-pause hang fix + serve-miss
diagnostics) can actually run. The only Blacksmith dependency was the runner label
itself (no `useblacksmith/*` actions; mold + cargo tools are installed by steps),
so this is a clean mechanical swap.

DO NOT MERGE this commit — revert to `blacksmith-4vcpu-ubuntu-2404` before the PR
lands. GitHub-hosted runners are 2 vCPU (vs 4) and bill Actions minutes; this is
only to unblock the stuck queue.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Revert "ci: TEMPORARY — run on github-hosted ubuntu-24.04 (Blacksmith capacity stall)"

GitHub-hosted runners don't schedule for this org either (runs sit `pending` with
zero jobs, `updated_at == created_at` — github-hosted is disabled / $0 spending
limit), so the swap cannot unblock CI. Restore `blacksmith-4vcpu-ubuntu-2404` so the
branch is correct and will run automatically once the Blacksmith outage clears.

This reverts the runner-label swap; the #1673/#1674 code (window-pause hang fix +
serve-miss diagnostics + nextest terminate-after) is unaffected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* ci: TEMPORARY — run on github-hosted ubuntu-24.04 (Blacksmith outage)

Blacksmith is in a major outage. GitHub-hosted budget IS enabled for the org; the
earlier github-hosted attempt only stalled because it was queued behind the
un-cancellable stuck Blacksmith run in the `ci-${{ github.ref }}` concurrency group.
With the old runs force-cancelled the group is clear, so github-hosted schedules.

DO NOT MERGE — revert to `blacksmith-4vcpu-ubuntu-2404` before the PR lands. Only to
unblock #1673/#1674 CI during the outage.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(cache): disable origin idle-connection pooling to fix cross-runtime crash (#1673)

CI evidence (the coverage `test` job on this branch) pinned the disjoint serve-miss
`early eof` — `two_concurrent_disjoint_own_origin_misses_two_fetches_no_wedge` — to an
origin HTTP fault, not a coalescing/teardown bug:

  DIAG#1673 local_pull_leg.ended hash=3eb0463… err="origin GET …(range) failed:
    … client error (SendRequest): dispatch task is gone: runtime dropped the dispatch task"
  DIAG#1673 outboard_reader.dead_range node=TreeNode(127) pull_outcome=Some(Err(… dispatch task is gone …))
  DIAG#1673 serve_leg.first_frame hash=3eb0463… err=coherent range encode failed … upstream pull failed
  DIAG#1673 serve_leg.stream_end_ok hash=43e396…   ← the OTHER disjoint serve completed cleanly

Root cause: `HttpOrigin` holds ONE shared `reqwest::Client` (cloned across serves), and
reqwest keeps a per-host idle keep-alive pool whose hyper dispatch task is pinned to the
runtime that first drove it. Each own-origin serve-miss pull leg runs on an EPHEMERAL
per-serve current-thread runtime that `serve_via_backend_origin` drops the moment that
serve finishes. So a connection first opened on serve A's runtime, pooled, and reused by
concurrent serve B dies when serve A completes and its runtime is dropped — failing B's
in-flight GET with "dispatch task is gone", which the paying client sees as `early eof`.
CI coverage-starvation widens the drop-while-in-flight window; fast cores almost never
hit it, matching the CI-only flakiness.

Fix: `pool_max_idle_per_host(0)` on the origin client — no idle connection is ever
retained, so none is reused across runtimes; each serve opens its own connection on its
own runtime and a finishing serve's teardown can never strand another's request. Own-origin
pulls fetch few, large ranges, so the per-request handshake cost amortizes over big
transfers. Correctness fix, not tuning.

The window-pause lost-wakeup fix (prior commit) is confirmed by the same CI run: 2742
passed, `window_pull_through_serves_and_caches_full_blob` no longer hangs. The DIAG#1673
instrumentation is kept one more CI cycle to confirm this fix turns the disjoint test
green under coverage, then removed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* diag(node): remove DIAG#1673 instrumentation now both flakes are root-caused (#1673)

The capture-on-failure `DIAG#1673` eprintln logging (serve_leg, serve_encoder,
fill_session, pull_leg, window) did its job: the coverage `test` job's captured
stderr pinned the disjoint serve-miss `early eof` to reqwest's "dispatch task is
gone" cross-runtime connection reuse. Both #1673 flakes are now fixed (the
window-pause lost-wakeup and the origin idle-pool crash) and confirmed green under
coverage instrumentation, so the instrumentation is removed as promised.

Kept: both fixes, the `served_paid_wait_tests` regression, and the nextest
`terminate-after` safety net. Also cross-references the origin-pooling workaround to
its tracking issue #1675.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Revert "ci: TEMPORARY — run on github-hosted ubuntu-24.04 (Blacksmith outage)"

Restore `runs-on: blacksmith-4vcpu-ubuntu-2404` on all jobs. The github-hosted swap
was only to get #1673/#1674 CI results during the Blacksmith outage; both fixes are
confirmed green, so the branch goes back to the normal runners (which also restores
the warm rust-cache the github-hosted runs couldn't reach).

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
@github-actions

Copy link
Copy Markdown

Coverage report

Total: 80.83% (was 80.59%, ▲ +0.24%) — 59650/73795 lines

File Coverage Lines Δ
crates/cli/src/commands/bundle_pull.rs 50.55% 459/908 ▲ +0.76%
crates/cli/src/commands/channel.rs — — deleted
crates/cli/src/commands/config.rs 85.71% 534/623 ▼ 0.68%
crates/cli/src/commands/fetch.rs 31.00% 323/1042 ▼ 8.64%
crates/cli/src/commands/node.rs 77.47% 1176/1518 ▼ 0.04%
crates/cli/src/commands/pool.rs 57.06% 303/531 new
crates/cli/src/commands/rotate_key/iroh.rs 62.91% 485/771 ● 0.00%
crates/cli/src/known_chains.rs 86.75% 72/83 ● 0.00%
crates/cli/src/main.rs 64.10% 25/39 ▼ 3.40%
crates/client-pull/src/buyer_channel.rs — — deleted
crates/client-pull/src/buyer_pool.rs 53.68% 153/285 new
crates/client-pull/src/cooperative_close.rs — — deleted
crates/client-pull/src/driver.rs 95.78% 771/805 ▲ +0.05%
crates/client-pull/src/ledger.rs 99.42% 345/347 ▼ 0.36%
crates/client-pull/src/lib.rs 89.76% 1473/1641 ▼ 0.02%
crates/client-pull/src/source.rs 90.34% 262/290 ▼ 0.03%
crates/common/src/address.rs 100.00% 32/32 ● 0.00%
crates/common/src/admin.rs 94.74% 126/133 ▼ 0.04%
crates/common/src/cli/fetch.rs 97.67% 168/172 ▼ 2.33%
crates/common/src/cli/mod.rs 100.00% 3/3 ● 0.00%
crates/common/src/cli/node.rs 100.00% 5/5 ● 0.00%
crates/common/src/config/mod.rs 97.10% 6860/7065 ▼ 0.03%
crates/common/src/config/resolved.rs 100.00% 33/33 ● 0.00%
crates/e2e/src/assert.rs 11.82% 13/110 ▼ 7.72%
crates/e2e/src/chain.rs 1.51% 21/1391 ● 0.00%
crates/e2e/src/client.rs 0.00% 0/457 ● 0.00%
crates/e2e/src/node.rs 24.59% 120/488 ● 0.00%
crates/incentive/src/buyer_channel.rs — — deleted
crates/incentive/src/buyer_channel_redb.rs — — deleted
crates/incentive/src/buyer_channel_table.rs — — deleted
crates/incentive/src/buyer_pool.rs 90.17% 376/417 new
crates/incentive/src/buyer_pool_redb.rs 94.25% 164/174 new
crates/incentive/src/buyer_pool_table.rs 90.18% 817/906 new
crates/incentive/src/capability.rs 98.91% 182/184 new
crates/incentive/src/capability_grant.rs 100.00% 113/113 new
crates/incentive/src/channel.rs — — deleted
crates/incentive/src/client_bridge.rs 98.85% 172/174 ▼ 0.06%
crates/incentive/src/coop_close_request.rs — — deleted
crates/incentive/src/cooperative_close.rs — — deleted
crates/incentive/src/lane.rs 96.05% 365/380 new
crates/incentive/src/payment_pool.rs 100.00% 45/45 new
crates/incentive/src/pool_open_error.rs 95.77% 68/71 new
crates/incentive/src/probe_sig.rs 97.46% 230/236 ● 0.00%
crates/incentive/src/rate.rs 95.36% 144/151 ● 0.00%
crates/incentive/src/store.rs 91.35% 169/185 ▲ +0.54%
crates/incentive/src/stream_sig.rs 97.92% 235/240 ● 0.00%
crates/incentive/src/swap_uniswap.rs 65.57% 139/212 ● 0.00%
crates/incentive/src/voucher.rs 99.27% 271/273 ● 0.00%
crates/incentive/src/voucher_activity.rs 100.00% 53/53 ● 0.00%
crates/node/src/admin.rs 95.55% 1180/1235 ● 0.00%

Showing top 50 of 80 changed files — see the workflow Step Summary for the full table.

History
Commit Total Δ vs base
9c14aa4 (HEAD) 80.83% ▲ +0.24%

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.

2 participants