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

Support go-rapidsnark in addition to snarkjs with a flag (Part 1) #181

Merged
merged 66 commits into from
Jul 2, 2024

Conversation

syntrust
Copy link
Collaborator

@syntrust syntrust commented Jan 9, 2024

@syntrust
Copy link
Collaborator Author

Some initial test results (time measured in seconds) :

MBP 2.9 GHz 6-Core Intel Core i9

Implementation Proof per sample (mode 1) Proof for 2 samples (mode 2)
snarkjs 43.8 60.1
rapidsnark + wazero.Circom2WZWitnessCalculator 47.1 82.3
rapidsnark + wasmer.Circom2WitnessCalculator 49.5 101.8

AX101

Implementation Proof per sample (mode 1) Proof for 2 samples (mode 2)
snarkjs 12.6 24.4
rapidsnark + wazero.Circom2WZWitnessCalculator 5.7 14.1
rapidsnark + wasmer.Circom2WitnessCalculator 10.2 17.5

Note rapidsnark supports 2 witness calculator implementations which wazero wins.

Will continue research to see if there is any optimization to do with Mac.

@syntrust syntrust changed the base branch from zkp2 to main January 10, 2024 07:31
@syntrust
Copy link
Collaborator Author

With -tags rapidsnark_asm AX101 has an obvious improvement, esp. mode2:

Implementation Proof per sample (mode 1) Proof for 2 samples (mode 2)
rapidsnark + wazero.Circom2WZWitnessCalculator 5.7 14.1
rapidsnark + wazero.Circom2WZWitnessCalculator + -tags rapidsnark_asm 4.6 8.2

But this is not the case for Mac. MacOS build has the optimization enabled according to the go-rapidsnark doc.

@syntrust syntrust changed the title (Draft) Replace snarkjs with Rapidsnark Replace snarkjs with Rapidsnark Jan 11, 2024
@syntrust syntrust requested a review from qzhodl January 11, 2024 10:01
README.md Outdated Show resolved Hide resolved
@qzhodl
Copy link
Collaborator

qzhodl commented Jan 14, 2024

Some initial test results (time measured in seconds) :

MBP 2.9 GHz 6-Core Intel Core i9

Implementation Proof per sample (mode 1) Proof for 2 samples (mode 2)
snarkjs 43.8 60.1
rapidsnark + wazero.Circom2WZWitnessCalculator 47.1 82.3
rapidsnark + wasmer.Circom2WitnessCalculator 49.5 101.8
AX101

Implementation Proof per sample (mode 1) Proof for 2 samples (mode 2)
snarkjs 12.6 24.4
rapidsnark + wazero.Circom2WZWitnessCalculator 5.7 14.1
rapidsnark + wasmer.Circom2WitnessCalculator 10.2 17.5
Note rapidsnark supports 2 witness calculator implementations which wazero wins.

Will continue research to see if there is any optimization to do with Mac.

By running proof by using rapidsnark(https://github.com/iden3/rapidsnark) vs snarkjs, I can reproduce the performance gain (8s vs 40s)

ethstorage/prover/zk_prover.go Outdated Show resolved Hide resolved
ethstorage/prover/zk_prover.go Show resolved Hide resolved
@qzhodl qzhodl requested review from ping-ke and qzhodl April 18, 2024 09:03
@syntrust syntrust changed the title Support go-rapidsnark in addition to snarkjs with a flag (Draft) Support go-rapidsnark in addition to snarkjs with a flag Apr 18, 2024
@syntrust syntrust changed the title (Draft) Support go-rapidsnark in addition to snarkjs with a flag Support go-rapidsnark in addition to snarkjs with a flag (Part 2) Apr 29, 2024
@syntrust syntrust changed the title Support go-rapidsnark in addition to snarkjs with a flag (Part 2) Support go-rapidsnark in addition to snarkjs with a flag (Part 1) Apr 29, 2024
@syntrust syntrust merged commit 039cd3a into main Jul 2, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants