Skip to content

feat(mantaray): add the depth-guarded reader - #369

Merged
mfw78 merged 1 commit into
mainfrom
s324/12-reader
Jul 21, 2026
Merged

feat(mantaray): add the depth-guarded reader#369
mfw78 merged 1 commit into
mainfrom
s324/12-reader

Conversation

@mfw78

@mfw78 mfw78 commented Jul 18, 2026

Copy link
Copy Markdown
Member

What

Adds a new Reader<S, BS> in crates/mantaray/src/reader.rs: an O(depth) NodeView-per-hop descent from a root address, with:

  • get: returns Ok(None) on miss; fetches the terminal chunk only for VALUE forks.
  • has_prefix: answers boundary checks from the parent fork record alone, without fetching the terminal chunk.
  • A per-lookup max_depth fetch budget, with DEFAULT_MAX_DEPTH = 256.

Adds a typed ReaderError { Store, Corrupt, MaxDepth } in error.rs. lib.rs re-exports Reader, DEFAULT_MAX_DEPTH, ReaderError.

Why

Closes #343

Testing

  • Differential test harness vs legacy Manifest::get/has_prefix and the deprecated lookup, across six trie corpora (prefix splits, nested, one-byte chains, >30-byte edges) with miss/prefix/extension/empty probes.
  • Encrypted-trie and metadata differentials.
  • Exact fetch-count pins proving O(depth) behaviour.
  • MaxDepth boundary tests.
  • Store-miss and corrupt-chunk error tests.
  • cargo fmt --all -- --check: clean.
  • cargo clippy --workspace --all-targets --locked: no new warnings in the diff's crate.
  • cargo nextest run -p nectar-mantaray --locked: 144/144 passed, 0 skipped.

AI Assistance

Implementation by Fable, review by Opus, PR by Sonnet.

@mfw78
mfw78 force-pushed the s324/10-codec-nodeview branch from 8738e69 to 60f216e Compare July 19, 2026 03:37
@mfw78
mfw78 force-pushed the s324/10-codec-nodeview branch from 60f216e to b6e2af5 Compare July 19, 2026 03:40
@mfw78
mfw78 force-pushed the s324/10-codec-nodeview branch from b6e2af5 to 3f9f6a8 Compare July 21, 2026 08:59
Base automatically changed from s324/10-codec-nodeview to main July 21, 2026 11:13
Resolve paths against persisted tries one NodeView per hop: get reports
misses as Ok(None), has_prefix answers edge boundaries from the parent
fork record without fetching the boundary node, and every lookup spends
a typed max_depth fetch budget. Differential tests pin both lookups to
the legacy manifest answers across plain, encrypted and
metadata-carrying tries.
@mfw78
mfw78 merged commit c9fbd5d into main Jul 21, 2026
21 checks passed
@mfw78
mfw78 deleted the s324/12-reader branch July 21, 2026 11:20
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mantaray: depth-guarded reader

1 participant