Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions recursive-verifier/cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func main() {
vkUrl := c.String("vk_url")
r1csUrl := c.String("r1cs_url")

if configFilePath == "" {
return fmt.Errorf("config file path must be provided")
}

configFile, err := os.ReadFile(configFilePath)
if err != nil {
return fmt.Errorf("failed to read config file: %w", err)
Expand All @@ -88,6 +92,10 @@ func main() {
return fmt.Errorf("failed to unmarshal config JSON: %w", err)
}

if r1csFilePath == "" && r1csUrl == "" {
return fmt.Errorf("must provide either --r1cs or --r1cs_url")
}

var r1csFile []byte
if r1csFilePath != "" {
r1csFile, err = os.ReadFile(r1csFilePath)
Expand Down Expand Up @@ -121,6 +129,10 @@ func main() {
}
} else {
log.Printf("No valid PK/VK url or file combo provided, generating new keys unsafely")
pk, vk, err = circuit.GenerateUnsafeKeys()
if err != nil {
return fmt.Errorf("failed to generate unsafe keys: %w", err)
}
Comment on lines +132 to +135
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

}

if err = circuit.PrepareAndVerifyCircuit(config, r1cs, pk, vk, outputCcsPath); err != nil {
Expand Down