Skip to content

Conversation

@brawncode
Copy link

added a few things to make life easier and avoid crashes:

  • check that --config isn’t empty.
  • make sure you provide at least one R1CS source (--r1cs or --r1cs_url).
  • if PK/VK aren’t given, we now generate them automatically.

should save some headaches and prevent silly errors.

@Bisht13 Bisht13 requested review from ashpect and Copilot and removed request for ashpect September 4, 2025 15:43
Copy link

Copilot AI left a 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.

Comment on lines +132 to +135
pk, vk, err = circuit.GenerateUnsafeKeys()
if err != nil {
return fmt.Errorf("failed to generate unsafe keys: %w", err)
}
Copy link

Copilot AI Sep 4, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

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

Copy link
Collaborator

@ashpect ashpect left a 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.

Comment on lines +132 to +135
pk, vk, err = circuit.GenerateUnsafeKeys()
if err != nil {
return fmt.Errorf("failed to generate unsafe keys: %w", err)
}
Copy link
Collaborator

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

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.

2 participants