refactor(generators): consolidate Groth16 generators#491
Open
feltroidprime wants to merge 9 commits intomainfrom
Open
refactor(generators): consolidate Groth16 generators#491feltroidprime wants to merge 9 commits intomainfrom
feltroidprime wants to merge 9 commits intomainfrom
Conversation
refactor(generators): use Risc0VerifierGenerator in gen_risc0_groth16_verifier
refactor(generators): use SP1VerifierGenerator in gen_sp1_groth16_verifier
- Extract shared template fragments (MSM syscall, pairing check, imports) - Add Groth16VerifierGenerator base class - Implement StandardGroth16Generator, Risc0VerifierGenerator, SP1VerifierGenerator - Maintain backward compatibility via existing function signatures - Generated Cairo output is functionally identical to before refactor Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add helper functions for additional common patterns: - get_storage_struct(): Empty storage struct - get_verification_comment(): DO NOT EDIT comment block - get_msm_hint_loop(): Loop to append hint array - get_curve_id_append(): Curve identifier append with comment These can be used to further reduce duplication in generator subclasses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Groth16VerifierGeneratorbase class with common generation logicStandardGroth16Generator,Risc0VerifierGenerator,SP1VerifierGeneratorsubclassesBenefits
get_pairing_check_code()onceget_msm_syscall_code()onceGroth16VerifierGeneratorTest plan
make rewritegenerates functionally identical output🤖 Generated with Claude Code