mirror of
https://github.com/arnaucube/go-circom-prover-verifier.git
synced 2026-02-06 19:06:43 +01:00
Add ProvingKey binary parser
The time on the parsing doesn't improve, as the data from the binary file needs to be converted to `affine` representation, and then parsed into the `bn256.G1` & `bn256.G2` formats (Montgomery). But the size of the ProvingKey files in binary is much smaller, so will be better handled by the smarthpones. - Parse time benchmarks: ``` BenchmarkParsePk/Parse_Pk_bin_circuit1k-4 2 563729994 ns/op BenchmarkParsePk/Parse_Pk_json_circuit1k-4 635641 1941 ns/op BenchmarkParsePk/Parse_Pk_bin_circuit5k-4 1 2637941658 ns/op BenchmarkParsePk/Parse_Pk_json_circuit5k-4 1 2986560185 ns/op BenchmarkParsePk/Parse_Pk_bin_circuit10k-4 1 5337639150 ns/op BenchmarkParsePk/Parse_Pk_json_circuit10k-4 1 6149568824 ns/op BenchmarkParsePk/Parse_Pk_bin_circuit20k-4 1 10533654623 ns/op BenchmarkParsePk/Parse_Pk_json_circuit20k-4 1 11657326851 ns/op ``` - Size of ProvingKey file for a circuit of 50k constraints: ``` circuit 20k constraints: 10097812 bytes of proving_key.bin 29760049 bytes of proving_key.json circuit 50k constraints: 24194964 bytes of proving_key.bin 71484081 bytes of proving_key.json ```
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
bn256 "github.com/ethereum/go-ethereum/crypto/bn256/cloudflare"
|
||||
)
|
||||
|
||||
var Q, _ = new(big.Int).SetString("21888242871839275222246405745257275088696311157297823662689037894645226208583", 10)
|
||||
|
||||
// R is the mod of the finite field
|
||||
var R, _ = new(big.Int).SetString("21888242871839275222246405745257275088548364400416034343698204186575808495617", 10)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user