fix: Remove proving key buf len estimation #26
Merged
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.
In https://github.com/AztecProtocol/barretenberg/blob/f2fdebe037d4d2d90761f98e28b4b0d[…]3/cpp/src/aztec/join_split_example/proofs/join_split/c_bind.cpp we estimate the size of the proving key before writing it to a buffer (as per the comments it is difficult to compute the size of the serialized key, and there was a desire to keep memory usage down). This is fine for individual circuits, however, when trying to generalize the circuits for Noir this will lead to a max proving key size. It looks like keeping this write strategy will require constructing some sort of method for estimating the proving key size if I don't want to allocate a massive buffer each time.
This PR switches to using the same write strategy for proving keys that is used for verification keys (https://github.com/AztecProtocol/barretenberg/blob/f2fdebe037d4d2d90761f98e28b4b0d[…]3/cpp/src/aztec/join_split_example/proofs/join_split/c_bind.cpp). Using this same write strategy with proving keys looks to be working for my tests. I successfully proved and verified circuits locally using varying examples of small to large circuits. This seems like the best strategy at the moment especially if the current comments in bb mention that estimating the proving key is nontrivial.