Repository navigation
fix(cli,client): batch fixes for adopted-pool spend, tiny top-ups, stale coverage and dedup slots - #2305
Merged
Conversation
…ns (#2292) A row adopted from chain has no lanes, so the pool's `totalRedeemed` is its only record of what other lanes paid out. Only the adopting run saw it: every later run reused the row as tracked, passed zero as the spend elsewhere, and counted just the lanes recorded since. The proactive refill then read the pool as fuller than it was, and the run's funding baseline undercounted the same spend. `BuyerPoolState` now carries `redeemed_elsewhere`, set from `totalRedeemed` at adoption and persisted at the end of the buyer record (schema v4). `pool_spend` and the lane's `LaneSpend` read it from the row, so every run that reuses the row sees what the adopting run saw. Closes #2292 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on a refill (#2296) Right after a proactive refill restored a pool, a node whose chain watcher had not seen it yet refused the next open as InsufficientDeposit. The driver confirmed an exhaustion, and the pacer topped up the gap to the working deposit: a few micro-USDC, each costing an approve and a topUp transaction and one of the run's three reactive top-ups. Lanes built before the refill also kept the deposit they were built with, so one classed a gap the refill had paid for as unaffordable. - The pacer sends a reactive top-up for a confirmed exhaustion the deposit can still afford only when it adds at least the low water (working / LOW_WATER_DIVISOR), the threshold the proactive refill uses. A voucher the deposit cannot pay still tops up any shortfall. - An InsufficientDeposit refusal while the deposit already sits within that low water of the working target settle-waits on the existing budget before it confirms an exhaustion. - A lane build raises the pool's deposit watch and every started lane's context to the deposit it read, never lowering one, in place of only seeding a zero watch. Closes #2296 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tFound inside it (#2281) A probed partial holder that refused a range its own coverage claimed was never counted: the answer was a delivery fault only, so the holder cooled for a few seconds and was asked for the same range again, for as long as the item ran. On the testnet one node refused 108 ranges inside its advertised coverage in one batch, each followed by a stalled remainder. Such a refusal now counts against every discovery block the refused range touches. The node refuses the whole range at its first chunk it does not hold and does not say which chunk that is. A block refused ABSENT_AFTER_NOT_FOUND times leaves the holder's coverage for the rest of the blob, and a rediscovery that repeats the stale claim does not bring it back. The acquire loop mirrors the narrowed coverage into its per-lane view, so the block's ranges go to the other sources. Once the block is outside the coverage, the pull-through bar from #2263 bounds any further asks. Closes #2281 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…donor (#2283) A range-dedup entry held its --jobs permit after its complement landed, while it only waited for the sibling fetch that registers its donor chunks. A waiter moves no bytes, yet it kept a queued entry from fetching. On an SDXL pull with --jobs 5, two or three such waiters held the run to 2-3 downloading entries for minutes at a time. Two caps both equalled --jobs: the gate semaphore and run_groups' buffer_unordered width. Every group is now in flight at once and waits in start order for a FetchSlot of the gate, the one cap, taken before its file bar. The dedup reconcile gives the slot back just before it waits for a donor registration, and every drive (complement, donor re-fetch, deferred fallback, self-heal) takes one again first. No wait happens while a permit is held, so the change cannot deadlock. Closes #2283 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Record schema 4 appends `redeemed_elsewhere` (#2292). The reader matches `schema_version` exactly, so under the `_v5` tables a row an older binary wrote fails a point lookup, and `decdn fetch` fails with it. Under `_v6` the old table reads as absent: the store starts empty, and a node or client re-adopts its live pool from chain, now with its redeemed spend. Records the four batch fixes in CHANGELOG.md. Refs #2292 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Adopted-pool accounting still undercounts spend, and node adoption plus covered extra-stream refusal handling remain incomplete.
Review effort: Balanced
Findings: 3
Open (4)
What changed in this PR
Fixes buyer-pool accounting, reactive funding, stale holder coverage, and bundle-pull concurrency.
Changes:
- Persists adopted-pool redeemed spend with schema v4 tables.
- Avoids tiny top-ups and propagates refilled deposits.
- Drops stale coverage and releases donor-waiter job slots.
| File | Description |
|---|---|
crates/incentive/src/buyer_pool.rs |
Adds persisted redeemed spend. |
crates/incentive/src/buyer_pool_table.rs |
Introduces schema v4 and _v6 tables. |
crates/common/src/cli/bundle.rs |
Updates --jobs documentation. |
crates/client/src/source_set.rs |
Tracks refused covered blocks. |
crates/client/src/scheduler.rs |
Synchronizes coverage and deposits. |
crates/client/src/pacer.rs |
Adds a reactive top-up minimum. |
crates/client/src/ledgers.rs |
Raises deposits across lane contexts. |
crates/client/src/driver.rs |
Waits for stale deposit watchers. |
crates/cli/src/commands/pull_progress.rs |
Documents donor-waiter bars. |
crates/cli/src/commands/fetch.rs |
Uses persisted adopted-pool spend. |
crates/cli/src/commands/bundle_pull.rs |
Releases and reacquires fetch slots. |
CHANGELOG.md |
Records user-visible fixes. |
adr/appendix-bundles.md |
Updates bundle concurrency semantics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit a7b2acd in the Show a line coverage summary of the most impacted files.
Updated |
…s lanes advance (#2292) Keeping `totalRedeemed` as a floor under the tracked lanes' sum lost spend once a tracked lane advanced. With 100 redeemed, 60 of it on lane A, A advancing to 80 read as max(80, 100) = 100, while the pool had spent 120. `redeemed_elsewhere` is now the redeemed spend no tracked lane accounts for. Seeding a lane from its on-chain watermark (`seed_lane`, and `BuyerPoolStore::seed_progress` in one write) records the lane and takes its amount out of that remainder, so `BuyerPoolState::pool_spend` is the tracked lanes plus the remainder, and stays right as the lane advances. `decdn fetch` seeds a lane it resumes from chain before it reads the spend. The node adopts with `totalRedeemed`, seeds through `seed_progress`, and its low-water refill reads `pool_spend`. Without this, the `_v6` move would re-adopt every node's pool with no spend counted at all. Refs #2292 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…m refusals (#2281) A covered NotFound is not proof of absence: load shed and a stale chain view reach the client as the same wire NotFound. A dropped block now returns after PULL_THROUGH_BAR, with its count restarted, and a count whose last refusal is that old starts again, so sparse transient refusals never add up. Rediscovery keeps a block out only until its drop ends. A NotFound for a covered range on an extra stream now counts too: the scheduler passes every extra-stream refusal to `record_extra_refusal`, which splits covered from uncovered itself. Refs #2281 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cing out or dropping a source (#2296, #2281) Review of #2305: - A source that keeps refusing a deposit near the working target past its own settle budget faults as `StaleDepositView`, classified as a source fault, with one WARN. It used to fall through to a confirmed exhaustion that the pacer floor refuses, which read as PoolExhausted and barred the source until a deposit rise no top-up brings. The budget is separate from the post-top-up settle budget and re-arms on a landed leg; its waits log. - An extra stream's covered NotFound is not counted again: a node's per-signer live cap, which extra streams hit, refuses as plain NotFound. - Covered refusals count from the refused part of a range (after its landed bytes), once per cooldown, and a verified byte in a block clears its count. A probe that reports a holder as whole ends its block drops, so a drop's end cannot make it partial again. - `raise_to_lane` recovers a poisoned context like its siblings. - Tests for the stale-view fault, the burst and served-byte rules, a whole-holder merge, `Work::set_coverage` restore, a raise that never lowers, and `LaneLedgers::raise_all`. Refs #2296 Refs #2281 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…2283) Review of #2305: a waiter whose donors arrived without a fallback drive finished with its slot still released, so its splice, whole-file hash and materialize ran outside --jobs. The donor wait now gives the slot back only across the wait (`RangeDriver::retake_slot`). A slot taken again would otherwise queue behind every group still to start. `JobGate` adds an admission queue for new groups' first permit, so a retake waits behind at most the one admitted group. `FetchSlot::ensure` keeps the first permit if two ever race. Refs #2283 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd retry a seed on a moved row (#2292) Review of #2305: - `BuyerPoolState::adopt` builds an adopted row with its `totalRedeemed`, and `hydrate` takes the stored `redeemed_elsewhere`, so no caller can drop it. The free setter is gone. - The CLI lane seed fails the build when the row was forgotten or replaced, rather than pricing the lane or escrowing a refill against a row the store no longer holds, and resumes from the row when another run already moved past the watermark. - Node tests: an adopted drained pool keeps its redeemed spend and its refill fires; a lane seeded on an adopted row counts its watermark once. - Docs: the buyer record's suffix rule, `committed_amount` vs `pool_spend`, the lane mutators, LaneSpend, the node reseed and refill, and CHANGELOG for the review fixes. Refs #2292 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 5, 2026
7 tasks done
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.


What
Four
cli-area fixes from the testnet SDXL/Whisper bundle-pull batches. There is one commit per issue, plus one for the buyer-table bump and the CHANGELOG.BuyerPoolStatestoresredeemed_elsewhere(buyer record schema 4): the pool'stotalRedeemedat adoption, less the watermark of each lane seeded since (seed_lane/BuyerPoolStore::seed_progress).BuyerPoolState::pool_spend()is the tracked lanes plus that remainder, so it stays right as a seeded lane advances. The CLI seeds a lane it resumes from chain. The node adopts withtotalRedeemed, seeds throughseed_progress, and refills onpool_spend().BudgetPacertops up a confirmed exhaustion that the deposit can still afford only when the top-up adds at least the low water (working /LOW_WATER_DIVISOR). A voucher the deposit cannot pay still tops up any shortfall.InsufficientDepositrefusal while the deposit already sits within that low water of the working deposit. That refusal is the node's stale watcher.NotFoundfrom a probed partial holder now counts. The refusal counts against every discovery block the refused range touches, because the node does not say which chunk it lacks. AfterABSENT_AFTER_NOT_FOUNDrefusals, the block leaves the holder's coverage for the rest of the blob, and a rediscovery does not restore it. The acquire loop mirrors the coverage intoWorkviaset_coverage, and the fix(client,node,cli): bar refused pull-through, refuse over-ceiling ranges, heal stale under-fold, hold expiry margins #2263 pull-through bar bounds any further asks.--jobsslot. Two caps both equalled--jobs: the gate andrun_groups' fan-out width. Now every group is in flight and waits FIFO for aFetchSlotof the gate, taken before the file bar.reconcile_deferredgives the slot back before it waits for a donor, and eachRangeDriver::drivetakes it again.Closes #2292
Closes #2296
Closes #2281
Closes #2283
Reviewer notes
Buyer tables move to
_v6(BREAKING, CHANGELOG entry). The schema-4 record appends a field, but the reader matchesschema_versionexactly. Under_v5, a v3 row would failget_by_ownerand fail the fetch. Under_v6, old rows read as absent, and the client or node re-adopts its pool from chain, now with its redeemed spend. This follows buyer pool row's deployment tag carries no chain id #2198.client: a partial holder that refuses NotFound inside its advertised coverage is asked again every 3 s (follow-up to #2262) #2281 granularity and decay. The refusal carries no chunk, so a refused range counts against every block its refused part (after
landed) touches. WireNotFoundalso covers load shed, a stale chain view and the per-signer live cap (as in fix(client,node,cli): bar refused pull-through, refuse over-ceiling ranges, heal stale under-fold, hold expiry margins #2263), so:PULL_THROUGH_BARwith its count restarted;Covered refusals on extra streams do not count, because the per-signer cap is what extra streams hit.
bundle pull: a range-dedup entry holds its --jobs permit while it waits for a donor, so only 2 of 5 fetches run #2283 slot scope and order. A waiter gives its slot back only across the donor wait (
release_slot/retake_slot), so the splice, the whole-file hash and the materialize stay under--jobs.JobGateputs new groups' first permit behind an admission queue, so a retake waits behind at most one admitted group, not the whole bundle. Nothing waits while it holds a permit, so the change cannot deadlock.client: right after a proactive refill, the pacer sends reactive top-ups of a few µUSDC (approve + topUp each) #2296 node impact and stale views.
BudgetPaceris shared with node pacers. The new floor applies only to theexhaustion_confirmed && affordablebranch; the seller-floor band (step 2b) is unchanged. A source that keeps refusing a deposit near the working target past its own settle budget faults asStaleDepositView(Fault::Source, one WARN). It does not end asPoolExhausted, which would bar the source until a deposit rise that never comes.Not in this batch: cli, client: log typed RPC errors through sanitize_error_sources so the failure class survives #2277 (blocked on fix(node): bound admit-path chain reads and keep the RPC failure class in logs #2278) and Multi-RPC priority failover: blockchain.rpc_urls with sticky fallback #2156 (feature).
Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemscargo nextest run -p decdn-incentive -p decdn-client -p decdn-cli -p decdn-node: all pass.--features anvil-e2e):cli_bundle_pull_range_dedup,cli_fetch_topup,node_pull_topup,anvil_pool_redeem,node_pull_pool_adopt,node_pull_pool_redeploy,node_to_node_coalesce,cli_fetch_delegatedandsmoke, 21/21 pass.a_reused_adopted_row_keeps_the_pools_redeemed_spenda_confirmed_exhaustion_below_the_low_water_shortfall_refusesan_unaffordable_voucher_tops_up_even_a_small_shortfallan_insufficient_deposit_refusal_at_the_working_deposit_settle_waitsa_refill_a_later_lane_build_made_raises_the_running_lanesthree_covered_refusals_drop_the_block_from_a_partial_holders_coveragesparse_covered_refusals_never_drop_a_blockpool_spend_keeps_an_adopted_pools_redeemed_spend_as_its_lanes_advanceseed_progress_moves_a_new_lanes_watermark_out_of_the_redeemed_spenda_partial_holder_refusing_a_covered_block_loses_it_from_its_coveragea_donor_waiter_gives_its_slot_to_a_queued_entry_and_retakes_it_to_driveCHANGELOG.mdentries added.adr/appendix-bundles.mdconcurrency note updated.🤖 Generated with Claude Code