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.
Abstraction of Common Methods:
The AbstractBackend has been introduced with common methods for instantiate, generateProof, verifyProof, getVerificationKey, and destroy. Methods specific to each type have been moved to the UltraPlonkBackend and UltraHonkBackend classes.
Encapsulation of Duplicate Code:
The method extractProofAndPublicInputs has been moved to the abstract class for data processing in one place. The instantiate method has been implemented with the honkRecursion parameter to configure the recursive mode, reducing logic duplication in each class.
Use of Interfaces:
An interface Backend has been created to unify expectations for the classes, simplifying future class replacement and modification.
Simplification of proofAsFields and vkAsFields Generation:
The generation and serialization of fields (proofAsFields and vkAsFields) are now more unified and isolated in the class.
Improvement of Modularity:
Helper functions (acirToUint8Array and base64Decode) have been extracted separately, simplifying their use and testing. Extracting methods into separate classes and using higher-order methods improves readability and maintainability, making testing and refactoring easier.
Improvement of Error Handling:
Error handling for decoding in base64Decode is now more specific to the environment (Node.js and the browser).