Skip to main content

Crate pir_types

Crate pir_types 

Source
Expand description

Shared types and constants for the PIR subsystem.

Wire types are serialized over HTTP between pir-server and pir-client. Tier-layout constants define the data-format contract shared by all crates (export, server, client, test).

The default feature set is lightweight (only serde). Enable the reader feature to get tier-data parsers ([tier0::Tier0Data], [tier1::Tier1Row], [tier2::Tier2Row]) and Fp serialization helpers ([fp_utils]).

Structs§

HealthInfo
Health check response returned by GET /health.
PirMetadata
Metadata written to pir_root.json alongside the tier files.
RootInfo
Root hash and metadata returned by GET /root.
YpirScenario
Parameters describing a YPIR database scenario.

Constants§

PIR_DEPTH
Depth of the PIR Merkle tree.
TIER0_LAYERS
Number of layers in Tier 0 (root at depth 0 down to subtree records at depth 9).
TIER1_ITEM_BITS
Tier 1 item size in bits (for YPIR parameter setup).
TIER1_LAYERS
Number of layers in each Tier 1 subtree (depth 9 to depth 15).
TIER1_LEAVES
Number of leaves per Tier 1 subtree (at relative depth 6 = global depth 15).
TIER1_ROWS
Number of Tier 1 rows (one per depth-9 subtree).
TIER1_ROW_BYTES
Byte size of one Tier 1 row: 64 × 64 (leaf records only).
TIER1_YPIR_ROWS
Number of rows in the Tier 1 YPIR database (padded to YPIR minimum).
TIER2_ITEM_BITS
Tier 2 item size in bits (for YPIR parameter setup).
TIER2_LAYERS
Number of layers in each Tier 2 subtree (depth 15 to depth 25).
TIER2_LEAF_BYTES
Byte size of each Tier 2 leaf record: 3 field elements for punctured range [nf_lo, nf_mid, nf_hi].
TIER2_LEAVES
Number of leaves per Tier 2 subtree (at relative depth 10 = global depth 25).
TIER2_ROWS
Number of Tier 2 rows (one per depth-15 subtree).
TIER2_ROW_BYTES
Byte size of one Tier 2 row: 1,024 × 96 (leaf records only).
YPIR_MIN_ROWS
YPIR SimplePIR requires at least 2048 rows (poly_len). When TIER1_ROWS is smaller, the YPIR database is padded with zero rows up to this minimum.

Functions§

serialize_ypir_query
Serialize a YPIR SimplePIR query into the wire format expected by pir-server.