Repository navigation
fix(client,node): heal a chain-seeded lane's BytesRegression by rebasing to the seller's anchor - #2313
Merged
Conversation
…ing to the seller's anchor A buyer-table schema bump starts the node's buyer store empty. Bootstrap adopts the on-chain pool with no lanes, and each lane seeds from getWatermark on its first use. That seed counts redeemed vouchers only, so it sits below any voucher the provider holds unredeemed. The ledger prices its spans from the lower seed: its amount passes the provider's anchor while its bytes still trail it, and the provider rejects BytesRegression with its watermark bundle. heal_watermark_desync took no heal for that reason, so the drive ended and node-origin suppressed a healthy provider. Client: - A BytesRegression whose bundle is at or behind the ledger on amount and ahead of it on bytes rebases to the bundle, through the new PoolLedger::rebase_ahead_on_bytes. The bytes test runs under the issuance lock beside the generation test. - A bundle the ledger already covers on both axes retries from the ledger. A BytesRegression with no bundle stays a single-signer fault. - scopes_to_source includes BytesRegression, so a healed rejection past the resume budget cools only that source. Node: - Lane seeds take a per-lane lock and re-read the row under it, so concurrent streams seed a lane once. A replaced row seeds the new pool; a vanished row refuses the pull. - The getWatermark read times out after WATERMARK_READ_TIMEOUT (10 s). ADR 005 documents the BytesRegression rebase, and ADR 003 lists it among the recoveries. Closes #2254 Co-Authored-By: Claude Opus 5.5 <[email protected]>
3 tasks
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Zero-watermark concurrency repeats serialized RPCs, and the seed-lock registry grows without reclamation.
Review effort: Balanced
Findings: 2
Open (4)
What changed in this PR
Adds recovery for chain-seeded lanes rejected with BytesRegression and coordinates concurrent lane seeding.
Changes:
- Rebases buyer ledgers to authenticated seller anchors.
- Adds per-lane seed locking and watermark-read timeouts.
- Updates tests, ADRs, and changelog documentation.
| File | Description |
|---|---|
crates/node/src/handlers/client/voucher.rs |
Tests bundled regression anchors. |
crates/node/src/buyer_channel.rs |
Coordinates lane seeding and bounds RPC reads. |
crates/incentive/src/buyer_pool.rs |
Documents rebase persistence. |
crates/incentive/src/buyer_pool_table.rs |
Tests byte-ahead rebases. |
crates/client/src/lib.rs |
Implements BytesRegression healing. |
crates/client/src/ledger.rs |
Adds conditional byte-ahead rebasing. |
crates/client/src/fault.rs |
Clarifies terminal rejection behavior. |
crates/client/src/driver.rs |
Scopes exhausted healing to its source. |
crates/client/src/buyer_pool.rs |
Updates progress-write semantics. |
CHANGELOG.md |
Records the user-visible fix. |
adr/005-protocol.md |
Specifies regression recovery. |
adr/003-payments.md |
Updates payment-rejection guidance. |
💡 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 4149571 in the Show a line coverage summary of the most impacted files.
Updated |
…une idle slots Review follow-ups for #2254 (PR #2313): - A zero watermark persists nothing, so each stream queued on a lane's seed lock re-read the chain in turn. The lane's seed slot now carries the first stream's read, and the rest of the queue reuses it. - The seed-lock map kept one entry per lane ever attempted. A SeedTurn guard now removes a lane's slot when the last stream holding it leaves, including one cancelled while it waited. - ADR 003: keep the BytesRegression qualifier on the rebase action, not on UnderFold's fold. - ADR 005: a current-generation BytesRegression rebases again, as an Underpaid does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
The investigation answers the three questions in #2254.
1. Why the local lane record is missing: a schema bump, not lost writes. Each reseed wave follows a boot that logged
BuyerPoolService bootstrap complete tracked=0 adopted=truefleet-wide:c0406912(fix(cli,incentive,node): count resumed bundle bytes apart, tag buyer rows with the chain id, flag unmatched filters #2244)b2053825(fix(cli,client): batch fixes for adopted-pool spend, tiny top-ups, stale coverage and dedup slots #2305)Both commits renamed the buyer table, so the new binary started with an empty store. Bootstrap then adopted the pool with no lanes, and each lane seeds when it is first used, which can be hours later. The 15:27 restart booted with
tracked=1. The boots on 10-01, 10-02 and 10-03 caused no reseeds. Buyer writes areDurability::Immediate. So there is nothing to fix here; only the doc onreseed_lane_from_chainchanges.2. Why the rejection was terminal: a gap in the client heal (fixed).
lane.rsthen rejectsBytesRegression, and the rejection carries the anchor as a watermark bundle.heal_watermark_desynchad no heal for that reason, so the drive ended and node-origin suppressed the provider. The payer now rebases to the bundle, which is its own voucher, and resumes.3. Concurrent double seed (fixed). Two streams that find one lane missing now seed it once.
Closes #2254
Reviewer notes
Read these first:
crates/client/src/lib.rs:heal_bytes_regression.crates/client/src/ledger.rs:rebase_ahead_on_bytes/rebase_if. The bytes test runs under the issuance lock beside the generation test, so a sibling voucher that commits past the bundle cannot be overwritten downward.crates/node/src/buyer_channel.rs: per-laneseed_locks,reread_before_seed, andWATERMARK_READ_TIMEOUT.Behaviour decisions:
BytesRegressionbundle that the ledger already covers on both axes is retried, because the rejected voucher trailed the ledger. It is no longer terminal.scopes_to_sourcenow includesBytesRegression, so a healed rejection past the resume budget cools only that source.Unchanged on purpose:
voucher.rs, feat(payments): self-describing vouchers to enable concurrent same-lane settlement #1699 rule 4) still rejectsBytesRegressionwith no bundle. If a seeded lane's amount lands exactly on the anchor, that lane still ends there. Each crossing has roughly a 1-in-(per-voucher price step) chance of landing exactly on the anchor. Closing that gap means attaching the bundle on that arm, which reverses a deliberate policy, so it is left for a separate decision.BytesRegression → OurDeadLanestays. Only a rejection that no heal took reaches it.Not covered by tests:
getWatermarktimeout, because the mock transport cannot hang.The
decdn-spec-disciplinegate passed for the ADR 005 edit. The heal is enforced locally by the payer and adds no wire, chain or config surface.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run -p decdn-client -p decdn-node -p decdn-incentive: 2438 passedRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemsconcurrent_reseeds_of_one_lane_read_the_chain_once.proof_generationfailsa_bytes_regression_from_an_earlier_generation_is_stale.contracts/changed: n/aCHANGELOG.mdentry added🤖 Generated with Claude Code