Skip to content

fix(zk-verifier): don't fail verify_proof extrinsic in runtime-benchmarks#90

Merged
nol4lej merged 1 commit into
mainfrom
fix/zk-verifier-benchmark-pass-on-invalid-proof
May 22, 2026
Merged

fix(zk-verifier): don't fail verify_proof extrinsic in runtime-benchmarks#90
nol4lej merged 1 commit into
mainfrom
fix/zk-verifier-benchmark-pass-on-invalid-proof

Conversation

@nol4lej
Copy link
Copy Markdown
Member

@nol4lej nol4lej commented May 22, 2026

When benchmarking verify_proof, the Groth16 pairing computation runs in full (VK deserialization, proof deserialization, field element conversion and multi-pairing all execute), so the measured weight is accurate. However the extrinsic was returning Err(VerificationFailed) when the benchmark fixtures don't produce a valid pairing result, causing the FRAME benchmark runner to reject the sample.

Add a #[cfg(not(feature = runtime-benchmarks))] guard around the error return so that:

  • Benchmarks: extrinsic completes with Ok(()), weight is recorded.
  • Production: unchanged — returns Err(VerificationFailed) as before.

…arks

When benchmarking verify_proof, the Groth16 pairing computation runs in
full (VK deserialization, proof deserialization, field element conversion
and multi-pairing all execute), so the measured weight is accurate.
However the extrinsic was returning Err(VerificationFailed) when the
benchmark fixtures don't produce a valid pairing result, causing the
FRAME benchmark runner to reject the sample.

Add a #[cfg(not(feature = runtime-benchmarks))] guard around the
error return so that:
- Benchmarks: extrinsic completes with Ok(()), weight is recorded.
- Production: unchanged — returns Err(VerificationFailed) as before.
@nol4lej nol4lej merged commit 72e4ba3 into main May 22, 2026
6 checks passed
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.

1 participant