Skip to main content

Module trace

Module trace 

Source
Expand description

Header chain trace encoding for ligerito polynomial commitment proofs.

Encodes block headers into a trace polynomial that ligerito can prove over. The trace layout binds block hashes, prev_hash linkage, difficulty progression, state roots at epoch boundaries, and a sentinel row with tip NOMT roots.

§Trace layout (32 fields per header)

Field  0:      height
Fields 1-8:    block_hash (32 bytes = 8 × 4-byte LE fields)
Fields 9-16:   prev_hash  (32 bytes = 8 × 4-byte LE fields)
Field  17:     nBits (compact difficulty target)
Field  18:     cumulative_difficulty (lower 32 bits)
Field  19:     running header commitment (Blake2b-512 chain, lower 4 bytes)
Fields 20-23:  sapling_root (16 bytes, epoch boundaries only)
Fields 24-27:  orchard_root (16 bytes, epoch boundaries only)
Fields 28-29:  nullifier_root (8 bytes, epoch boundaries only)
Field  30:     state_commitment (Blake2b-512 chain, lower 4 bytes)
Field  31:     reserved

After all headers, a sentinel row of 24 fields:

Fields 0-7:   tip_tree_root (32 bytes)
Fields 8-15:  tip_nullifier_root (32 bytes)
Fields 16-23: final_actions_commitment (32 bytes)

Public outputs are extracted from fixed trace positions by the prover and bound to the Fiat-Shamir transcript. The Ligerito proximity test does NOT constrain these values — soundness relies on the honest-prover assumption plus cross-verification against independent nodes.

Structs§

EpochStateRoots
State roots at an epoch boundary.
HeaderChainTrace
Header chain trace for ligerito proving.
TraceHeader
Header data for trace encoding. Minimal fields needed. No full block data, just what goes into the trace.

Constants§

FIELDS_PER_HEADER
Fields encoded per block header in the trace polynomial.
TIP_SENTINEL_SIZE
Sentinel row appended after all headers. Contains tip_tree_root, tip_nullifier_root, final_actions_commitment.

Functions§

bytes_to_field
Convert 4 bytes (LE) to a BinaryElem32 trace field.
encode_trace
Encode headers into a trace polynomial for ligerito proving.
hex_to_bytes
Hex string to bytes.
nbits_to_difficulty
Convert nBits (compact difficulty target) to difficulty value.
parse_tree_root_bytes
Derive tree root hash from zebrad’s hex-encoded final state string.
update_running_commitment
Running header commitment chain (Blake2b-512, truncated to 32 bytes).
update_state_commitment
Running state commitment chain (Blake2b-512, truncated to 32 bytes).