Repository navigation
Description
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:
- The daemon's
report_stranded_poolsenumerates by owner, so it will name the CLI's pool as a stranded deposit and tell the operator tocloseit — a pool a human may be actively fetching against. - 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:
- Warn on a node data dir, naming both stores, and proceed. Cheapest; preserves every current workflow.
- Refuse unless
--data-dirwas passed explicitly, so the node's dir is never the implicit target. - 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.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(cli): batch of five CLI fixes around the node-vs-client data dir (#…
fix(cli,incentive): adopt the pool the wallet already owns instead of…