Decryption PIR#18
Open
p0mvn wants to merge 11 commits into
Open
Conversation
Position-indexed append-only store of DecryptionLeaf values with per-block rollback, sub-shard queries, PIR database serialization (8192 rows × 29696 bytes), and checksummed snapshot persistence. Shares the same shard/sub-shard geometry as the witness PIR database but requires no Merkle hashing. Made-with: Cursor
Axum HTTP server for decryption PIR: /health, /metadata, /params, /query routes. Includes StubPirEngine for testing, real YPIR engine (feature-gated), snapshot I/O for DecryptionDb persistence, and a full HTTP round-trip test against the stub engine. Made-with: Cursor
New `decryption` feature flag (implies `witness`) that adds: - Initial sync: loads DecryptionDb snapshot or creates one with the same window offset as the witness tree, catches up via block fetching with completing-block spillover handling - Follow loop: single-pass extraction of both commitments and decryption leaves using extract_commitments_and_decryption, append/rollback in lockstep with the witness tree - PIR rebuild after each block batch alongside witness and nullifier - Routes nested under /decrypt, decryption health in /health - Periodic snapshot persistence for DecryptionDb Made-with: Cursor
Runs decryption-types, decryption-db, and decryption-server unit tests on PRs that touch witness/ or the decryption crates. Adds a dedicated path filter and includes decryption in Slack failure notifications. Made-with: Cursor
- Validate tree_size >= leaf_offset in snapshot deserialization to prevent usize underflow on corrupted data (+ test) - Enforce shard alignment in DecryptionDb::with_offset in all builds, not just debug (was debug_assert, now assert) - Handle missing orchard_commitment_tree_size in catch_up_decryption windowed spillover path — log warning and skip instead of silently treating as zero - Log the actual error when decryption snapshot load fails in the combined-server instead of swallowing it - Add populated_shards to DecryptionMetadata and HealthResponse for parity with WitnessMetadata - Remove unused deps: witness-types from decryption-db, serde_json from decryption-server - Fix duplicate comment in combined-server follow loop - Cleaner match pattern for dec_latest catch-up logic - Document from_bytes trailing-byte behavior - Update CLI help text to mention decryption/ subdirectory Made-with: Cursor
- Expand round-trip test to exercise /health (verify populated_shards, phase, anchor_height) and /metadata (verify window geometry) - Add 503 test: /query and /metadata return SERVICE_UNAVAILABLE when PIR state hasn't been built yet - Verify populated_shards and window_start_shard in rebuild_pir test Made-with: Cursor
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.
Summary
decryption-dbcrate: flat, append-only store ofDecryptionLeafvalues with per-block rollback, sub-shard PIR database builder, and checksummed snapshot persistence. Shares shard/sub-shard geometry with witness PIR but requires no Merkle hashing.decryption-servercrate: Axum HTTP server (/health,/metadata,/params,/query),rebuild_pirfunction,StubPirEnginefor testing, real YPIR engine (feature-gated), andDecryptionDbsnapshot I/O.Builds on the
decryption-typescrate andcommitment-ingestparser extensions already on main.Remaining work (on this branch)
Test plan
decryption-db: 12 unit tests (append, rollback, sub-shard queries, PIR DB layout, snapshot round-trip)decryption-server: 5 tests (stub engine, rebuild, full HTTP round-trip)--libcheck passesMade with Cursor