Skip to content

gateway: remember hashes that are not bundle manifests so a repeat request does not pay again #2478

Closed

Description

@thiras

Problem

The gateway caches only manifests that parse (Gateway::manifest, crates/cli/src/commands/gateway.rs). Since #2477, a /<hash>/ or /<hash>/<path> request for a blob that is not a manifest answers 404. That covers a blob over the manifest cap and a blob whose bytes do not parse. Each failed pull still costs up to the manifest cap (64 MiB, or a lower nonzero --max-blob-mb), and nothing records the verdict. So every repeat request for the same hash pulls and pays again. The pulls run one at a time under manifest_fill, but each one is paid.

The verdict is permanent:

  • the bytes are content-addressed, so the same hash never parses differently;
  • the cap stop comes from verified bytes, so a blob over the cap stays over it.

Only an operator change to --max-blob-mb changes it, and that takes a restart.

Proposed fix

  • Keep a small bounded set of hashes found not to be manifests, beside ManifestCache. Use the same LRU pattern with a count bound like MAX_CACHED_MANIFESTS.
  • Look it up before taking manifest_fill, and again after, as cached_manifest is checked twice.
  • Answer a hit with the same 404 and message, without a pull. Store the message, or the cap and the hint, with the hash.
  • Record a hash only for PullError::NotManifest. Never record Funding or Other, which are transient or upstream.

Test

Use the Recording backend in gateway/tests.rs. Request /<hash>/ twice for a Reply::TooLarge blob and for a Reply::Bytes(b"not json") blob. Check two 404s and one recorded pull per hash. Check that an Other failure such as "no node holds the blob" is pulled again.

Follow-up from the #2477 review.

Activity

  1. self-assigned this
    on Oct 16, 2026
  2. added
    kind:feature
    area:cli
    prio:low
    area:payments
    on Oct 16, 2026
  3. removed their assignment
    on Oct 16, 2026
  4. self-assigned this
    on Oct 27, 2026
  5. moved this from Backlog to In progress in deCDNon Oct 27, 2026
  6. moved this from In progress to Done in deCDNon Oct 27, 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:featureprio:low

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions