Skip to content

decdn fetch and bundle pull escrow into a node's data dir under the node's own keystore #2082

Closed

Description

@thiras

decdn pool now refuses to escrow into a decdn-node daemon's data dir (#2078, merged in #2081). decdn fetch and decdn bundle pull open the same client store on the same resolved data_dir with no such check, so the door #2078 closed has an unlocked one beside it.

Mechanism

Both open the client store unconditionally:

  • crates/cli/src/commands/fetch.rs:1275 — RedbBuyerPoolStore::open(&chain.data_dir)?
  • crates/cli/src/commands/bundle_pull.rs:852 — same

data_dir resolves through the same precedence ladder pool uses (flag > identity.data_dir > ~/.decdn/client), and load_file_config(None) falls back to ~/.decdn/node.toml, so on a node host the node's identity.data_dir is already the default with no flag passed.

The keystore comes from the same place. fetch.rs:282 derives it as eth_identity::keystore_path(&data_dir) when no --keystore / blockchain.eth_keystore is given. So decdn fetch on a node host does not merely open a second pool — it opens one under the node's own operator address.

Why that is worse than the pool case

Two consequences follow from the pool being owned by the same address the daemon uses:

  1. The daemon's report_stranded_pools enumerates by owner, so it will name the CLI's pool as a stranded deposit and tell the operator to close it — a pool a human may be actively fetching against.
  2. If the daemon's store is ever reset, its adoption path (newest_solvent) can adopt the CLI's pool. Daemon and CLI would then sign cumulative vouchers on the same (pool_id, signer, provider) lane from two independent watermarks, which is the stranded-channel failure the lane watermark exists to prevent.

Is it intentional?

Arguably a human fetching from a node host is a legitimately separate buyer, and --data-dir is a real override there in a way it is not for pool open. That is why #2081 deliberately left it alone rather than guessing. But the asymmetry is currently undocumented: adr/012-client.md describes the node-vs-client store split and says nothing about fetch being exempt.

Suggested direction

The classifier is already reusable — decdn_common::data_dir::daemon_marker plus classify_buyer_store in crates/cli/src/commands/pool.rs. Options, in rough order of increasing strictness:

  1. Warn on a node data dir, naming both stores, and proceed. Cheapest; preserves every current workflow.
  2. Refuse unless --data-dir was passed explicitly, so the node's dir is never the implicit target.
  3. Refuse outright, matching pool open.

Whichever is chosen, state it in adr/012-client.md beside the existing store-split paragraph, so "fetch is exempt" is a recorded decision rather than an omission.

Related hardening

Inside pool.rs the guard and the store acquisition are still two separable statements (classify_buyer_store(..).refuse_escrow(..)? then a bare RedbBuyerPoolStore::open, at :292 and :347). Both are guarded and covered by subprocess tests today, but fusing them — having the guard return the store — would make a future subcommand unable to forget the check.

Activity

  1. added
    kind:bug
    area:cli
    area:payments
    on Sep 20, 2026
  2. moved this from Backlog to In progress in deCDNon Sep 20, 2026
  3. moved this from In progress to Done in deCDNon Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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