metacraft-labs / DendrETH

A smart contract implementation of the Ethereum light client sync protocol
GNU General Public License v3.0
46 stars 10 forks source link

Create a benchmark for evaluating the performance of the WASM implementations of the BN curve #108

Open zah opened 1 year ago

zah commented 1 year ago

Our repository currently features a Nim and Rust implementation of the BN curve primitives required for Groth16 verification.

The Nim implementation is lifted from the Nimbus codebase and the Rust one is taken from arkworks. There are some additional implementations that we can potentially evaluate such as the original BN curve crate from ZCash and the WASM-native work in the wasmcurves project.

Due to various technical details, these implementations are not portable to all of our targeted blockchains, but we need to understand better how they stack against each other performance-wise.

We should create a basic test harness based on the standard WebAssembly run-time in node.js (and potentially other run-times in the future). The benchmark can measure either the wall clock time as a good proxy for the consumed gas or things like executed instructions count if some of the WASM run-times can provide such information.

zah commented 1 year ago

Another contender that might also be relevant for Solana where we currently challenges is the following C++ project:

https://github.com/AztecProtocol/barretenberg

The following article suggests that it has a WebAssembly version known as Barretenberg.js: https://medium.com/aztec-protocol/introducing-noir-the-universal-language-of-zero-knowledge-ff43f38d86d9

zah commented 1 year ago

Gnark may have a browser version as well: https://consensys.net/blog/research-development/gnark-your-guide-to-write-zksnarks-in-go/