Skip to content

cli: an adopted buyer row forgets the pool's redeemed spend after the adopting run #2292

Closed

Description

@thiras

Component

cli (decdn binary)

Version

fix/pool-wide-refill-2288-2289 (#2291).

Summary

When the local buyer row is lost, the CLI adopts the live pool from chain (pool_to_reuse → adopt_owned_pool in crates/cli/src/commands/fetch.rs). The adopted row is recorded with the on-chain deposit and no lanes. Only the run that adopts the pool sees its totalRedeemed (as spent_elsewhere). On every later run the row is "tracked", so spent_elsewhere is 0. The pool-wide spend (pool_spend, #2288) then counts only lanes this machine has recorded since adoption. Spend that other providers' lanes redeemed before adoption is no longer counted.

Effect

  • The proactive refill reads the pool as fuller than it is and does not fire when it should.
  • The reactive gate, which reads RunFunding's baseline, undercounts the same spend. A genuine SpendingCapExhausted refusal can then be judged a lie.

Steps to reproduce

  1. Spend a pool across several providers, then lose the local buyer row (new data dir, or move buyer.redb aside).
  2. Run decdn fetch: the row is adopted, and this run sees totalRedeemed.
  3. Run decdn fetch again against one provider: the pool-wide spend now omits the other providers' redeemed amounts.

Fix direction

Persist the pool-wide spend the row cannot attribute to a lane, for example a redeemed_elsewhere amount on BuyerPoolState recorded at adoption. Alternatively, read totalRedeemed on every reuse and take the larger of it and the row's lane sum. The second option costs one eth_call per lane build. Under the pre-launch rule, no migration is needed for the row format.

Found while fixing #2288 / #2289.

Activity

  1. self-assigned this
    on Oct 2, 2026
  2. added
    kind:bug
    area:cli
    area:payments
    on Oct 2, 2026
  3. removed their assignment
    on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliarea:paymentskind:bug

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions