Skip to content

Commit

Permalink
add bls12 g1/g2 msm to evmtool benchmark subcommand
Browse files Browse the repository at this point in the history
Signed-off-by: garyschulte <[email protected]>
  • Loading branch information
garyschulte committed Oct 1, 2024
1 parent 873a2d5 commit d9fe3e4
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 707 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.hyperledger.besu.BesuInfo;
import org.hyperledger.besu.evmtool.benchmarks.AltBN128Benchmark;
import org.hyperledger.besu.evmtool.benchmarks.BLS12Benchmark;
import org.hyperledger.besu.evmtool.benchmarks.BenchmarkExecutor;
import org.hyperledger.besu.evmtool.benchmarks.ECRecoverBenchmark;
import org.hyperledger.besu.evmtool.benchmarks.ModExpBenchmark;
Expand Down Expand Up @@ -56,7 +57,9 @@ enum Benchmark {
// blake2f
EcRecover(new ECRecoverBenchmark()),
ModExp(new ModExpBenchmark()),
Secp256k1(new Secp256k1Benchmark());
Secp256k1(new Secp256k1Benchmark()),
// bls12
Bls12(new BLS12Benchmark());

final BenchmarkExecutor benchmarkExecutor;

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.hyperledger.besu.evm.frame.ExceptionalHaltReason;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.nativelib.gnark.LibGnarkEIP196;
import org.hyperledger.besu.nativelib.gnark.LibGnarkEIP2537;

import java.util.Optional;
Expand Down Expand Up @@ -67,6 +68,21 @@ public abstract class AbstractBLS12PrecompiledContract implements PrecompiledCon
this.inputLimit = inputLen + 1;
}

/**
* Is bls12 supported on this platform
*
* @return true if the native library was loaded.
*/
public static boolean isAvailable() {
try {
return LibGnarkEIP2537.ENABLED;
} catch (UnsatisfiedLinkError | NoClassDefFoundError ule) {
LOG.info("bls12-381 native precompile not available: {}", ule.getMessage());
}
return false;
}


@Override
public String getName() {
return name;
Expand Down
Loading

0 comments on commit d9fe3e4

Please sign in to comment.