besu icon indicating copy to clipboard operation
besu copied to clipboard

EVM benchmark error

Open Federico2014 opened this issue 5 months ago • 7 comments

System info

Processor: 2.6 GHz 6-Core Intel Core i7 Operating system: macOS 15.41 Java version: openjdk version "21.0.7" 2025-04-15

Test ERROR

when I run the bench test: $ ./evmtool benchmark --native, it shows the following problem:

besu/v25.6-develop-509d63f/osx-x86_64/openjdk-java-21
Benchmarks for altBn128 on fork PRAGUE
Native AltBN128
AltBN128 Add    150 gas @    3.9 µs /    38.0 MGps
AltBN128 Mul  6,000 gas @   51.5 µs /   116.5 MGps
AltBN128 2 pairing 79,000 gas @  476.7 µs /   165.7 MGps
AltBN128 4 pairing 113,000 gas @  711.6 µs /   158.8 MGps
AltBN128 6 pairing 147,000 gas @  863.1 µs /   170.3 MGps
Benchmarks for EcRecover on fork PRAGUE
Native secp256k1
ecrecover  3,000 gas @   53.9 µs /    55.7 MGps
Benchmarks for ModExp on fork PRAGUE

**** Calculate the derived gas from execution time with a target of 100 mgas/s *****
*                                                                                  *
*   If 247,914 ns is the execution time of the precompile call, so this is how     *
*                the derived gas is calculated                                     *
*                                                                                  *
*   100,000,000 gas    -------> 1 second (1_000_000_000 ns)                        *
*   x           gas    -------> 247,914 ns                                         *
*                                                                                  *
*       x = (247,914 * 100,000,000) / 1_000_000_000 = 24,791 gas                   *
************************************************************************************

Native ModExp
                               |  Actual cost | Derived Cost |  Iteration time |      Throughput
eip_example1                   |    1,360 gas |    3,564 gas |     35,644.2 ns |      38.15 MGps
eip_example2                   |    1,360 gas |    2,991 gas |     29,912.3 ns |      45.47 MGps
even-modulus-1                 |    9,760 gas |      273 gas |      2,732.1 ns |   3,572.41 MGps
even-modulus-2                 |   17,050 gas |    9,522 gas |     95,222.1 ns |     179.06 MGps
even-modulus-3                 |    6,666 gas |      283 gas |      2,827.9 ns |   2,357.20 MGps
nagydani-1-square              |      500 gas |      406 gas |      4,064.6 ns |     123.01 MGps
nagydani-1-qube                |      500 gas |      510 gas |      5,096.0 ns |      98.12 MGps
nagydani-1-pow0x10001          |      682 gas |      671 gas |      6,711.0 ns |     101.62 MGps
nagydani-2-square              |      500 gas |    1,017 gas |     10,171.5 ns |      49.16 MGps
nagydani-2-qube                |      500 gas |    1,010 gas |     10,104.4 ns |      49.48 MGps
nagydani-2-pow0x10001          |    2,730 gas |    2,085 gas |     20,854.6 ns |     130.91 MGps
nagydani-3-square              |      682 gas |    2,948 gas |     29,481.7 ns |      23.13 MGps
nagydani-3-qube                |      682 gas |    4,250 gas |     42,502.6 ns |      16.05 MGps
nagydani-3-pow0x10001          |   10,922 gas |    6,686 gas |     66,856.0 ns |     163.37 MGps
nagydani-4-square              |    2,730 gas |   10,273 gas |    102,734.3 ns |      26.57 MGps
nagydani-4-qube                |    2,730 gas |   12,010 gas |    120,103.8 ns |      22.73 MGps
nagydani-4-pow0x10001          |   43,690 gas |   23,892 gas |    238,923.9 ns |     182.86 MGps
nagydani-5-square              |   10,922 gas |   43,307 gas |    433,069.8 ns |      25.22 MGps
nagydani-5-qube                |   10,922 gas |   47,744 gas |    477,436.9 ns |      22.88 MGps
nagydani-5-pow0x10001          |  174,762 gas |   92,925 gas |    929,252.7 ns |     188.07 MGps
marius-1-even                  |   15,098 gas |    6,856 gas |     68,559.4 ns |     220.22 MGps
guido-1-even                   |   17,045 gas |    6,670 gas |     66,698.0 ns |     255.55 MGps
guido-2-even                   |   17,050 gas |    8,847 gas |     88,474.6 ns |     192.71 MGps
guido-3-even                   |   10,800 gas |   26,748 gas |    267,483.8 ns |      40.38 MGps
guido-4-even                   |   31,482 gas |   11,806 gas |    118,057.5 ns |     266.67 MGps
guido-4-even-nethermind        |    5,541 gas |    2,637 gas |     26,370.4 ns |     210.12 MGps
marcin-1-base-heavy            |      500 gas |    2,069 gas |     20,690.4 ns |      24.17 MGps
marcin-1-exp-heavy             |    5,541 gas |    2,544 gas |     25,443.4 ns |     217.78 MGps
marcin-modexp-215gas-exp-heavy |   31,482 gas |   11,456 gas |    114,558.3 ns |     274.81 MGps
marcin-1-balanced              |      500 gas |      797 gas |      7,966.6 ns |      62.76 MGps
marcin-2-base-heavy            |    1,734 gas |    7,889 gas |     78,893.7 ns |      21.98 MGps
marcin-2-exp-heavy             |    5,456 gas |    4,568 gas |     45,676.9 ns |     119.45 MGps
marcin-2-balanced              |    1,992 gas |    2,268 gas |     22,684.5 ns |      87.81 MGps
marcin-3-base-heavy            |      677 gas |    2,060 gas |     20,596.5 ns |      32.87 MGps
marcin-3-exp-heavy             |    1,360 gas |    2,598 gas |     25,981.6 ns |      52.34 MGps
marcin-3-balanced              |    1,360 gas |    4,416 gas |     44,161.5 ns |      30.80 MGps
pawel-1-exp-heavy              |    8,186 gas |    3,680 gas |     36,797.8 ns |     222.46 MGps
pawel-2-exp-heavy              |    2,042 gas |    2,420 gas |     24,201.4 ns |      84.38 MGps
pawel-3-exp-heavy              |      890 gas |    1,999 gas |     19,985.1 ns |      44.53 MGps
pawel-4-exp-heavy              |      506 gas |    1,746 gas |     17,461.6 ns |      28.98 MGps
Benchmarks for Secp256k1 on fork PRAGUE
Native secp256k1
secp256k1 signature recovery for 45.8 µs
Benchmarks for Bls12 on fork PRAGUE
runtime: g 17: unexpected return pc for runtime.cgocallback called from 0x1680dc381
stack: frame={sp:0x1c000157fb8, fp:0x1c000157fe0} stack=[0x1c000156000,0x1c000158000)
0x000001c000157eb8:  0x000000c000002a80  0x0000000200000003 
0x000001c000157ec8:  0x00000001af145ec0 <_cgoexp_273a2c827519_eip2537blsG1Add+0x0000000000000000>  0x0000000000000000 
0x000001c000157ed8:  0x000000c000002a80  0x00000001af021840 <runtime.cgocallbackg1.deferwrap2+0x0000000000000000> 
0x000001c000157ee8:  0x000001c000157eb5  0x0000000000000000 
0x000001c000157ef8:  0x0000000000000000  0x0000000000000000 
0x000001c000157f08:  0x0000000000000000  0x000001c000157ee0 
0x000001c000157f18:  0x000001c000157f80  0x00000001af021453 <runtime.cgocallbackg+0x0000000000000133> 
0x000001c000157f28:  0x00000001af145ec0 <_cgoexp_273a2c827519_eip2537blsG1Add+0x0000000000000000>  0x0000700003faf928 
0x000001c000157f38:  0x0000000000000000  0x0100000000000000 
0x000001c000157f48:  0x00000001680dc381  0x0000700003eb1000 
0x000001c000157f58:  0x0000700003fb1000  0x000001c000157fe0 
0x000001c000157f68:  0x0000000000000000  0x000000c000002a80 
0x000001c000157f78:  0x000000c000064008  0x000001c000157fa8 
0x000001c000157f88:  0x00000001af089589 <runtime.cgocallbackg+0x0000000000000029>  0x00000001af145ec0 <_cgoexp_273a2c827519_eip2537blsG1Add+0x0000000000000000> 
0x000001c000157f98:  0x0000700003faf928  0x0000000000000000 
0x000001c000157fa8:  0x0000700003faf8b8  0x00000001af086eec <runtime.cgocallback+0x00000000000000cc> 
0x000001c000157fb8: <0x00000001af145ec0 <_cgoexp_273a2c827519_eip2537blsG1Add+0x0000000000000000>  0x0000700003faf928 
0x000001c000157fc8:  0x0000000000000000  0x0000000000000000 
0x000001c000157fd8:  0x00000001680dc381 >0x0000000000000000 
0x000001c000157fe8:  0x0000000000000000  0x0000000000000000 
0x000001c000157ff8:  0x0000000000000000 
fatal error: unknown caller pc

runtime stack:
runtime.throw({0x1af16392b?, 0x700003faf630?})
        /usr/local/opt/go/libexec/src/runtime/panic.go:1101 +0x48 fp=0x700003faf5d8 sp=0x700003faf5a8 pc=0x1af080068
runtime.(*unwinder).next(0x700003faf688)
        /usr/local/opt/go/libexec/src/runtime/traceback.go:470 +0x249 fp=0x700003faf650 sp=0x700003faf5d8 pc=0x1af0709c9
runtime.copystack(0xc000002a80, 0x1af06d17e?)
        /usr/local/opt/go/libexec/src/runtime/stack.go:934 +0x2ef fp=0x700003faf748 sp=0x700003faf650 pc=0x1af0677ef
runtime.shrinkstack(0xc000002a80)
        /usr/local/opt/go/libexec/src/runtime/stack.go:1237 +0x15f fp=0x700003faf768 sp=0x700003faf748 pc=0x1af06873f
runtime.newstack()
        /usr/local/opt/go/libexec/src/runtime/stack.go:1066 +0x39b fp=0x700003faf8a0 sp=0x700003faf768 pc=0x1af067cdb
runtime.morestack()
        /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:621 +0x7a fp=0x700003faf8a8 sp=0x700003faf8a0 pc=0x1af08525a

goroutine 17 gp=0xc000002a80 m=1 mp=0xc000064008 [running, locked to thread]:
github.com/consensys/gnark-crypto/ecc/bls12-381/fp.mul(0x1c000157c50, 0x1c000157c50, 0x1c000157bf0)
        /Users/runner/go/pkg/mod/github.com/consensys/[email protected]/field/asm/element_6w/element_6w_amd64.s:282 +0x75e fp=0x1c000157bd8 sp=0x1c000157bd0 pc=0x1af100a1e
github.com/consensys/gnark-crypto/ecc/bls12-381/fp.(*Element).Mul(...)
        /Users/runner/go/pkg/mod/github.com/consensys/[email protected]/ecc/bls12-381/fp/element_amd64.go:48
github.com/consensys/gnark-crypto/ecc/bls12-381.(*G1Affine).Add(0x1c0001c5da0, 0x1c0001c5da0, 0x1c0001c5e00)
        /Users/runner/go/pkg/mod/github.com/consensys/[email protected]/ecc/bls12-381/g1.go:107 +0x50c fp=0x1c000157df8 sp=0x1c000157bd8 pc=0x1af10e18c
main.eip2537blsG1Add(0x600001c6d200, 0x600001c6dd00, 0x600001c6d500, 0x0?, 0x0?, 0xaf085101?)
        /Users/runner/work/besu-native/besu-native/gnark/gnark-jni/gnark-eip-2537.go:77 +0x139 fp=0x1c000157e38 sp=0x1c000157df8 pc=0x1af142b59
_cgoexp_273a2c827519_eip2537blsG1Add(0x700003faf928)
        _cgo_gotypes.go:74 +0x30 fp=0x1c000157e70 sp=0x1c000157e38 pc=0x1af145ef0
runtime.cgocallbackg1(0x1af145ec0, 0x700003faf928, 0x0)
        /usr/local/opt/go/libexec/src/runtime/cgocall.go:444 +0x276 fp=0x1c000157f28 sp=0x1c000157e70 pc=0x1af021796
runtime.cgocallbackg(0x1af145ec0, 0x700003faf928, 0x0)
        /usr/local/opt/go/libexec/src/runtime/cgocall.go:350 +0x133 fp=0x1c000157f90 sp=0x1c000157f28 pc=0x1af021453
runtime.cgocallbackg(0x1af145ec0, 0x700003faf928, 0x0)
        <autogenerated>:1 +0x29 fp=0x1c000157fb8 sp=0x1c000157f90 pc=0x1af089589
runtime.cgocallback(0x0, 0x0, 0x0)
        /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1084 +0xcc fp=0x1c000157fe0 sp=0x1c000157fb8 pc=0x1af086eec
runtime: g 17: unexpected return pc for runtime.cgocallback called from 0x1680dc381
stack: frame={sp:0x1c000157fb8, fp:0x1c000157fe0} stack=[0x1c000156000,0x1c000158000)
0x000001c000157eb8:  0x000000c000002a80  0x0000000200000003 
0x000001c000157ec8:  0x00000001af145ec0 <_cgoexp_273a2c827519_eip2537blsG1Add+0x0000000000000000>  0x0000000000000000 
0x000001c000157ed8:  0x000000c000002a80  0x00000001af021840 <runtime.cgocallbackg1.deferwrap2+0x0000000000000000> 
0x000001c000157ee8:  0x000001c000157eb5  0x0000000000000000 
0x000001c000157ef8:  0x0000000000000000  0x0000000000000000 
0x000001c000157f08:  0x0000000000000000  0x000001c000157ee0 
0x000001c000157f18:  0x000001c000157f80  0x00000001af021453 <runtime.cgocallbackg+0x0000000000000133> 
0x000001c000157f28:  0x00000001af145ec0 <_cgoexp_273a2c827519_eip2537blsG1Add+0x0000000000000000>  0x0000700003faf928 
0x000001c000157f38:  0x0000000000000000  0x0100000000000000 
0x000001c000157f48:  0x00000001680dc381  0x0000700003eb1000 
0x000001c000157f58:  0x0000700003fb1000  0x000001c000157fe0 
0x000001c000157f68:  0x0000000000000000  0x000000c000002a80 
0x000001c000157f78:  0x000000c000064008  0x000001c000157fa8 
0x000001c000157f88:  0x00000001af089589 <runtime.cgocallbackg+0x0000000000000029>  0x00000001af145ec0 <_cgoexp_273a2c827519_eip2537blsG1Add+0x0000000000000000> 
0x000001c000157f98:  0x0000700003faf928  0x0000000000000000 
0x000001c000157fa8:  0x0000700003faf8b8  0x00000001af086eec <runtime.cgocallback+0x00000000000000cc> 
0x000001c000157fb8: <0x00000001af145ec0 <_cgoexp_273a2c827519_eip2537blsG1Add+0x0000000000000000>  0x0000700003faf928 
0x000001c000157fc8:  0x0000000000000000  0x0000000000000000 
0x000001c000157fd8:  0x00000001680dc381 >0x0000000000000000 
0x000001c000157fe8:  0x0000000000000000  0x0000000000000000 
0x000001c000157ff8:  0x0000000000000000 

goroutine 2 gp=0x1c000002fc0 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /usr/local/opt/go/libexec/src/runtime/proc.go:435 +0xce fp=0x1c00005efa8 sp=0x1c00005ef88 pc=0x1af08014e
runtime.goparkunlock(...)
        /usr/local/opt/go/libexec/src/runtime/proc.go:441
runtime.forcegchelper()
        /usr/local/opt/go/libexec/src/runtime/proc.go:348 +0xb3 fp=0x1c00005efe0 sp=0x1c00005efa8 pc=0x1af051133
runtime.goexit({})
        /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1700 +0x1 fp=0x1c00005efe8 sp=0x1c00005efe0 pc=0x1af087121
created by runtime.init.7 in goroutine 1
        /usr/local/opt/go/libexec/src/runtime/proc.go:336 +0x1a

goroutine 3 gp=0x1c000003880 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /usr/local/opt/go/libexec/src/runtime/proc.go:435 +0xce fp=0x1c00005f780 sp=0x1c00005f760 pc=0x1af08014e
runtime.goparkunlock(...)
        /usr/local/opt/go/libexec/src/runtime/proc.go:441
runtime.bgsweep(0x1c000092000)
        /usr/local/opt/go/libexec/src/runtime/mgcsweep.go:276 +0x94 fp=0x1c00005f7c8 sp=0x1c00005f780 pc=0x1af03d2b4
runtime.gcenable.gowrap1()
        /usr/local/opt/go/libexec/src/runtime/mgc.go:204 +0x25 fp=0x1c00005f7e0 sp=0x1c00005f7c8 pc=0x1af0319c5
runtime.goexit({})
        /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1700 +0x1 fp=0x1c00005f7e8 sp=0x1c00005f7e0 pc=0x1af087121
created by runtime.gcenable in goroutine 1
        /usr/local/opt/go/libexec/src/runtime/mgc.go:204 +0x66

goroutine 4 gp=0x1c000003a40 m=nil [GC scavenge wait]:
runtime.gopark(0x1c000092000?, 0x1af1b0e98?, 0x1?, 0x0?, 0x1c000003a40?)
        /usr/local/opt/go/libexec/src/runtime/proc.go:435 +0xce fp=0x1c00005ff78 sp=0x1c00005ff58 pc=0x1af08014e
runtime.goparkunlock(...)
        /usr/local/opt/go/libexec/src/runtime/proc.go:441
runtime.(*scavengerState).park(0x1af314e80)
        /usr/local/opt/go/libexec/src/runtime/mgcscavenge.go:425 +0x49 fp=0x1c00005ffa8 sp=0x1c00005ff78 pc=0x1af03ad49
runtime.bgscavenge(0x1c000092000)
        /usr/local/opt/go/libexec/src/runtime/mgcscavenge.go:653 +0x3c fp=0x1c00005ffc8 sp=0x1c00005ffa8 pc=0x1af03b2bc
runtime.gcenable.gowrap2()
        /usr/local/opt/go/libexec/src/runtime/mgc.go:205 +0x25 fp=0x1c00005ffe0 sp=0x1c00005ffc8 pc=0x1af031965
runtime.goexit({})
        /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1700 +0x1 fp=0x1c00005ffe8 sp=0x1c00005ffe0 pc=0x1af087121
created by runtime.gcenable in goroutine 1
        /usr/local/opt/go/libexec/src/runtime/mgc.go:205 +0xa5

goroutine 18 gp=0x1c0001028c0 m=nil [finalizer wait]:
runtime.gopark(0x1b8?, 0x1c000002540?, 0x1?, 0x25?, 0x1c00005e688?)
        /usr/local/opt/go/libexec/src/runtime/proc.go:435 +0xce fp=0x1c00005e630 sp=0x1c00005e610 pc=0x1af08014e
runtime.runfinq()
        /usr/local/opt/go/libexec/src/runtime/mfinal.go:196 +0x107 fp=0x1c00005e7e0 sp=0x1c00005e630 pc=0x1af030987
runtime.goexit({})
        /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1700 +0x1 fp=0x1c00005e7e8 sp=0x1c00005e7e0 pc=0x1af087121
created by runtime.createfing in goroutine 1
        /usr/local/opt/go/libexec/src/runtime/mfinal.go:166 +0x3d

💣 Program crashed: Aborted at 0x00007ff8072a7842

Thread 2 crashed:

0 0x00007ff8072a7842 __pthread_kill + 10 in libsystem_kernel.dylib
1 0x00007ff8071c612a raise + 24 in libsystem_c.dylib
2 0x00000001af088e4b runtime.raise_trampoline.abi0 + 11 in libgnark_eip_2537.dylib
3 0x00000001af086dfd runtime.asmcgocall.abi0 + 157 in libgnark_eip_2537.dylib

Backtrace took 1.16s

How can I fix it?

Federico2014 avatar Jun 24 '25 07:06 Federico2014

@garyschulte if you can have a look. I can't reproduce on my side with AARCH 64

besu/v25.6-develop-f6372d6/osx-aarch_64/openjdk-java-21

ahamlat avatar Jun 24 '25 15:06 ahamlat

./evmtool benchmark --native
besu/v25.6-develop-f6372d6/osx-aarch_64/openjdk-java-21
Benchmarks for altBn128 on fork PRAGUE
Native AltBN128
AltBN128 Add    150 gas @    2.3 µs /    66.4 MGps
AltBN128 Mul  6,000 gas @   45.1 µs /   133.2 MGps
AltBN128 2 pairing 79,000 gas @  665.6 µs /   118.7 MGps
AltBN128 4 pairing 113,000 gas @  983.3 µs /   114.9 MGps
AltBN128 6 pairing 147,000 gas @1,219.6 µs /   120.5 MGps
Benchmarks for EcRecover on fork PRAGUE
Native secp256k1
ecrecover  3,000 gas @   38.0 µs /    79.0 MGps
Benchmarks for ModExp on fork PRAGUE

**** Calculate the derived gas from execution time with a target of 100 mgas/s *****
*                                                                                  *
*   If 247,914 ns is the execution time of the precompile call, so this is how     *
*                the derived gas is calculated                                     *
*                                                                                  *
*   100,000,000 gas    -------> 1 second (1_000_000_000 ns)                        *
*   x           gas    -------> 247,914 ns                                         *
*                                                                                  *
*	x = (247,914 * 100,000,000) / 1_000_000_000 = 24,791 gas                   *
************************************************************************************

Native ModExp
                               |  Actual cost | Derived Cost |  Iteration time |      Throughput
eip_example1                   |    1,360 gas |    2,850 gas |     28,503.3 ns |      47.71 MGps
eip_example2                   |    1,360 gas |    2,427 gas |     24,269.8 ns |      56.04 MGps
even-modulus-1                 |    9,760 gas |      183 gas |      1,827.1 ns |   5,341.84 MGps
even-modulus-2                 |   17,050 gas |    5,743 gas |     57,431.6 ns |     296.88 MGps
even-modulus-3                 |    6,666 gas |      168 gas |      1,675.2 ns |   3,979.19 MGps
nagydani-1-square              |      500 gas |      401 gas |      4,008.9 ns |     124.72 MGps
nagydani-1-qube                |      500 gas |      307 gas |      3,070.2 ns |     162.86 MGps
nagydani-1-pow0x10001          |      682 gas |      568 gas |      5,683.2 ns |     120.00 MGps
nagydani-2-square              |      500 gas |      738 gas |      7,383.9 ns |      67.71 MGps
nagydani-2-qube                |      500 gas |      759 gas |      7,586.6 ns |      65.91 MGps
nagydani-2-pow0x10001          |    2,730 gas |    1,560 gas |     15,596.6 ns |     175.04 MGps
nagydani-3-square              |      682 gas |    2,533 gas |     25,332.5 ns |      26.92 MGps
nagydani-3-qube                |      682 gas |    3,543 gas |     35,429.1 ns |      19.25 MGps
nagydani-3-pow0x10001          |   10,922 gas |    5,606 gas |     56,063.7 ns |     194.81 MGps
nagydani-4-square              |    2,730 gas |    9,573 gas |     95,728.0 ns |      28.52 MGps
nagydani-4-qube                |    2,730 gas |    9,984 gas |     99,842.6 ns |      27.34 MGps
nagydani-4-pow0x10001          |   43,690 gas |   21,327 gas |    213,272.3 ns |     204.86 MGps
nagydani-5-square              |   10,922 gas |   35,041 gas |    350,410.9 ns |      31.17 MGps
nagydani-5-qube                |   10,922 gas |   38,952 gas |    389,523.7 ns |      28.04 MGps
nagydani-5-pow0x10001          |  174,762 gas |   83,884 gas |    838,836.1 ns |     208.34 MGps
marius-1-even                  |   15,098 gas |    4,917 gas |     49,170.0 ns |     307.06 MGps
guido-1-even                   |   17,045 gas |    4,827 gas |     48,265.4 ns |     353.15 MGps
guido-2-even                   |   17,050 gas |    5,856 gas |     58,559.7 ns |     291.16 MGps
guido-3-even                   |   10,800 gas |   22,617 gas |    226,165.3 ns |      47.75 MGps
guido-4-even                   |   31,482 gas |    7,548 gas |     75,477.1 ns |     417.11 MGps
guido-4-even-nethermind        |    5,541 gas |    1,627 gas |     16,270.4 ns |     340.56 MGps
marcin-1-base-heavy            |      500 gas |    1,629 gas |     16,292.8 ns |      30.69 MGps
marcin-1-exp-heavy             |    5,541 gas |    1,668 gas |     16,681.6 ns |     332.16 MGps
marcin-modexp-215gas-exp-heavy |   31,482 gas |    7,542 gas |     75,422.6 ns |     417.41 MGps
marcin-1-balanced              |      500 gas |      550 gas |      5,498.4 ns |      90.94 MGps
marcin-2-base-heavy            |    1,734 gas |    6,418 gas |     64,182.3 ns |      27.02 MGps
marcin-2-exp-heavy             |    5,456 gas |    2,607 gas |     26,069.6 ns |     209.29 MGps
marcin-2-balanced              |    1,992 gas |    1,686 gas |     16,864.0 ns |     118.12 MGps
marcin-3-base-heavy            |      677 gas |    1,533 gas |     15,328.0 ns |      44.17 MGps
marcin-3-exp-heavy             |    1,360 gas |    1,924 gas |     19,239.2 ns |      70.69 MGps
marcin-3-balanced              |    1,360 gas |    3,001 gas |     30,011.2 ns |      45.32 MGps
pawel-1-exp-heavy              |    8,186 gas |    2,357 gas |     23,567.5 ns |     347.34 MGps
pawel-2-exp-heavy              |    2,042 gas |    1,460 gas |     14,602.2 ns |     139.84 MGps
pawel-3-exp-heavy              |      890 gas |    1,319 gas |     13,186.6 ns |      67.49 MGps
pawel-4-exp-heavy              |      506 gas |    1,107 gas |     11,070.9 ns |      45.71 MGps
Benchmarks for Secp256k1 on fork PRAGUE
Native secp256k1
secp256k1 signature recovery for 37.2 µs
Benchmarks for Bls12 on fork PRAGUE
Bls12 G1 Add    375 avg gas @    4.6 µs /    81.9 MGps
Bls12 G1 MSM   501,672 total gas @4,717.6 µs /   106.3 MGps
Bls12 MapFpToG1  5,500 avg gas @   53.8 µs /   102.2 MGps
Bls12 G2 Add    600 avg gas @    8.2 µs /    72.8 MGps
Bls12 G2 MSM   991,080 total gas @8,060.0 µs /   123.0 MGps
Bls12 MapFp2G1 23,800 avg gas @  262.1 µs /    90.8 MGps
Bls12 Pairing 2,209,700 total gas @24,685.4 µs /    89.5 MGps

ahamlat avatar Jun 24 '25 15:06 ahamlat

I believe it's the 'Bls12' benchmarks that you are having problems with. I'm running on the main branch right now @05cf551 and cannot reproduce it on a Mac with intel chipset:

$ ethereum/evmtool/build/install/evmtool/bin/evmtool benchmark Bls12 --native
besu/v25.6-develop-05cf551/osx-x86_64/oracle-java-21
Benchmarks for Bls12 on fork PRAGUE
Bls12 G1 Add    375 avg gas @   12.1 µs /    30.9 MGps
Bls12 G1 MSM   501,672 total gas @15,976.3 µs /    31.4 MGps
Bls12 MapFpToG1  5,500 avg gas @  160.4 µs /    34.3 MGps
Bls12 G2 Add    600 avg gas @   18.5 µs /    32.5 MGps
Bls12 G2 MSM   991,080 total gas @33,329.5 µs /    29.7 MGps
Bls12 MapFp2G1 23,800 avg gas @  770.3 µs /    30.9 MGps
Bls12 Pairing 2,209,700 total gas @64,710.2 µs /    34.1 MGps

$ java -version
java version "21.0.7" 2025-04-15 LTS
Java(TM) SE Runtime Environment (build 21.0.7+8-LTS-245)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.7+8-LTS-245, mixed mode, sharing)

$ sw_vers
ProductName:    macOS
ProductVersion: 11.7.10
BuildVersion:   20G1427

$ sysctl -a | grep cpu.brand_string
machdep.cpu.brand_string: Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz

Unfortunately I cannot fully match your specs because my laptop only goes up to Big Sur and you are on Sequoia, you must have a Mac Pro circa 2018. This seems like some bad build or some incompatible native libraries installed on your system. Maybe try installing an older version of MacOS if you can? https://support.apple.com/en-ie/120282

lu-pinto avatar Jun 25 '25 09:06 lu-pinto

perhaps we need to update the ci build environment to reflect the latest macos version, and target the older SDK from the latest build environment for maximum compatibility. It seems like macos-latest might be the better build environment option, even if it is a moving target

I also don't have access to the latest macos on x86. @Federico2014 could you test a specific build version to ensure it fixes the issue?

garyschulte avatar Jun 25 '25 14:06 garyschulte

@lu-pinto, when I run the Bls12 benchmark alone, it also works.

$ ethereum/evmtool/build/install/evmtool/bin/evmtool benchmark Bls12 --native
besu/v25.6-develop-509d63f/osx-x86_64/openjdk-java-21
Benchmarks for Bls12 on fork PRAGUE
Bls12 G1 Add    375 avg gas @    7.1 µs /    52.7 MGps
Bls12 G1 MSM   501,672 total gas @5,074.8 µs /    98.9 MGps
Bls12 MapFpToG1  5,500 avg gas @   67.0 µs /    82.1 MGps
Bls12 G2 Add    600 avg gas @    9.8 µs /    61.0 MGps
Bls12 G2 MSM   991,080 total gas @7,790.0 µs /   127.2 MGps
Bls12 MapFp2G1 23,800 avg gas @  265.1 µs /    89.8 MGps
Bls12 Pairing 2,209,700 total gas @22,607.9 µs /    97.7 MGps

$ ethereum/evmtool/build/install/evmtool/bin/evmtool benchmark command also works. but $ ethereum/evmtool/build/install/evmtool/bin/evmtool benchmark --native command will always show the above error.

 $ java -version
openjdk version "21.0.7" 2025-04-15
OpenJDK Runtime Environment Homebrew (build 21.0.7)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.7, mixed mode, sharing)

 $ sw_vers
ProductName:            macOS
ProductVersion:         15.4.1
BuildVersion:           24E263

 $ sysctl -a | grep cpu.brand_string
machdep.cpu.brand_string: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz

@garyschulte Sure, I can run the tests on my macOS environment. Let me know which specific build version or branch you'd like me to test, and I’ll verify if it resolves the issue.

Federico2014 avatar Jun 26 '25 05:06 Federico2014

When I switch to Oracle JDK 21, it returns the same error.

Federico2014 avatar Jun 26 '25 06:06 Federico2014

From the benchmark, I find that ModExp in Java version outperforms the native version in most test cases. Is it reasonable?

Federico2014 avatar Jun 26 '25 06:06 Federico2014