Repository navigation
feat(cli): decdn quote <URI> prices a pull from signed probe rates (#2600) - #2626
Merged
Merged
Conversation
…2600) One unpaid `cdn/probe/v1` round reaches every node a pull can draw from and verifies each signed rate against its operator. The quote prints the size, the holders, their rate range in USDC per GB, the `--max-rate-per-mb` ceiling, and the cost on bao wire bytes: at the cheapest rate, at the most expensive, and the likely cost over the first `--max-sources` nodes in the pull's own order (one node per operator, then the ceiling). A bundle's size is its manifest's planned download. The quote probes the 4 largest blobs and prices the rest at their mean rate; a manifest that is not cached is a small paid pull, cached for the `get` that follows. `decdn get --dry-run` prints the same block, on a blob URI too, and its `--json` plan carries `quote` and `quote_error`. `decdn get` prints a one-line `Estimate:` on stderr before the pull. decdn-client gains the `quote` module (`census`, `HashCensus::serve_order`, `price`, `wire_bytes`) and `bundle::planned_downloads`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Bundle wire-byte accounting and dry-run argument validation need correction before approval.
4 open issues
What changed in this PR
Adds decdn quote <URI> to estimate download costs from signed node probe rates, reusing the client’s discovery, provider ordering, and bundle planning.
Changes:
- Adds unpaid probe census and pricing APIs, plus text and JSON quote output.
- Integrates quotes into
get --dry-runand adds pre-download estimates to paid pulls. - Adds unit and end-to-end coverage, public API snapshots, and documentation.
| File | Description |
|---|---|
| README.md | Documents quote usage. |
| crates/e2e/tests/cli_quote.rs | Tests quotes and downloads against real nodes. |
| crates/common/src/cli/quote.rs | Defines quote arguments. |
| crates/common/src/cli/mod.rs | Registers the quote command. |
| crates/common/src/cli/get.rs | Updates dry-run and JSON help. |
| crates/client/tests/snapshots/public_api__public_api.snap | Records new public APIs. |
| crates/client/src/targets/tests.rs | Tests rate-hint selection. |
| crates/client/src/targets.rs | Shares discovery helpers and exposes rate hints. |
| crates/client/src/quote/tests.rs | Tests census, ordering, and pricing. |
| crates/client/src/quote.rs | Implements probe census and cost calculations. |
| crates/client/src/lib.rs | Exports the quote module. |
| crates/client/src/bundle/manifest_cache.rs | Clarifies dry-run cache documentation. |
| crates/client/src/bundle/engine/tests.rs | Tests planned downloads and rate hints. |
| crates/client/src/bundle/engine.rs | Exposes download plans and collects rates. |
| crates/client/src/bundle.rs | Adds planning and rate-hint APIs. |
| crates/cli/src/main.rs | Dispatches quote commands. |
| crates/cli/src/commands/quote/tests.rs | Tests quote planning and output. |
| crates/cli/src/commands/quote.rs | Implements quotes and dry-run integration. |
| crates/cli/src/commands/mod.rs | Exports the quote command module. |
| crates/cli/src/commands/get/tests.rs | Tests blob dry-run flag handling. |
| crates/cli/src/commands/get.rs | Routes blob dry runs to quotes. |
| crates/cli/src/commands/gateway/worker/tests.rs | Disables estimates in gateway fixtures. |
| crates/cli/src/commands/gateway.rs | Disables estimates for gateway responses. |
| crates/cli/src/commands/fetch.rs | Prints blob download estimates. |
| crates/cli/src/commands/bundle_pull/tests.rs | Tests dry-run JSON and isolates configuration. |
| crates/cli/src/commands/bundle_pull.rs | Integrates bundle estimates and paid manifest fetching. |
| CHANGELOG.md | Records quote and dry-run behavior. |
| adr/appendix-bundles.md | Documents network-enabled dry runs. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
…lags first A bundle's wire bytes are not the wire length of its summed content: each blob has its own bao tree, and a blob that splices a shared chunk pays for its download ranges plus the proof path down its own tree. `bundle::PlannedBlob::wire` gives those bytes per blob, from the same drive ranges a pull fetches. The quote, its `wire_bytes` JSON field and the `get` bundle estimate sum them. `get --dry-run` checks the flag combination and the pinned node's flags before the quote's set-up, so a dangling `--provider-address` or a malformed `--node-id` fails the dry run with or without a chain configured. 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
decdn quote <decdn: URI>prices a pull from the rates the nodes sign in theircdn/probe/v1answers, before any paid byte.decdn_client::quote::census): one unpaid probe round over every node a pull can draw from. That is the peer store's or the registry's list, narrowed by the region allowlist and not sampled down; a pinned--node-idis probed alone. Each answer's signed rate is verified against its operator, and the samples are recorded in the peer store.HashCensus::serve_orderreuses the pull'sfailover_order. It keeps one node per operator, then drops nodes above--max-rate-per-mb, as the pull refuses those streams at open.pricegiveslowandhigh(every byte at the extreme rates) andlikely.likelysplits the bytes evenly over the first--max-sourcesnodes and is capped athigh.bundle::planned_downloads): a duplicate blob and a shared chunk count once.getthat follows.decdn get --dry-runprints the same block, on a blob URI too, and--jsonis allowed there with--dry-run. Its JSON plan always carriesquoteandquote_error. Without a cached manifest it names thedecdn quote … -o …command to run.decdn getprints a one-lineEstimate:on stderr before the pull (not under--json). It uses the rates its own probe round and the peer store hold, so it adds no probe round.Closes #2600
Reviewer notes
crates/client/src/quote.rs(census, order, price), thencrates/cli/src/commands/quote.rs(plan, view, output, dry-run glue).get --dry-runis no longer offline. It still sends no transaction and opens no keystore, but it reads the registry when the peer store cannot supply it, and it probes.ResolveConfigFaultfails the dry run, as it fails the real run. That covers a malformed--node-idor--provider-address, and probe signatures that do not recover to their operators.bundle_pulldry-run unit tests now pass an empty config file (offline_config()), so they never read the machine's~/.decdnconfig.getestimate may use peer-store rates. It skips failure-suppressed nodes, and is labelled "Estimate".--max-rate-per-mbstays a flag.<ns>.decdn.linkthat pays a pool behind the scenes #2593), and the sponsord onramp estimate. The onramp one needs the installer to pass the URI or size to/fund, which changes the installer contract.Verification
Always:
pre-commit run --all-files: passed. The cargo-deny hook is warn-only; it reports two existing RUSTSEC advisories, andCargo.lockis unchanged.CARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-features: ran ascargo clippy --workspace --all-targets --all-features -- -D warnings, exit 0.cargo nextest run: workspace, 5793 passed.Only if touched:
decdn-client:.snapregenerated (thequotemodule,bundle::PlannedBlob,bundle::planned_downloads).adr/:make -C adr check-refspassed. Onlyappendix-bundles.md§--dry-runchanges, soarchitecture.mdneeds no update.CHANGELOG.mdentry added.Also:
CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-items: exit 0..github/scripts/check_crate_edges.py: OK.cargo nextest run -p decdn-e2e --features anvil-e2e -E 'binary(cli_quote)': passed against two real nodes at 8 and 12 µUSDC/MiB. It covers:likely;--node-id;get --dry-run, text and--json;get --dry-run --json;Estimate:line on a paidget.🤖 Generated with Claude Code