execution-spec-tests icon indicating copy to clipboard operation
execution-spec-tests copied to clipboard

zkevm: add remaining precompiles

Open jsign opened this issue 10 months ago • 1 comments

This PR adds coverage for all remaining precompiles:

  • bn128_add
  • bn128_mul
  • bn128_pairing
  • blake2f
  • point_evaluation
  • All seven new BLS precompiles activated in Pectra.

I created a generic setup, so adding other precompile cases (if anyone thinks other inputs create even worse-case scenarios) is very simple.

I ran this in the SP1 for counting cycles:

  • bls12_fp_to_g1 -> 2.3 billion cycles
  • bls12_fp_to_g2 -> 2.4 billion cycles
  • bls12_g1add -> 2.4 billion cycles
  • bls12_g1msm -> Crash
  • bls12_g2add -> 2.5 billion cycles
  • bls12_g2msm -> Crash
  • bls12_pairing -> 2.4 billion cycles
  • bn128_add -> 18.5 billion cycles
  • bn128_mul -> 28.5 billion cycles
  • bn128_pairing -> 18.6 billion cycles
  • point_evaluation -> 6.8 billion cycles
  • blake2f -> 21 billion cycles

jsign avatar May 09 '25 15:05 jsign

@chfast, I applied your suggestions if you'd like to take another look. Cycles remained the same for everything, but now both MSM make the SP1 RISCV emulator crash :)

jsign avatar May 16 '25 19:05 jsign