In this section, we describe the implementation of the polynomial commitment scheme verifier.Documentation Index
Fetch the complete documentation index at: https://docs.starknet.io/llms.txt
Use this file to discover all available pages before exploring further.
Commitment Scheme Verifier
TheCommitmentSchemeVerifier struct manages the verification process for the polynomial commitment scheme. It maintains a collection of Merkle verifiers (one for each commitment tree) and the protocol configuration.
CommitmentSchemeVerifier struct.
Read Commitments
Thecommit function reads a Merkle root from the prover and initializes a MerkleVerifier for the committed columns. It is implemented as follows:
Verify
Theverify_values function is the core of the verification protocol. It checks that the prover’s openings at the sampled points are consistent with the commitments and that the committed polynomials are of low degree via the FRI protocol. It is implemented as follows:
-
Mix Sampled Values into the Fiat-Shamir Channel:
- The verifier mixes the
sampled_values(openings at the queried points) into the Fiat-Shamir channel, ensuring that all subsequent randomness is bound to these values.
- The verifier mixes the
-
Draw Random Coefficient:
- The verifier draws a
random_coefffrom the channel, which is used to combine the quotient polynomials in the FRI protocol.
- The verifier draws a
-
Determine Degree Bounds:
- The verifier computes the degree
boundsfor each column, based on the log sizes and the protocol’s blowup factor. These bounds are used to configure the FRI verifier.
- The verifier computes the degree
-
FRI Commitment Phase:
- The verifier initializes the
fri_verifierwith the FRI protocol configuration, the FRI proof from the prover, and the degree bounds.
- The verifier initializes the
-
Verify Proof of Work:
- The verifier checks the
proof_of_workvalue provided by the prover using thepow_bitsin the PCS config.
- The verifier checks the
-
Sample FRI Query Positions:
- The verifier uses the channel to generate random
query_positions_per_log_sizefor the FRI protocol.
- The verifier uses the channel to generate random
-
Verify Merkle Decommitments:
- For each commitment tree, the verifier checks that the Merkle decommitments at the queried positions are valid and that the opened values match the commitments.
-
Prepare FRI Query Answers:
- The verifier assembles the answers to the FRI queries by matching the sampled points and values, and prepares them for the FRI verifier.
-
FRI Decommitment Phase:
- The verifier provides the FRI query answers to the FRI verifier, which checks that the quotient polynomials are of low degree.
- Return Verification Result:
- If all checks pass, the function returns
Ok(()). If any check fails (e.g., Merkle decommitment, proof of work, or FRI check), it returns an appropriate error.