Skip to content

Commit adac040

Browse files
committed
fix: bundle verifier
1 parent 1515cc5 commit adac040

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

coordinator/cmd/tool/verify.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func verify(cCtx *cli.Context) error {
2828
proofType = cCtx.Args().Get(1)
2929
proofPath = cCtx.Args().Get(2)
3030
}
31-
log.Info("verify proof in: ", proofPath, "type", proofType, "forkName", forkName)
31+
log.Info("verify proof", "in", proofPath, "type", proofType, "forkName", forkName)
3232

3333
// Load the content of the proof file
3434
data, err := os.ReadFile(filepath.Clean(proofPath))
@@ -53,7 +53,7 @@ func verify(cCtx *cli.Context) error {
5353
return fmt.Errorf("no vk loaded for fork %s", forkName)
5454
}
5555
if len(proof.Vk) != 0 {
56-
if bytes.Equal(proof.Vk, vk) {
56+
if !bytes.Equal(proof.Vk, vk) {
5757
return fmt.Errorf("unmatch vk with expected: expected %s, get %s",
5858
base64.StdEncoding.EncodeToString(vk),
5959
base64.StdEncoding.EncodeToString(proof.Vk),
@@ -74,7 +74,7 @@ func verify(cCtx *cli.Context) error {
7474
return fmt.Errorf("no vk loaded for fork %s", forkName)
7575
}
7676
if len(proof.Vk) != 0 {
77-
if bytes.Equal(proof.Vk, vk) {
77+
if !bytes.Equal(proof.Vk, vk) {
7878
return fmt.Errorf("unmatch vk with expected: expected %s, get %s",
7979
base64.StdEncoding.EncodeToString(vk),
8080
base64.StdEncoding.EncodeToString(proof.Vk),
@@ -94,16 +94,7 @@ func verify(cCtx *cli.Context) error {
9494
if !ok {
9595
return fmt.Errorf("no vk loaded for fork %s", forkName)
9696
}
97-
if len(proof.Vk) != 0 {
98-
if bytes.Equal(proof.Vk, vk) {
99-
return fmt.Errorf("unmatch vk with expected: expected %s, get %s",
100-
base64.StdEncoding.EncodeToString(vk),
101-
base64.StdEncoding.EncodeToString(proof.Vk),
102-
)
103-
}
104-
} else {
105-
proof.Vk = vk
106-
}
97+
proof.Vk = vk
10798

10899
ret, err = vf.VerifyBundleProof(proof, forkName)
109100
default:

crates/prover-bin/src/prover.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ impl LocalProver {
203203
.get(hard_fork_name)
204204
.ok_or_else(|| eyre::eyre!("no corresponding config for fork {hard_fork_name}"))?;
205205

206+
let workspace_path = &config.workspace_path;
206207
let universal_prover = EuclidV2Handler::new(config);
207208
let _ = universal_prover
208209
.get_prover()
@@ -224,6 +225,21 @@ impl LocalProver {
224225
let f = File::create(out_path.join("openVmVk.json"))?;
225226
serde_json::to_writer(f, &dump)?;
226227

228+
// Copy verifier.bin from workspace bundle directory to output path
229+
let bundle_verifier_path = Path::new(workspace_path)
230+
.join("bundle")
231+
.join("verifier.bin");
232+
if bundle_verifier_path.exists() {
233+
let dest_path = out_path.join("verifier.bin");
234+
std::fs::copy(&bundle_verifier_path, &dest_path)
235+
.map_err(|e| eyre::eyre!("Failed to copy verifier.bin: {}", e))?;
236+
} else {
237+
eprintln!(
238+
"Warning: verifier.bin not found at {:?}",
239+
bundle_verifier_path
240+
);
241+
}
242+
227243
Ok(())
228244
}
229245
}

crates/prover-bin/src/zk_circuits_handler/euclidV2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl EuclidV2Handler {
7070
ProofType::Batch => self.cached_vks[&ProofType::Batch]
7171
.get_or_init(|| BASE64_STANDARD.encode(self.batch_prover.get_app_vk())),
7272
ProofType::Bundle => self.cached_vks[&ProofType::Bundle]
73-
.get_or_init(|| BASE64_STANDARD.encode(self.bundle_prover.get_evm_vk())),
73+
.get_or_init(|| BASE64_STANDARD.encode(self.bundle_prover.get_app_vk())),
7474
_ => unreachable!("Unsupported proof type {:?}", task_type),
7575
}
7676
.clone()

0 commit comments

Comments
 (0)