mirror of
https://github.com/arnaucube/gnark-plonky2-verifier.git
synced 2026-01-12 00:51:33 +01:00
Poseidon BN128 (#20)
* initial commit of poseidon bn128 * got challenger working * deserialize is working * cleaned up deserialization function a bit * fixed challenger * add in the hack to the challenges * fixed some bugs in poseidon_bn128 * fri verification is working * some changes for benchmarking * added decode_block plonky2 data * initial commit for poseidon_mds_gate * updated gate test cases * working poseidon mds gate * full verifier test case working
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
type VerifierOnlyCircuitData struct {
|
||||
ConstantSigmasCap MerkleCap
|
||||
CircuitDigest poseidon.Hash
|
||||
CircuitDigest poseidon.PoseidonBN128HashOut
|
||||
}
|
||||
|
||||
type CircuitConfig struct {
|
||||
|
||||
@@ -5,18 +5,18 @@ import (
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/poseidon"
|
||||
)
|
||||
|
||||
type MerkleCap = []poseidon.Hash
|
||||
type MerkleCap = []poseidon.PoseidonBN128HashOut
|
||||
|
||||
func NewMerkleCap(capHeight uint64) MerkleCap {
|
||||
return make([]poseidon.Hash, 1<<capHeight)
|
||||
return make([]poseidon.PoseidonBN128HashOut, 1<<capHeight)
|
||||
}
|
||||
|
||||
type MerkleProof struct {
|
||||
Siblings []poseidon.Hash // Length = CircuitConfig.FriConfig.DegreeBits + CircuitConfig.FriConfig.RateBits - CircuitConfig.FriConfig.CapHeight
|
||||
Siblings []poseidon.PoseidonBN128HashOut // Length = CircuitConfig.FriConfig.DegreeBits + CircuitConfig.FriConfig.RateBits - CircuitConfig.FriConfig.CapHeight
|
||||
}
|
||||
|
||||
func NewMerkleProof(merkleProofLen uint64) MerkleProof {
|
||||
return MerkleProof{Siblings: make([]poseidon.Hash, merkleProofLen)}
|
||||
return MerkleProof{Siblings: make([]poseidon.PoseidonBN128HashOut, merkleProofLen)}
|
||||
}
|
||||
|
||||
type EvalProof struct {
|
||||
|
||||
BIN
verifier/data/.DS_Store
vendored
Normal file
BIN
verifier/data/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -35,7 +35,7 @@
|
||||
"num_query_rounds": 28
|
||||
},
|
||||
"hiding": false,
|
||||
"degree_bits": 13,
|
||||
"degree_bits": 12,
|
||||
"reduction_arity_bits": [
|
||||
4,
|
||||
4
|
||||
@@ -43,6 +43,8 @@
|
||||
},
|
||||
"gates": [
|
||||
"NoopGate",
|
||||
"ConstantGate { num_consts: 2 }",
|
||||
"PoseidonMdsGate(PhantomData<plonky2_field::goldilocks_field::GoldilocksField>)<WIDTH=12>",
|
||||
"PublicInputGate",
|
||||
"BaseSumGate { num_limbs: 63 } + Base: 2",
|
||||
"ReducingExtensionGate { num_coeffs: 33 }",
|
||||
@@ -50,7 +52,6 @@
|
||||
"ArithmeticExtensionGate { num_ops: 10 }",
|
||||
"ArithmeticGate { num_ops: 20 }",
|
||||
"MulExtensionGate { num_ops: 13 }",
|
||||
"ExponentiationGate { num_power_bits: 67, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"RandomAccessGate { bits: 4, num_copies: 4, num_extra_constants: 2, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"CosetInterpolationGate { subgroup_bits: 4, degree: 6, barycentric_weights: [17293822565076172801, 18374686475376656385, 18446744069413535745, 281474976645120, 17592186044416, 18446744069414584577, 18446744000695107601, 18446744065119617025, 1152921504338411520, 72057594037927936, 18446744069415632897, 18446462594437939201, 18446726477228539905, 18446744069414584065, 68719476720, 4294967296], _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"PoseidonGate(PhantomData<plonky2_field::goldilocks_field::GoldilocksField>)<WIDTH=12>"
|
||||
@@ -63,6 +64,7 @@
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
@@ -73,15 +75,15 @@
|
||||
"groups": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 6
|
||||
"end": 7
|
||||
},
|
||||
{
|
||||
"start": 6,
|
||||
"end": 10
|
||||
"start": 7,
|
||||
"end": 11
|
||||
},
|
||||
{
|
||||
"start": 10,
|
||||
"end": 12
|
||||
"start": 11,
|
||||
"end": 13
|
||||
}
|
||||
]
|
||||
},
|
||||
15082
verifier/data/decode_block/proof_with_public_inputs.json
Normal file
15082
verifier/data/decode_block/proof_with_public_inputs.json
Normal file
File diff suppressed because it is too large
Load Diff
21
verifier/data/decode_block/verifier_only_circuit_data.json
Normal file
21
verifier/data/decode_block/verifier_only_circuit_data.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"constants_sigmas_cap": [
|
||||
"1499622638644728537774239858053278546400257982434845489329927574295172033326",
|
||||
"2930852415723089264561622935088329191815636786066772202039928107654951266023",
|
||||
"14464526654918087476596183134411486973966295253353738267325575394304709517161",
|
||||
"18983137502540745159803953284357786408225887846069384394220291955925143226141",
|
||||
"1386895482273961356932873002155159178542488359092693049720219479086930861707",
|
||||
"14771237880407068338879830535366644743003305760875598132537125639168034999022",
|
||||
"19702788661528474550894036146582137462836271070153286539426392895353557950694",
|
||||
"15334727368281990897779779337943379898609200739305205677598255362701124565320",
|
||||
"21691768748620820719274018448050849816536829760110881140528389629789448704790",
|
||||
"15262009449532190852183220678787716636953257578372619913911054925901367503449",
|
||||
"18166082909492900359627895435428332272663141560067836935272838076830554017630",
|
||||
"10686995103794494099325675278866631156892436169286799401423857508483307145846",
|
||||
"7660138004813546044706396059680360544539623731113711012915164533145284575301",
|
||||
"1616448650742704848585620443874003913130079345238283349517269437117477195625",
|
||||
"5734773590975050772666682899969130545487941904460247131732227238307211841652",
|
||||
"11959183492303708131395376843823862107323459381741154704909455973421596288592"
|
||||
],
|
||||
"circuit_digest": "11532502846882484230992726008257788785937565673229400981185786126842727172973"
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"num_wires": 135,
|
||||
"num_routed_wires": 80,
|
||||
"num_constants": 2,
|
||||
"use_base_arithmetic_gate": true,
|
||||
"security_bits": 100,
|
||||
"num_challenges": 2,
|
||||
"zero_knowledge": false,
|
||||
"max_quotient_degree_factor": 8,
|
||||
"fri_config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 28
|
||||
}
|
||||
},
|
||||
"fri_params": {
|
||||
"config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 28
|
||||
},
|
||||
"hiding": false,
|
||||
"degree_bits": 14,
|
||||
"reduction_arity_bits": [
|
||||
4,
|
||||
4,
|
||||
4
|
||||
]
|
||||
},
|
||||
"gates": [
|
||||
"NoopGate",
|
||||
"ConstantGate { num_consts: 2 }",
|
||||
"PublicInputGate"
|
||||
],
|
||||
"selectors_info": {
|
||||
"selector_indices": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"quotient_degree_factor": 8,
|
||||
"num_gate_constraints": 4,
|
||||
"num_constants": 3,
|
||||
"num_public_inputs": 0,
|
||||
"k_is": [
|
||||
1,
|
||||
7,
|
||||
49,
|
||||
343,
|
||||
2401,
|
||||
16807,
|
||||
117649,
|
||||
823543,
|
||||
5764801,
|
||||
40353607,
|
||||
282475249,
|
||||
1977326743,
|
||||
13841287201,
|
||||
96889010407,
|
||||
678223072849,
|
||||
4747561509943,
|
||||
33232930569601,
|
||||
232630513987207,
|
||||
1628413597910449,
|
||||
11398895185373143,
|
||||
79792266297612001,
|
||||
558545864083284007,
|
||||
3909821048582988049,
|
||||
8922003270666332022,
|
||||
7113790686420571191,
|
||||
12903046666114829695,
|
||||
16534350385145470581,
|
||||
5059988279530788141,
|
||||
16973173887300932666,
|
||||
8131752794619022736,
|
||||
1582037354089406189,
|
||||
11074261478625843323,
|
||||
3732854072722565977,
|
||||
7683234439643377518,
|
||||
16889152938674473984,
|
||||
7543606154233811962,
|
||||
15911754940807515092,
|
||||
701820169165099718,
|
||||
4912741184155698026,
|
||||
15942444219675301861,
|
||||
916645121239607101,
|
||||
6416515848677249707,
|
||||
8022122801911579307,
|
||||
814627405137302186,
|
||||
5702391835961115302,
|
||||
3023254712898638472,
|
||||
2716038920875884983,
|
||||
565528376716610560,
|
||||
3958698637016273920,
|
||||
9264146389699333119,
|
||||
9508792519651578870,
|
||||
11221315429317299127,
|
||||
4762231727562756605,
|
||||
14888878023524711914,
|
||||
11988425817600061793,
|
||||
10132004445542095267,
|
||||
15583798910550913906,
|
||||
16852872026783475737,
|
||||
7289639770996824233,
|
||||
14133990258148600989,
|
||||
6704211459967285318,
|
||||
10035992080941828584,
|
||||
14911712358349047125,
|
||||
12148266161370408270,
|
||||
11250886851934520606,
|
||||
4969231685883306958,
|
||||
16337877731768564385,
|
||||
3684679705892444769,
|
||||
7346013871832529062,
|
||||
14528608963998534792,
|
||||
9466542400916821939,
|
||||
10925564598174000610,
|
||||
2691975909559666986,
|
||||
397087297503084581,
|
||||
2779611082521592067,
|
||||
1010533508236560148,
|
||||
7073734557655921036,
|
||||
12622653764762278610,
|
||||
14571600075677612986,
|
||||
9767480182670369297
|
||||
],
|
||||
"num_partial_products": 9
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"constants_sigmas_cap": [
|
||||
{
|
||||
"elements": [
|
||||
4759797886241550041,
|
||||
16047691004983234860,
|
||||
9659762256552197216,
|
||||
10112553966470275428
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
6580856520142680697,
|
||||
17545262075403841780,
|
||||
17375632104615520990,
|
||||
7416977774732798943
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
16353512268073979322,
|
||||
819827092644027799,
|
||||
16690673607724368808,
|
||||
15037968687422549712
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
8436504004905600346,
|
||||
9803040091724299970,
|
||||
13874489205559745161,
|
||||
9113368467425613680
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
11091349953543466700,
|
||||
16835828310505248580,
|
||||
9401730018779004456,
|
||||
16217511395210280637
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
14652613590798123935,
|
||||
6513400524233583632,
|
||||
14260635575060377802,
|
||||
2934429662141013591
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
16079430466329685864,
|
||||
15523825632000959289,
|
||||
10929447713382773099,
|
||||
13359117551990706652
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
3981642429220224195,
|
||||
16563383270645026066,
|
||||
11676626736400014113,
|
||||
12391006943408842728
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
14534632951568236500,
|
||||
6622950057448608217,
|
||||
10317722778604321203,
|
||||
16857091229989966532
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
1854667436830330051,
|
||||
10698208885037992043,
|
||||
8279000029256055765,
|
||||
16473632613257578260
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
6112653519502862522,
|
||||
16414985808267477185,
|
||||
17212339018953338390,
|
||||
2035088574051215606
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
283442216994125368,
|
||||
5745335585396117672,
|
||||
5374569058514548582,
|
||||
10252700696576858963
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
9306370623805561429,
|
||||
16251397047578608507,
|
||||
14346837135739683212,
|
||||
16134961398977435830
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
7908139687533230014,
|
||||
868091850428391307,
|
||||
17334379805830263268,
|
||||
14344912333616841759
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
5694816422417791625,
|
||||
1123655791248550867,
|
||||
10759039854778271524,
|
||||
14259550375971834217
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
8540856852870738366,
|
||||
13653940430116418378,
|
||||
12200920580995523853,
|
||||
4531851613365767268
|
||||
]
|
||||
}
|
||||
],
|
||||
"circuit_digest": {
|
||||
"elements": [
|
||||
651333322065354824,
|
||||
4413552684545354123,
|
||||
11977324165034072678,
|
||||
16531113439125733803
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"config":{"num_wires":135,"num_routed_wires":80,"num_constants":2,"use_base_arithmetic_gate":true,"security_bits":100,"num_challenges":2,"zero_knowledge":false,"max_quotient_degree_factor":8,"fri_config":{"rate_bits":12,"cap_height":4,"proof_of_work_bits":16,"reduction_strategy":{"ConstantArityBits":[4,5]},"num_query_rounds":7}},"fri_params":{"config":{"rate_bits":12,"cap_height":4,"proof_of_work_bits":16,"reduction_strategy":{"ConstantArityBits":[4,5]},"num_query_rounds":7},"hiding":false,"degree_bits":2,"reduction_arity_bits":[]},"gates":["NoopGate","ConstantGate { num_consts: 2 }","PublicInputGate"],"selectors_info":{"selector_indices":[0,0,0],"groups":[{"start":0,"end":3}]},"quotient_degree_factor":8,"num_gate_constraints":4,"num_constants":3,"num_public_inputs":0,"k_is":[1,7,49,343,2401,16807,117649,823543,5764801,40353607,282475249,1977326743,13841287201,96889010407,678223072849,4747561509943,33232930569601,232630513987207,1628413597910449,11398895185373143,79792266297612001,558545864083284007,3909821048582988049,8922003270666332022,7113790686420571191,12903046666114829695,16534350385145470581,5059988279530788141,16973173887300932666,8131752794619022736,1582037354089406189,11074261478625843323,3732854072722565977,7683234439643377518,16889152938674473984,7543606154233811962,15911754940807515092,701820169165099718,4912741184155698026,15942444219675301861,916645121239607101,6416515848677249707,8022122801911579307,814627405137302186,5702391835961115302,3023254712898638472,2716038920875884983,565528376716610560,3958698637016273920,9264146389699333119,9508792519651578870,11221315429317299127,4762231727562756605,14888878023524711914,11988425817600061793,10132004445542095267,15583798910550913906,16852872026783475737,7289639770996824233,14133990258148600989,6704211459967285318,10035992080941828584,14911712358349047125,12148266161370408270,11250886851934520606,4969231685883306958,16337877731768564385,3684679705892444769,7346013871832529062,14528608963998534792,9466542400916821939,10925564598174000610,2691975909559666986,397087297503084581,2779611082521592067,1010533508236560148,7073734557655921036,12622653764762278610,14571600075677612986,9767480182670369297],"num_partial_products":9}
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
{"constants_sigmas_cap":[{"elements":[12942050173360299287,15429129527496118608,11044804177370023771,17027862521442293343]},{"elements":[5129937521595676319,9249371000310776833,1698652619737853229,3597277235363989900]},{"elements":[9499069482602362280,6056775334288968735,9416720030884613634,8481612183293566397]},{"elements":[7444928464878659248,59632799137831308,6374428807271012784,12055696886890254745]},{"elements":[11760551261657627154,5292872815316944996,12187602224948210417,184439611357521062]},{"elements":[13972524877212598728,11420817450690243876,15994255466128604849,1311060574252414086]},{"elements":[16494325411515456931,18075355179587378715,4646724997371828866,1372832552151954570]},{"elements":[16387476627685153284,17032030743812759632,16808048043752991311,16788518620316721833]},{"elements":[4194862242212612774,364226560743618053,11438397620101696839,9286576348843874621]},{"elements":[6340101954898285234,10773051474343740098,6629082148740745229,3982094848619266494]},{"elements":[8009275308971482529,10105260369496924395,8987390598028905021,9739740379439925196]},{"elements":[13635364907274847648,1135616847056663194,6574618410485087638,11497429148813108159]},{"elements":[15405963465632273554,10983537026674671450,17181205620785852479,2598367474817225484]},{"elements":[16613943869767229638,8953767102519510969,2778482474224727871,835196900223386389]},{"elements":[213910466424313779,1036984933257510494,9766858993890477954,5836427172912690664]},{"elements":[1538574690328025715,2426907990630109879,8393881157947355071,8063812988973786255]}],"circuit_digest":{"elements":[18101853563531100136,12778281678899705371,12856635299514517756,11554767480547589421]}}
|
||||
@@ -1,152 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"num_wires": 135,
|
||||
"num_routed_wires": 80,
|
||||
"num_constants": 2,
|
||||
"use_base_arithmetic_gate": true,
|
||||
"security_bits": 100,
|
||||
"num_challenges": 2,
|
||||
"zero_knowledge": false,
|
||||
"max_quotient_degree_factor": 8,
|
||||
"fri_config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 28
|
||||
}
|
||||
},
|
||||
"fri_params": {
|
||||
"config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 28
|
||||
},
|
||||
"hiding": false,
|
||||
"degree_bits": 3,
|
||||
"reduction_arity_bits": []
|
||||
},
|
||||
"gates": [
|
||||
"ConstantGate { num_consts: 2 }",
|
||||
"PublicInputGate",
|
||||
"ArithmeticGate { num_ops: 20 }",
|
||||
"PoseidonGate(PhantomData<plonky2_field::goldilocks_field::GoldilocksField>)<WIDTH=12>"
|
||||
],
|
||||
"selectors_info": {
|
||||
"selector_indices": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 3
|
||||
},
|
||||
{
|
||||
"start": 3,
|
||||
"end": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"quotient_degree_factor": 8,
|
||||
"num_gate_constraints": 123,
|
||||
"num_constants": 4,
|
||||
"num_public_inputs": 3,
|
||||
"k_is": [
|
||||
1,
|
||||
7,
|
||||
49,
|
||||
343,
|
||||
2401,
|
||||
16807,
|
||||
117649,
|
||||
823543,
|
||||
5764801,
|
||||
40353607,
|
||||
282475249,
|
||||
1977326743,
|
||||
13841287201,
|
||||
96889010407,
|
||||
678223072849,
|
||||
4747561509943,
|
||||
33232930569601,
|
||||
232630513987207,
|
||||
1628413597910449,
|
||||
11398895185373143,
|
||||
79792266297612001,
|
||||
558545864083284007,
|
||||
3909821048582988049,
|
||||
8922003270666332022,
|
||||
7113790686420571191,
|
||||
12903046666114829695,
|
||||
16534350385145470581,
|
||||
5059988279530788141,
|
||||
16973173887300932666,
|
||||
8131752794619022736,
|
||||
1582037354089406189,
|
||||
11074261478625843323,
|
||||
3732854072722565977,
|
||||
7683234439643377518,
|
||||
16889152938674473984,
|
||||
7543606154233811962,
|
||||
15911754940807515092,
|
||||
701820169165099718,
|
||||
4912741184155698026,
|
||||
15942444219675301861,
|
||||
916645121239607101,
|
||||
6416515848677249707,
|
||||
8022122801911579307,
|
||||
814627405137302186,
|
||||
5702391835961115302,
|
||||
3023254712898638472,
|
||||
2716038920875884983,
|
||||
565528376716610560,
|
||||
3958698637016273920,
|
||||
9264146389699333119,
|
||||
9508792519651578870,
|
||||
11221315429317299127,
|
||||
4762231727562756605,
|
||||
14888878023524711914,
|
||||
11988425817600061793,
|
||||
10132004445542095267,
|
||||
15583798910550913906,
|
||||
16852872026783475737,
|
||||
7289639770996824233,
|
||||
14133990258148600989,
|
||||
6704211459967285318,
|
||||
10035992080941828584,
|
||||
14911712358349047125,
|
||||
12148266161370408270,
|
||||
11250886851934520606,
|
||||
4969231685883306958,
|
||||
16337877731768564385,
|
||||
3684679705892444769,
|
||||
7346013871832529062,
|
||||
14528608963998534792,
|
||||
9466542400916821939,
|
||||
10925564598174000610,
|
||||
2691975909559666986,
|
||||
397087297503084581,
|
||||
2779611082521592067,
|
||||
1010533508236560148,
|
||||
7073734557655921036,
|
||||
12622653764762278610,
|
||||
14571600075677612986,
|
||||
9767480182670369297
|
||||
],
|
||||
"num_partial_products": 9
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"constants_sigmas_cap": [
|
||||
{
|
||||
"elements": [
|
||||
2913805118787558759,
|
||||
15605217703384212484,
|
||||
9293436862297178555,
|
||||
10529947991695419448
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
1937331278189251620,
|
||||
17537260089483183877,
|
||||
10458485670158100707,
|
||||
4116443229550247591
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
8142760542024755709,
|
||||
3845244796524514577,
|
||||
16191049345326767258,
|
||||
7348433903875207214
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
18274477257392359471,
|
||||
9341197367296335592,
|
||||
14314312946600883535,
|
||||
17431979896521737468
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
12713790163422286570,
|
||||
9838614764658999419,
|
||||
3024549327814176904,
|
||||
6544549858431318793
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17461063081201329467,
|
||||
1929790214678747830,
|
||||
14738190695567211833,
|
||||
4502436664569676311
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17446087997043032816,
|
||||
17518692693064701003,
|
||||
4915378766449394412,
|
||||
10675325761198739044
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
11349186227918507635,
|
||||
7105572536043210156,
|
||||
13296927306801261929,
|
||||
6138189381388819111
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17427080957162886576,
|
||||
4310228111529328877,
|
||||
16109317445338921222,
|
||||
11923676504992192083
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
11292141569337462929,
|
||||
7213981967192374125,
|
||||
4837353949249389782,
|
||||
13157524938508720907
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17221477633935993097,
|
||||
7905315334616496868,
|
||||
2950048088611741910,
|
||||
16851660641249290423
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
1918571898367258879,
|
||||
14473285549490778842,
|
||||
16456257732802770188,
|
||||
16611801325745795527
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
7880989808200689690,
|
||||
16935107633380717766,
|
||||
8956194191973051375,
|
||||
1103945341495739535
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
4501339912027744074,
|
||||
12142665268233044767,
|
||||
9270990890291324944,
|
||||
45374981263348191
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
13657768796246999470,
|
||||
2899654677720502418,
|
||||
7228867285602519410,
|
||||
3363587770111123806
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
18227101298896629706,
|
||||
12986849723013952028,
|
||||
16815808278639394978,
|
||||
16460725848109409638
|
||||
]
|
||||
}
|
||||
],
|
||||
"circuit_digest": {
|
||||
"elements": [
|
||||
15489309507512017401,
|
||||
16244437215982314072,
|
||||
10011620388767144997,
|
||||
15394117319313330212
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"num_wires": 135,
|
||||
"num_routed_wires": 80,
|
||||
"num_constants": 2,
|
||||
"use_base_arithmetic_gate": true,
|
||||
"security_bits": 100,
|
||||
"num_challenges": 2,
|
||||
"zero_knowledge": false,
|
||||
"max_quotient_degree_factor": 8,
|
||||
"fri_config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 28
|
||||
}
|
||||
},
|
||||
"fri_params": {
|
||||
"config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 28
|
||||
},
|
||||
"hiding": false,
|
||||
"degree_bits": 12,
|
||||
"reduction_arity_bits": [
|
||||
4,
|
||||
4
|
||||
]
|
||||
},
|
||||
"gates": [
|
||||
"NoopGate",
|
||||
"PublicInputGate",
|
||||
"BaseSumGate { num_limbs: 63 } + Base: 2",
|
||||
"ReducingExtensionGate { num_coeffs: 32 }",
|
||||
"ReducingGate { num_coeffs: 43 }",
|
||||
"ArithmeticExtensionGate { num_ops: 10 }",
|
||||
"ArithmeticGate { num_ops: 20 }",
|
||||
"MulExtensionGate { num_ops: 13 }",
|
||||
"RandomAccessGate { bits: 4, num_copies: 4, num_extra_constants: 2, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"CosetInterpolationGate { subgroup_bits: 4, degree: 6, barycentric_weights: [17293822565076172801, 18374686475376656385, 18446744069413535745, 281474976645120, 17592186044416, 256, 18446744000695107601, 18446744065119617025, 1152921504338411520, 72057594037927936, 1048576, 18446462594437939201, 18446726477228539905, 18446744069414584065, 68719476720, 4294967296], _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"PoseidonGate(PhantomData<plonky2_field::goldilocks_field::GoldilocksField>)<WIDTH=12>"
|
||||
],
|
||||
"selectors_info": {
|
||||
"selector_indices": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
2
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 6
|
||||
},
|
||||
{
|
||||
"start": 6,
|
||||
"end": 9
|
||||
},
|
||||
{
|
||||
"start": 9,
|
||||
"end": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
"quotient_degree_factor": 8,
|
||||
"num_gate_constraints": 123,
|
||||
"num_constants": 5,
|
||||
"num_public_inputs": 0,
|
||||
"k_is": [
|
||||
1,
|
||||
7,
|
||||
49,
|
||||
343,
|
||||
2401,
|
||||
16807,
|
||||
117649,
|
||||
823543,
|
||||
5764801,
|
||||
40353607,
|
||||
282475249,
|
||||
1977326743,
|
||||
13841287201,
|
||||
96889010407,
|
||||
678223072849,
|
||||
4747561509943,
|
||||
33232930569601,
|
||||
232630513987207,
|
||||
1628413597910449,
|
||||
11398895185373143,
|
||||
79792266297612001,
|
||||
558545864083284007,
|
||||
3909821048582988049,
|
||||
8922003270666332022,
|
||||
7113790686420571191,
|
||||
12903046666114829695,
|
||||
16534350385145470581,
|
||||
5059988279530788141,
|
||||
16973173887300932666,
|
||||
8131752794619022736,
|
||||
1582037354089406189,
|
||||
11074261478625843323,
|
||||
3732854072722565977,
|
||||
7683234439643377518,
|
||||
16889152938674473984,
|
||||
7543606154233811962,
|
||||
15911754940807515092,
|
||||
701820169165099718,
|
||||
4912741184155698026,
|
||||
15942444219675301861,
|
||||
916645121239607101,
|
||||
6416515848677249707,
|
||||
8022122801911579307,
|
||||
814627405137302186,
|
||||
5702391835961115302,
|
||||
3023254712898638472,
|
||||
2716038920875884983,
|
||||
565528376716610560,
|
||||
3958698637016273920,
|
||||
9264146389699333119,
|
||||
9508792519651578870,
|
||||
11221315429317299127,
|
||||
4762231727562756605,
|
||||
14888878023524711914,
|
||||
11988425817600061793,
|
||||
10132004445542095267,
|
||||
15583798910550913906,
|
||||
16852872026783475737,
|
||||
7289639770996824233,
|
||||
14133990258148600989,
|
||||
6704211459967285318,
|
||||
10035992080941828584,
|
||||
14911712358349047125,
|
||||
12148266161370408270,
|
||||
11250886851934520606,
|
||||
4969231685883306958,
|
||||
16337877731768564385,
|
||||
3684679705892444769,
|
||||
7346013871832529062,
|
||||
14528608963998534792,
|
||||
9466542400916821939,
|
||||
10925564598174000610,
|
||||
2691975909559666986,
|
||||
397087297503084581,
|
||||
2779611082521592067,
|
||||
1010533508236560148,
|
||||
7073734557655921036,
|
||||
12622653764762278610,
|
||||
14571600075677612986,
|
||||
9767480182670369297
|
||||
],
|
||||
"num_partial_products": 9
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"constants_sigmas_cap": [
|
||||
{
|
||||
"elements": [
|
||||
5792880812518408658,
|
||||
2007865592137458435,
|
||||
5118679776640867091,
|
||||
13069431186724985571
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
620745627896223750,
|
||||
11689482378865345226,
|
||||
515625484560203909,
|
||||
6594700411046985771
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
4288547219194413000,
|
||||
13137436527356415412,
|
||||
12622945773280822587,
|
||||
650627082873761457
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
13506996103707830465,
|
||||
8679821128676565111,
|
||||
4223042913738287628,
|
||||
9099197279443824593
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
14449575924890308633,
|
||||
8733833351673036584,
|
||||
16541374894852431819,
|
||||
9332074455551145433
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
10076928807302913775,
|
||||
3821138534617469739,
|
||||
1717959071597020718,
|
||||
17760656161674093717
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
2599426417611084017,
|
||||
13871968726722310950,
|
||||
1516291378797220061,
|
||||
13799666340648349967
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
12663813165492321869,
|
||||
14876506856106059016,
|
||||
1242723042851988831,
|
||||
2875934737469787816
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17378423119286703930,
|
||||
11222598627075744078,
|
||||
9488528583590922099,
|
||||
14157718813638267686
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
1071412395592558182,
|
||||
18101728088624707784,
|
||||
3182026360229291426,
|
||||
14227530413232734538
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
726974142246132532,
|
||||
15153315199262507247,
|
||||
17940113059510197877,
|
||||
16772587044853202303
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
12231534358502296703,
|
||||
10511512947619127431,
|
||||
16590010230992836643,
|
||||
12522924984185338479
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
8037124124878150231,
|
||||
7299067373190351508,
|
||||
6928393757878692343,
|
||||
14665216450327743533
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
8476349181260794151,
|
||||
2992858515573144844,
|
||||
12544833538408559347,
|
||||
12322593314271890822
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17452538538131258483,
|
||||
16559982778748471691,
|
||||
7832234514212696397,
|
||||
7687737265950783860
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
5386649132465675374,
|
||||
15880918294706587722,
|
||||
12305658309516685089,
|
||||
1973473830101720437
|
||||
]
|
||||
}
|
||||
],
|
||||
"circuit_digest": {
|
||||
"elements": [
|
||||
7986243079228529757,
|
||||
6431975618990554147,
|
||||
3826625528654889031,
|
||||
10807866526356205171
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"num_wires": 135,
|
||||
"num_routed_wires": 80,
|
||||
"num_constants": 2,
|
||||
"use_base_arithmetic_gate": true,
|
||||
"security_bits": 100,
|
||||
"num_challenges": 2,
|
||||
"zero_knowledge": false,
|
||||
"max_quotient_degree_factor": 8,
|
||||
"fri_config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 2
|
||||
}
|
||||
},
|
||||
"fri_params": {
|
||||
"config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 2
|
||||
},
|
||||
"hiding": false,
|
||||
"degree_bits": 9,
|
||||
"reduction_arity_bits": [
|
||||
4
|
||||
]
|
||||
},
|
||||
"gates": [
|
||||
"NoopGate",
|
||||
"ConstantGate { num_consts: 2 }",
|
||||
"PublicInputGate",
|
||||
"BaseSumGate { num_limbs: 63 } + Base: 2",
|
||||
"ReducingExtensionGate { num_coeffs: 32 }",
|
||||
"ReducingGate { num_coeffs: 43 }",
|
||||
"ArithmeticExtensionGate { num_ops: 10 }",
|
||||
"ArithmeticGate { num_ops: 20 }",
|
||||
"MulExtensionGate { num_ops: 13 }",
|
||||
"RandomAccessGate { bits: 4, num_copies: 4, num_extra_constants: 2, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"PoseidonGate(PhantomData<plonky2_field::goldilocks_field::GoldilocksField>)<WIDTH=12>"
|
||||
],
|
||||
"selectors_info": {
|
||||
"selector_indices": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 6
|
||||
},
|
||||
{
|
||||
"start": 6,
|
||||
"end": 10
|
||||
},
|
||||
{
|
||||
"start": 10,
|
||||
"end": 11
|
||||
}
|
||||
]
|
||||
},
|
||||
"quotient_degree_factor": 8,
|
||||
"num_gate_constraints": 123,
|
||||
"num_constants": 5,
|
||||
"num_public_inputs": 0,
|
||||
"k_is": [
|
||||
1,
|
||||
7,
|
||||
49,
|
||||
343,
|
||||
2401,
|
||||
16807,
|
||||
117649,
|
||||
823543,
|
||||
5764801,
|
||||
40353607,
|
||||
282475249,
|
||||
1977326743,
|
||||
13841287201,
|
||||
96889010407,
|
||||
678223072849,
|
||||
4747561509943,
|
||||
33232930569601,
|
||||
232630513987207,
|
||||
1628413597910449,
|
||||
11398895185373143,
|
||||
79792266297612001,
|
||||
558545864083284007,
|
||||
3909821048582988049,
|
||||
8922003270666332022,
|
||||
7113790686420571191,
|
||||
12903046666114829695,
|
||||
16534350385145470581,
|
||||
5059988279530788141,
|
||||
16973173887300932666,
|
||||
8131752794619022736,
|
||||
1582037354089406189,
|
||||
11074261478625843323,
|
||||
3732854072722565977,
|
||||
7683234439643377518,
|
||||
16889152938674473984,
|
||||
7543606154233811962,
|
||||
15911754940807515092,
|
||||
701820169165099718,
|
||||
4912741184155698026,
|
||||
15942444219675301861,
|
||||
916645121239607101,
|
||||
6416515848677249707,
|
||||
8022122801911579307,
|
||||
814627405137302186,
|
||||
5702391835961115302,
|
||||
3023254712898638472,
|
||||
2716038920875884983,
|
||||
565528376716610560,
|
||||
3958698637016273920,
|
||||
9264146389699333119,
|
||||
9508792519651578870,
|
||||
11221315429317299127,
|
||||
4762231727562756605,
|
||||
14888878023524711914,
|
||||
11988425817600061793,
|
||||
10132004445542095267,
|
||||
15583798910550913906,
|
||||
16852872026783475737,
|
||||
7289639770996824233,
|
||||
14133990258148600989,
|
||||
6704211459967285318,
|
||||
10035992080941828584,
|
||||
14911712358349047125,
|
||||
12148266161370408270,
|
||||
11250886851934520606,
|
||||
4969231685883306958,
|
||||
16337877731768564385,
|
||||
3684679705892444769,
|
||||
7346013871832529062,
|
||||
14528608963998534792,
|
||||
9466542400916821939,
|
||||
10925564598174000610,
|
||||
2691975909559666986,
|
||||
397087297503084581,
|
||||
2779611082521592067,
|
||||
1010533508236560148,
|
||||
7073734557655921036,
|
||||
12622653764762278610,
|
||||
14571600075677612986,
|
||||
9767480182670369297
|
||||
],
|
||||
"num_partial_products": 9
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"constants_sigmas_cap": [
|
||||
{
|
||||
"elements": [
|
||||
158845205314874220,
|
||||
9668380905015929998,
|
||||
1411954196422652535,
|
||||
16261560315091018602
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
10819768878069205512,
|
||||
10806329121382974236,
|
||||
4449962652936030991,
|
||||
3437130958683867731
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
13409308832792573752,
|
||||
5142428395608775971,
|
||||
8304804561534366563,
|
||||
3333782371953158323
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
18228625912291347825,
|
||||
10166925566614695203,
|
||||
18158685652491144528,
|
||||
5812383934966268838
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
9826807818157299303,
|
||||
16982355347088639655,
|
||||
9164194217012055587,
|
||||
2807644941373961188
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
14310741273297755831,
|
||||
12981827714166111968,
|
||||
4530737992662289685,
|
||||
18335773668219568846
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
7917966912899515534,
|
||||
17667717333057450416,
|
||||
952641997971486450,
|
||||
428804504796282154
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
6150969121154358920,
|
||||
8533162538572915310,
|
||||
13902780732405127329,
|
||||
10048329503515769882
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17799006350046251788,
|
||||
10571037994954145577,
|
||||
16382491710544403234,
|
||||
8887053452984223370
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
3963886065503765705,
|
||||
2739764768577488879,
|
||||
5343505536176223500,
|
||||
9151432391854309795
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
4165310799113686308,
|
||||
10915634867031695254,
|
||||
5813235613342911366,
|
||||
17907275021812350449
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
12954911538188629834,
|
||||
6738667513261916639,
|
||||
12025960525821021496,
|
||||
3765915660295958137
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
15699732256890621800,
|
||||
14355912053969064032,
|
||||
9559845752177194786,
|
||||
6008684051170164157
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
5973104887002336129,
|
||||
15822297470108300955,
|
||||
1285855046140391788,
|
||||
8567304882129939594
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
531701086966465293,
|
||||
13988001761158611208,
|
||||
10640541520023034000,
|
||||
12368315472470450606
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
16726108137472169650,
|
||||
9400941780708454743,
|
||||
2656080070909638220,
|
||||
10262921538692249992
|
||||
]
|
||||
}
|
||||
],
|
||||
"circuit_digest": {
|
||||
"elements": [
|
||||
7291397556757192596,
|
||||
149044718719699113,
|
||||
14214393601687894808,
|
||||
15901190186686913364
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"constants_sigmas_cap": [
|
||||
{
|
||||
"elements": [
|
||||
11953454831364282697,
|
||||
1780640713616741507,
|
||||
9332530534753348552,
|
||||
17084282210745809382
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17758681460299977814,
|
||||
15435331084685806694,
|
||||
7766646160278036540,
|
||||
5345072798617230589
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
8802797469535268068,
|
||||
3037505332513657608,
|
||||
16030922155257393390,
|
||||
13188886177244942097
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
2357959411935908456,
|
||||
1458480601790550366,
|
||||
11949473050563493262,
|
||||
1836765554619785226
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17907165543584078363,
|
||||
9893605436382885449,
|
||||
6670152476736706784,
|
||||
562838117712837468
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
5744223185797504102,
|
||||
13743400022410455956,
|
||||
6205029693922586080,
|
||||
15336463778776378871
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
14723206064376829937,
|
||||
13180213430291675472,
|
||||
5411273601294455899,
|
||||
8840354110576908600
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
10897208927347958232,
|
||||
2388900836403833331,
|
||||
13400951517389305038,
|
||||
2629935461033320568
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
6382278241197748160,
|
||||
2864721123412042365,
|
||||
1383065474344220868,
|
||||
2692411485496850147
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
4198408477591504932,
|
||||
8255926325330378434,
|
||||
14022111482748940978,
|
||||
8650742941998823647
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
6235912550116348485,
|
||||
1591288015265630569,
|
||||
6942981485091244971,
|
||||
9620918527217246407
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
8301265937387597891,
|
||||
13822840883914340904,
|
||||
13370707368391237777,
|
||||
15118584100319351289
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
12805136189787682184,
|
||||
14515274878974073778,
|
||||
15431575651860817805,
|
||||
1563913167146652597
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
6512639279406449383,
|
||||
15697846660972222282,
|
||||
5729086478860256848,
|
||||
1818341437677547274
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
4116477618393991081,
|
||||
604123225308335767,
|
||||
459683656323372900,
|
||||
10069219213626177582
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
7335240546348323257,
|
||||
12233386866476119728,
|
||||
4755043335297619337,
|
||||
2281707033870644336
|
||||
]
|
||||
}
|
||||
],
|
||||
"circuit_digest": {
|
||||
"elements": [
|
||||
14321013545913480595,
|
||||
17038401155010977967,
|
||||
2998069758835997053,
|
||||
10198464630670001962
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"num_wires": 136,
|
||||
"num_routed_wires": 80,
|
||||
"num_constants": 2,
|
||||
"use_base_arithmetic_gate": true,
|
||||
"security_bits": 100,
|
||||
"num_challenges": 2,
|
||||
"zero_knowledge": false,
|
||||
"max_quotient_degree_factor": 8,
|
||||
"fri_config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 1
|
||||
}
|
||||
},
|
||||
"fri_params": {
|
||||
"config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 1
|
||||
},
|
||||
"hiding": false,
|
||||
"degree_bits": 9,
|
||||
"reduction_arity_bits": [
|
||||
4
|
||||
]
|
||||
},
|
||||
"gates": [
|
||||
"NoopGate",
|
||||
"ConstantGate { num_consts: 2 }",
|
||||
"PublicInputGate",
|
||||
"BaseSumGate { num_limbs: 63 } + Base: 2",
|
||||
"ReducingExtensionGate { num_coeffs: 33 }",
|
||||
"ReducingGate { num_coeffs: 44 }",
|
||||
"ArithmeticExtensionGate { num_ops: 10 }",
|
||||
"ArithmeticGate { num_ops: 20 }",
|
||||
"MulExtensionGate { num_ops: 13 }",
|
||||
"RandomAccessGate { bits: 4, num_copies: 4, num_extra_constants: 2, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"CosetInterpolationGate { subgroup_bits: 4, degree: 6, barycentric_weights: [17293822565076172801, 18374686475376656385, 18446744069413535745, 281474976645120, 17592186044416, 256, 18446744000695107601, 18446744065119617025, 1152921504338411520, 72057594037927936, 1048576, 18446462594437939201, 18446726477228539905, 18446744069414584065, 68719476720, 4294967296], _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"PoseidonGate(PhantomData<plonky2_field::goldilocks_field::GoldilocksField>)<WIDTH=12>"
|
||||
],
|
||||
"selectors_info": {
|
||||
"selector_indices": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
2
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 6
|
||||
},
|
||||
{
|
||||
"start": 6,
|
||||
"end": 10
|
||||
},
|
||||
{
|
||||
"start": 10,
|
||||
"end": 12
|
||||
}
|
||||
]
|
||||
},
|
||||
"quotient_degree_factor": 8,
|
||||
"num_gate_constraints": 123,
|
||||
"num_constants": 5,
|
||||
"num_public_inputs": 0,
|
||||
"k_is": [
|
||||
1,
|
||||
7,
|
||||
49,
|
||||
343,
|
||||
2401,
|
||||
16807,
|
||||
117649,
|
||||
823543,
|
||||
5764801,
|
||||
40353607,
|
||||
282475249,
|
||||
1977326743,
|
||||
13841287201,
|
||||
96889010407,
|
||||
678223072849,
|
||||
4747561509943,
|
||||
33232930569601,
|
||||
232630513987207,
|
||||
1628413597910449,
|
||||
11398895185373143,
|
||||
79792266297612001,
|
||||
558545864083284007,
|
||||
3909821048582988049,
|
||||
8922003270666332022,
|
||||
7113790686420571191,
|
||||
12903046666114829695,
|
||||
16534350385145470581,
|
||||
5059988279530788141,
|
||||
16973173887300932666,
|
||||
8131752794619022736,
|
||||
1582037354089406189,
|
||||
11074261478625843323,
|
||||
3732854072722565977,
|
||||
7683234439643377518,
|
||||
16889152938674473984,
|
||||
7543606154233811962,
|
||||
15911754940807515092,
|
||||
701820169165099718,
|
||||
4912741184155698026,
|
||||
15942444219675301861,
|
||||
916645121239607101,
|
||||
6416515848677249707,
|
||||
8022122801911579307,
|
||||
814627405137302186,
|
||||
5702391835961115302,
|
||||
3023254712898638472,
|
||||
2716038920875884983,
|
||||
565528376716610560,
|
||||
3958698637016273920,
|
||||
9264146389699333119,
|
||||
9508792519651578870,
|
||||
11221315429317299127,
|
||||
4762231727562756605,
|
||||
14888878023524711914,
|
||||
11988425817600061793,
|
||||
10132004445542095267,
|
||||
15583798910550913906,
|
||||
16852872026783475737,
|
||||
7289639770996824233,
|
||||
14133990258148600989,
|
||||
6704211459967285318,
|
||||
10035992080941828584,
|
||||
14911712358349047125,
|
||||
12148266161370408270,
|
||||
11250886851934520606,
|
||||
4969231685883306958,
|
||||
16337877731768564385,
|
||||
3684679705892444769,
|
||||
7346013871832529062,
|
||||
14528608963998534792,
|
||||
9466542400916821939,
|
||||
10925564598174000610,
|
||||
2691975909559666986,
|
||||
397087297503084581,
|
||||
2779611082521592067,
|
||||
1010533508236560148,
|
||||
7073734557655921036,
|
||||
12622653764762278610,
|
||||
14571600075677612986,
|
||||
9767480182670369297
|
||||
],
|
||||
"num_partial_products": 9
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"constants_sigmas_cap": [
|
||||
{
|
||||
"elements": [
|
||||
18341772251201060973,
|
||||
8863499337164177585,
|
||||
3680903997187631396,
|
||||
12765086892713286422
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
10011842595440383490,
|
||||
16803433616479820503,
|
||||
5116105297375993895,
|
||||
1284372878762986134
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
9771429197922126084,
|
||||
11795709479898502019,
|
||||
9760789605311014828,
|
||||
14587465303757273799
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
14268034713225276697,
|
||||
18296479136879705605,
|
||||
10850612887933280806,
|
||||
9639487702530117083
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
9754005887238773284,
|
||||
5374369974939340944,
|
||||
4959182047845142644,
|
||||
1120709750910555570
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
7250035629074136036,
|
||||
15739653461985901088,
|
||||
14987756440121950753,
|
||||
9158371711408827053
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
13216298745969283339,
|
||||
16888689116176782846,
|
||||
12982122889871085039,
|
||||
5211135798140140360
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
1504326644701451030,
|
||||
8409612476357826852,
|
||||
7563553194601621378,
|
||||
11995034742915891064
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
5488329807694506217,
|
||||
18091194776727670160,
|
||||
17052473172701400255,
|
||||
16236156822718879559
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17715347985838125739,
|
||||
3615805299049017601,
|
||||
8585175301607696636,
|
||||
1968868157246799025
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
13447598860253889564,
|
||||
6631647170626609560,
|
||||
2112142850806037543,
|
||||
14266806193129176172
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
2730627694247012781,
|
||||
17236598033654074636,
|
||||
4452557557605684638,
|
||||
468430371172463963
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
6798850231787296859,
|
||||
16600632819568012939,
|
||||
11299208732485603538,
|
||||
15684010143706607232
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
3144604974895131192,
|
||||
4061404887662630886,
|
||||
5007128585099235364,
|
||||
16758955485500576037
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
4096461731986790461,
|
||||
12546978492628150144,
|
||||
18147834661139732319,
|
||||
4737766556076016924
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
14221961188679542125,
|
||||
17198447421299265716,
|
||||
4429176582749668482,
|
||||
3028817214334434508
|
||||
]
|
||||
}
|
||||
],
|
||||
"circuit_digest": {
|
||||
"elements": [
|
||||
10592544746408303090,
|
||||
6263847280826784938,
|
||||
13362953309332334276,
|
||||
1690911406899164489
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"num_wires": 136,
|
||||
"num_routed_wires": 80,
|
||||
"num_constants": 2,
|
||||
"use_base_arithmetic_gate": true,
|
||||
"security_bits": 100,
|
||||
"num_challenges": 2,
|
||||
"zero_knowledge": false,
|
||||
"max_quotient_degree_factor": 8,
|
||||
"fri_config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 28
|
||||
}
|
||||
},
|
||||
"fri_params": {
|
||||
"config": {
|
||||
"rate_bits": 3,
|
||||
"cap_height": 4,
|
||||
"proof_of_work_bits": 16,
|
||||
"reduction_strategy": {
|
||||
"ConstantArityBits": [
|
||||
4,
|
||||
5
|
||||
]
|
||||
},
|
||||
"num_query_rounds": 28
|
||||
},
|
||||
"hiding": false,
|
||||
"degree_bits": 21,
|
||||
"reduction_arity_bits": [
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4
|
||||
]
|
||||
},
|
||||
"gates": [
|
||||
"NoopGate",
|
||||
"ConstantGate { num_consts: 2 }",
|
||||
"PublicInputGate",
|
||||
"BaseSumGate { num_limbs: 32 } + Base: 2",
|
||||
"BaseSumGate { num_limbs: 63 } + Base: 2",
|
||||
"ArithmeticGate { num_ops: 20 }",
|
||||
"RandomAccessGate { bits: 2, num_copies: 13, num_extra_constants: 2, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"XOR3Gate { num_xors: 16 }",
|
||||
"BaseSumGate { num_limbs: 16 } + Base: 4",
|
||||
"ComparisonGate { num_bits: 32, num_chunks: 16, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>",
|
||||
"U32AddManyGate { num_addends: 11, num_ops: 4, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32AddManyGate { num_addends: 13, num_ops: 4, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32AddManyGate { num_addends: 15, num_ops: 3, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32AddManyGate { num_addends: 16, num_ops: 3, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32AddManyGate { num_addends: 3, num_ops: 5, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32AddManyGate { num_addends: 5, num_ops: 5, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32AddManyGate { num_addends: 7, num_ops: 4, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32AddManyGate { num_addends: 9, num_ops: 4, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32ArithmeticGate { num_ops: 3, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32RangeCheckGate { num_input_limbs: 8, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"U32SubtractionGate { num_ops: 6, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }",
|
||||
"RandomAccessGate { bits: 4, num_copies: 4, num_extra_constants: 2, _phantom: PhantomData<plonky2_field::goldilocks_field::GoldilocksField> }<D=2>"
|
||||
],
|
||||
"selectors_info": {
|
||||
"selector_indices": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 6
|
||||
},
|
||||
{
|
||||
"start": 6,
|
||||
"end": 11
|
||||
},
|
||||
{
|
||||
"start": 11,
|
||||
"end": 16
|
||||
},
|
||||
{
|
||||
"start": 16,
|
||||
"end": 21
|
||||
},
|
||||
{
|
||||
"start": 21,
|
||||
"end": 22
|
||||
}
|
||||
]
|
||||
},
|
||||
"quotient_degree_factor": 8,
|
||||
"num_gate_constraints": 136,
|
||||
"num_constants": 7,
|
||||
"num_public_inputs": 0,
|
||||
"k_is": [
|
||||
1,
|
||||
7,
|
||||
49,
|
||||
343,
|
||||
2401,
|
||||
16807,
|
||||
117649,
|
||||
823543,
|
||||
5764801,
|
||||
40353607,
|
||||
282475249,
|
||||
1977326743,
|
||||
13841287201,
|
||||
96889010407,
|
||||
678223072849,
|
||||
4747561509943,
|
||||
33232930569601,
|
||||
232630513987207,
|
||||
1628413597910449,
|
||||
11398895185373143,
|
||||
79792266297612001,
|
||||
558545864083284007,
|
||||
3909821048582988049,
|
||||
8922003270666332022,
|
||||
7113790686420571191,
|
||||
12903046666114829695,
|
||||
16534350385145470581,
|
||||
5059988279530788141,
|
||||
16973173887300932666,
|
||||
8131752794619022736,
|
||||
1582037354089406189,
|
||||
11074261478625843323,
|
||||
3732854072722565977,
|
||||
7683234439643377518,
|
||||
16889152938674473984,
|
||||
7543606154233811962,
|
||||
15911754940807515092,
|
||||
701820169165099718,
|
||||
4912741184155698026,
|
||||
15942444219675301861,
|
||||
916645121239607101,
|
||||
6416515848677249707,
|
||||
8022122801911579307,
|
||||
814627405137302186,
|
||||
5702391835961115302,
|
||||
3023254712898638472,
|
||||
2716038920875884983,
|
||||
565528376716610560,
|
||||
3958698637016273920,
|
||||
9264146389699333119,
|
||||
9508792519651578870,
|
||||
11221315429317299127,
|
||||
4762231727562756605,
|
||||
14888878023524711914,
|
||||
11988425817600061793,
|
||||
10132004445542095267,
|
||||
15583798910550913906,
|
||||
16852872026783475737,
|
||||
7289639770996824233,
|
||||
14133990258148600989,
|
||||
6704211459967285318,
|
||||
10035992080941828584,
|
||||
14911712358349047125,
|
||||
12148266161370408270,
|
||||
11250886851934520606,
|
||||
4969231685883306958,
|
||||
16337877731768564385,
|
||||
3684679705892444769,
|
||||
7346013871832529062,
|
||||
14528608963998534792,
|
||||
9466542400916821939,
|
||||
10925564598174000610,
|
||||
2691975909559666986,
|
||||
397087297503084581,
|
||||
2779611082521592067,
|
||||
1010533508236560148,
|
||||
7073734557655921036,
|
||||
12622653764762278610,
|
||||
14571600075677612986,
|
||||
9767480182670369297
|
||||
],
|
||||
"num_partial_products": 9
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"constants_sigmas_cap": [
|
||||
{
|
||||
"elements": [
|
||||
9037422181318074482,
|
||||
13844553280258601189,
|
||||
14013690396566737561,
|
||||
14600533186953608428
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
3891365497285560518,
|
||||
6785071445101560305,
|
||||
7146616719154245281,
|
||||
8484433928946731576
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
15935467950899360740,
|
||||
1041659913562170406,
|
||||
11898906592313038819,
|
||||
7940456224436700998
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
17420135248456983,
|
||||
10686061014804565544,
|
||||
17782021355470763205,
|
||||
12726022340820773339
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
13322967402317526249,
|
||||
12119892482906381301,
|
||||
1483851501277040422,
|
||||
17519911664522741561
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
3901474702590233137,
|
||||
16494478574194405372,
|
||||
3644962804006307872,
|
||||
7967195830112920768
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
15532816309418050992,
|
||||
11198055639421810456,
|
||||
7449000032233257165,
|
||||
6080646728225911938
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
7944791944524511304,
|
||||
15470849481646525511,
|
||||
11102721978231118523,
|
||||
10011467322465036320
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
14679375199524381062,
|
||||
9219647684485300612,
|
||||
8902882543708912876,
|
||||
6737676211275058717
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
15215848762718399329,
|
||||
9538467614418882672,
|
||||
7337952705707955964,
|
||||
17932579689749986997
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
3111383469397480110,
|
||||
17276616486884637185,
|
||||
10511216595022742027,
|
||||
3343575652946909638
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
2417848701164748156,
|
||||
7846191940051381446,
|
||||
4363725272084187306,
|
||||
3143323624098735830
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
7639597922146523429,
|
||||
14015537888097194053,
|
||||
10449936634441844342,
|
||||
3897071524048579556
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
12445360068819311840,
|
||||
4910166437012489060,
|
||||
9670875686931891121,
|
||||
5569206524147441284
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
6965775890897127688,
|
||||
14853930701622190781,
|
||||
2643689027677976461,
|
||||
1883768007952536249
|
||||
]
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
6771363979354677578,
|
||||
6567107174924251028,
|
||||
15758449129319031800,
|
||||
6619880945043941329
|
||||
]
|
||||
}
|
||||
],
|
||||
"circuit_digest": {
|
||||
"elements": [
|
||||
8574090053162898339,
|
||||
2808971464690312489,
|
||||
14807704193989191909,
|
||||
14951686172889873386
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,8 @@ type FriChip struct {
|
||||
api frontend.API `gnark:"-"`
|
||||
fieldAPI field.FieldAPI `gnark:"-"`
|
||||
qeAPI *field.QuadraticExtensionAPI `gnark:"-"`
|
||||
hashAPI *poseidon.HashAPI `gnark:"-"`
|
||||
|
||||
poseidonChip *poseidon.PoseidonChip
|
||||
poseidonBN128Chip *poseidon.PoseidonBN128Chip
|
||||
|
||||
friParams *common.FriParams `gnark:"-"`
|
||||
}
|
||||
@@ -28,17 +27,15 @@ func NewFriChip(
|
||||
api frontend.API,
|
||||
fieldAPI field.FieldAPI,
|
||||
qeAPI *field.QuadraticExtensionAPI,
|
||||
hashAPI *poseidon.HashAPI,
|
||||
poseidonChip *poseidon.PoseidonChip,
|
||||
poseidonBN128Chip *poseidon.PoseidonBN128Chip,
|
||||
friParams *common.FriParams,
|
||||
) *FriChip {
|
||||
return &FriChip{
|
||||
api: api,
|
||||
fieldAPI: fieldAPI,
|
||||
qeAPI: qeAPI,
|
||||
hashAPI: hashAPI,
|
||||
poseidonChip: poseidonChip,
|
||||
friParams: friParams,
|
||||
api: api,
|
||||
fieldAPI: fieldAPI,
|
||||
qeAPI: qeAPI,
|
||||
poseidonBN128Chip: poseidonBN128Chip,
|
||||
friParams: friParams,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,66 +60,15 @@ func (f *FriChip) fromOpeningsAndAlpha(openings *FriOpenings, alpha field.Quadra
|
||||
return reducedOpenings
|
||||
}
|
||||
|
||||
func (f *FriChip) hashOrNoop(data []field.F) poseidon.Hash {
|
||||
var elements poseidon.Hash
|
||||
if len(data) <= 4 {
|
||||
// Pad the data to have a size of 4
|
||||
for i, inputElement := range data {
|
||||
elements[i] = inputElement
|
||||
}
|
||||
for i := len(data); i < 4; i++ {
|
||||
elements[i] = field.ZERO_F
|
||||
}
|
||||
|
||||
return elements
|
||||
} else {
|
||||
hashOutput := f.poseidonChip.HashNToMNoPad(data, 4)
|
||||
|
||||
if len(hashOutput) != len(elements) {
|
||||
panic("The length of hashOutput and elements is different")
|
||||
}
|
||||
|
||||
for i, hashField := range hashOutput {
|
||||
elements[i] = hashField
|
||||
}
|
||||
|
||||
return elements
|
||||
}
|
||||
}
|
||||
|
||||
func (f *FriChip) verifyMerkleProofToCapWithCapIndex(leafData []field.F, leafIndexBits []frontend.Variable, capIndexBits []frontend.Variable, merkleCap common.MerkleCap, proof *common.MerkleProof) {
|
||||
currentDigest := f.hashOrNoop(leafData)
|
||||
fourZeros := [4]field.F{field.ZERO_F, field.ZERO_F, field.ZERO_F, field.ZERO_F}
|
||||
currentDigest := f.poseidonBN128Chip.HashOrNoop(leafData)
|
||||
for i, sibling := range proof.Siblings {
|
||||
bit := leafIndexBits[i]
|
||||
|
||||
var leftSiblingState poseidon.PoseidonState
|
||||
copy(leftSiblingState[0:4], sibling[0:4])
|
||||
copy(leftSiblingState[4:8], currentDigest[0:4])
|
||||
copy(leftSiblingState[8:12], fourZeros[0:4])
|
||||
|
||||
leftHash := f.poseidonChip.Poseidon(leftSiblingState)
|
||||
|
||||
var leftHashCompress poseidon.Hash
|
||||
leftHashCompress[0] = leftHash[0]
|
||||
leftHashCompress[1] = leftHash[1]
|
||||
leftHashCompress[2] = leftHash[2]
|
||||
leftHashCompress[3] = leftHash[3]
|
||||
|
||||
var rightSiblingState poseidon.PoseidonState
|
||||
copy(rightSiblingState[0:4], currentDigest[0:4])
|
||||
copy(rightSiblingState[4:8], sibling[0:4])
|
||||
copy(rightSiblingState[8:12], fourZeros[0:4])
|
||||
|
||||
rightHash := f.poseidonChip.Poseidon(rightSiblingState)
|
||||
|
||||
var rightHashCompress poseidon.Hash
|
||||
rightHashCompress[0] = rightHash[0]
|
||||
rightHashCompress[1] = rightHash[1]
|
||||
rightHashCompress[2] = rightHash[2]
|
||||
rightHashCompress[3] = rightHash[3]
|
||||
|
||||
currentDigest = f.hashAPI.SelectHash(bit, leftHashCompress, rightHashCompress)
|
||||
// TODO: Don't need to do two hashes by using a trick that the plonky2 verifier circuit does
|
||||
// https://github.com/mir-protocol/plonky2/blob/973624f12d2d12d74422b3ea051358b9eaacb050/plonky2/src/gates/poseidon.rs#L298
|
||||
leftHash := f.poseidonBN128Chip.TwoToOne(sibling, currentDigest)
|
||||
rightHash := f.poseidonBN128Chip.TwoToOne(currentDigest, sibling)
|
||||
currentDigest = f.api.Select(bit, leftHash, rightHash)
|
||||
}
|
||||
|
||||
// We assume that the cap_height is 4. Create two levels of the Lookup2 circuit
|
||||
@@ -136,19 +82,19 @@ func (f *FriChip) verifyMerkleProofToCapWithCapIndex(leafData []field.F, leafInd
|
||||
}
|
||||
|
||||
const NUM_LEAF_LOOKUPS = 4
|
||||
var leafLookups [NUM_LEAF_LOOKUPS]poseidon.Hash
|
||||
var leafLookups [NUM_LEAF_LOOKUPS]poseidon.PoseidonBN128HashOut
|
||||
// First create the "leaf" lookup2 circuits
|
||||
// The will use the least significant bits of the capIndexBits array
|
||||
for i := 0; i < NUM_LEAF_LOOKUPS; i++ {
|
||||
leafLookups[i] = f.hashAPI.Lookup2Hash(
|
||||
leafLookups[i] = f.api.Lookup2(
|
||||
capIndexBits[0], capIndexBits[1],
|
||||
merkleCap[i*NUM_LEAF_LOOKUPS], merkleCap[i*NUM_LEAF_LOOKUPS+1], merkleCap[i*NUM_LEAF_LOOKUPS+2], merkleCap[i*NUM_LEAF_LOOKUPS+3],
|
||||
)
|
||||
}
|
||||
|
||||
// Use the most 2 significant bits of the capIndexBits array for the "root" lookup
|
||||
merkleCapEntry := f.hashAPI.Lookup2Hash(capIndexBits[2], capIndexBits[3], leafLookups[0], leafLookups[1], leafLookups[2], leafLookups[3])
|
||||
f.hashAPI.AssertIsEqualHash(currentDigest, merkleCapEntry)
|
||||
merkleCapEntry := f.api.Lookup2(capIndexBits[2], capIndexBits[3], leafLookups[0], leafLookups[1], leafLookups[2], leafLookups[3])
|
||||
f.api.AssertIsEqual(currentDigest, merkleCapEntry)
|
||||
}
|
||||
|
||||
func (f *FriChip) verifyInitialProof(xIndexBits []frontend.Variable, proof *common.FriInitialTreeProof, initialMerkleCaps []common.MerkleCap, capIndexBits []frontend.Variable) {
|
||||
@@ -422,7 +368,8 @@ func (f *FriChip) verifyQueryRound(
|
||||
roundProof *common.FriQueryRound,
|
||||
) {
|
||||
f.assertNoncanonicalIndicesOK()
|
||||
xIndexBits := f.fieldAPI.ToBits(xIndex)
|
||||
xIndex = f.fieldAPI.Reduce(xIndex)
|
||||
xIndexBits := f.fieldAPI.ToBits(xIndex)[0 : f.friParams.DegreeBits+f.friParams.Config.RateBits]
|
||||
capIndexBits := xIndexBits[len(xIndexBits)-int(f.friParams.Config.CapHeight):]
|
||||
|
||||
f.verifyInitialProof(xIndexBits, &roundProof.InitialTreesProof, initialMerkleCaps, capIndexBits)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/poseidon"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/verifier/common"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/verifier/internal/fri"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/verifier/internal/plonk"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/verifier/utils"
|
||||
)
|
||||
|
||||
@@ -16,12 +17,6 @@ type TestFriCircuit struct {
|
||||
proofWithPIsFilename string `gnark:"-"`
|
||||
commonCircuitDataFilename string `gnark:"-"`
|
||||
verifierOnlyCircuitDataFilename string `gnark:"-"`
|
||||
|
||||
PlonkZeta field.QuadraticExtension
|
||||
FriAlpha field.QuadraticExtension
|
||||
FriBetas []field.QuadraticExtension
|
||||
FriPOWResponse field.F
|
||||
FriQueryIndices []field.F
|
||||
}
|
||||
|
||||
func (circuit *TestFriCircuit) Define(api frontend.API) error {
|
||||
@@ -31,16 +26,44 @@ func (circuit *TestFriCircuit) Define(api frontend.API) error {
|
||||
|
||||
fieldAPI := field.NewFieldAPI(api)
|
||||
qeAPI := field.NewQuadraticExtensionAPI(api, fieldAPI, commonCircuitData.DegreeBits)
|
||||
hashAPI := poseidon.NewHashAPI(fieldAPI)
|
||||
poseidonChip := poseidon.NewPoseidonChip(api, fieldAPI, qeAPI)
|
||||
friChip := fri.NewFriChip(api, fieldAPI, qeAPI, hashAPI, poseidonChip, &commonCircuitData.FriParams)
|
||||
poseidonBN128Chip := poseidon.NewPoseidonBN128Chip(api, fieldAPI)
|
||||
friChip := fri.NewFriChip(api, fieldAPI, qeAPI, poseidonBN128Chip, &commonCircuitData.FriParams)
|
||||
challengerChip := plonk.NewChallengerChip(api, fieldAPI, poseidonChip, poseidonBN128Chip)
|
||||
|
||||
friChallenges := common.FriChallenges{
|
||||
FriAlpha: circuit.FriAlpha,
|
||||
FriBetas: circuit.FriBetas,
|
||||
FriPowResponse: circuit.FriPOWResponse,
|
||||
FriQueryIndices: circuit.FriQueryIndices,
|
||||
}
|
||||
challengerChip.ObserveBN128Hash(verifierOnlyCircuitData.CircuitDigest)
|
||||
challengerChip.ObserveHash(poseidonChip.HashNoPad(proofWithPis.PublicInputs))
|
||||
challengerChip.ObserveCap(proofWithPis.Proof.WiresCap)
|
||||
plonkBetas := challengerChip.GetNChallenges(commonCircuitData.Config.NumChallenges) // For plonk betas
|
||||
fieldAPI.AssertIsEqual(plonkBetas[0], field.NewFieldConst(17615363392879944733))
|
||||
plonkGammas := challengerChip.GetNChallenges(commonCircuitData.Config.NumChallenges) // For plonk gammas
|
||||
fieldAPI.AssertIsEqual(plonkGammas[0], field.NewFieldConst(15174493176564484303))
|
||||
|
||||
challengerChip.ObserveCap(proofWithPis.Proof.PlonkZsPartialProductsCap)
|
||||
plonkAlphas := challengerChip.GetNChallenges(commonCircuitData.Config.NumChallenges) // For plonk alphas
|
||||
fieldAPI.AssertIsEqual(plonkAlphas[0], field.NewFieldConst(9276470834414745550))
|
||||
|
||||
challengerChip.ObserveCap(proofWithPis.Proof.QuotientPolysCap)
|
||||
plonkZeta := challengerChip.GetExtensionChallenge()
|
||||
fieldAPI.AssertIsEqual(plonkZeta[0], field.NewFieldConst(3892795992421241388))
|
||||
|
||||
challengerChip.ObserveOpenings(fri.ToFriOpenings(proofWithPis.Proof.Openings))
|
||||
|
||||
friChallenges := challengerChip.GetFriChallenges(
|
||||
proofWithPis.Proof.OpeningProof.CommitPhaseMerkleCaps,
|
||||
proofWithPis.Proof.OpeningProof.FinalPoly,
|
||||
proofWithPis.Proof.OpeningProof.PowWitness,
|
||||
commonCircuitData.DegreeBits,
|
||||
commonCircuitData.Config.FriConfig,
|
||||
)
|
||||
|
||||
fieldAPI.AssertIsEqual(friChallenges.FriAlpha[0], field.NewFieldConst(885535811531859621))
|
||||
|
||||
fieldAPI.AssertIsEqual(friChallenges.FriBetas[0][0], field.NewFieldConst(5231781384587895507))
|
||||
|
||||
fieldAPI.AssertIsEqual(friChallenges.FriPowResponse, field.NewFieldConst(70715523064019))
|
||||
|
||||
fieldAPI.AssertIsEqual(friChallenges.FriQueryIndices[0], field.NewFieldConst(11890500485816111017))
|
||||
|
||||
initialMerkleCaps := []common.MerkleCap{
|
||||
verifierOnlyCircuitData.ConstantSigmasCap,
|
||||
@@ -49,8 +72,27 @@ func (circuit *TestFriCircuit) Define(api frontend.API) error {
|
||||
proofWithPis.Proof.QuotientPolysCap,
|
||||
}
|
||||
|
||||
// Seems like there is a bug in the emulated field code.
|
||||
// Add ZERO to all of the fri challenges values to reduce them.
|
||||
plonkZeta[0] = fieldAPI.Add(plonkZeta[0], field.ZERO_F)
|
||||
plonkZeta[1] = fieldAPI.Add(plonkZeta[1], field.ZERO_F)
|
||||
|
||||
friChallenges.FriAlpha[0] = fieldAPI.Add(friChallenges.FriAlpha[0], field.ZERO_F)
|
||||
friChallenges.FriAlpha[1] = fieldAPI.Add(friChallenges.FriAlpha[1], field.ZERO_F)
|
||||
|
||||
for i := 0; i < len(friChallenges.FriBetas); i++ {
|
||||
friChallenges.FriBetas[i][0] = fieldAPI.Add(friChallenges.FriBetas[i][0], field.ZERO_F)
|
||||
friChallenges.FriBetas[i][1] = fieldAPI.Add(friChallenges.FriBetas[i][1], field.ZERO_F)
|
||||
}
|
||||
|
||||
friChallenges.FriPowResponse = fieldAPI.Add(friChallenges.FriPowResponse, field.ZERO_F)
|
||||
|
||||
for i := 0; i < len(friChallenges.FriQueryIndices); i++ {
|
||||
friChallenges.FriQueryIndices[i] = fieldAPI.Add(friChallenges.FriQueryIndices[i], field.ZERO_F)
|
||||
}
|
||||
|
||||
friChip.VerifyFriProof(
|
||||
fri.GetFriInstance(&commonCircuitData, qeAPI, circuit.PlonkZeta, commonCircuitData.DegreeBits),
|
||||
fri.GetFriInstance(&commonCircuitData, qeAPI, plonkZeta, commonCircuitData.DegreeBits),
|
||||
fri.ToFriOpenings(proofWithPis.Proof.Openings),
|
||||
&friChallenges,
|
||||
initialMerkleCaps,
|
||||
@@ -60,182 +102,19 @@ func (circuit *TestFriCircuit) Define(api frontend.API) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestFibonacciFriProof(t *testing.T) {
|
||||
func TestDecodeBlockFriVerification(t *testing.T) {
|
||||
assert := test.NewAssert(t)
|
||||
|
||||
testCase := func() {
|
||||
circuit := TestFriCircuit{
|
||||
proofWithPIsFilename: "./data/fibonacci/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "./data/fibonacci/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "./data/fibonacci/verifier_only_circuit_data.json",
|
||||
PlonkZeta: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("14887793628029982930"),
|
||||
field.NewFieldConstFromString("1136137158284059037"),
|
||||
},
|
||||
FriAlpha: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("14641715242626918707"),
|
||||
field.NewFieldConstFromString("10574243340537902930"),
|
||||
},
|
||||
FriBetas: []field.QuadraticExtension{},
|
||||
FriPOWResponse: field.NewFieldConst(82451580476419),
|
||||
FriQueryIndices: []field.F{
|
||||
field.NewFieldConst(6790812084677375942),
|
||||
field.NewFieldConst(12394212020331474798),
|
||||
field.NewFieldConst(16457600747000998582),
|
||||
field.NewFieldConst(1543271328932331916),
|
||||
field.NewFieldConst(12115726870906958644),
|
||||
field.NewFieldConst(6775897107605342797),
|
||||
field.NewFieldConst(15989401564746021030),
|
||||
field.NewFieldConst(10691676456016926845),
|
||||
field.NewFieldConst(1632499470630032007),
|
||||
field.NewFieldConst(1317292355445098328),
|
||||
field.NewFieldConst(18391440812534384252),
|
||||
field.NewFieldConst(17321705613231354333),
|
||||
field.NewFieldConst(6176487551308859603),
|
||||
field.NewFieldConst(7119835651572002873),
|
||||
field.NewFieldConst(3903019169623116693),
|
||||
field.NewFieldConst(4886491111111487546),
|
||||
field.NewFieldConst(4087641893164620518),
|
||||
field.NewFieldConst(13801643080324181364),
|
||||
field.NewFieldConst(16993775312274189321),
|
||||
field.NewFieldConst(9268202926222765679),
|
||||
field.NewFieldConst(10683001302406181735),
|
||||
field.NewFieldConst(13359465725531647963),
|
||||
field.NewFieldConst(4523327590105620849),
|
||||
field.NewFieldConst(4883588003760409588),
|
||||
field.NewFieldConst(187699146998097671),
|
||||
field.NewFieldConst(14489263557623716717),
|
||||
field.NewFieldConst(11748359318238148146),
|
||||
field.NewFieldConst(13636347200053048758),
|
||||
},
|
||||
}
|
||||
witness := TestFriCircuit{}
|
||||
err := test.IsSolved(&circuit, &witness, field.TEST_CURVE.ScalarField())
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
testCase()
|
||||
}
|
||||
|
||||
func TestDummyFriProof(t *testing.T) {
|
||||
assert := test.NewAssert(t)
|
||||
|
||||
testCase := func() {
|
||||
circuit := TestFriCircuit{
|
||||
proofWithPIsFilename: "../../data/dummy_2^14_gates/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "../../data/dummy_2^14_gates/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "../../data/dummy_2^14_gates/verifier_only_circuit_data.json",
|
||||
PlonkZeta: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("17377750363769967882"),
|
||||
field.NewFieldConstFromString("11921191651424768462"),
|
||||
},
|
||||
FriAlpha: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("16721004555774385479"),
|
||||
field.NewFieldConstFromString("10688151135543754663"),
|
||||
},
|
||||
FriBetas: []field.QuadraticExtension{
|
||||
{
|
||||
field.NewFieldConstFromString("3312441922957827805"),
|
||||
field.NewFieldConstFromString("15128092514958289671"),
|
||||
},
|
||||
{
|
||||
field.NewFieldConstFromString("13630530769060141802"),
|
||||
field.NewFieldConstFromString("14559883974933163008"),
|
||||
},
|
||||
{
|
||||
field.NewFieldConstFromString("16146508250083930687"),
|
||||
field.NewFieldConstFromString("5176346568444408396"),
|
||||
},
|
||||
},
|
||||
FriPOWResponse: field.NewFieldConst(4389),
|
||||
FriQueryIndices: []field.F{
|
||||
field.NewFieldConstFromString("16334967868590615051"),
|
||||
field.NewFieldConstFromString("2911473540496037915"),
|
||||
field.NewFieldConstFromString("14887216056886344225"),
|
||||
field.NewFieldConstFromString("7808811227805914295"),
|
||||
field.NewFieldConstFromString("2018594961417375749"),
|
||||
field.NewFieldConstFromString("3733368398777208435"),
|
||||
field.NewFieldConstFromString("2623035669037055104"),
|
||||
field.NewFieldConstFromString("299243030573481514"),
|
||||
field.NewFieldConstFromString("7189789717962704433"),
|
||||
field.NewFieldConstFromString("14566344026886816268"),
|
||||
field.NewFieldConstFromString("12555390069003437453"),
|
||||
field.NewFieldConstFromString("17225508403199418233"),
|
||||
field.NewFieldConstFromString("5088797913879903292"),
|
||||
field.NewFieldConstFromString("9715691392773433023"),
|
||||
field.NewFieldConstFromString("7565836764713256165"),
|
||||
field.NewFieldConstFromString("1500143546029322929"),
|
||||
field.NewFieldConstFromString("1245802417104422080"),
|
||||
field.NewFieldConstFromString("6831959786661245110"),
|
||||
field.NewFieldConstFromString("17271054758535453780"),
|
||||
field.NewFieldConstFromString("6225460404576395409"),
|
||||
field.NewFieldConstFromString("15932661092896277351"),
|
||||
field.NewFieldConstFromString("12452534049198240575"),
|
||||
field.NewFieldConstFromString("4225199666055520177"),
|
||||
field.NewFieldConstFromString("13235091290587791090"),
|
||||
field.NewFieldConstFromString("2562357622728700774"),
|
||||
field.NewFieldConstFromString("17676678042980201498"),
|
||||
field.NewFieldConstFromString("5837067135702409874"),
|
||||
field.NewFieldConstFromString("11238419549114325157"),
|
||||
},
|
||||
proofWithPIsFilename: "../../data/decode_block/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "../../data/decode_block//common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "../../data/decode_block//verifier_only_circuit_data.json",
|
||||
}
|
||||
witness := TestFriCircuit{
|
||||
proofWithPIsFilename: "../../data/dummy_2^14_gates/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "../../data/dummy_2^14_gates/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: ".../../data/dummy_2^14_gates/verifier_only_circuit_data.json",
|
||||
PlonkZeta: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("17377750363769967882"),
|
||||
field.NewFieldConstFromString("11921191651424768462"),
|
||||
},
|
||||
FriAlpha: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("16721004555774385479"),
|
||||
field.NewFieldConstFromString("10688151135543754663"),
|
||||
},
|
||||
FriBetas: []field.QuadraticExtension{
|
||||
{
|
||||
field.NewFieldConstFromString("3312441922957827805"),
|
||||
field.NewFieldConstFromString("15128092514958289671"),
|
||||
},
|
||||
{
|
||||
field.NewFieldConstFromString("13630530769060141802"),
|
||||
field.NewFieldConstFromString("14559883974933163008"),
|
||||
},
|
||||
{
|
||||
field.NewFieldConstFromString("16146508250083930687"),
|
||||
field.NewFieldConstFromString("5176346568444408396"),
|
||||
},
|
||||
},
|
||||
FriPOWResponse: field.NewFieldConst(4389),
|
||||
FriQueryIndices: []field.F{
|
||||
field.NewFieldConstFromString("16334967868590615051"),
|
||||
field.NewFieldConstFromString("2911473540496037915"),
|
||||
field.NewFieldConstFromString("14887216056886344225"),
|
||||
field.NewFieldConstFromString("7808811227805914295"),
|
||||
field.NewFieldConstFromString("2018594961417375749"),
|
||||
field.NewFieldConstFromString("3733368398777208435"),
|
||||
field.NewFieldConstFromString("2623035669037055104"),
|
||||
field.NewFieldConstFromString("299243030573481514"),
|
||||
field.NewFieldConstFromString("7189789717962704433"),
|
||||
field.NewFieldConstFromString("14566344026886816268"),
|
||||
field.NewFieldConstFromString("12555390069003437453"),
|
||||
field.NewFieldConstFromString("17225508403199418233"),
|
||||
field.NewFieldConstFromString("5088797913879903292"),
|
||||
field.NewFieldConstFromString("9715691392773433023"),
|
||||
field.NewFieldConstFromString("7565836764713256165"),
|
||||
field.NewFieldConstFromString("1500143546029322929"),
|
||||
field.NewFieldConstFromString("1245802417104422080"),
|
||||
field.NewFieldConstFromString("6831959786661245110"),
|
||||
field.NewFieldConstFromString("17271054758535453780"),
|
||||
field.NewFieldConstFromString("6225460404576395409"),
|
||||
field.NewFieldConstFromString("15932661092896277351"),
|
||||
field.NewFieldConstFromString("12452534049198240575"),
|
||||
field.NewFieldConstFromString("4225199666055520177"),
|
||||
field.NewFieldConstFromString("13235091290587791090"),
|
||||
field.NewFieldConstFromString("2562357622728700774"),
|
||||
field.NewFieldConstFromString("17676678042980201498"),
|
||||
field.NewFieldConstFromString("5837067135702409874"),
|
||||
field.NewFieldConstFromString("11238419549114325157"),
|
||||
},
|
||||
}
|
||||
err := test.IsSolved(&circuit, &witness, field.TEST_CURVE.ScalarField())
|
||||
assert.NoError(err)
|
||||
|
||||
@@ -23,6 +23,7 @@ var gateRegexHandlers = map[*regexp.Regexp]func(parameters map[string]string) Ga
|
||||
mulExtensionGateRegex: deserializeMulExtensionGate,
|
||||
noopGateRegex: deserializeNoopGate,
|
||||
poseidonGateRegex: deserializePoseidonGate,
|
||||
poseidonMdsGateRegex: deserializePoseidonMdsGate,
|
||||
publicInputGateRegex: deserializePublicInputGate,
|
||||
randomAccessGateRegex: deserializeRandomAccessGate,
|
||||
reducingExtensionGateRegex: deserializeReducingExtensionGate,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
86
verifier/internal/gates/poseidon_mds_gate.go
Normal file
86
verifier/internal/gates/poseidon_mds_gate.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package gates
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/consensys/gnark/frontend"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/field"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/poseidon"
|
||||
)
|
||||
|
||||
var poseidonMdsGateRegex = regexp.MustCompile("PoseidonMdsGate.*")
|
||||
|
||||
func deserializePoseidonMdsGate(parameters map[string]string) Gate {
|
||||
// Has the format "PoseidonMdsGate(PhantomData<plonky2_field::goldilocks_field::GoldilocksField>)<WIDTH=12>"
|
||||
return NewPoseidonMdsGate()
|
||||
}
|
||||
|
||||
type PoseidonMdsGate struct {
|
||||
}
|
||||
|
||||
func NewPoseidonMdsGate() *PoseidonMdsGate {
|
||||
return &PoseidonMdsGate{}
|
||||
}
|
||||
|
||||
func (g *PoseidonMdsGate) Id() string {
|
||||
return "PoseidonMdsGate"
|
||||
}
|
||||
|
||||
func (g *PoseidonMdsGate) WireInput(i uint64) Range {
|
||||
if i >= poseidon.SPONGE_WIDTH {
|
||||
panic("Input less than sponge width")
|
||||
}
|
||||
return Range{i * field.D, (i + 1) * field.D}
|
||||
}
|
||||
|
||||
func (g *PoseidonMdsGate) WireOutput(i uint64) Range {
|
||||
if i >= poseidon.SPONGE_WIDTH {
|
||||
panic("Input less than sponge width")
|
||||
}
|
||||
return Range{(poseidon.SPONGE_WIDTH + i) * field.D, (poseidon.SPONGE_WIDTH + i + 1) * field.D}
|
||||
}
|
||||
|
||||
func (g *PoseidonMdsGate) mdsRowShfAlgebra(r uint64, v [poseidon.SPONGE_WIDTH]field.QEAlgebra, qeAPI *field.QuadraticExtensionAPI) field.QEAlgebra {
|
||||
if r >= poseidon.SPONGE_WIDTH {
|
||||
panic("MDS row index out of range")
|
||||
}
|
||||
|
||||
res := qeAPI.ZERO_QE_ALGEBRA
|
||||
for i := uint64(0); i < poseidon.SPONGE_WIDTH; i++ {
|
||||
coeff := qeAPI.FieldToQE(poseidon.MDS_MATRIX_CIRC[i])
|
||||
res = qeAPI.AddExtensionAlgebra(res, qeAPI.ScalarMulExtensionAlgebra(coeff, v[(i+r)%poseidon.SPONGE_WIDTH]))
|
||||
}
|
||||
|
||||
coeff := qeAPI.FieldToQE(poseidon.MDS_MATRIX_DIAG[r])
|
||||
res = qeAPI.AddExtensionAlgebra(res, qeAPI.ScalarMulExtensionAlgebra(coeff, v[r]))
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func (g *PoseidonMdsGate) mdsLayerAlgebra(state [poseidon.SPONGE_WIDTH]field.QEAlgebra, qeAPI *field.QuadraticExtensionAPI) [poseidon.SPONGE_WIDTH]field.QEAlgebra {
|
||||
var result [poseidon.SPONGE_WIDTH]field.QEAlgebra
|
||||
for r := uint64(0); r < poseidon.SPONGE_WIDTH; r++ {
|
||||
result[r] = g.mdsRowShfAlgebra(r, state, qeAPI)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (g *PoseidonMdsGate) EvalUnfiltered(api frontend.API, qeAPI *field.QuadraticExtensionAPI, vars EvaluationVars) []field.QuadraticExtension {
|
||||
constraints := []field.QuadraticExtension{}
|
||||
|
||||
var inputs [poseidon.SPONGE_WIDTH]field.QEAlgebra
|
||||
for i := uint64(0); i < poseidon.SPONGE_WIDTH; i++ {
|
||||
inputs[i] = vars.GetLocalExtAlgebra(g.WireInput(i))
|
||||
}
|
||||
|
||||
computed_outputs := g.mdsLayerAlgebra(inputs, qeAPI)
|
||||
|
||||
for i := uint64(0); i < poseidon.SPONGE_WIDTH; i++ {
|
||||
output := vars.GetLocalExtAlgebra(g.WireOutput(i))
|
||||
diff := qeAPI.SubExtensionAlgebra(output, computed_outputs[i])
|
||||
constraints = append(constraints, diff[0], diff[1])
|
||||
}
|
||||
|
||||
return constraints
|
||||
}
|
||||
@@ -8,13 +8,13 @@ import (
|
||||
type EvaluationVars struct {
|
||||
localConstants []field.QuadraticExtension
|
||||
localWires []field.QuadraticExtension
|
||||
publicInputsHash poseidon.Hash
|
||||
publicInputsHash poseidon.PoseidonHashOut
|
||||
}
|
||||
|
||||
func NewEvaluationVars(
|
||||
localConstants []field.QuadraticExtension,
|
||||
localWires []field.QuadraticExtension,
|
||||
publicInputsHash poseidon.Hash,
|
||||
publicInputsHash poseidon.PoseidonHashOut,
|
||||
) *EvaluationVars {
|
||||
return &EvaluationVars{
|
||||
localConstants: localConstants,
|
||||
|
||||
@@ -11,15 +11,16 @@ import (
|
||||
)
|
||||
|
||||
type ChallengerChip struct {
|
||||
api frontend.API `gnark:"-"`
|
||||
field field.FieldAPI `gnark:"-"`
|
||||
poseidonChip *poseidon.PoseidonChip
|
||||
spongeState [poseidon.SPONGE_WIDTH]field.F
|
||||
inputBuffer []field.F
|
||||
outputBuffer []field.F
|
||||
api frontend.API `gnark:"-"`
|
||||
field field.FieldAPI `gnark:"-"`
|
||||
poseidonChip *poseidon.PoseidonChip
|
||||
poseidonBN128Chip *poseidon.PoseidonBN128Chip
|
||||
spongeState [poseidon.SPONGE_WIDTH]field.F
|
||||
inputBuffer []field.F
|
||||
outputBuffer []field.F
|
||||
}
|
||||
|
||||
func NewChallengerChip(api frontend.API, fieldAPI field.FieldAPI, poseidonChip *poseidon.PoseidonChip) *ChallengerChip {
|
||||
func NewChallengerChip(api frontend.API, fieldAPI field.FieldAPI, poseidonChip *poseidon.PoseidonChip, poseidonBN128Chip *poseidon.PoseidonBN128Chip) *ChallengerChip {
|
||||
var spongeState [poseidon.SPONGE_WIDTH]field.F
|
||||
var inputBuffer []field.F
|
||||
var outputBuffer []field.F
|
||||
@@ -29,12 +30,13 @@ func NewChallengerChip(api frontend.API, fieldAPI field.FieldAPI, poseidonChip *
|
||||
}
|
||||
|
||||
return &ChallengerChip{
|
||||
api: api,
|
||||
field: fieldAPI,
|
||||
poseidonChip: poseidonChip,
|
||||
spongeState: spongeState,
|
||||
inputBuffer: inputBuffer,
|
||||
outputBuffer: outputBuffer,
|
||||
api: api,
|
||||
field: fieldAPI,
|
||||
poseidonChip: poseidonChip,
|
||||
poseidonBN128Chip: poseidonBN128Chip,
|
||||
spongeState: spongeState,
|
||||
inputBuffer: inputBuffer,
|
||||
outputBuffer: outputBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,13 +54,19 @@ func (c *ChallengerChip) ObserveElements(elements []field.F) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ChallengerChip) ObserveHash(hash poseidon.Hash) {
|
||||
c.ObserveElements(hash[:])
|
||||
func (c *ChallengerChip) ObserveHash(hash poseidon.PoseidonHashOut) {
|
||||
elements := c.poseidonChip.ToVec(hash)
|
||||
c.ObserveElements(elements)
|
||||
}
|
||||
|
||||
func (c *ChallengerChip) ObserveCap(cap []poseidon.Hash) {
|
||||
func (c *ChallengerChip) ObserveBN128Hash(hash poseidon.PoseidonBN128HashOut) {
|
||||
elements := c.poseidonBN128Chip.ToVec(hash)
|
||||
c.ObserveElements(elements)
|
||||
}
|
||||
|
||||
func (c *ChallengerChip) ObserveCap(cap []poseidon.PoseidonBN128HashOut) {
|
||||
for i := 0; i < len(cap); i++ {
|
||||
c.ObserveHash(cap[i])
|
||||
c.ObserveBN128Hash(cap[i])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +110,7 @@ func (c *ChallengerChip) GetExtensionChallenge() field.QuadraticExtension {
|
||||
return field.QuadraticExtension{values[0], values[1]}
|
||||
}
|
||||
|
||||
func (c *ChallengerChip) GetHash() poseidon.Hash {
|
||||
func (c *ChallengerChip) GetHash() poseidon.PoseidonHashOut {
|
||||
return [4]field.F{c.GetChallenge(), c.GetChallenge(), c.GetChallenge(), c.GetChallenge()}
|
||||
}
|
||||
|
||||
@@ -140,9 +148,7 @@ func (c *ChallengerChip) duplexing() {
|
||||
panic("something went wrong")
|
||||
}
|
||||
|
||||
for i := 0; i < len(c.inputBuffer); i++ {
|
||||
c.spongeState[i] = c.inputBuffer[i]
|
||||
}
|
||||
copy(c.spongeState[:], c.inputBuffer)
|
||||
c.inputBuffer = clearBuffer(c.inputBuffer)
|
||||
c.spongeState = c.poseidonChip.Poseidon(c.spongeState)
|
||||
clearBuffer(c.outputBuffer)
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
package plonk
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/consensys/gnark/frontend"
|
||||
"github.com/consensys/gnark/test"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/field"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/poseidon"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/utils"
|
||||
)
|
||||
|
||||
type TestChallengerCircuit struct {
|
||||
PublicInputs [3]frontend.Variable
|
||||
CircuitDigest [4]frontend.Variable
|
||||
WiresCap [16][4]frontend.Variable
|
||||
PlonkZsPartialProductsCap [16][4]frontend.Variable
|
||||
QuotientPolysCap [16][4]frontend.Variable
|
||||
PublicInputs []field.F
|
||||
CircuitDigest poseidon.PoseidonBN128HashOut
|
||||
WiresCap [16]poseidon.PoseidonBN128HashOut
|
||||
PlonkZsPartialProductsCap [16]poseidon.PoseidonBN128HashOut
|
||||
QuotientPolysCap [16]poseidon.PoseidonBN128HashOut
|
||||
}
|
||||
|
||||
func (circuit *TestChallengerCircuit) Define(api frontend.API) error {
|
||||
@@ -23,53 +23,23 @@ func (circuit *TestChallengerCircuit) Define(api frontend.API) error {
|
||||
degreeBits := 3
|
||||
qeAPI := field.NewQuadraticExtensionAPI(api, fieldAPI, uint64(degreeBits))
|
||||
poseidonChip := poseidon.NewPoseidonChip(api, fieldAPI, qeAPI)
|
||||
challengerChip := NewChallengerChip(api, fieldAPI, poseidonChip)
|
||||
poseidonBN128Chip := poseidon.NewPoseidonBN128Chip(api, fieldAPI)
|
||||
challengerChip := NewChallengerChip(api, fieldAPI, poseidonChip, poseidonBN128Chip)
|
||||
|
||||
var circuitDigest [4]field.F
|
||||
for i := 0; i < len(circuitDigest); i++ {
|
||||
circuitDigest[i] = fieldAPI.FromBits(api.ToBinary(circuit.CircuitDigest[i], 64)...)
|
||||
}
|
||||
|
||||
var publicInputs [3]field.F
|
||||
for i := 0; i < len(publicInputs); i++ {
|
||||
publicInputs[i] = fieldAPI.FromBits(api.ToBinary(circuit.PublicInputs[i], 64)...)
|
||||
}
|
||||
|
||||
var wiresCap [16][4]field.F
|
||||
for i := 0; i < len(wiresCap); i++ {
|
||||
for j := 0; j < len(wiresCap[0]); j++ {
|
||||
wiresCap[i][j] = fieldAPI.FromBits(api.ToBinary(circuit.WiresCap[i][j], 64)...)
|
||||
}
|
||||
}
|
||||
|
||||
var plonkZsPartialProductsCap [16][4]field.F
|
||||
for i := 0; i < len(plonkZsPartialProductsCap); i++ {
|
||||
for j := 0; j < len(plonkZsPartialProductsCap[0]); j++ {
|
||||
plonkZsPartialProductsCap[i][j] = fieldAPI.FromBits(api.ToBinary(circuit.PlonkZsPartialProductsCap[i][j], 64)...)
|
||||
}
|
||||
}
|
||||
|
||||
var quotientPolysCap [16][4]field.F
|
||||
for i := 0; i < len(quotientPolysCap); i++ {
|
||||
for j := 0; j < len(quotientPolysCap[0]); j++ {
|
||||
quotientPolysCap[i][j] = fieldAPI.FromBits(api.ToBinary(circuit.QuotientPolysCap[i][j], 64)...)
|
||||
}
|
||||
}
|
||||
|
||||
publicInputHash := poseidonChip.HashNoPad(publicInputs[:])
|
||||
challengerChip.ObserveHash(circuitDigest)
|
||||
challengerChip.ObserveBN128Hash(circuit.CircuitDigest)
|
||||
publicInputHash := poseidonChip.HashNoPad(circuit.PublicInputs[:])
|
||||
challengerChip.ObserveHash(publicInputHash)
|
||||
challengerChip.ObserveCap(wiresCap[:])
|
||||
challengerChip.ObserveCap(circuit.WiresCap[:])
|
||||
|
||||
numChallenges := uint64(2)
|
||||
plonkBetas := challengerChip.GetNChallenges(numChallenges)
|
||||
plonkGammas := challengerChip.GetNChallenges(numChallenges)
|
||||
|
||||
expectedPublicInputHash := [4]field.F{
|
||||
field.NewFieldConstFromString("8416658900775745054"),
|
||||
field.NewFieldConstFromString("12574228347150446423"),
|
||||
field.NewFieldConstFromString("9629056739760131473"),
|
||||
field.NewFieldConstFromString("3119289788404190010"),
|
||||
field.NewFieldConstFromString("0"),
|
||||
field.NewFieldConstFromString("0"),
|
||||
field.NewFieldConstFromString("0"),
|
||||
field.NewFieldConstFromString("0"),
|
||||
}
|
||||
|
||||
for i := 0; i < 4; i++ {
|
||||
@@ -77,13 +47,13 @@ func (circuit *TestChallengerCircuit) Define(api frontend.API) error {
|
||||
}
|
||||
|
||||
expectedPlonkBetas := [2]field.F{
|
||||
field.NewFieldConstFromString("4678728155650926271"),
|
||||
field.NewFieldConstFromString("13611962404289024887"),
|
||||
field.NewFieldConstFromString("17615363392879944733"),
|
||||
field.NewFieldConstFromString("9422446877322953047"),
|
||||
}
|
||||
|
||||
expectedPlonkGammas := [2]field.F{
|
||||
field.NewFieldConstFromString("13237663823305715949"),
|
||||
field.NewFieldConstFromString("15389314098328235145"),
|
||||
field.NewFieldConstFromString("15174493176564484303"),
|
||||
field.NewFieldConstFromString("6175150444166239851"),
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
@@ -91,24 +61,24 @@ func (circuit *TestChallengerCircuit) Define(api frontend.API) error {
|
||||
fieldAPI.AssertIsEqual(plonkGammas[i], expectedPlonkGammas[i])
|
||||
}
|
||||
|
||||
challengerChip.ObserveCap(plonkZsPartialProductsCap[:])
|
||||
challengerChip.ObserveCap(circuit.PlonkZsPartialProductsCap[:])
|
||||
plonkAlphas := challengerChip.GetNChallenges(numChallenges)
|
||||
|
||||
expectedPlonkAlphas := [2]field.F{
|
||||
field.NewFieldConstFromString("14505919539124304197"),
|
||||
field.NewFieldConstFromString("1695455639263736117"),
|
||||
field.NewFieldConstFromString("9276470834414745550"),
|
||||
field.NewFieldConstFromString("5302812342351431915"),
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
fieldAPI.AssertIsEqual(plonkAlphas[i], expectedPlonkAlphas[i])
|
||||
}
|
||||
|
||||
challengerChip.ObserveCap(quotientPolysCap[:])
|
||||
challengerChip.ObserveCap(circuit.QuotientPolysCap[:])
|
||||
plonkZeta := challengerChip.GetExtensionChallenge()
|
||||
|
||||
expectedPlonkZeta := field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("14887793628029982930"),
|
||||
field.NewFieldConstFromString("1136137158284059037"),
|
||||
field.NewFieldConstFromString("3892795992421241388"),
|
||||
field.NewFieldConstFromString("15786647757418200302"),
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
@@ -118,15 +88,25 @@ func (circuit *TestChallengerCircuit) Define(api frontend.API) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func StringToBN128Hash(hashStr string) poseidon.PoseidonBN128HashOut {
|
||||
hashBigInt, ok := new(big.Int).SetString(hashStr, 10)
|
||||
if !(ok) {
|
||||
panic("Invalid hash: " + hashStr)
|
||||
}
|
||||
|
||||
hashVar := frontend.Variable(*hashBigInt)
|
||||
return poseidon.PoseidonBN128HashOut(hashVar)
|
||||
}
|
||||
|
||||
func TestChallengerWitness(t *testing.T) {
|
||||
assert := test.NewAssert(t)
|
||||
|
||||
testCase := func(
|
||||
publicInputs [3]frontend.Variable,
|
||||
circuitDigest [4]frontend.Variable,
|
||||
wiresCap [16][4]frontend.Variable,
|
||||
plonkZsPartialProductsCap [16][4]frontend.Variable,
|
||||
quotientPolysCap [16][4]frontend.Variable,
|
||||
publicInputs []field.F,
|
||||
circuitDigest poseidon.PoseidonBN128HashOut,
|
||||
wiresCap [16]poseidon.PoseidonBN128HashOut,
|
||||
plonkZsPartialProductsCap [16]poseidon.PoseidonBN128HashOut,
|
||||
quotientPolysCap [16]poseidon.PoseidonBN128HashOut,
|
||||
) {
|
||||
circuit := TestChallengerCircuit{
|
||||
PublicInputs: publicInputs,
|
||||
@@ -146,80 +126,63 @@ func TestChallengerWitness(t *testing.T) {
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
publicInputsStr := []string{"0", "1", "3736710860384812976"}
|
||||
circuitDigestStr := []string{"7754113318730736048", "18436136620016916513", "18054530212389526288", "5893739326632906028"}
|
||||
wiresCapStr := [][]string{
|
||||
{"13884351014873073118", "5174249846243191862", "2208632528791973868", "1071582828677910652"},
|
||||
{"11475361245556894879", "14867351574926692044", "17013374066934071379", "1027671036932569748"},
|
||||
{"5604634992452399010", "3684464596850094189", "5565599237356852406", "4136295609943151014"},
|
||||
{"8463721840990025805", "5922588965472526198", "8096699027533803435", "2210089353004111478"},
|
||||
{"17531628199677307555", "11513452064460680964", "1482441508929181375", "5139566233781982440"},
|
||||
{"13271417993289093233", "17257193898955790413", "16883807866578566670", "7423179920948669117"},
|
||||
{"13462567520785358202", "15555103598281658890", "5859961276885232601", "4464568704709749394"},
|
||||
{"153012620162729043", "14072764618167122665", "3025694603779494447", "15948104906680148838"},
|
||||
{"18050235253694287284", "11467396424826912141", "11302553396166323353", "10976271719722841224"},
|
||||
{"15208241660644051470", "8520722208187871063", "10775022596056682771", "16048513824198271730"},
|
||||
{"6929477084755896240", "11382029470138215117", "13205948643259905511", "9421863267852221772"},
|
||||
{"15449187573546292268", "10216729601353604194", "9493934392442974211", "9848643714440191835"},
|
||||
{"2172475758127444753", "16681095938683502188", "9983383760611275566", "2603547977557388755"},
|
||||
{"17440301588003279095", "11799356585691460705", "1386003375936412946", "11059100806278290279"},
|
||||
{"10758265002546797581", "1374136260999724547", "7200401521491969338", "219493657547391496"},
|
||||
{"5995963332181008902", "4442996285152250372", "2005936434281221193", "6869325719052666642"},
|
||||
}
|
||||
plonkZsPartialProductsCapStr := [][]string{
|
||||
{"1209867952068639569", "4958824272276746373", "8278739766347565702", "1966940898171663504"},
|
||||
{"12599305286358028697", "8932511136775685440", "5376267558248004641", "6313904687311555884"},
|
||||
{"11190791343943249124", "4016631697385248176", "10356629842603047568", "10968099068686195317"},
|
||||
{"1963983823153667719", "6333891613271539690", "12318891063769180636", "10443318253972130654"},
|
||||
{"7799898099378084347", "2751829638242157622", "8351904444410446701", "5284662773710644867"},
|
||||
{"1588568181448440843", "10836321455257423751", "5543952383542989142", "12946954522116753258"},
|
||||
{"15710202198621978057", "13746115173212319217", "6103259182317700987", "17589471289629134988"},
|
||||
{"12877950969971815168", "4963889190939310439", "8868772654550990048", "11774978531783219015"},
|
||||
{"16832740767463005599", "15040340114131672027", "7469306538360789573", "3154855824233652432"},
|
||||
{"9383568437827143152", "1741060064145647394", "17668587021570420286", "5241789470902809114"},
|
||||
{"2087729156816989530", "8248918881937854542", "8673194597758568216", "10710697836634846115"},
|
||||
{"11253371860840267365", "16818881664594712299", "11933553751682199585", "1936353232880935379"},
|
||||
{"12163553231829171860", "17244267969759347515", "2003902333564157189", "6934019871173840760"},
|
||||
{"2082141893879862527", "18267460725569427782", "1129651898415533808", "14011240934155569890"},
|
||||
{"2526273401266876282", "6955959191669943337", "5926536548217021446", "17949337312612691782"},
|
||||
{"8858882459906353593", "5813258279939597857", "6320047506247573502", "15969724232572328561"},
|
||||
}
|
||||
quotientPolysCapStr := [][]string{
|
||||
{"9435614145733021495", "1742717829476348934", "11178548223985487003", "14531951007568589725"},
|
||||
{"11747844681527676730", "3089691012847802165", "5887135310661642077", "13943570416123664971"},
|
||||
{"11150071448774479229", "4486829025930200476", "9369448886033958276", "15757606153229850783"},
|
||||
{"14603194410536469617", "11776185929725558373", "3122936423686490326", "10128277488128872810"},
|
||||
{"4990578700975083076", "4997575606014863069", "14499603187047727337", "14028694557236527137"},
|
||||
{"2279147899956815983", "16034899207717647338", "14763350037932939672", "10075834812570828076"},
|
||||
{"1102006741007271956", "15242779529961262072", "6900547375301951311", "8631780317175902419"},
|
||||
{"6299112770394539219", "6297397453582105768", "14148031335065995704", "3794733067587629405"},
|
||||
{"7891039548997763820", "4260484126440019022", "6493066317319943586", "14775252570136307979"},
|
||||
{"10790514248728420789", "14444029601980227412", "17514190309172155536", "12973059492411164965"},
|
||||
{"8940755416742726696", "8469566845539112244", "7642612722784522739", "15276772682665052607"},
|
||||
{"18306931819862706026", "14374659904694625207", "8609543532143656606", "17350044275494282679"},
|
||||
{"9062024023737444614", "13780128979028684176", "6115495431779737008", "7170446003855284754"},
|
||||
{"6191400598853400595", "7806485717076924017", "3225145303141729264", "3644550749005104128"},
|
||||
{"15759718266801608721", "2406060174022670585", "15679263832775538866", "18066847192985300443"},
|
||||
{"9184823221361582966", "4767786405185004644", "9827047623720647370", "993615002460432327"},
|
||||
}
|
||||
publicInputs := []field.F{}
|
||||
|
||||
var publicInputs [3]frontend.Variable
|
||||
var circuitDigest [4]frontend.Variable
|
||||
var wiresCap [16][4]frontend.Variable
|
||||
var plonkZsPartialProductsCap [16][4]frontend.Variable
|
||||
var quotientPolysCap [16][4]frontend.Variable
|
||||
circuitDigest := StringToBN128Hash("11532502846882484230992726008257788785937565673229400981185786126842727172973")
|
||||
|
||||
copy(publicInputs[:], utils.StrArrayToFrontendVariableArray(publicInputsStr))
|
||||
copy(circuitDigest[:], utils.StrArrayToFrontendVariableArray(circuitDigestStr))
|
||||
for i := 0; i < len(wiresCapStr); i++ {
|
||||
copy(wiresCap[i][:], utils.StrArrayToFrontendVariableArray(wiresCapStr[i]))
|
||||
}
|
||||
for i := 0; i < len(plonkZsPartialProductsCapStr); i++ {
|
||||
copy(plonkZsPartialProductsCap[i][:], utils.StrArrayToFrontendVariableArray(plonkZsPartialProductsCapStr[i]))
|
||||
}
|
||||
for i := 0; i < len(quotientPolysCapStr); i++ {
|
||||
copy(quotientPolysCap[i][:], utils.StrArrayToFrontendVariableArray(quotientPolysCapStr[i]))
|
||||
}
|
||||
wiresCaps := [16]poseidon.PoseidonBN128HashOut{}
|
||||
wiresCaps[0] = StringToBN128Hash("6232016528318542211523647364792867346449137823066292895075623303633330508214")
|
||||
wiresCaps[1] = StringToBN128Hash("3849229275985461680629770572508259203226163621677714310355251582693130685288")
|
||||
wiresCaps[2] = StringToBN128Hash("5987556171512366759354088598227343740440477791444099795740854232780130336082")
|
||||
wiresCaps[3] = StringToBN128Hash("8523377779888975334090507575349048869294640263235559121841789718805736414837")
|
||||
wiresCaps[4] = StringToBN128Hash("4173305429039088756536564029627250985745421317354666614089039608061166671898")
|
||||
wiresCaps[5] = StringToBN128Hash("19514742808406256372169729907222415291809011606011679387563713660256488346125")
|
||||
wiresCaps[6] = StringToBN128Hash("8519703011007005463193900985655355044586093539828702987016626948657512235078")
|
||||
wiresCaps[7] = StringToBN128Hash("13337062986664638507390757043422262298890182385759661595000247205380836291424")
|
||||
wiresCaps[8] = StringToBN128Hash("13956988298720968721248573872513053256190487207048215310365406791617256823071")
|
||||
wiresCaps[9] = StringToBN128Hash("4139118776078237399422219240136866906229498819930564462151328936368637474741")
|
||||
wiresCaps[10] = StringToBN128Hash("20010683036854145765538326917745039166608941517703057250025522185331298063240")
|
||||
wiresCaps[11] = StringToBN128Hash("16542849340693186579674885260236043503488748690860552251132996633211111581047")
|
||||
wiresCaps[12] = StringToBN128Hash("15340310232736118098606223218073833983285921571850333937460777227732109309104")
|
||||
wiresCaps[13] = StringToBN128Hash("14370557250059545670244193708996703450518439828341533154117610442161777001185")
|
||||
wiresCaps[14] = StringToBN128Hash("18844434454299441334771065219656682212700835025465734281792408139929868142021")
|
||||
wiresCaps[15] = StringToBN128Hash("19676343740377898318702605893881480074303742058989194823248293456630167789460")
|
||||
|
||||
testCase(publicInputs, circuitDigest, wiresCap, plonkZsPartialProductsCap, quotientPolysCap)
|
||||
plonkZsPartialProductsCaps := [16]poseidon.PoseidonBN128HashOut{}
|
||||
plonkZsPartialProductsCaps[0] = StringToBN128Hash("18630303757724954689095079665308152603926320437432442392614316813333911252124")
|
||||
plonkZsPartialProductsCaps[1] = StringToBN128Hash("1941509032097423911575973752610668722198580889286836043016771886256831254944")
|
||||
plonkZsPartialProductsCaps[2] = StringToBN128Hash("6147898094056673441182607282006528423230906496770003193057422314911254596722")
|
||||
plonkZsPartialProductsCaps[3] = StringToBN128Hash("8711744418341460096856191310559061094028644913424948320707020455945693390966")
|
||||
plonkZsPartialProductsCaps[4] = StringToBN128Hash("3170507894509162329082713944669012510679535839018490515228566075949014704871")
|
||||
plonkZsPartialProductsCaps[5] = StringToBN128Hash("9513443633020527244719737008971091746535961947215556968735061932963144145728")
|
||||
plonkZsPartialProductsCaps[6] = StringToBN128Hash("16440622144490342815400399751667969445057099157732990266662948140364680211732")
|
||||
plonkZsPartialProductsCaps[7] = StringToBN128Hash("16904904288584890809819587275120157893767917607795020298373538872373275028362")
|
||||
plonkZsPartialProductsCaps[8] = StringToBN128Hash("1322883689945010694042124537248103086068476085787048131689196755087178475099")
|
||||
plonkZsPartialProductsCaps[9] = StringToBN128Hash("3859729225679954076862546769780866075152550721517632074656261209033111218654")
|
||||
plonkZsPartialProductsCaps[10] = StringToBN128Hash("5995885491698588595978721670502011088690021401297557688057158353938846681398")
|
||||
plonkZsPartialProductsCaps[11] = StringToBN128Hash("16957177478856199232404038751327729781816109007496656232207408246975862260922")
|
||||
plonkZsPartialProductsCaps[12] = StringToBN128Hash("9422393668093911702915740702404346320943009100616501740579421944206639410155")
|
||||
plonkZsPartialProductsCaps[13] = StringToBN128Hash("15680345727093646870610240619814271686346382346107751208797654607051065248818")
|
||||
plonkZsPartialProductsCaps[14] = StringToBN128Hash("4939261448468032698521878059774016528161329965101885352386001950329280576201")
|
||||
plonkZsPartialProductsCaps[15] = StringToBN128Hash("7003946111898359335505647195128523292498498760325513092978040051648331398446")
|
||||
|
||||
quotientPolysCaps := [16]poseidon.PoseidonBN128HashOut{}
|
||||
quotientPolysCaps[0] = StringToBN128Hash("3918560082526903400389798118659365477465402367561322989181693953047280669646")
|
||||
quotientPolysCaps[1] = StringToBN128Hash("496966935842756068593963213547105605432646958081400837931911611833297095727")
|
||||
quotientPolysCaps[2] = StringToBN128Hash("8683297895986438077633020202252074142721819824824948690853505463451806801507")
|
||||
quotientPolysCaps[3] = StringToBN128Hash("14623770060934618886104076268225324888644340537717836901769942847173950269850")
|
||||
quotientPolysCaps[4] = StringToBN128Hash("902377468311802642056170073282349607767917979325737018777782566011948776523")
|
||||
quotientPolysCaps[5] = StringToBN128Hash("12124340721627925810131860890689432371048624670798932303474977401990312142398")
|
||||
quotientPolysCaps[6] = StringToBN128Hash("21656753786114693289615694183370749990935753681953197920766927707640495235100")
|
||||
quotientPolysCaps[7] = StringToBN128Hash("4651674172794111060599611529192263627230814664669763852917839857516619530510")
|
||||
quotientPolysCaps[8] = StringToBN128Hash("13161231355626784301812735677481006076469384200800574341495987998366265598910")
|
||||
quotientPolysCaps[9] = StringToBN128Hash("20853590455948262404101100028402584187982204016660952863575312077951992942329")
|
||||
quotientPolysCaps[10] = StringToBN128Hash("742867642166478273564934628555265381154191517824405375118170559554873960389")
|
||||
quotientPolysCaps[11] = StringToBN128Hash("17617970388755497287414457313283777609067524774358298322461931046141926005038")
|
||||
quotientPolysCaps[12] = StringToBN128Hash("55496208750959228576253470708262329602643441253143570259294790484739321332")
|
||||
quotientPolysCaps[13] = StringToBN128Hash("18450079114184018679423491604333957974306902732410122012117555285853099024676")
|
||||
quotientPolysCaps[14] = StringToBN128Hash("14403337493956171864251492809058241138806636992110526018123749007090024780352")
|
||||
quotientPolysCaps[15] = StringToBN128Hash("252265115458024097842043026135110356285192501597856208375838682286051476335")
|
||||
|
||||
testCase(publicInputs, circuitDigest, wiresCaps, plonkZsPartialProductsCaps, quotientPolysCaps)
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ func (p *PlonkChip) evalVanishingPoly(vars gates.EvaluationVars, proofChallenges
|
||||
return reducedValues
|
||||
}
|
||||
|
||||
func (p *PlonkChip) Verify(proofChallenges common.ProofChallenges, openings common.OpeningSet, publicInputsHash poseidon.Hash) {
|
||||
func (p *PlonkChip) Verify(proofChallenges common.ProofChallenges, openings common.OpeningSet, publicInputsHash poseidon.PoseidonHashOut) {
|
||||
// Calculate zeta^n
|
||||
zetaPowN := p.expPowerOf2Extension(proofChallenges.PlonkZeta)
|
||||
|
||||
|
||||
@@ -38,31 +38,14 @@ func (circuit *TestPlonkCircuit) Define(api frontend.API) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestPlonkFibonacci(t *testing.T) {
|
||||
func TestPlonkDecodeBlock(t *testing.T) {
|
||||
assert := test.NewAssert(t)
|
||||
|
||||
testCase := func() {
|
||||
circuit := TestPlonkCircuit{
|
||||
proofWithPIsFilename: "./data/fibonacci/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "./data/fibonacci/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "./data/fibonacci/verifier_only_circuit_data.json",
|
||||
}
|
||||
witness := TestPlonkCircuit{}
|
||||
err := test.IsSolved(&circuit, &witness, field.TEST_CURVE.ScalarField())
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
testCase()
|
||||
}
|
||||
|
||||
func TestPlonkDummy(t *testing.T) {
|
||||
assert := test.NewAssert(t)
|
||||
|
||||
testCase := func() {
|
||||
circuit := TestPlonkCircuit{
|
||||
proofWithPIsFilename: "./data/dummy_2^14_gates/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "./data/dummy_2^14_gates/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "./data/dummy_2^14_gates/verifier_only_circuit_data.json",
|
||||
proofWithPIsFilename: "../../data/decode_block/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "../../data/decode_block/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "../../data/decode_block/verifier_only_circuit_data.json",
|
||||
}
|
||||
witness := TestPlonkCircuit{}
|
||||
err := test.IsSolved(&circuit, &witness, field.TEST_CURVE.ScalarField())
|
||||
|
||||
@@ -3,8 +3,10 @@ package utils
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"math/big"
|
||||
"os"
|
||||
|
||||
"github.com/consensys/gnark/frontend"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/field"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/poseidon"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/utils"
|
||||
@@ -14,16 +16,10 @@ import (
|
||||
|
||||
type ProofWithPublicInputsRaw struct {
|
||||
Proof struct {
|
||||
WiresCap []struct {
|
||||
Elements []uint64 `json:"elements"`
|
||||
} `json:"wires_cap"`
|
||||
PlonkZsPartialProductsCap []struct {
|
||||
Elements []uint64 `json:"elements"`
|
||||
} `json:"plonk_zs_partial_products_cap"`
|
||||
QuotientPolysCap []struct {
|
||||
Elements []uint64 `json:"elements"`
|
||||
} `json:"quotient_polys_cap"`
|
||||
Openings struct {
|
||||
WiresCap []string `json:"wires_cap"`
|
||||
PlonkZsPartialProductsCap []string `json:"plonk_zs_partial_products_cap"`
|
||||
QuotientPolysCap []string `json:"quotient_polys_cap"`
|
||||
Openings struct {
|
||||
Constants [][]uint64 `json:"constants"`
|
||||
PlonkSigmas [][]uint64 `json:"plonk_sigmas"`
|
||||
Wires [][]uint64 `json:"wires"`
|
||||
@@ -33,14 +29,16 @@ type ProofWithPublicInputsRaw struct {
|
||||
QuotientPolys [][]uint64 `json:"quotient_polys"`
|
||||
} `json:"openings"`
|
||||
OpeningProof struct {
|
||||
CommitPhaseMerkleCaps []MerkleCapsRaw `json:"commit_phase_merkle_caps"`
|
||||
CommitPhaseMerkleCaps [][]string `json:"commit_phase_merkle_caps"`
|
||||
QueryRoundProofs []struct {
|
||||
InitialTreesProof struct {
|
||||
EvalsProofs []EvalProofRaw `json:"evals_proofs"`
|
||||
} `json:"initial_trees_proof"`
|
||||
Steps []struct {
|
||||
Evals [][]uint64 `json:"evals"`
|
||||
MerkleProof MerkleProofRaw `json:"merkle_proof"`
|
||||
Evals [][]uint64 `json:"evals"`
|
||||
MerkleProof struct {
|
||||
Siblings []string `json:"siblings"`
|
||||
} `json:"merkle_proof"`
|
||||
} `json:"steps"`
|
||||
} `json:"query_round_proofs"`
|
||||
FinalPoly struct {
|
||||
@@ -52,39 +50,22 @@ type ProofWithPublicInputsRaw struct {
|
||||
PublicInputs []uint64 `json:"public_inputs"`
|
||||
}
|
||||
|
||||
type MerkleCapsRaw struct {
|
||||
hashes [][]uint64
|
||||
}
|
||||
|
||||
func (m *MerkleCapsRaw) UnmarshalJSON(data []byte) error {
|
||||
var merkleCaps []map[string][]uint64
|
||||
if err := json.Unmarshal(data, &merkleCaps); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
m.hashes = make([][]uint64, len(merkleCaps))
|
||||
for i := 0; i < len(merkleCaps); i++ {
|
||||
m.hashes[i] = merkleCaps[i]["elements"]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type EvalProofRaw struct {
|
||||
leafElements []uint64
|
||||
merkleProof MerkleProofRaw
|
||||
LeafElements []uint64
|
||||
MerkleProof MerkleProofRaw
|
||||
}
|
||||
|
||||
func (e *EvalProofRaw) UnmarshalJSON(data []byte) error {
|
||||
return json.Unmarshal(data, &[]interface{}{&e.leafElements, &e.merkleProof})
|
||||
return json.Unmarshal(data, &[]interface{}{&e.LeafElements, &e.MerkleProof})
|
||||
}
|
||||
|
||||
type MerkleProofRaw struct {
|
||||
hash [][]uint64
|
||||
Hash []string
|
||||
}
|
||||
|
||||
func (m *MerkleProofRaw) UnmarshalJSON(data []byte) error {
|
||||
type SiblingObject struct {
|
||||
Siblings []map[string][]uint64 // "siblings"
|
||||
Siblings []string // "siblings"
|
||||
}
|
||||
|
||||
var siblings SiblingObject
|
||||
@@ -92,10 +73,8 @@ func (m *MerkleProofRaw) UnmarshalJSON(data []byte) error {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
m.hash = make([][]uint64, len(siblings.Siblings))
|
||||
for siblingIdx, sibling := range siblings.Siblings {
|
||||
m.hash[siblingIdx] = sibling["elements"]
|
||||
}
|
||||
m.Hash = make([]string, len(siblings.Siblings))
|
||||
copy(m.Hash[:], siblings.Siblings)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -164,19 +143,16 @@ type ProofChallengesRaw struct {
|
||||
}
|
||||
|
||||
type VerifierOnlyCircuitDataRaw struct {
|
||||
ConstantsSigmasCap []struct {
|
||||
Elements []uint64 `json:"elements"`
|
||||
} `json:"constants_sigmas_cap"`
|
||||
CircuitDigest struct {
|
||||
Elements []uint64 `json:"elements"`
|
||||
} `json:"circuit_digest"`
|
||||
ConstantsSigmasCap []string `json:"constants_sigmas_cap"`
|
||||
CircuitDigest string `json:"circuit_digest"`
|
||||
}
|
||||
|
||||
func DeserializeMerkleCap(merkleCapRaw []struct{ Elements []uint64 }) common.MerkleCap {
|
||||
func DeserializeMerkleCap(merkleCapRaw []string) common.MerkleCap {
|
||||
n := len(merkleCapRaw)
|
||||
merkleCap := make([]poseidon.Hash, n)
|
||||
merkleCap := make([]poseidon.PoseidonBN128HashOut, n)
|
||||
for i := 0; i < n; i++ {
|
||||
copy(merkleCap[i][:], utils.Uint64ArrayToFArray(merkleCapRaw[i].Elements))
|
||||
capBigInt, _ := new(big.Int).SetString(merkleCapRaw[i], 10)
|
||||
merkleCap[i] = frontend.Variable(capBigInt)
|
||||
}
|
||||
return merkleCap
|
||||
}
|
||||
@@ -184,10 +160,10 @@ func DeserializeMerkleCap(merkleCapRaw []struct{ Elements []uint64 }) common.Mer
|
||||
func DeserializeMerkleProof(merkleProofRaw struct{ Siblings []interface{} }) common.MerkleProof {
|
||||
n := len(merkleProofRaw.Siblings)
|
||||
var mp common.MerkleProof
|
||||
mp.Siblings = make([]poseidon.Hash, n)
|
||||
mp.Siblings = make([]poseidon.PoseidonBN128HashOut, n)
|
||||
for i := 0; i < n; i++ {
|
||||
element := merkleProofRaw.Siblings[i].(struct{ Elements []uint64 })
|
||||
copy(mp.Siblings[i][:], utils.Uint64ArrayToFArray(element.Elements))
|
||||
mp.Siblings[i] = utils.Uint64ArrayToFArray(element.Elements)
|
||||
}
|
||||
return mp
|
||||
}
|
||||
@@ -212,15 +188,29 @@ func DeserializeOpeningSet(openingSetRaw struct {
|
||||
}
|
||||
}
|
||||
|
||||
func StringArrayToHashBN128Array(rawHashes []string) []poseidon.PoseidonBN128HashOut {
|
||||
hashes := []poseidon.PoseidonBN128HashOut{}
|
||||
|
||||
for i := 0; i < len(rawHashes); i++ {
|
||||
hashBigInt, _ := new(big.Int).SetString(rawHashes[i], 10)
|
||||
hashVar := frontend.Variable(hashBigInt)
|
||||
hashes = append(hashes, poseidon.PoseidonBN128HashOut(hashVar))
|
||||
}
|
||||
|
||||
return hashes
|
||||
}
|
||||
|
||||
func DeserializeFriProof(openingProofRaw struct {
|
||||
CommitPhaseMerkleCaps []MerkleCapsRaw
|
||||
CommitPhaseMerkleCaps [][]string
|
||||
QueryRoundProofs []struct {
|
||||
InitialTreesProof struct {
|
||||
EvalsProofs []EvalProofRaw
|
||||
}
|
||||
Steps []struct {
|
||||
Evals [][]uint64
|
||||
MerkleProof MerkleProofRaw
|
||||
MerkleProof struct {
|
||||
Siblings []string
|
||||
}
|
||||
}
|
||||
}
|
||||
FinalPoly struct {
|
||||
@@ -234,7 +224,7 @@ func DeserializeFriProof(openingProofRaw struct {
|
||||
|
||||
openingProof.CommitPhaseMerkleCaps = make([]common.MerkleCap, len(openingProofRaw.CommitPhaseMerkleCaps))
|
||||
for i := 0; i < len(openingProofRaw.CommitPhaseMerkleCaps); i++ {
|
||||
openingProof.CommitPhaseMerkleCaps[i] = poseidon.Uint64ArrayToHashArray(openingProofRaw.CommitPhaseMerkleCaps[i].hashes)
|
||||
openingProof.CommitPhaseMerkleCaps[i] = StringArrayToHashBN128Array(openingProofRaw.CommitPhaseMerkleCaps[i])
|
||||
}
|
||||
|
||||
numQueryRoundProofs := len(openingProofRaw.QueryRoundProofs)
|
||||
@@ -244,15 +234,15 @@ func DeserializeFriProof(openingProofRaw struct {
|
||||
numEvalProofs := len(openingProofRaw.QueryRoundProofs[i].InitialTreesProof.EvalsProofs)
|
||||
openingProof.QueryRoundProofs[i].InitialTreesProof.EvalsProofs = make([]common.EvalProof, numEvalProofs)
|
||||
for j := 0; j < numEvalProofs; j++ {
|
||||
openingProof.QueryRoundProofs[i].InitialTreesProof.EvalsProofs[j].Elements = utils.Uint64ArrayToFArray(openingProofRaw.QueryRoundProofs[i].InitialTreesProof.EvalsProofs[j].leafElements)
|
||||
openingProof.QueryRoundProofs[i].InitialTreesProof.EvalsProofs[j].MerkleProof.Siblings = poseidon.Uint64ArrayToHashArray(openingProofRaw.QueryRoundProofs[i].InitialTreesProof.EvalsProofs[j].merkleProof.hash)
|
||||
openingProof.QueryRoundProofs[i].InitialTreesProof.EvalsProofs[j].Elements = utils.Uint64ArrayToFArray(openingProofRaw.QueryRoundProofs[i].InitialTreesProof.EvalsProofs[j].LeafElements)
|
||||
openingProof.QueryRoundProofs[i].InitialTreesProof.EvalsProofs[j].MerkleProof.Siblings = StringArrayToHashBN128Array(openingProofRaw.QueryRoundProofs[i].InitialTreesProof.EvalsProofs[j].MerkleProof.Hash)
|
||||
}
|
||||
|
||||
numSteps := len(openingProofRaw.QueryRoundProofs[i].Steps)
|
||||
openingProof.QueryRoundProofs[i].Steps = make([]common.FriQueryStep, numSteps)
|
||||
for j := 0; j < numSteps; j++ {
|
||||
openingProof.QueryRoundProofs[i].Steps[j].Evals = utils.Uint64ArrayToQuadraticExtensionArray(openingProofRaw.QueryRoundProofs[i].Steps[j].Evals)
|
||||
openingProof.QueryRoundProofs[i].Steps[j].MerkleProof.Siblings = poseidon.Uint64ArrayToHashArray(openingProofRaw.QueryRoundProofs[i].Steps[j].MerkleProof.hash)
|
||||
openingProof.QueryRoundProofs[i].Steps[j].MerkleProof.Siblings = StringArrayToHashBN128Array(openingProofRaw.QueryRoundProofs[i].Steps[j].MerkleProof.Siblings)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,9 +265,9 @@ func DeserializeProofWithPublicInputs(path string) common.ProofWithPublicInputs
|
||||
}
|
||||
|
||||
var proofWithPis common.ProofWithPublicInputs
|
||||
proofWithPis.Proof.WiresCap = DeserializeMerkleCap([]struct{ Elements []uint64 }(raw.Proof.WiresCap))
|
||||
proofWithPis.Proof.PlonkZsPartialProductsCap = DeserializeMerkleCap([]struct{ Elements []uint64 }(raw.Proof.PlonkZsPartialProductsCap))
|
||||
proofWithPis.Proof.QuotientPolysCap = DeserializeMerkleCap([]struct{ Elements []uint64 }(raw.Proof.QuotientPolysCap))
|
||||
proofWithPis.Proof.WiresCap = DeserializeMerkleCap(raw.Proof.WiresCap)
|
||||
proofWithPis.Proof.PlonkZsPartialProductsCap = DeserializeMerkleCap(raw.Proof.PlonkZsPartialProductsCap)
|
||||
proofWithPis.Proof.QuotientPolysCap = DeserializeMerkleCap(raw.Proof.QuotientPolysCap)
|
||||
proofWithPis.Proof.Openings = DeserializeOpeningSet(struct {
|
||||
Constants [][]uint64
|
||||
PlonkSigmas [][]uint64
|
||||
@@ -288,14 +278,16 @@ func DeserializeProofWithPublicInputs(path string) common.ProofWithPublicInputs
|
||||
QuotientPolys [][]uint64
|
||||
}(raw.Proof.Openings))
|
||||
proofWithPis.Proof.OpeningProof = DeserializeFriProof(struct {
|
||||
CommitPhaseMerkleCaps []MerkleCapsRaw
|
||||
CommitPhaseMerkleCaps [][]string
|
||||
QueryRoundProofs []struct {
|
||||
InitialTreesProof struct {
|
||||
EvalsProofs []EvalProofRaw
|
||||
}
|
||||
Steps []struct {
|
||||
Evals [][]uint64
|
||||
MerkleProof MerkleProofRaw
|
||||
MerkleProof struct {
|
||||
Siblings []string
|
||||
}
|
||||
}
|
||||
}
|
||||
FinalPoly struct{ Coeffs [][]uint64 }
|
||||
@@ -436,8 +428,9 @@ func DeserializeVerifierOnlyCircuitData(path string) common.VerifierOnlyCircuitD
|
||||
}
|
||||
|
||||
var verifierOnlyCircuitData common.VerifierOnlyCircuitData
|
||||
verifierOnlyCircuitData.ConstantSigmasCap = DeserializeMerkleCap([]struct{ Elements []uint64 }(raw.ConstantsSigmasCap))
|
||||
copy(verifierOnlyCircuitData.CircuitDigest[:], utils.Uint64ArrayToFArray(raw.CircuitDigest.Elements))
|
||||
|
||||
verifierOnlyCircuitData.ConstantSigmasCap = DeserializeMerkleCap(raw.ConstantsSigmasCap)
|
||||
circuitDigestBigInt, _ := new(big.Int).SetString(raw.CircuitDigest, 10)
|
||||
circuitDigestVar := frontend.Variable(circuitDigestBigInt)
|
||||
verifierOnlyCircuitData.CircuitDigest = poseidon.PoseidonBN128HashOut(circuitDigestVar)
|
||||
return verifierOnlyCircuitData
|
||||
}
|
||||
|
||||
@@ -6,19 +6,19 @@ import (
|
||||
)
|
||||
|
||||
func TestDeserializeProofWithPublicInputs(t *testing.T) {
|
||||
proofWithPis := DeserializeProofWithPublicInputs("./data/fibonacci/proof_with_public_inputs.json")
|
||||
proofWithPis := DeserializeProofWithPublicInputs("../data/decode_block/proof_with_public_inputs.json")
|
||||
fmt.Printf("%+v\n", proofWithPis)
|
||||
panic("look at stdout")
|
||||
}
|
||||
|
||||
func TestDeserializeCommonCircuitData(t *testing.T) {
|
||||
commonCircuitData := DeserializeCommonCircuitData("./data/fibonacci/common_circuit_data.json")
|
||||
commonCircuitData := DeserializeCommonCircuitData("../data/decode_block/common_circuit_data.json")
|
||||
fmt.Printf("%+v\n", commonCircuitData)
|
||||
panic("look at stdout")
|
||||
}
|
||||
|
||||
func TestDeserializeVerifierOnlyCircuitData(t *testing.T) {
|
||||
verifierOnlyCircuitData := DeserializeVerifierOnlyCircuitData("./data/fibonacci/verifier_only_circuit_data.json")
|
||||
verifierOnlyCircuitData := DeserializeVerifierOnlyCircuitData("../data/decode_block/verifier_only_circuit_data.json")
|
||||
fmt.Printf("%+v\n", verifierOnlyCircuitData)
|
||||
panic("look at stdout")
|
||||
}
|
||||
|
||||
@@ -10,51 +10,55 @@ import (
|
||||
)
|
||||
|
||||
type VerifierChip struct {
|
||||
api frontend.API `gnark:"-"`
|
||||
fieldAPI field.FieldAPI `gnark:"-"`
|
||||
qeAPI *field.QuadraticExtensionAPI `gnark:"-"`
|
||||
poseidonChip *poseidon.PoseidonChip
|
||||
plonkChip *plonk.PlonkChip
|
||||
friChip *fri.FriChip
|
||||
api frontend.API `gnark:"-"`
|
||||
fieldAPI field.FieldAPI `gnark:"-"`
|
||||
qeAPI *field.QuadraticExtensionAPI `gnark:"-"`
|
||||
poseidonChip *poseidon.PoseidonChip
|
||||
poseidonBN128Chip *poseidon.PoseidonBN128Chip
|
||||
plonkChip *plonk.PlonkChip
|
||||
friChip *fri.FriChip
|
||||
}
|
||||
|
||||
func NewVerifierChip(api frontend.API, commonCircuitData common.CommonCircuitData) *VerifierChip {
|
||||
|
||||
fieldAPI := field.NewFieldAPI(api)
|
||||
qeAPI := field.NewQuadraticExtensionAPI(api, fieldAPI, commonCircuitData.DegreeBits)
|
||||
hashAPI := poseidon.NewHashAPI(fieldAPI)
|
||||
poseidonChip := poseidon.NewPoseidonChip(api, fieldAPI, qeAPI)
|
||||
poseidonBN128Chip := poseidon.NewPoseidonBN128Chip(api, fieldAPI)
|
||||
|
||||
friChip := fri.NewFriChip(api, fieldAPI, qeAPI, hashAPI, poseidonChip, &commonCircuitData.FriParams)
|
||||
friChip := fri.NewFriChip(api, fieldAPI, qeAPI, poseidonBN128Chip, &commonCircuitData.FriParams)
|
||||
plonkChip := plonk.NewPlonkChip(api, qeAPI, commonCircuitData)
|
||||
|
||||
// We are using goldilocks poseidon for the challenge computation
|
||||
poseidonChip := poseidon.NewPoseidonChip(api, fieldAPI, qeAPI)
|
||||
|
||||
return &VerifierChip{
|
||||
api: api,
|
||||
fieldAPI: fieldAPI,
|
||||
qeAPI: qeAPI,
|
||||
poseidonChip: poseidonChip,
|
||||
plonkChip: plonkChip,
|
||||
friChip: friChip,
|
||||
api: api,
|
||||
fieldAPI: fieldAPI,
|
||||
qeAPI: qeAPI,
|
||||
poseidonChip: poseidonChip,
|
||||
poseidonBN128Chip: poseidonBN128Chip,
|
||||
plonkChip: plonkChip,
|
||||
friChip: friChip,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *VerifierChip) GetPublicInputsHash(publicInputs []field.F) poseidon.Hash {
|
||||
func (c *VerifierChip) GetPublicInputsHash(publicInputs []field.F) poseidon.PoseidonHashOut {
|
||||
return c.poseidonChip.HashNoPad(publicInputs)
|
||||
}
|
||||
|
||||
func (c *VerifierChip) GetChallenges(
|
||||
proofWithPis common.ProofWithPublicInputs,
|
||||
publicInputsHash poseidon.Hash,
|
||||
publicInputsHash poseidon.PoseidonHashOut,
|
||||
commonData common.CommonCircuitData,
|
||||
verifierData common.VerifierOnlyCircuitData,
|
||||
) common.ProofChallenges {
|
||||
config := commonData.Config
|
||||
numChallenges := config.NumChallenges
|
||||
challenger := plonk.NewChallengerChip(c.api, c.fieldAPI, c.poseidonChip)
|
||||
challenger := plonk.NewChallengerChip(c.api, c.fieldAPI, c.poseidonChip, c.poseidonBN128Chip)
|
||||
|
||||
var circuitDigest = verifierData.CircuitDigest
|
||||
|
||||
challenger.ObserveHash(circuitDigest)
|
||||
challenger.ObserveBN128Hash(circuitDigest)
|
||||
challenger.ObserveHash(publicInputsHash)
|
||||
challenger.ObserveCap(proofWithPis.Proof.WiresCap)
|
||||
plonkBetas := challenger.GetNChallenges(numChallenges)
|
||||
|
||||
@@ -6,286 +6,10 @@ import (
|
||||
"github.com/consensys/gnark/frontend"
|
||||
"github.com/consensys/gnark/test"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/field"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/poseidon"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/verifier"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/verifier/common"
|
||||
"github.com/succinctlabs/gnark-plonky2-verifier/verifier/utils"
|
||||
)
|
||||
|
||||
type TestVerifierChallengesCircuit struct {
|
||||
fieldAPI frontend.API `gnark:"-"`
|
||||
qeAPI *field.QuadraticExtensionAPI `gnark:"-"`
|
||||
hashAPI *poseidon.HashAPI `gnark:"-"`
|
||||
|
||||
proofWithPIsFilename string `gnark:"-"`
|
||||
commonCircuitDataFilename string `gnark:"-"`
|
||||
verifierOnlyCircuitDataFilename string `gnark:"-"`
|
||||
|
||||
numChallenges uint64 `gnark:"-"`
|
||||
numFriQueries uint64 `gnark:"-"`
|
||||
|
||||
t *testing.T `gnark:"-"`
|
||||
|
||||
expectedPublicInputsHash poseidon.Hash
|
||||
expectedPlonkBetas []field.F // slice length == num challenges
|
||||
expectedPlonkGammas []field.F // slice length == num challenges
|
||||
expectedPlonkAlphas []field.F // slice length == num challenges
|
||||
expectedPlonkZeta field.QuadraticExtension
|
||||
expectedFriAlpha field.QuadraticExtension
|
||||
expectedFriBetas []field.QuadraticExtension // slice length == num fri rounds
|
||||
expectedFriQueryIndices []field.F // slice length == num fri queries
|
||||
|
||||
verifierChip *verifier.VerifierChip
|
||||
}
|
||||
|
||||
func (c *TestVerifierChallengesCircuit) GetChallengesSanityCheck(
|
||||
proofWithPis common.ProofWithPublicInputs,
|
||||
verifierData common.VerifierOnlyCircuitData,
|
||||
commonData common.CommonCircuitData,
|
||||
) {
|
||||
publicInputsHash := c.verifierChip.GetPublicInputsHash(proofWithPis.PublicInputs)
|
||||
proofChallenges := c.verifierChip.GetChallenges(proofWithPis, publicInputsHash, commonData, verifierData)
|
||||
|
||||
c.hashAPI.AssertIsEqualHash(publicInputsHash, c.expectedPublicInputsHash)
|
||||
|
||||
if len(proofChallenges.PlonkBetas) != int(c.numChallenges) {
|
||||
c.t.Errorf("len(PlonkBetas) should equal numChallenges")
|
||||
}
|
||||
for i := 0; i < int(c.numChallenges); i++ {
|
||||
c.fieldAPI.AssertIsEqual(proofChallenges.PlonkBetas[i], c.expectedPlonkBetas[i])
|
||||
}
|
||||
|
||||
if len(proofChallenges.PlonkGammas) != int(c.numChallenges) {
|
||||
c.t.Errorf("len(PlonkGammas) should equal numChallenges")
|
||||
}
|
||||
for i := 0; i < int(c.numChallenges); i++ {
|
||||
c.fieldAPI.AssertIsEqual(proofChallenges.PlonkGammas[i], c.expectedPlonkGammas[i])
|
||||
}
|
||||
|
||||
if len(proofChallenges.PlonkAlphas) != int(c.numChallenges) {
|
||||
c.t.Errorf("len(PlonkAlphas) should equal numChallenges")
|
||||
}
|
||||
for i := 0; i < int(c.numChallenges); i++ {
|
||||
c.fieldAPI.AssertIsEqual(proofChallenges.PlonkAlphas[i], c.expectedPlonkAlphas[i])
|
||||
}
|
||||
|
||||
c.qeAPI.AssertIsEqual(proofChallenges.PlonkZeta, c.expectedPlonkZeta)
|
||||
|
||||
c.qeAPI.AssertIsEqual(proofChallenges.FriChallenges.FriAlpha, c.expectedFriAlpha)
|
||||
|
||||
if len(proofChallenges.FriChallenges.FriBetas) != len(commonData.FriParams.ReductionArityBits) {
|
||||
c.t.Errorf("len(PlonkAlphas) should equal num fri rounds")
|
||||
}
|
||||
for i := 0; i < len(commonData.FriParams.ReductionArityBits); i++ {
|
||||
c.qeAPI.AssertIsEqual(proofChallenges.FriChallenges.FriBetas[i], c.expectedFriBetas[i])
|
||||
}
|
||||
|
||||
// This test is commented out because pow_witness is randomized between runs of the prover.
|
||||
// expectedPowResponse := field.NewFieldConstFromString("92909863298412")
|
||||
// c.field.AssertIsEqual(proofChallenges.FriChallenges.FriPowResponse, expectedPowResponse)
|
||||
|
||||
if len(proofChallenges.FriChallenges.FriQueryIndices) != int(c.numFriQueries) {
|
||||
c.t.Errorf("len(expectedFriQueryIndices) should equal num fri queries")
|
||||
}
|
||||
|
||||
for i := 0; i < int(c.numFriQueries); i++ {
|
||||
c.fieldAPI.AssertIsEqual(c.expectedFriQueryIndices[i], proofChallenges.FriChallenges.FriQueryIndices[i])
|
||||
}
|
||||
}
|
||||
|
||||
func (c *TestVerifierChallengesCircuit) Define(api frontend.API) error {
|
||||
proofWithPis := utils.DeserializeProofWithPublicInputs(c.proofWithPIsFilename)
|
||||
commonCircuitData := utils.DeserializeCommonCircuitData(c.commonCircuitDataFilename)
|
||||
verfierOnlyCircuitData := utils.DeserializeVerifierOnlyCircuitData(c.verifierOnlyCircuitDataFilename)
|
||||
|
||||
c.numChallenges = commonCircuitData.Config.NumChallenges
|
||||
c.numFriQueries = commonCircuitData.FriParams.Config.NumQueryRounds
|
||||
|
||||
c.verifierChip = verifier.NewVerifierChip(api, commonCircuitData)
|
||||
|
||||
c.GetChallengesSanityCheck(proofWithPis, verfierOnlyCircuitData, commonCircuitData)
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestFibonacciVerifierWitness(t *testing.T) {
|
||||
assert := test.NewAssert(t)
|
||||
|
||||
testCase := func() {
|
||||
circuit := TestVerifierChallengesCircuit{
|
||||
proofWithPIsFilename: "./data/fibonacci/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "./data/fibonacci/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "./data/fibonacci/verifier_only_circuit_data.json",
|
||||
t: t,
|
||||
|
||||
expectedPublicInputsHash: poseidon.Hash{
|
||||
field.NewFieldConstFromString("8416658900775745054"),
|
||||
field.NewFieldConstFromString("12574228347150446423"),
|
||||
field.NewFieldConstFromString("9629056739760131473"),
|
||||
field.NewFieldConstFromString("3119289788404190010"),
|
||||
},
|
||||
|
||||
expectedPlonkBetas: []field.F{
|
||||
field.NewFieldConstFromString("4678728155650926271"),
|
||||
field.NewFieldConstFromString("13611962404289024887"),
|
||||
},
|
||||
|
||||
expectedPlonkGammas: []field.F{
|
||||
field.NewFieldConstFromString("13237663823305715949"),
|
||||
field.NewFieldConstFromString("15389314098328235145"),
|
||||
},
|
||||
|
||||
expectedPlonkAlphas: []field.F{
|
||||
field.NewFieldConstFromString("14505919539124304197"),
|
||||
field.NewFieldConstFromString("1695455639263736117"),
|
||||
},
|
||||
|
||||
expectedPlonkZeta: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("14887793628029982930"),
|
||||
field.NewFieldConstFromString("1136137158284059037"),
|
||||
},
|
||||
|
||||
expectedFriAlpha: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("14641715242626918707"),
|
||||
field.NewFieldConstFromString("10574243340537902930"),
|
||||
},
|
||||
|
||||
expectedFriBetas: []field.QuadraticExtension{},
|
||||
|
||||
expectedFriQueryIndices: []field.F{
|
||||
field.NewFieldConst(6790812084677375942),
|
||||
field.NewFieldConst(12394212020331474798),
|
||||
field.NewFieldConst(16457600747000998582),
|
||||
field.NewFieldConst(1543271328932331916),
|
||||
field.NewFieldConst(12115726870906958644),
|
||||
field.NewFieldConst(6775897107605342797),
|
||||
field.NewFieldConst(15989401564746021030),
|
||||
field.NewFieldConst(10691676456016926845),
|
||||
field.NewFieldConst(1632499470630032007),
|
||||
field.NewFieldConst(1317292355445098328),
|
||||
field.NewFieldConst(18391440812534384252),
|
||||
field.NewFieldConst(17321705613231354333),
|
||||
field.NewFieldConst(6176487551308859603),
|
||||
field.NewFieldConst(7119835651572002873),
|
||||
field.NewFieldConst(3903019169623116693),
|
||||
field.NewFieldConst(4886491111111487546),
|
||||
field.NewFieldConst(4087641893164620518),
|
||||
field.NewFieldConst(13801643080324181364),
|
||||
field.NewFieldConst(16993775312274189321),
|
||||
field.NewFieldConst(9268202926222765679),
|
||||
field.NewFieldConst(10683001302406181735),
|
||||
field.NewFieldConst(13359465725531647963),
|
||||
field.NewFieldConst(4523327590105620849),
|
||||
field.NewFieldConst(4883588003760409588),
|
||||
field.NewFieldConst(187699146998097671),
|
||||
field.NewFieldConst(14489263557623716717),
|
||||
field.NewFieldConst(11748359318238148146),
|
||||
field.NewFieldConst(13636347200053048758),
|
||||
},
|
||||
}
|
||||
witness := TestVerifierChallengesCircuit{}
|
||||
err := test.IsSolved(&circuit, &witness, field.TEST_CURVE.ScalarField())
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
testCase()
|
||||
}
|
||||
|
||||
func TestDummyVerifierWitness(t *testing.T) {
|
||||
assert := test.NewAssert(t)
|
||||
|
||||
testCase := func() {
|
||||
circuit := TestVerifierChallengesCircuit{
|
||||
proofWithPIsFilename: "./data/dummy_2^14_gates/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "./data/dummy_2^14_gates/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "./data/dummy_2^14_gates/verifier_only_circuit_data.json",
|
||||
t: t,
|
||||
|
||||
expectedPublicInputsHash: poseidon.Hash{
|
||||
field.NewFieldConstFromString("0"),
|
||||
field.NewFieldConstFromString("0"),
|
||||
field.NewFieldConstFromString("0"),
|
||||
field.NewFieldConstFromString("0"),
|
||||
},
|
||||
|
||||
expectedPlonkBetas: []field.F{
|
||||
field.NewFieldConstFromString("11216469004148781751"),
|
||||
field.NewFieldConstFromString("6201977337075152249"),
|
||||
},
|
||||
|
||||
expectedPlonkGammas: []field.F{
|
||||
field.NewFieldConstFromString("8369751006669847974"),
|
||||
field.NewFieldConstFromString("3610024170884289835"),
|
||||
},
|
||||
|
||||
expectedPlonkAlphas: []field.F{
|
||||
field.NewFieldConstFromString("970160439138448145"),
|
||||
field.NewFieldConstFromString("2402201283787401921"),
|
||||
},
|
||||
|
||||
expectedPlonkZeta: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("17377750363769967882"),
|
||||
field.NewFieldConstFromString("11921191651424768462"),
|
||||
},
|
||||
|
||||
expectedFriAlpha: field.QuadraticExtension{
|
||||
field.NewFieldConstFromString("16721004555774385479"),
|
||||
field.NewFieldConstFromString("10688151135543754663"),
|
||||
},
|
||||
|
||||
expectedFriBetas: []field.QuadraticExtension{
|
||||
{
|
||||
field.NewFieldConstFromString("3312441922957827805"),
|
||||
field.NewFieldConstFromString("15128092514958289671"),
|
||||
},
|
||||
{
|
||||
field.NewFieldConstFromString("13630530769060141802"),
|
||||
field.NewFieldConstFromString("14559883974933163008"),
|
||||
},
|
||||
{
|
||||
field.NewFieldConstFromString("16146508250083930687"),
|
||||
field.NewFieldConstFromString("5176346568444408396"),
|
||||
},
|
||||
},
|
||||
|
||||
expectedFriQueryIndices: []field.F{
|
||||
field.NewFieldConst(16334967868590615051),
|
||||
field.NewFieldConst(2911473540496037915),
|
||||
field.NewFieldConst(14887216056886344225),
|
||||
field.NewFieldConst(7808811227805914295),
|
||||
field.NewFieldConst(2018594961417375749),
|
||||
field.NewFieldConst(3733368398777208435),
|
||||
field.NewFieldConst(2623035669037055104),
|
||||
field.NewFieldConst(299243030573481514),
|
||||
field.NewFieldConst(7189789717962704433),
|
||||
field.NewFieldConst(14566344026886816268),
|
||||
field.NewFieldConst(12555390069003437453),
|
||||
field.NewFieldConst(17225508403199418233),
|
||||
field.NewFieldConst(5088797913879903292),
|
||||
field.NewFieldConst(9715691392773433023),
|
||||
field.NewFieldConst(7565836764713256165),
|
||||
field.NewFieldConst(1500143546029322929),
|
||||
field.NewFieldConst(1245802417104422080),
|
||||
field.NewFieldConst(6831959786661245110),
|
||||
field.NewFieldConst(17271054758535453780),
|
||||
field.NewFieldConst(6225460404576395409),
|
||||
field.NewFieldConst(15932661092896277351),
|
||||
field.NewFieldConst(12452534049198240575),
|
||||
field.NewFieldConst(4225199666055520177),
|
||||
field.NewFieldConst(13235091290587791090),
|
||||
field.NewFieldConst(2562357622728700774),
|
||||
field.NewFieldConst(17676678042980201498),
|
||||
field.NewFieldConst(5837067135702409874),
|
||||
field.NewFieldConst(11238419549114325157),
|
||||
},
|
||||
}
|
||||
witness := TestVerifierChallengesCircuit{} // No real witness as the test circuit's Define function will inject in the witness
|
||||
err := test.IsSolved(&circuit, &witness, field.TEST_CURVE.ScalarField())
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
testCase()
|
||||
}
|
||||
|
||||
type TestVerifierCircuit struct {
|
||||
proofWithPIsFilename string `gnark:"-"`
|
||||
commonCircuitDataFilename string `gnark:"-"`
|
||||
@@ -302,14 +26,14 @@ func (c *TestVerifierCircuit) Define(api frontend.API) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestDummyVerifier(t *testing.T) {
|
||||
func TestDecodeBlockVerifier(t *testing.T) {
|
||||
assert := test.NewAssert(t)
|
||||
|
||||
testCase := func() {
|
||||
circuit := TestVerifierCircuit{
|
||||
proofWithPIsFilename: "./data/dummy_2^14_gates/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "./data/dummy_2^14_gates/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "./data/dummy_2^14_gates/verifier_only_circuit_data.json",
|
||||
proofWithPIsFilename: "./data/decode_block/proof_with_public_inputs.json",
|
||||
commonCircuitDataFilename: "./data/decode_block/common_circuit_data.json",
|
||||
verifierOnlyCircuitDataFilename: "./data/decode_block/verifier_only_circuit_data.json",
|
||||
}
|
||||
|
||||
witness := TestVerifierCircuit{}
|
||||
|
||||
Reference in New Issue
Block a user