You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cache: drop double BLAKE3 hash once iroh-blobs exposes verified-insert #233
CacheEngine::pull_through currently pays BLAKE3 twice on the happy path of a cache miss:
Explicit Hash::new(&bytes) for content-address verification before insertion.
Implicit rehash inside iroh_blobs::store::fs::FsStore::blobs().add_bytes(...), which always hashes what it's storing.
For small blobs this is negligible. For larger blobs — the default max_blob_size_mb is 1 GB and the design tolerates objects up to ~10 GB — it is not. BLAKE3 is fast but not free, and the cost is 100% of the origin-miss hot path.
Why not merge the two today
The verify-then-insert order is correctness-load-bearing: dropping the pre-check and trusting iroh-blobs to notice a mismatch would mean unverified bytes transiently enter the store. The workaround is an iroh-blobs API that accepts an expected hash and refuses the insert atomically if the computed hash disagrees.
Action
When iroh-blobs exposes such an API (or an equivalent "insert-with-expected-hash" call), replace the explicit Hash::new(&bytes) + add_bytes pair in crates/cache/src/engine.rspull_through with the single verified-insert call. Keep the post-receive size cap and the HashMismatch error surface.
Tracking
Referenced by the TODO(#233): comment at crates/cache/src/engine.rs:1005. When picking this up, also update that comment to cite this issue number.
Acceptance
Single BLAKE3 pass per pull-through miss.
hash_mismatch_is_rejected_and_not_cached still passes unchanged.
No change to CacheError::HashMismatch variant shape.
Activity
docs(cache): tag double-hash TODO with tracking issue #233
feat(cache): add cache engine with HTTP + filesystem origin adapters (#…
fix(node): address PR #371 review + CI
feat(node): `decdn node evict` and `decdn node announce` (#279, #280) (…
feat(cache): stream FilesystemOrigin + engine.add_stream (#271 PR2/4)
fixup(cache): post-review hardening for #271 streaming stack
feat(cache): stream FilesystemOrigin + engine.add_stream (#271 PR2/4)
feat(cache): stream FilesystemOrigin + engine.add_stream (#271 PR2/4) (…
fixup(cache): post-review hardening for #271 streaming stack
feat(cache): stream S3Origin via ByteStream::into_async_read (#271 PR…