-
Notifications
You must be signed in to change notification settings - Fork 29
fix: missing validations and automatic PK/VK generation #177
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the CLI validation and key generation capabilities of the recursive verifier by adding input validation and automatic key generation. The changes prevent common user errors and improve the tool's usability by handling missing keys gracefully.
- Added validation to ensure required configuration and R1CS inputs are provided
- Implemented automatic PK/VK generation when keys are not explicitly provided
- Enhanced error handling with descriptive error messages
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| pk, vk, err = circuit.GenerateUnsafeKeys() | ||
| if err != nil { | ||
| return fmt.Errorf("failed to generate unsafe keys: %w", err) | ||
| } |
Copilot
AI
Sep 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The automatic generation of 'unsafe' keys in production code poses a security risk. Consider adding a warning log message or requiring explicit user consent before generating unsafe keys, as these should typically only be used for testing or development purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call pk, vk, err = circuit.GenerateUnsafeKeys() does not exist in the circuit packag, this function isn’t defined and the code would not compile.
Regarding the generation of pk/vk keys, if they are not explicitly provided, they are generated at this location in the codebase
ashpect
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, the CLI will exit with an error message, but the two improved logs do make life easier.
However, the pk/vk generation code is redundant and should be removed. Also, please rename the PR to fix: missing validation.
| pk, vk, err = circuit.GenerateUnsafeKeys() | ||
| if err != nil { | ||
| return fmt.Errorf("failed to generate unsafe keys: %w", err) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call pk, vk, err = circuit.GenerateUnsafeKeys() does not exist in the circuit packag, this function isn’t defined and the code would not compile.
Regarding the generation of pk/vk keys, if they are not explicitly provided, they are generated at this location in the codebase
added a few things to make life easier and avoid crashes:
--configisn’t empty.--r1csor--r1cs_url).should save some headaches and prevent silly errors.