Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the merkle trees used in the BN128 Stark RecursiveF proof have an arity of 16. This was optimal from the prover performance point of view. The problem is that right now we are quite close to the next power of 2 (our final circuit has 16.509M and 2^24 = 16.777M), and with Feijoa chances are that we may surpass that value.
To mitigate this problem, this PR parametrizes the arity of the merkle tree to be any power of two. The reasoning behind this is that the VerifyMerkleHash circuit was originally optimized for Groth16 by adding a lot of sums, which is not efficient for Fflonk, our current proving system.
This PR not only adds the parametrization, but proposes changing the arity to 4, which leads to a 4M constraints reduction on the final circuit. The proof time will not be impacted much, since the extra proving time added to the StarkRecursiveF will be compensated in the Fflonk proof