Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.1.0 #32

Open
wants to merge 439 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
439 commits
Select commit Hold shift + click to select a range
7bb5fa4
Remove count check because it's not compatible with criterion
StefanosChaliasos May 16, 2023
4c18745
Update config of halo2_pse
StefanosChaliasos May 16, 2023
2edf46a
Remove debug print command
StefanosChaliasos May 16, 2023
b54cdf2
Add halo2_pse benchmarks
StefanosChaliasos May 16, 2023
3065f8e
Fix k value for halo2 circuits
StefanosChaliasos May 24, 2023
642047b
Fix halo2 exponentiate circuits and inputs
StefanosChaliasos May 25, 2023
cc0d7c8
Remove println stmt
StefanosChaliasos May 25, 2023
7990f15
Use python3
StefanosChaliasos May 25, 2023
9f5b311
Fix k for sha256
StefanosChaliasos May 25, 2023
96039b8
Add exponentiate benchmarks
StefanosChaliasos May 25, 2023
afadc57
Update sha256 code and use hardcoded values
StefanosChaliasos May 25, 2023
bb7f502
Update sha256 benchmarks for halo2
StefanosChaliasos May 25, 2023
16275da
Decouple snarkjs from circom
StefanosChaliasos May 23, 2023
0b1c46b
Add rapidsnark arithmetics and ec benchmarks
StefanosChaliasos May 23, 2023
94c49c9
Fix rapidsnark paths
StefanosChaliasos May 23, 2023
8bc0dfe
node_modules are in the outer dir
StefanosChaliasos May 23, 2023
b1dd1dc
Remove logging statement
StefanosChaliasos May 23, 2023
edda552
Add rapidsnark instructions in Makefile
StefanosChaliasos May 23, 2023
92d5a8f
Fix rapidsnark configs
StefanosChaliasos May 23, 2023
e7b4475
Add more installation instructions
StefanosChaliasos May 23, 2023
083b4bd
We only support add and mul in rapidsnark
StefanosChaliasos May 23, 2023
a7e8327
We need milliseconds instead of nano seconds for curve operations
StefanosChaliasos May 23, 2023
c45f2f5
Add rapidsnark results
StefanosChaliasos May 23, 2023
86cb74c
Use milliseconds in rapidsnark ec
StefanosChaliasos May 23, 2023
8a86577
Update rapidsnark results
StefanosChaliasos May 23, 2023
578f2ca
Use many threads in snarkjs
StefanosChaliasos May 23, 2023
f4d3b5f
Add rapidsnark prover support (wip)
StefanosChaliasos May 23, 2023
b68809e
Add MSM
tumberger May 24, 2023
e17e003
Update snarkjs and rapidsnark benchmarks
StefanosChaliasos May 24, 2023
b39984f
Update snarkjs_arithmetics only EC2
tumberger May 24, 2023
deff525
Update ec benchmarks
StefanosChaliasos May 24, 2023
6f70f62
Update snarkjs_ec.csv
tumberger May 24, 2023
e4b417b
Add missing ec benchmarks (inputs 3-9)
StefanosChaliasos May 24, 2023
38f0b93
Add snarkjs pairing and remove duplicate msm rapidsnark
StefanosChaliasos May 24, 2023
f46f0d4
Add circom sha256 benchmarks
StefanosChaliasos May 24, 2023
deeb5e4
Add SHA-256 circom
tumberger May 23, 2023
8d86724
Finish exponentiate and handle template variables in python runner
StefanosChaliasos May 23, 2023
ce72e96
Make sha256 circuit parameterized
StefanosChaliasos May 23, 2023
85f06de
Add more exponentiate inputs
StefanosChaliasos May 24, 2023
1efc8e7
Add benchmark results for circom
StefanosChaliasos May 24, 2023
37522e0
Minor fixes in circom's runner
StefanosChaliasos May 24, 2023
8c3584d
Fix exponentiate circuit
StefanosChaliasos May 24, 2023
e7c28ea
Fix node memory issue
StefanosChaliasos May 24, 2023
5f35ceb
Add support for running rapidsnark
StefanosChaliasos May 24, 2023
b155878
Add instructions rapidsnark
StefanosChaliasos May 24, 2023
d4ad6f8
Add circom exponentatiate results for circom/snarkjs and circom/rapid…
StefanosChaliasos May 24, 2023
79c2c87
Add benchmarks for bellman_ce MIMC
tumberger May 10, 2023
c02a1c5
Add bellman benchmarks SHA256
tumberger May 14, 2023
0e865d8
Variable size input sha256
tumberger May 15, 2023
9e337ee
Initial wct + memory benchmarks bellman sha-256
tumberger May 19, 2023
723e96b
Add benchmarks
tumberger May 19, 2023
8cd7cc9
Add parsing from config for bellman SHA-256
tumberger May 19, 2023
642481f
Add config bellman
tumberger May 19, 2023
a1dc6f3
Add Exponentiation circuit for dummy constraints, Readme, update SHA …
tumberger May 19, 2023
afc81dc
Update config & command bellman
tumberger May 19, 2023
bbd8abf
Update WIP benchmarks
tumberger May 19, 2023
eae307b
update rust utilities
tumberger May 20, 2023
9b4a1b0
Add script parsing bellman_ce
tumberger May 20, 2023
92fe601
Update benchmarks
tumberger May 20, 2023
dbc42e7
Generate inputs for benchmarks & fix parsing
tumberger May 20, 2023
71b1d74
Smaller input, add bin for bellman
tumberger May 20, 2023
27f7501
Minor SHA-256 fix
tumberger May 20, 2023
29b7556
Add bellman benchmarks
May 24, 2023
0e49836
sha and exponetiate benchmarks
May 24, 2023
b045c4c
Add halo2_pse circuit benchmarks
StefanosChaliasos May 16, 2023
818b7be
Add missing bin directory
StefanosChaliasos May 16, 2023
317963d
Add benchmark-halo2-pse-circuits command in Makefile (wip)
StefanosChaliasos May 16, 2023
1a6d96c
Rename halo2_pse exponentiation to exponentiate
StefanosChaliasos May 16, 2023
169685a
Implement script for halo2_pse (wip)
StefanosChaliasos May 16, 2023
55ed8fa
Add parser for criterion and use it in main script
StefanosChaliasos May 16, 2023
3054ed9
Update halo2_pse config
StefanosChaliasos May 16, 2023
17a10b0
Remove debug print command
StefanosChaliasos May 16, 2023
196b78d
Fix k value for halo2 circuits
StefanosChaliasos May 24, 2023
36c3ce0
Fix halo2 exponentiate circuits and inputs
StefanosChaliasos May 25, 2023
54a0fa2
Remove println stmt
StefanosChaliasos May 25, 2023
d6c11d7
We need milliseconds instead of nano seconds for curve operations
StefanosChaliasos May 23, 2023
46612b0
Use milliseconds in rapidsnark ec
StefanosChaliasos May 23, 2023
b3a2440
Update ec benchmarks
StefanosChaliasos May 24, 2023
581ff5b
Refactor & add memory binaries for groth16
tumberger May 31, 2023
19cde6e
Adapt scripts & gitignore for gnark memroy
tumberger Jun 6, 2023
7970afd
fix gnark memory benchmarks groth16
tumberger Jun 6, 2023
068d226
Update benchmarks sha groth16
tumberger Jun 6, 2023
b65af4f
bump version to develop branch, add memory benchmarks for plonk with …
tumberger Jun 8, 2023
b43a701
Merge branch feat/recursionTwoChain, adds PlonkFRI as well
tumberger Jun 9, 2023
d85c254
Set scalars and bases in MultiExp to non-default
StefanosChaliasos Jun 12, 2023
b722d0c
Fix memory for halo2 (wip)
StefanosChaliasos Jun 16, 2023
46d2789
Add rust csv parser
StefanosChaliasos Jun 16, 2023
72becdc
Include proof size
StefanosChaliasos Jun 16, 2023
5cfe360
Fix rust parser
StefanosChaliasos Jun 16, 2023
6edf17c
Use sha256 inputs dynamically
StefanosChaliasos Jun 16, 2023
54e3027
Add option for rapidsnark
StefanosChaliasos Jun 16, 2023
791ed30
Update logs format
StefanosChaliasos Jun 16, 2023
49ca6b0
Fix bellman memory measurements
StefanosChaliasos Jun 18, 2023
7b6dcc4
Update gitignore
StefanosChaliasos Jun 18, 2023
ada3a8e
Update .gitignore
StefanosChaliasos Jun 18, 2023
ed6ded6
Circom update logs
StefanosChaliasos Jun 18, 2023
e0cd630
Update logs in halo2_pse and bellman
StefanosChaliasos Jun 18, 2023
1411010
Fix bellman exponentiate verification
tumberger Jun 18, 2023
e4d3e29
Use proper options for time command given the host
StefanosChaliasos Jun 18, 2023
d12aaf0
Rename folder to solve build error
tumberger Jun 18, 2023
71758dc
Update configs and Makefile
tumberger Jun 18, 2023
c3c7564
remove rust-utils
tumberger Jun 18, 2023
57f8de0
Update output format gnark
tumberger Jun 18, 2023
2753770
Add --machine option and remove old benchmarks
StefanosChaliasos Jun 18, 2023
80d815c
Handle machine in Makefile
StefanosChaliasos Jun 18, 2023
abd54be
Remove print stmt
StefanosChaliasos Jun 18, 2023
c47f51f
Make machine persist by using a singleton
StefanosChaliasos Jun 19, 2023
0ea7e34
Update configs and Makefile
tumberger Jun 18, 2023
a991459
Handle machine in Makefile
StefanosChaliasos Jun 18, 2023
708338a
Update Makefile
StefanosChaliasos Jun 19, 2023
60342f9
Add README for benchmarks
StefanosChaliasos Jun 19, 2023
a9dc79a
Update circom gitignore
StefanosChaliasos Jun 19, 2023
a3e99a8
Remove Bellman CE
StefanosChaliasos Jun 19, 2023
1b57308
Move move frameworks into frameworks directory
StefanosChaliasos Jun 19, 2023
9baf49e
Update benchmark paths
StefanosChaliasos Jun 19, 2023
da514b7
Inlcude circuits/math to benchmarks dir
StefanosChaliasos Jun 19, 2023
0d113df
fix gnark input/output path
tumberger Jun 19, 2023
6594aa9
Gnark output path flag
tumberger Jun 19, 2023
f8fbad4
fix bellman memory verify
tumberger Jun 19, 2023
e9f1fd3
Update Readme
tumberger Jun 20, 2023
343774a
Remove legacy code and config
StefanosChaliasos Jun 21, 2023
a089d45
SnarkJS already exists in zkalc
StefanosChaliasos Jun 21, 2023
d05b292
Rapidsnark, halo2curves, and pairing_ce are either included
StefanosChaliasos Jun 23, 2023
175f6ee
Update Makefile (wip)
StefanosChaliasos Jun 23, 2023
eb80a2e
Merge v0.1.0 into feat/zkalc
StefanosChaliasos Jun 23, 2023
32d7e8f
Add MATH.csv
StefanosChaliasos Jun 23, 2023
ec4a466
Update README.md
StefanosChaliasos Jun 23, 2023
283ef0d
Update README.md
StefanosChaliasos Jun 23, 2023
2685337
Add zkalc parser
StefanosChaliasos Jun 23, 2023
e3be114
Merge pull request #34 from zkCollective/feat/zkalc
StefanosChaliasos Jun 23, 2023
144b535
Update math-related Makefile rules
StefanosChaliasos Jun 28, 2023
d54b5de
Update makefile for arkworks-curves
StefanosChaliasos Jul 4, 2023
92b8afc
Add halo2_curves
StefanosChaliasos Jul 4, 2023
af9cf83
Update Readme
tumberger Jul 6, 2023
5994bd9
Update Readme
tumberger Jul 6, 2023
7e912c6
Update Makefile
tumberger Jul 6, 2023
37e723d
Update gnark and ffiasm math commands
StefanosChaliasos Jul 6, 2023
93db642
Add support for lists in input_path
StefanosChaliasos Jul 7, 2023
27aba16
Do not overide memory of other rows
StefanosChaliasos Jul 7, 2023
3aca068
Update Makefile and configs for circuits
StefanosChaliasos Jul 7, 2023
85aa026
update gnark math
tumberger Jul 7, 2023
8688ca0
Update makefile init gnark build
tumberger Jul 7, 2023
8e0dea5
Add dependency rule to gnark circuits rules
StefanosChaliasos Jul 8, 2023
efbbb15
Update Makefile
StefanosChaliasos Jul 8, 2023
4e8a516
Add circom circuits config
StefanosChaliasos Jul 8, 2023
8d7f67a
Add benchmarks m5.2xlarge
Jul 8, 2023
562d2e6
fix makefile
tumberger Jul 8, 2023
55e71de
Add starky time + memory, merge to csv missing
tumberger Jun 23, 2023
1a22815
fix parsing for starky
tumberger Jun 23, 2023
46011c6
Add inputs + benchmarks M2-Air for starky
tumberger Jun 23, 2023
648e7d3
Update process_circuit.py
tumberger Jun 27, 2023
484a50f
Fix user input when config has verify, just leave ToDo
tumberger Jul 4, 2023
ff3a377
Change starky input files num rows power of 2
tumberger Jul 4, 2023
a883913
update test starky previously failed
tumberger Jul 7, 2023
5d14c29
Add Serialization of proof starky for memory benchmarks
tumberger Jul 8, 2023
7333b82
fix proof transformer measurement
tumberger Jul 8, 2023
41575f6
Add starky time + memory, merge to csv missing
tumberger Jun 23, 2023
b212562
Update starky order of commands
tumberger Jul 8, 2023
cf6471e
Add test command for starky
StefanosChaliasos Jul 8, 2023
60d1eba
Update Makefile
StefanosChaliasos Jul 8, 2023
762be57
fix bellman sha256
tumberger Jul 9, 2023
86ba4f9
Clean benchmarks
StefanosChaliasos Jul 9, 2023
2a36027
Update benchmarks README.md
StefanosChaliasos Jul 9, 2023
aa40edf
Update README.md
StefanosChaliasos Jul 9, 2023
8eb8c42
Update Makefile
StefanosChaliasos Jul 9, 2023
28271ac
Rename _input and _scripts
StefanosChaliasos Jul 9, 2023
c64d7a7
Remove nix
StefanosChaliasos Jul 9, 2023
13326e9
Add data and script for supported payloads
StefanosChaliasos Jul 9, 2023
653ac5c
Add data/math.json
StefanosChaliasos Jul 9, 2023
91f9e6b
Add ffiasm in the list, update README, and fix parsing script
StefanosChaliasos Jul 9, 2023
b223792
Add INSTALL.md
StefanosChaliasos Jul 9, 2023
f62c2b8
Update README.md
StefanosChaliasos Jul 9, 2023
ab0f443
Add comment about logs
StefanosChaliasos Jul 9, 2023
5643b74
Add ARCHITECTURE.md and remove documentation/
StefanosChaliasos Jul 9, 2023
89c9e7e
Update README.md
StefanosChaliasos Jul 9, 2023
1a7a570
Update README.md
StefanosChaliasos Jul 9, 2023
e5b01c8
Update README.md
tumberger Jul 10, 2023
8192e64
Update README.md
tumberger Jul 10, 2023
86ae713
Update ARCHITECTURE.md
StefanosChaliasos Jul 10, 2023
a9c9805
Update README.md
StefanosChaliasos Jul 10, 2023
0c04a2b
Fix circuits benchmarks path
StefanosChaliasos Jul 10, 2023
d51ebb5
Add benchmarks bellman and halo2_pse
Jul 10, 2023
8b71814
rename folder
Jul 10, 2023
e836bf1
Update configs input path
tumberger Jul 10, 2023
3eada98
Update INSTALL.md
StefanosChaliasos Jul 10, 2023
70fa8d8
Remove short argument
StefanosChaliasos Jul 10, 2023
9094600
Update INSTALL.md
StefanosChaliasos Jul 10, 2023
49d7ea7
fix _input, _scripts
tumberger Jul 11, 2023
96d5aea
Powers of TAU file renaming and update installation instructions
StefanosChaliasos Jul 11, 2023
4fa0708
Update README.md
StefanosChaliasos Jul 11, 2023
2a321ab
update images
tumberger Jul 11, 2023
1741753
Fix gnark command lenght issue
tumberger Jul 12, 2023
24bdc75
Add tutorial bellman
tumberger Jul 12, 2023
cf301b3
add starky tutorial
tumberger Jul 12, 2023
2d84456
Update ffjavascript benchmarks
Jul 12, 2023
afbabc8
continuous run gnark
tumberger Jul 12, 2023
614159e
s/vesta\/msm/vesta\/msm\/G1/g
StefanosChaliasos Jul 14, 2023
5986b6b
run commands individually
tumberger Jul 14, 2023
6895547
Add logging to command execution
tumberger Jul 14, 2023
4bae99f
add starky benchmarks
Jul 16, 2023
c1bdfc7
fix makefile + gnark expo circuit input parsing
tumberger Jul 16, 2023
a3c42c2
Add exponentiate gnark
Jul 16, 2023
b12566c
Add benchmarks curve25519-dalek and halo2_curves
Jul 17, 2023
770da95
Add sha256 test configs and make rules
StefanosChaliasos Jul 19, 2023
976335f
Update rapidsnark command
StefanosChaliasos Jul 19, 2023
ac08d44
Add math benchmarks m6i.8xlarge
Jul 19, 2023
88d2147
Update benchmarks m6i.8xlarge
Jul 20, 2023
1b12ed8
Add benchmarks m6i.8xlarge circuits
Jul 22, 2023
d93112c
Add math benchmarks ARM
Jul 23, 2023
fd81563
Add starky m6i.8xlarge
Jul 24, 2023
74187ca
update m6i.8xlarge arkworks benchmarks
Jul 28, 2023
db8f973
Remove MATH.csv
StefanosChaliasos Jul 28, 2023
cec8d6f
Add zkCollective/bench-data submodule
StefanosChaliasos Jul 28, 2023
5b9a276
Update cloning commands
StefanosChaliasos Jul 28, 2023
6992511
Update exponentiate input
tumberger Jul 29, 2023
d8c5da6
Add verify into starky configs
StefanosChaliasos Jul 30, 2023
9b09e62
Update benchmarks submodule to track main branch
StefanosChaliasos Jul 31, 2023
c04bfd0
Pull latest results
StefanosChaliasos Jul 31, 2023
e1fa82b
Use dev branch of zkalc
StefanosChaliasos Aug 3, 2023
d494c0a
Fix count for circom
StefanosChaliasos Aug 3, 2023
acc761c
Fix halo2 verification
StefanosChaliasos Aug 3, 2023
ae7325f
Keep variance for gnark and remove PlonkFRI
StefanosChaliasos Aug 4, 2023
2d6ada3
udpate config order
tumberger Aug 5, 2023
7264b8f
Update gnark header for consistency & change benchmarks to microsecon…
tumberger Aug 5, 2023
37f5607
Work on powers of 2
StefanosChaliasos Aug 5, 2023
90dd0d6
Add benchmark-comparison-circuits Makefile rule
StefanosChaliasos Aug 5, 2023
eeabc00
Milliseconds -> microseconds Circom
StefanosChaliasos Aug 5, 2023
ddb0c35
sha256 input should be in bytes for circom
StefanosChaliasos Aug 6, 2023
e2137c6
Move ark-curves.json inside arkworks
StefanosChaliasos Aug 6, 2023
26b003c
Fix parser to not remove verify if memory command has failed
StefanosChaliasos Aug 7, 2023
f5a6731
Increase max node space
StefanosChaliasos Aug 7, 2023
d0b5c79
Update redirection for ffjavascript
StefanosChaliasos Aug 20, 2023
76000d1
bump branch from dev to master, fix mimc test value, add sha2 as in g…
tumberger Sep 4, 2023
d64a8fd
Add Sha2 test prover succeeds
tumberger Sep 4, 2023
145370f
Add test prover failed
tumberger Sep 4, 2023
00a5c91
align benchmark directory name with bench-data submodule
tumberger Sep 7, 2023
830bb2d
update submodule bench-data
tumberger Sep 8, 2023
ac99429
Update sha2 circuit - optimized with lookups gnark std
tumberger Sep 15, 2023
8099918
Update SHA2
tumberger Sep 15, 2023
653ae75
Update README.md
mmaker Sep 21, 2023
1b3e2d4
Merge pull request #45 from mmaker/patch-1
tumberger Sep 21, 2023
89df65e
update path
tumberger Sep 25, 2023
2e25d2b
update sha pub variable
tumberger Sep 25, 2023
45d5551
Update memory benchmarks, fix plonk memory benchmarks
tumberger Sep 25, 2023
f4278a4
fix sha256 config order
tumberger Sep 25, 2023
bdecf32
fix gnark merge command
tumberger Sep 25, 2023
c8c0b43
update config sha
tumberger Sep 25, 2023
b4ed49b
fix
tumberger Sep 25, 2023
726ab42
Update bench data
StefanosChaliasos Sep 26, 2023
c6052c6
Update ARCHITECTURE.md
leopardracer Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
machine
tmp/
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Files generated for benchmarking gnark memory
frameworks/gnark/tmp

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
Expand Down Expand Up @@ -55,7 +60,7 @@ __pycache__/
*.so

# Distribution / packaging
bin/
./bin/
build/
develop-eggs/
dist/
Expand Down Expand Up @@ -106,6 +111,14 @@ pipenv/
node_modules/

# Gnark symlinks
gnark/gnark
gnark/template
frameworks/gnark/gnark
frameworks/gnark/groth16*
frameworks/gnark/plonk*
frameworks/gnark/template
.idea/

tags/

# Vim
*.*.swp
*tags
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "circom/rapidsnark"]
path = frameworks/circom/rapidsnark
url = https://github.com/iden3/rapidsnark.git
[submodule "benchmarks"]
path = benchmarks
url = https://github.com/zkCollective/bench-data.git
156 changes: 156 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Architecture

![Alt text](./architecture.png?raw=true "Title")

Our benchmarking framework is designed to support all types of different frameworks.
We specify a generic set of interfaces, such that benchmarks can be invoked through
a configuration file `config.json`, which produces a standardized output
for a given benchmarking scenario.

## Overview

On a high level, zk-Harness takes as input a configuration file.
The “Config Reader” reads the standardized config and invokes the ZKP framework
as specified in the configuration file. You can find a description of the
configuration file below. Each integrated ZKP framework exposes a runner
that take as an input the standardized configuration parameters to execute the
corresponding benchmarks. The output of benchmarking a given ZKP framework
is a log file in csv format with standardized metrics.
The log file is read by the “Log Analyzer”,
which compiles the logs into pandas dataframes that are used by the front-end and displayed on the public website. You can find the standardized logging
format in the following.

### Config.json

The ``config.json`` file contains information about what benchmarks to execute when invoking the zk-Harness. The following describes how to run benchmarks given a specific config file. Further, we specify each of the keys in a common config file and their expected values.

## Running benchmarks for a specific config file

Given a config file, you can run `python3 -m src.reader --config path/to/config.json` to run the benchmarks defined by a given config file.

## config.json key specification

### `project`

The name of the project being benchmarked.

### `project_url`

The URL(s) to the repository for the project.

### `category`

The category for which the zk-Harness should benchmark a ZKP-framework.
Currently, it supports only `circuit`.

### `count`

The number of runs over which a given computation specified by the config should be averaged.
This option is taken under consideration only if the benchmarking is performed
manually and not through a benchmarking framework such as criterion.

### `payload`

`payload` specifies the exact algorithms to benchmark.
- `backend`
The backend algorithm(s) to use for proving the specified circuit(s).
- `curves`
The curve(s) for which the ZKP-framework should be benchmarked.
- `circuits`
The name of the circuit to benchmark.
Equivalent circuits across frameworks should have the same naming scheme for
ease of comparison.
If a new circuit is added, which does not yet exist in any framework,
one should create a new input specification in the
`input/circuit/<circuit_name>/input_<input_related_identifier>.json`.
- `algorithm`
The algorithm to execute. Note that not all algorithms exist for every framework.
Valid algorithms to execute in a given framework are currently:
- `compile`
- `setup`
- `witness`
- `prove`
- `verify`

If a given algorithm is not specified for the configured framework,
the execution will fail.

## Logs

In the following sections, we describe the columns in the CSV file for each benchmark category.
Note that for "Field Arithmetic" and "Elliptic Curve Group Operations", the logs
are generated by the front-end and used only for displaying data in the UI.

### Circuits

The following information is recorded for each circuit benchmark:

* framework: the name of the framework (e.g., gnark)
* category: the category of the benchmark (i.e., circuit)
* backend: the backend used (e.g., groth16)
* curve: the curve used (e.g., bn256)
* circuit: the circuit being run
* input: file path of the input used
* operation: the step being measured -- compile, witness, setup, prove, verify
* nbConstraints: the number of constraints in the circuit
* nbSecret: number of secret inputs
* nbPublic: number of public inputs
* ram: memory consumed in **bytes**
* time: elapsed time in **milliseconds**
* proofSize: the size of the proof in **bytes** -- empty value when `operation != prove`
* count: number of times that we run the benchmark

### Field Arithmetic

The following information is recorded for each field arithmetic benchmark:

* framework: the name of the framework (e.g., gnark)
* category: the category of the benchmark (i.e., arithmetic)
* curve: the curve of which field we use
* field: the benchmarked field (base or scalar)
* operation: the operation performed (add, sub, mul, inv, exp)
* time: elapsed time in **nanoseconds**
* count: number of times that we run the benchmark

### Elliptic Curve Group Operations

The following information is recorded for each elliptic curve group operation benchmark:

* framework: the name of the framework (e.g., gnark)
* category: the category of the benchmark (i.e., ec)
* curve: the benchmarked curve
* operation: the operation performed -- `g1-scalar-multiplication`, `g2-scalar-multiplication`, `g1-multi-scalar-multiplication`, `g2-multi-scalar-multiplication`, `pairing`
* input: Provided input
* time: elapsed time in **nanoseconds**
* count: number of times that we run the benchmark

## Adding a new framework to the zk-Harness

To integrate a framework, one should follow the following steps:

1. First, fork the `zk-harness` repository
2. Create a `frameworks/<framework_name>` folder in the root folder of the repository.
3. Create a custom benchmarking script that *(i)* reads from the standardized
input of the `config.json` and outputs *(ii)* the standardized logs.
* For example, benchmarking for `gnark` is done through a custom CLI,
based on [cobra](https://github.com/spf13/cobra)
* Your script should be able to take a variety of arguments as specified in
the `config.json`, such that benchmarks can be easily executed and extended.
For example, a common command in the gnark integration would be
`./gnark groth16 --circuit=sha256 --input=_input/circuit/sha256/input_3.json --curve=bn254`
4. Modify the `src/reader/process_circuit.py` scripts to include your newly
created script as described in step 3, which is called if the `project` field of
the respective config contains the `<framework_name>` of your newly added ZKP framework.
* The `src/reader/process_circuit.py` processing python scripts are invoked by
`__main__.py`.
5. Create a documentation in the `frameworks/<framework_name>/README.md`
to outline how others can include new circuits / benchmarks for another circuit
in the framework.
6. Add config files for running the benchmarks in `input/config/<framework_name>`
and add make rules for the new framework in the Makefile.

If you follow the specified interfaces for config and logs,
your framework specific benchmarking should seamlessly integrate into the zk-Harness frontend.

Once finished, please create a Pull Request and assign it to one of the maintainers
for review.
74 changes: 74 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Installation Instructions

To run most of the benchmarks, you will need to have the following software installed on your system:

1. Rust: Rust is a systems programming language that is used by some of the benchmarks. You can install Rust by following the instructions provided on the official website: https://www.rust-lang.org/tools/install.
2. Go: Go is a programming language that is used by some of the benchmarks. You can install Go by following the instructions provided on the official website: https://golang.org/doc/install.
3. Node.js: Node.js is a JavaScript runtime environment that is used by some of the benchmarks. You can install Node.js by following the instructions provided on the official website: https://nodejs.org.
4. Cargo Criterion: Cargo Criterion is a benchmarking library for Rust. To install Cargo Criterion, open a terminal and run the following command:

```bash
cargo install cargo-criterion
```

This will install Cargo Criterion and its dependencies.


Once you have installed the above software, you should be ready to run most of the benchmarks.

## Additional Dependencies

For running benchmarks for the following projects, you should follow the specific instructions.

### Circom

Install Circom compiler following the instructions here: https://docs.circom.io/getting-started/installation/#installing-dependencies.
You also need to install [jq](https://jqlang.github.io/jq/).

To install `jq` you can use `brew`, `apt`, or `yum`.

Furthermore, if you are going to run the full (or larger) benchmarks you will need
a larger powers of TAU file. The default one is downloaded from the
[Hermez ceremony](https://github.com/iden3/snarkjs#7-prepare-phase-2)
and it is `powersOfTau28_hez_final_16.ptau` saved into
`frameworks/circom/phase1/powersOfTau28_final.ptau`.
If you want to benchmark larger circuits we suggest downloading the TAU file
of power of 24 which is sufficient for the current benchmarks.
Note that this file needs 18 GB of disk space.

```
wget -O frameworks/circom/phase1/powersOfTau28_final.ptau https://hermez.s3-eu-west-1.amazonaws.com/powersOfTau28_hez_final_24.ptau
```

* Using SNARKJS

```
npm install snarkjs
```

* Using rapidsnark

Note that this would only work in Intel64

```
cd frameworks/circom
git submodule init && git submodule update
cd rapidsnark
# Following the instructions in the README
```

### ffiasm

Note that this would only work in Intel64

* Linux (ubuntu)

```
apt install libgmp-dev nasm
```

* Mac

```
brew install gmp nasm
```
Loading