Skip to main content

Module size

Module size 

Source
Expand description

The store SIZE and the SIZE PROOF (SPEC §4) — the download-gating core of this crate.

A store anchors its .dig SIZE on chain so a client can decide, BEFORE downloading, whether the artifact is worth fetching. The anchored size is a coarse power-of-2 bucket, not an exact byte count — the smallest representation that still conveys magnitude (NC-8, minimal on-chain encoding): a single exponent k ∈ 0..=10 mapping to 2^k MB, 1 MB..1 GB.

SizeBucket is re-exported VERBATIM from dig_merkle::SizeBucket — the ONE canonical owner of the ladder AND the byte→bucket mapping (SizeBucket::for_byte_len) — so the encoding lives in a single place and the on-chain (dig-merkle metadata "sz") and client-side (this proof) views can never drift.

The SIZE PROOF is the client-side check: given the bucket the store anchored on chain (NC-9) and the real byte length of a downloaded .dig, SizeProof::verify decides ACCEPT or DISCARD. A .dig whose real size does not fall in the anchored bucket is rejected — a dig-node MUST NOT store or serve it (SPEC §4, the discard rule).

Structs§

SizeBucket
A .dig store size quantised to a power-of-2 bucket: exponent k ∈ 0..=102^k MiB (1 MB..1 GB). See the module docs for the full ladder and the canonical unit (1 MB = 1 MiB).
SizeProof
The client-side SIZE PROOF check (SPEC §4).

Enums§

SizeVerdict
The verdict of a SizeProof::verify check: whether a downloaded .dig may be kept.