primitives.merkle_prover#
Merkle tree commitment abstraction for proof generation.
Mirrors MerkleVerifier: provides factory methods that construct properly-configured Merkle trees from StarkInfo, hiding arity and last_level_verification details.
Classes#
Merkle tree builder with encapsulated configuration. |
Module Contents#
- class primitives.merkle_prover.MerkleProver(config: primitives.merkle_verifier.MerkleConfig, custom: bool = False)[source]#
Merkle tree builder with encapsulated configuration.
- Usage:
prover = MerkleProver.for_stage(stark_info) root = prover.commit(data, height, n_cols) proof = prover.get_query_proof(idx, elem_size=1)
- classmethod for_stage(stark_info: protocol.stark_info.StarkInfo) MerkleProver[source]#
Create prover for stage commitment trees (cm1, cm2, …, cmQ).
- classmethod for_const(stark_info: protocol.stark_info.StarkInfo) MerkleProver[source]#
Create prover for constant polynomial tree.
- classmethod for_fri_step(stark_info: protocol.stark_info.StarkInfo) MerkleProver[source]#
Create prover for FRI folding step trees.
- commit(data: list[int], height: int, n_cols: int) primitives.merkle_tree.MerkleRoot[source]#
Build Merkle tree and return root.
- Args:
data: Flattened leaf data (height * n_cols elements) height: Number of leaves n_cols: Number of columns per leaf
- Returns:
Merkle root (HASH_SIZE elements)
- get_query_proof(idx: int, elem_size: int = 1) primitives.merkle_tree.QueryProof[source]#
Get Merkle proof for a query index.
- property tree: primitives.merkle_tree.MerkleTree[source]#
Access the underlying MerkleTree (for backward compatibility).