Skip to content

Commit

Permalink
feature verify_zkasm, could define pilverify config.
Browse files Browse the repository at this point in the history
  • Loading branch information
zkronos73 committed Nov 11, 2022
1 parent ae9c845 commit 70e9e54
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/verify_zkasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const smStorage = require("../src/sm/sm_storage/sm_storage.js");
const { index } = require("../src/sm/sm_main/test_tools.js");
const { config } = require("yargs");

module.exports.verifyZkasm = async function (zkasmFile, verifyPilFlag = true, pilConfig = {}, mainConfig = {}) {
module.exports.verifyZkasm = async function (zkasmFile, pilVerification = true, pilConfig = {}, mainConfig = {}) {

const Fr = new F1Field("0xFFFFFFFF00000001");
const brief = false;
Expand All @@ -38,6 +38,8 @@ module.exports.verifyZkasm = async function (zkasmFile, verifyPilFlag = true, pi
namespaces: ['Main','Global'] }
*/

const verifyPilFlag = pilVerification ? true: false;
const verifyPilConfig = pilVerification instanceof Object ? pilVerification:{};
const pil = await compile(Fr, "pil/main.pil", null, pilConfig);
if (pilConfig.defines && pilConfig.defines.N) {
console.log('force use N = 2 ** '+Math.log2(pilConfig.defines.N));
Expand Down Expand Up @@ -190,7 +192,7 @@ module.exports.verifyZkasm = async function (zkasmFile, verifyPilFlag = true, pi
console.log(`WARNING: Namespace Binary isn't included, but there are ${requiredMain.Binary.length} Binary operations`);
}

const res = verifyPilFlag ? await verifyPil(Fr, pil, cmPols , constPols) : [];
const res = verifyPilFlag ? await verifyPil(Fr, pil, cmPols , constPols, verifyPilConfig) : [];

if (res.length != 0) {
console.log("Pil does not pass");
Expand Down

0 comments on commit 70e9e54

Please sign in to comment.