Skip to content

Commit

Permalink
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 4 additions & 2 deletions crates/recursion/gnark-ffi/src/groth16_bn254.rs
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ impl Groth16Bn254Prover {
build_groth16_bn254(build_dir.to_str().unwrap());

// Write the corresponding asset files to the build dir.
let sp1_verifier_path = build_dir.join("Groth16SP1Verifier.sol");
let sp1_verifier_path = build_dir.join("SP1VerifierGroth16.sol");
let vkey_hash = Self::get_vkey_hash(&build_dir);
let sp1_verifier_str = include_str!("../assets/SP1Verifier.txt")
.replace("{SP1_CIRCUIT_VERSION}", SP1_CIRCUIT_VERSION)
@@ -108,7 +108,9 @@ impl Groth16Bn254Prover {
build_dir: &Path,
) {
if proof.groth16_vkey_hash != Self::get_vkey_hash(build_dir) {
panic!("Proof vkey hash does not match circuit vkey hash, it was generated with a different circuit.");
panic!(
"Proof vkey hash does not match circuit vkey hash, it was generated with a different circuit."
);
}
verify_groth16_bn254(
build_dir.to_str().unwrap(),
6 changes: 4 additions & 2 deletions crates/recursion/gnark-ffi/src/plonk_bn254.rs
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ impl PlonkBn254Prover {
build_plonk_bn254(build_dir.to_str().unwrap());

// Write the corresponding asset files to the build dir.
let sp1_verifier_path = build_dir.join("PlonkSP1Verifier.sol");
let sp1_verifier_path = build_dir.join("SP1VerifierPlonk.sol");
let vkey_hash = Self::get_vkey_hash(&build_dir);
let sp1_verifier_str = include_str!("../assets/SP1Verifier.txt")
.replace("{SP1_CIRCUIT_VERSION}", SP1_CIRCUIT_VERSION)
@@ -107,7 +107,9 @@ impl PlonkBn254Prover {
build_dir: &Path,
) {
if proof.plonk_vkey_hash != Self::get_vkey_hash(build_dir) {
panic!("Proof vkey hash does not match circuit vkey hash, it was generated with a different circuit.");
panic!(
"Proof vkey hash does not match circuit vkey hash, it was generated with a different circuit."
);
}
verify_plonk_bn254(
build_dir.to_str().unwrap(),
8 changes: 4 additions & 4 deletions crates/sdk/src/artifacts.rs
Original file line number Diff line number Diff line change
@@ -19,14 +19,14 @@ pub fn export_solidity_plonk_bn254_verifier(output_dir: impl Into<PathBuf>) -> R
} else {
try_install_circuit_artifacts()
};
let verifier_path = artifacts_dir.join("PlonkSP1Verifier.sol");
let verifier_path = artifacts_dir.join("SP1VerifierPlonk.sol");

if !verifier_path.exists() {
return Err(anyhow::anyhow!("verifier file not found at {:?}", verifier_path));
}

std::fs::create_dir_all(&output_dir).context("Failed to create output directory.")?;
let output_path = output_dir.join("PlonkSP1Verifier.sol");
let output_path = output_dir.join("SP1VerifierPlonk.sol");
std::fs::copy(&verifier_path, &output_path).context("Failed to copy verifier file.")?;
tracing::info!(
"exported verifier from {} to {}",
@@ -48,14 +48,14 @@ pub fn export_solidity_groth16_bn254_verifier(output_dir: impl Into<PathBuf>) ->
} else {
try_install_circuit_artifacts()
};
let verifier_path = artifacts_dir.join("Groth16SP1Verifier.sol");
let verifier_path = artifacts_dir.join("SP1VerifierGroth16.sol");

if !verifier_path.exists() {
return Err(anyhow::anyhow!("verifier file not found at {:?}", verifier_path));
}

std::fs::create_dir_all(&output_dir).context("Failed to create output directory.")?;
let output_path = output_dir.join("Groth16SP1Verifier.sol");
let output_path = output_dir.join("SP1VerifierGroth16.sol");
std::fs::copy(&verifier_path, &output_path).context("Failed to copy verifier file.")?;
tracing::info!(
"exported verifier from {} to {}",

0 comments on commit d3a73a9

Please sign in to comment.