You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
client: a delegated client's lane watermarks are never persisted #2435
A delegated client (one that pays under a dcap1 capability from a pool it does not own) never persists its lane watermarks.
After a fetch, the lanes record their progress through ProgressWrite::apply → BuyerPoolStore::{advance,rebase}_progress with owner = self_address. The redb store keys every lane write on the owner index (buyer_pool_table.rs, write_lane). A delegate owns no pool row, so each write returns AdvanceOutcome::UnknownPool and is dropped. The only trace is a warn! from persist_watermark.
This has two consequences:
Resume. A delegated lane resumes from zero on the next run (build_delegated_pool_ctx reads get_by_pool_id(grant.pool_id) and finds nothing). The node then answers the first stale voucher, and the lane has to resync. That costs a round trip, and it fails outright once the resync budget runs out.
Funding signal. ADR 039 § Client SDK funding signal says headroom is "the cap minus the vouchers signed under the key across all lanes, including earlier fetches in local records". There are no such local records for a delegate. So, across restarts, RunningLow undercounts the spend and can fire late. Within one run the CredentialSlot tracks spend in memory, so a single long run is unaffected. A bundle pull an embedder restarts is affected.
Proposed direction
Persist delegate lane progress keyed by (pool_id, signer, provider) with no owner row. This could be a delegate-lane table in the buyer store, or a row kind that carries lanes but no deposit. Then read it back in build_delegated_pool_ctx and in the slot's record_spend seed. This is a buyer-store schema change, so it reseeds lanes on the fleet. Pre-mainnet, it needs no migration.
Found while planning #2429. It is out of scope there, which moves the bundle pull into decdn-client and wires the live credential swap.
Activity
fix: persist a delegated client's lane watermarks (#2441)