Skip to content

fix(libzkevm): zkvm_bls12_* and zkvm_ripemd160 to be spec conformant#2865

Open
han0110 wants to merge 2 commits into
succinctlabs:mainfrom
han0110:patch/v6.3.1/libzkevm
Open

fix(libzkevm): zkvm_bls12_* and zkvm_ripemd160 to be spec conformant#2865
han0110 wants to merge 2 commits into
succinctlabs:mainfrom
han0110:patch/v6.3.1/libzkevm

Conversation

@han0110

@han0110 han0110 commented Jul 2, 2026

Copy link
Copy Markdown

Motivation

Crate libzkevm has a few places that are not eth-act/zkvm-standards conformant, this PR attempts to fix that.

Solution

  • zkvm_bls12_g1_add, zkvm_bls12_g1_msm

    Use all zeros for point at infinity (was 0x40 flag of bls12_381). Reject coordinates with flag bits set.

  • zkvm_bls12_g2_add, zkvm_bls12_g2_msm

    Same, plus Fp2 order is c0 || c1 (was c1 || c0).

  • zkvm_bls12_pairing

    Skip pairs with a point at infinity as perf improvement.

  • zkvm_bls12_map_fp2_to_g2

    Read Fp2 input as c0 || c1. Hardcode the image of u = 0 to work around a bls12_381 bug (its SWU emits an off-curve y = 0 point for u = 0, the only affected input, which cofactor clearing then collapses to infinity). Image derived from with py_ecc.

  • zkvm_ripemd160

    Write the digest to the last 20 bytes.

Also update conformance tests, examples, and test vectors to the corrected encoding, and verified against the test suites of execution-specs@tests-zkevm@v0.4.1 (23264 fixtures).

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

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