Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update backend.ts #9462

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SoulcoIIector
Copy link

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).

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant