Skip to content

Commit

Permalink
feat: groth16
Browse files Browse the repository at this point in the history
  • Loading branch information
jtguibas committed May 8, 2024
1 parent 8ee9a84 commit f297395
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions prover/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ pub const GROTH16_ARTIFACTS_COMMIT: &str = "49fedbe4";
pub fn install_groth16_artifacts(build_dir: PathBuf) {
// If build directory already exists, skip the download.
if build_dir.exists() {
println!("[sp1]: groth16 artifacts already seem to exist at {}. if you want to re-download them, delete the directory", build_dir.display());
println!("[sp1] groth16 artifacts already seem to exist at {}. if you want to re-download them, delete the directory", build_dir.display());
return;
} else {
println!(
"[sp1]: groth16 artifacts for commit {} do not exist at {}. downloading...",
"[sp1] groth16 artifacts for commit {} do not exist at {}. downloading...",
GROTH16_ARTIFACTS_COMMIT,
build_dir.display()
);
Expand Down Expand Up @@ -61,7 +61,7 @@ pub fn install_groth16_artifacts(build_dir: PathBuf) {
res.wait().unwrap();

println!(
"[sp1]: downloaded {} to {:?}",
"[sp1] downloaded {} to {:?}",
download_url,
build_dir.to_str().unwrap(),
);
Expand Down
2 changes: 1 addition & 1 deletion recursion/gnark/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestMain(t *testing.T) {
if err != nil {
panic(err)
}
fmt.Println("[sp1]: groth16 verifier constraints:", r1cs.GetNbConstraints())
fmt.Println("[sp1] groth16 verifier constraints:", r1cs.GetNbConstraints())

// Run the dummy setup.
var pk groth16.ProvingKey
Expand Down
14 changes: 7 additions & 7 deletions recursion/gnark/server/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func LoadCircuitArtifacts(dataDir, circuitType string) (constraint.ConstraintSys
defer wg.Done()

r1csFilePath := filepath.Join(dataDir, "circuit_"+circuitType+".bin")
fmt.Println("[sp1]: opening r1cs file at:", r1csFilePath)
fmt.Println("[sp1] opening r1cs file at:", r1csFilePath)
r1csFile, err := os.Open(r1csFilePath)
if err != nil {
errR1CS = errors.Wrap(err, "opening R1CS file")
Expand All @@ -77,11 +77,11 @@ func LoadCircuitArtifacts(dataDir, circuitType string) (constraint.ConstraintSys
r1csReader := bufio.NewReader(r1csFile)
r1csStart := time.Now()
r1cs = groth16.NewCS(ecc.BN254)
fmt.Println("[sp1]: reading r1cs file...")
fmt.Println("[sp1] reading r1cs file...")
if _, err = r1cs.ReadFrom(r1csReader); err != nil {
errR1CS = errors.Wrap(err, "reading R1CS content from file")
} else {
fmt.Printf("[sp1]: r1cs loaded in %s\n", time.Since(r1csStart))
fmt.Printf("[sp1] r1cs loaded in %s\n", time.Since(r1csStart))
}
}()

Expand All @@ -90,7 +90,7 @@ func LoadCircuitArtifacts(dataDir, circuitType string) (constraint.ConstraintSys
defer wg.Done()

pkFilePath := filepath.Join(dataDir, "pk_"+circuitType+".bin")
fmt.Println("[sp1]: opening pk file at", pkFilePath)
fmt.Println("[sp1] opening pk file at", pkFilePath)
pkFile, err := os.Open(pkFilePath)
if err != nil {
errPK = errors.Wrap(err, "opening PK file")
Expand All @@ -101,12 +101,12 @@ func LoadCircuitArtifacts(dataDir, circuitType string) (constraint.ConstraintSys
pkReader := bufio.NewReader(pkFile)
pkStart := time.Now()
pk = groth16.NewProvingKey(ecc.BN254)
fmt.Println("[sp1]: reading pk file...")
fmt.Println("[sp1] reading pk file...")
err = pk.ReadDump(pkReader)
if err != nil {
errPK = errors.Wrap(err, "reading PK content from file")
}
fmt.Printf("[sp1]: pk loaded in %s\n", time.Since(pkStart))
fmt.Printf("[sp1] pk loaded in %s\n", time.Since(pkStart))
}()

wg.Wait()
Expand Down Expand Up @@ -136,7 +136,7 @@ func LoadCircuitArtifacts(dataDir, circuitType string) (constraint.ConstraintSys
return nil, nil, nil, errors.Wrap(err, "error reading VK content")
}

fmt.Printf("[sp1]: circuit artifacts loaded successfully in %s\n", time.Since(startTime))
fmt.Printf("[sp1] circuit artifacts loaded successfully in %s\n", time.Since(startTime))

return r1cs, pk, vk, nil

Expand Down
2 changes: 1 addition & 1 deletion recursion/gnark/sp1/groth16.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func BuildGroth16(buildDir string) error {
panic(err)
}
// p.Stop()
fmt.Println("[sp1]: groth16 verifier constraints", r1cs.GetNbConstraints())
fmt.Println("[sp1] groth16 verifier constraints", r1cs.GetNbConstraints())

// Run the trusted setup.
pk, vk, err := groth16.Setup(r1cs)
Expand Down

0 comments on commit f297395

Please sign in to comment.