Stores the layer commitments C followed by [d_size, t_depth, a1, a0] and [poe, p, e1, e0] where:
1) d_size is the domain size divided by 4 of the domain corresponding to C.
2) t_depth is the tree depth of the Merkle tree with commitment C.
3) (a0, a1) is the folding challenge to create the next layer.
4) p is the query index and (e0, e1) is the evaluation at the first layer and poe is g^p with
g being the initial domain generator.
TODO: This pre-processing function should in fact compute d_size and t_depth for each C
starting from the original domain size.
## std::crypto::fri::frie2f4
| Procedure | Description |
| ----------- | ------------- |
| verify_query_layer | Checks that, for a query with index p at layer i, the folding procedure to create layer (i + 1)
was performed correctly. This also advances layer_ptr by 2 to point to the next query layer.
Input: [layer_ptr, layer_ptr, poe, p, e1, e0, layer_ptr, rem_ptr, x, x, x, x, x, x, x, x, ...]
Output: [layer_ptr + 2, layer_ptr + 2, poe^4, f_pos, ne1, ne0, layer_ptr + 2, rem_ptr, x, x, x, x, x, x, x, x, ...]
Cycles: 76
|
| verify_query | Verifies one FRI query.
Input: [poe, p, e1, e0, layer_ptr, rem_ptr, ...]
Output: [x, x, x, x, x, x, x, x, x, x, ...]
- poe is g^p.
- p is a query index at the first layer.
- (e0, e1) is an extension field element corresponding to the value of the first layer at index p.
- layer_ptr is the memory address of the layer data (Merkle tree root, alpha etc.) for the next
layer.
- rem_ptr is the memory address of the remainder codeword.
Cycles: 40 + num_layers * 76
|
| verify | Verifies a FRI proof where the proof was generated over the quadratic extension of the base
field and layer folding was performed using folding factor 4.
Note that the check that the remainder codeword corresponds to the remainder polynomial received
by the verifier should now be performed by the calling procedure.
Input: [query_ptr, layer_ptr, rem_ptr, g, ...]
Output: [...]
- query_ptr is a pointer to a list of tuples of the form (e0, e1, p, poe) where poe is equal
to g^p with g being the initial FRI domain generator. p is the query index at the first layer
and (e0, e1) is an extension field element corresponding to the value of the first layer at index p.
- layer_ptr is a pointer to the first layer commitment denoted throughout the code by C.
layer_ptr + 1 points to the first [alpha0, alpha1, t_depth, d_size] where d_size is the size
of initial domain divided by 4, t_depth is the depth of the Merkle tree commitment to the
first layer and (alpha0, alpha1) is the first challenge used in folding the first layer.
Both t_depth and d_size are expected to be smaller than 2^32. Otherwise, the result of
this procedure is undefined.
- rem_ptr is a pointer to the first tuple of two consecutive degree 2 extension field
elements making up the remainder codeword. This codeword can be of length either 32 or 64.
The memory referenced above is used contiguously, as follows:
[query_ptr ... layer_ptr ... rem_ptr ...]
This means for example that:
1. rem_ptr - 1 points to the last (alpha0, alpha1, t_depth, d_size) tuple.
2. layer_ptr - 1 points to the last (e0, e1, p, poe) tuple.
Cycles: 7 + 4 + num_queries * (40 + num_layers * 76 + 26)
|