diff --git a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_1.json b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_1.json index c844890a..0a6e7a71 100644 --- a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_1.json +++ b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_1.json @@ -5,7 +5,6 @@ { "input": { "values": [ - "1", "14854361253166356985827940126714566475275412573126716429346293669288261212877767002588736768495892518280555332082", "213732210873464696846782550184555137228225514409080200587629835423679101735680889388490505365220726936653232900722", "87538607630632344401950048588801759619324114043687193925268161368645768079512372989046887060116208844098222887523", @@ -14,6 +13,7 @@ "239017299818740889416561988179003000999440599788233589838386981563280711497257601212385904595560069610856834048609", "210817940648895568697680255986492415724502544301527123629003695092329489846191300997148203752109923795482648905049", "104796720182429147963427519368170838521257629224027565408974396362211239635140389257768036297199752289691646178885", + "1", "237849156256827398282019388933972533154056715710612980343582379691235964002811111531637163291964836316287473866944", "121324456153144638357885760921484124420296650752569739652599982435599667566663818850130137668154167962818124679946", "73600332144130508132510040050892177274732799381796146541825372722030832659283233558443467575385522990242420388929", diff --git a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_1.zok b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_1.zok index b4df2dca..ac406215 100644 --- a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_1.zok +++ b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_1.zok @@ -1,16 +1,35 @@ from "EMBED" import snark_verify_bls12_377 // Verifies a proof with 1 public input (0 inputs + 1 output) -// Circuit used in this test (compiled using `bls12_377` curve): +// Circuit used in this test: // // def main() -> field: // return 1 // -// Arguments: -// inputs - public inputs of the circuit -// proof - flattened proof to an array of field elements -// vk - flattened verification key to an array of field elements +// Save the circuit as "circuit.zok" and run the following commands (in order): +// $ zokrates compile -i ./circuit.zok -c bls12_377 +// $ zokrates compute-witness +// $ zokrates setup -b ark -s gm17 +// $ zokrates generate-proof -b ark -s gm17 +// +// To get flattened inputs needed for this test, use the following script: +// #!/usr/bin/env node +// +// const path = require("path"); +// const fs = require("fs"); +// +// let output = [] +// for (let i = 2; i < process.argv.length; i++) { +// const source = fs.readFileSync(path.resolve(process.argv[i]), 'utf8') +// const flat = [...source.matchAll(/0x[a-z0-9]+/gm)].map(n => BigInt(n).toString(10)); +// output.push(...flat) +// } +// +// console.log(JSON.stringify(output)); +// +// Save this script as "flatten.js" and run the following command: +// $ node flatten.js proof.json verification.key -def main(private field[1] inputs, private field[8] proof, private field[20] vk) -> bool: +def main(private field[8] proof, private field[1] inputs, private field[20] vk) -> bool: bool result = snark_verify_bls12_377(inputs, proof, vk) return result \ No newline at end of file diff --git a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_2.json b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_2.json index 00a7b238..096e63d2 100644 --- a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_2.json +++ b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_2.json @@ -5,8 +5,6 @@ { "input": { "values": [ - "2", - "4", "30886639936493049016175318852868223421962513695924799011862965798142544864756272917016480650319179059444391880142", "210714472424410627451557273311118253425679108293022860127144278352441005505195339659420709617036779682326673533186", "101969549978420613687361685686211943788361418391955806064423246725556175258043096446227634997412743489772585976407", @@ -15,6 +13,8 @@ "156965166665593649649919836247487186182263277589020558979047044043456286367751723077006781061358137877318135673282", "137741518433065408317198878994358008499493756319076293122811213051853618947340414216838530582726247267590705502194", "126547036337175013106414910386451161000910611736141896590177615068467376299665795605927145787930213987505973766731", + "2", + "4", "26150522755032959261786285436959898551137848025504557005325333189168466417284586793885098543725273736029879389211", "169754513648720531797744265077389392707096818238531464510797707592538650668826008029773773893361012602508598834793", "172926009578431040673671475398833553033375949638930965254433842547261096474109828672139964685904707258254717562981", diff --git a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_2.zok b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_2.zok index 1bdb7bdd..47ec38d6 100644 --- a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_2.zok +++ b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_2.zok @@ -1,16 +1,35 @@ from "EMBED" import snark_verify_bls12_377 // Verifies a proof with 2 public inputs (1 input + 1 output) -// Circuit used in this test (compiled using `bls12_377` curve): +// Circuit used in this test: // // def main(field a) -> field: // return a * a // -// Arguments: -// inputs - public inputs of the circuit -// proof - flattened proof to an array of field elements -// vk - flattened verification key to an array of field elements +// Save the circuit as "circuit.zok" and run the following commands (in order): +// $ zokrates compile -i ./circuit.zok -c bls12_377 +// $ zokrates compute-witness -a 2 +// $ zokrates setup -b ark -s gm17 +// $ zokrates generate-proof -b ark -s gm17 +// +// To get flattened inputs needed for this test, use the following script: +// #!/usr/bin/env node +// +// const path = require("path"); +// const fs = require("fs"); +// +// let output = [] +// for (let i = 2; i < process.argv.length; i++) { +// const source = fs.readFileSync(path.resolve(process.argv[i]), 'utf8') +// const flat = [...source.matchAll(/0x[a-z0-9]+/gm)].map(n => BigInt(n).toString(10)); +// output.push(...flat) +// } +// +// console.log(JSON.stringify(output)); +// +// Save this script as "flatten.js" and run the following command: +// $ node flatten.js proof.json verification.key -def main(private field[2] inputs, private field[8] proof, private field[22] vk) -> bool: +def main(private field[8] proof, private field[2] inputs, private field[22] vk) -> bool: bool result = snark_verify_bls12_377(inputs, proof, vk) return result \ No newline at end of file diff --git a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_5.json b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_5.json index 8c05a0ba..bbd9e48c 100644 --- a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_5.json +++ b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_5.json @@ -5,11 +5,6 @@ { "input": { "values": [ - "2", - "2", - "2", - "2", - "8", "60457684924193218954780799695448128402450659922819148866042534731462934804174889585425668379894806827192129355035", "30692976080216123852486339295726836787768525847434467843252380267593056117653493955651719058012291818530914713503", "125357500613234885873309304302314409734224357144836572740733227274842238671614205545693580811504410323545780196986", @@ -18,6 +13,11 @@ "52408210490520029867007596145203947635265945726032430791270964404506413872638222587937059680769423104224418341783", "245391920863498220927838330312555206148254951255756591670548373412908886220063896460749603543488483619267089689381", "78589112605630898410537770266153128219408270888620016803188045523021815277982064356841045190284469829851165791293", + "2", + "2", + "2", + "2", + "8", "177010185638377511324501604520563739739317808509681430951164029757345810095174696221494505373089763385490312116358", "153053794329278051178743982884522858761476481700312111393093980133181276780354993379856934110282786295862092443919", "119352601414532465114802089751399530705471140760948692288569726825270783170792459863146836606243083937386903791326", diff --git a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_5.zok b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_5.zok index 48514273..3e828495 100644 --- a/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_5.zok +++ b/zokrates_core_test/tests/tests/snark/snark_verify_bls12_377_5.zok @@ -1,7 +1,7 @@ from "EMBED" import snark_verify_bls12_377 // Verifies a proof with 5 public inputs (4 inputs + 1 output) -// Circuit used in this test (compiled using `bls12_377` curve): +// Circuit used in this test: // // def main(field[4] a) -> field: // field out = 0 @@ -10,11 +10,30 @@ from "EMBED" import snark_verify_bls12_377 // endfor // return out // -// Arguments: -// inputs - public inputs of the circuit -// proof - flattened proof to an array of field elements -// vk - flattened verification key to an array of field elements +// Save the circuit as "circuit.zok" and run the following commands (in order): +// $ zokrates compile -i ./circuit.zok -c bls12_377 +// $ zokrates compute-witness -a 2 2 2 2 +// $ zokrates setup -b ark -s gm17 +// $ zokrates generate-proof -b ark -s gm17 +// +// To get flattened inputs needed for this test, use the following script: +// #!/usr/bin/env node +// +// const path = require("path"); +// const fs = require("fs"); +// +// let output = [] +// for (let i = 2; i < process.argv.length; i++) { +// const source = fs.readFileSync(path.resolve(process.argv[i]), 'utf8') +// const flat = [...source.matchAll(/0x[a-z0-9]+/gm)].map(n => BigInt(n).toString(10)); +// output.push(...flat) +// } +// +// console.log(JSON.stringify(output)); +// +// Save this script as "flatten.js" and run the following command: +// $ node flatten.js proof.json verification.key -def main(private field[5] inputs, private field[8] proof, private field[28] vk) -> bool: +def main(private field[8] proof, private field[5] inputs, private field[28] vk) -> bool: bool result = snark_verify_bls12_377(inputs, proof, vk) return result \ No newline at end of file