From 8e320e899e67dbab7196b3516764dd1a48af7c0d Mon Sep 17 00:00:00 2001 From: mllwchrry Date: Mon, 16 Sep 2024 13:21:01 +0300 Subject: [PATCH 1/7] added verifyProofWithStruct function to the Solidity verifier template --- src/core/CircuitZKit.ts | 40 ++- src/core/templates/verifier_groth16.sol.ejs | 176 ++++++++- src/types/circuit-zkit.ts | 14 +- test/CircuitZKit.test.ts | 48 ++- .../MultiDimensionalArray.r1cs | Bin 0 -> 928 bytes .../MultiDimensionalArray.sym | 30 ++ .../MultiDimensionalArray.vkey.json | 1 + .../MultiDimensionalArray.zkey | Bin 0 -> 16474 bytes .../MultiDimensionalArray_artifacts.json | 75 ++++ .../MultiDimensionalArray_constraints.json | 10 + .../MultiDimensionalArray.wasm | Bin 0 -> 34872 bytes .../generate_witness.js | 20 ++ .../witness_calculator.js | 337 ++++++++++++++++++ .../Multiplier_artifacts.json | 1 + 14 files changed, 748 insertions(+), 4 deletions(-) create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.r1cs create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.sym create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.vkey.json create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.zkey create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_artifacts.json create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/MultiDimensionalArray.wasm create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/generate_witness.js create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/witness_calculator.js create mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/Multiplier.circom/Multiplier_artifacts.json diff --git a/src/core/CircuitZKit.ts b/src/core/CircuitZKit.ts index 30e0207..07dda9b 100644 --- a/src/core/CircuitZKit.ts +++ b/src/core/CircuitZKit.ts @@ -12,6 +12,8 @@ import { ProofStruct, VerifierProvingSystem, VerifierLanguageType, + PublicSignalInfo, + ArtifactSignal, } from "../types/circuit-zkit"; /** @@ -51,6 +53,7 @@ export class CircuitZKit { const templateParams = JSON.parse(fs.readFileSync(vKeyFilePath, "utf-8")); templateParams["verifier_id"] = this.getVerifierName(); + templateParams["signals"] = this.getPublicSignalsInfo(); const verifierCode = ejs.render(verifierTemplate, templateParams); @@ -192,9 +195,12 @@ export class CircuitZKit { case "sym": fileName = `${circuitName}.sym`; break; - case "json": + case "constraints": fileName = `${circuitName}_constraints.json`; break; + case "artifacts": + fileName = `${circuitName}_artifacts.json`; + break; case "wasm": fileName = `${circuitName}.wasm`; fileDir = path.join(fileDir, `${circuitName}_js`); @@ -205,4 +211,36 @@ export class CircuitZKit { return path.join(fileDir, fileName); } + + public getPublicSignalsInfo(): Array { + const artifactsFilePath: string = this.mustGetArtifactsFilePath("artifacts"); + const artifacts = JSON.parse(fs.readFileSync(artifactsFilePath, "utf-8")); + + const signals = artifacts.baseCircuitInfo?.signals; + + if (signals) { + const publicInputs = signals + .filter((signal: ArtifactSignal) => signal.type === "Input" && signal.visibility === "Public") + .map((signal: ArtifactSignal) => ({ + name: signal.name, + dimension: [...signal.dimension].reverse(), + })); + + const outputSignals = signals.filter((signal: ArtifactSignal) => signal.type === "Output"); + + const calculateDimensionSize = (dimensions: string[]): number => { + return dimensions.length === 0 ? 1 : dimensions.reduce((acc, dim) => acc * parseInt(dim, 10), 1); + }; + + const totalOutputSize = outputSignals + .map((signal: ArtifactSignal) => calculateDimensionSize(signal.dimension)) + .reduce((total: number, size: number) => total + size, 0); + + const output: PublicSignalInfo = { name: "output", dimension: [totalOutputSize.toString()] }; + + return [output, ...publicInputs]; + } + + return []; + } } diff --git a/src/core/templates/verifier_groth16.sol.ejs b/src/core/templates/verifier_groth16.sol.ejs index 1598130..ccf4b1c 100644 --- a/src/core/templates/verifier_groth16.sol.ejs +++ b/src/core/templates/verifier_groth16.sol.ejs @@ -48,7 +48,25 @@ contract <%=verifier_id%> { /// @dev memory pointer sizes uint16 public constant P_PUBLIC_SIGNALS_ACCUMULATOR_SIZE = 128; uint16 public constant P_TOTAL_SIZE = 896; + <%function generateType(dimension) { + if (dimension.length === 0) { + return 'uint256'; + } else { + return 'uint256' + dimension.map(d => `[${d}]`).join(''); + } + } + if (signals.length > 0) { + const structFields = signals + .map(signal => { + return `${generateType(signal.dimension)} ${signal.name};` + }) + .join('\n '); + %> + struct PubSignals { + <%= structFields %> + } + <% } %> function verifyProof( uint256[2] memory pointA_, uint256[2][2] memory pointB_, @@ -153,5 +171,161 @@ contract <%=verifier_id%> { verified_ := checkPairing(pointA_, pointB_, pointC_, publicSignals_, pointer_) } } - } + } <%if (signals.length > 0) {%> + + function verifyProofWithStruct( + uint256[2] memory pointA_, + uint256[2][2] memory pointB_, + uint256[2] memory pointC_, + PubSignals memory publicSignals_ + ) public view returns (bool verified_) { + assembly { + <% + const globalIndent = ' '.repeat(4); + + function generateLoops(dimensions, pointerVars, depth = 0, indexVars = []) { + let code = ''; + let indent = ' '.repeat(depth + 1) + ' '.repeat(3); + + let dimVar = `dim${depth}`; + let pointerVar = `arrayPntrLvl${depth}_`; + indexVars.push(dimVar); + + code += `${indent}for { let ${dimVar} := 0 } lt(${dimVar}, ${dimensions[depth]}) { ${dimVar} := add(${dimVar}, 1) } {\n`; + + if (depth === dimensions.length - 1) { + code += `${indent} mstore(add(pointer_, currentOffset), mload(add(${pointerVars[pointerVars.length - 1]}, mul(${dimVar}, 32))))\n`; + code += `${indent} currentOffset := add(currentOffset, 32)\n`; + } else { + pointerVars.push(pointerVar); + + code += `${indent} let ${pointerVar} := mload(add(${pointerVars[depth]}, mul(${dimVar}, 32)))\n\n`; + code += generateLoops(dimensions, pointerVars, depth + 1, indexVars); + } + code += `${indent}}\n`; + + return code; + } + + let linearizeCode = 'let currentOffset := 0\n'; + + for (let i = 0; i < signals.length; i++) { + linearizeCode += `\n${globalIndent}// ${signals[i].name}\n`; + + if (signals[i].dimension.length) { + linearizeCode += `${globalIndent}let ${signals[i].name}Ptr_ := mload(add(pubSignals_, ${i * 32}))\n`; + + linearizeCode += generateLoops(signals[i].dimension.reverse(), [`${signals[i].name}Ptr_`]); + } else { + linearizeCode += `${globalIndent}mstore(add(pointer_, currentOffset), mload(add(pubSignals_, ${i * 32})))\n`; + linearizeCode += `${globalIndent}currentOffset := add(currentOffset, 32)\n`; + } + } + + %>function linearizePubSignals(pubSignals_, pointer_) { + <%= linearizeCode %> } + + function checkField(signal_) -> res_ { + res_ := lt(signal_, BASE_FIELD_SIZE) + } + + function g1MulAdd(pR_, x_, y_, s_) -> res_ { + let pointer_ := mload(64) // free pointer + + mstore(pointer_, x_) + mstore(add(pointer_, 32), y_) + mstore(add(pointer_, 64), s_) + + res_ := staticcall(sub(gas(), 2000), 7, pointer_, 96, pointer_, 64) // ecMul + res_ := and(res_, gt(returndatasize(), 0)) // check that multiplication succeeded + + if iszero(res_) { + leave + } + + mstore(add(pointer_, 64), mload(pR_)) + mstore(add(pointer_, 96), mload(add(pR_, 32))) + + res_ := staticcall(sub(gas(), 2000), 6, pointer_, 128, pR_, 64) // ecAdd + res_ := and(res_, gt(returndatasize(), 0)) // check that addition succeeded + } + + function checkPairing(pA_, pB_, pC_, pubSignals_, pointer_) -> res_ { + let pPairing_ := add(pointer_, P_PUBLIC_SIGNALS_ACCUMULATOR_SIZE) + + mstore(pointer_, IC0_X) + mstore(add(pointer_, 32), IC0_Y) + + /// @dev compute the linear combination of public signals + <% for (let i = 1; i <= nPublic; i++) { %>if iszero(g1MulAdd(pointer_, IC<%=i%>_X, IC<%=i%>_Y, mload(add(pubSignals_, <%=(i-1)*32%>)))) { + leave + } + <% } -%> + + /// @dev -A + mstore(pPairing_, mload(pA_)) + mstore( + add(pPairing_, 32), + mod(sub(BASE_FIELD_SIZE, mload(add(pA_, 32))), BASE_FIELD_SIZE) + ) + + /// @dev B + mstore(add(pPairing_, 64), mload(mload(pB_))) + mstore(add(pPairing_, 96), mload(add(mload(pB_), 32))) + mstore(add(pPairing_, 128), mload(mload(add(pB_, 32)))) + mstore(add(pPairing_, 160), mload(add(mload(add(pB_, 32)), 32))) + + /// @dev alpha1 + mstore(add(pPairing_, 192), ALPHA_X) + mstore(add(pPairing_, 224), ALPHA_Y) + + /// @dev beta2 + mstore(add(pPairing_, 256), BETA_X1) + mstore(add(pPairing_, 288), BETA_X2) + mstore(add(pPairing_, 320), BETA_Y1) + mstore(add(pPairing_, 352), BETA_Y2) + + /// @dev public signals + mstore(add(pPairing_, 384), mload(pointer_)) + mstore(add(pPairing_, 416), mload(add(pointer_, 32))) + + /// @dev gamma2 + mstore(add(pPairing_, 448), GAMMA_X1) + mstore(add(pPairing_, 480), GAMMA_X2) + mstore(add(pPairing_, 512), GAMMA_Y1) + mstore(add(pPairing_, 544), GAMMA_Y2) + + /// @dev C + mstore(add(pPairing_, 576), mload(pC_)) + mstore(add(pPairing_, 608), mload(add(pC_, 32))) + + /// @dev delta2 + mstore(add(pPairing_, 640), DELTA_X1) + mstore(add(pPairing_, 672), DELTA_X2) + mstore(add(pPairing_, 704), DELTA_Y1) + mstore(add(pPairing_, 736), DELTA_Y2) + + res_ := staticcall(sub(gas(), 2000), 8, pPairing_, 768, pPairing_, 32) // ecPairing + res_ := and(res_, mload(pPairing_)) // check that pairing succeeded + } + + let pointer_ := mload(64) // free pointer + mstore(64, add(pointer_, P_TOTAL_SIZE)) + + let pubSignalsArray_ := mload(64) // free pointer + mstore(64, add(pubSignalsArray_, <%=32 * (IC.length - 1)%>)) + + linearizePubSignals(publicSignals_, pubSignalsArray_) + + /// @dev check that all public signals are in F + verified_ := 1 + <% for (let i = 0; i < IC.length; i++) { %>verified_ := and(verified_, checkField(mload(add(publicSignals_, <%=i*32%>)))) + <% } -%> + + /// @dev check pairings + if not(iszero(verified_)) { + verified_ := checkPairing(pointA_, pointB_, pointC_, pubSignalsArray_, pointer_) + } + } + } <% } %> } diff --git a/src/types/circuit-zkit.ts b/src/types/circuit-zkit.ts index b48399d..0b4e349 100644 --- a/src/types/circuit-zkit.ts +++ b/src/types/circuit-zkit.ts @@ -17,6 +17,18 @@ export type Calldata = [ PublicSignals, ]; +export type ArtifactSignal = { + name: string; + dimension: string[]; + type: string; + visibility: string; +}; + +export type PublicSignalInfo = { + name: string; + dimension: string[]; +}; + export type ProofStruct = { proof: Groth16Proof; publicSignals: PublicSignals; @@ -27,7 +39,7 @@ export type ArrayLike = NumberLike[] | ArrayLike[]; export type Signal = NumberLike | ArrayLike; export type Signals = Record; -export type ArtifactsFileType = "r1cs" | "zkey" | "vkey" | "sym" | "json" | "wasm"; +export type ArtifactsFileType = "r1cs" | "zkey" | "vkey" | "sym" | "constraints" | "artifacts" | "wasm"; export type VerifierProvingSystem = "groth16"; export type VerifierLanguageType = "sol" | "vy"; diff --git a/test/CircuitZKit.test.ts b/test/CircuitZKit.test.ts index 07bc0a5..e10988a 100644 --- a/test/CircuitZKit.test.ts +++ b/test/CircuitZKit.test.ts @@ -107,6 +107,7 @@ describe("CircuitZKit", () => { const template = CircuitZKit.getTemplate("groth16", "sol"); const templateParams = JSON.parse(fs.readFileSync(expectedVKeyFilePath, "utf-8")); templateParams["verifier_id"] = multiplierCircuit.getVerifierName(); + templateParams["signals"] = multiplierCircuit.getPublicSignalsInfo(); expect(fs.readFileSync(expectedVerifierFilePath, "utf-8")).to.be.eq(ejs.render(template, templateParams)); }); @@ -176,6 +177,47 @@ describe("CircuitZKit", () => { expect(await verifier.verifyProof(...data)).to.be.true; }); + it("should correctly create Solidity verifier and verify proof with public signals struct", async function () { + const circuitName = "MultiDimensionalArray"; + const verifierDirPath = getVerifiersDirFullPath(); + const artifactsDirFullPath = getArtifactsFullPath(`${circuitName}.circom`); + + const mdArrayCircuit: CircuitZKit = new CircuitZKit({ + circuitName, + circuitArtifactsPath: artifactsDirFullPath, + verifierDirPath, + }); + + const expectedVerifierFilePath = path.join(verifierDirPath, `${mdArrayCircuit.getVerifierName()}.sol`); + + await mdArrayCircuit.createVerifier("sol"); + expect(fs.existsSync(expectedVerifierFilePath)).to.be.true; + + await this.hre.run("compile", { quiet: true }); + + const a = [30, 40, 22, 14]; + const b = 2; + const c = [ + [2, 17, 4348, 14, 12, 11, 9, 333, 77], + [12, 10, 4, 3, 2, 99999, 82, 2, 2], + ]; + + const proof: any = await mdArrayCircuit.generateProof({ a, b, c }); + + expect(await mdArrayCircuit.verifyProof(proof)).to.be.true; + + const data = await mdArrayCircuit.generateCalldata(proof); + + const MdArrayVerifierFactory = await this.hre.ethers.getContractFactory("MultiDimensionalArrayVerifier"); + const verifier = await MdArrayVerifierFactory.deploy(); + + const output = data[3].slice(0, 5); + + const calldata = [data[0], data[1], data[2], { output, a, b, c }]; + + expect(await verifier.verifyProofWithStruct(...calldata)).to.be.true; + }); + it("should correctly create Vyper verifier and verify proof", async function () { const circuitName = "Multiplier"; const verifierDirPath = getVerifiersDirFullPath(); @@ -235,6 +277,7 @@ describe("CircuitZKit", () => { const template = CircuitZKit.getTemplate("groth16", "sol"); const templateParams = JSON.parse(fs.readFileSync(expectedVKeyFilePath, "utf-8")); templateParams["verifier_id"] = multiplierCircuit.getVerifierName(); + templateParams["signals"] = multiplierCircuit.getPublicSignalsInfo(); expect(fs.readFileSync(expectedVerifierFilePath, "utf-8")).to.be.eq(ejs.render(template, templateParams)); }); @@ -403,9 +446,12 @@ describe("CircuitZKit", () => { expect(multiplierCircuit.getArtifactsFilePath("sym")).to.be.eq( path.join(artifactsDirFullPath, `${circuitName}.sym`), ); - expect(multiplierCircuit.getArtifactsFilePath("json")).to.be.eq( + expect(multiplierCircuit.getArtifactsFilePath("constraints")).to.be.eq( path.join(artifactsDirFullPath, `${circuitName}_constraints.json`), ); + expect(multiplierCircuit.getArtifactsFilePath("artifacts")).to.be.eq( + path.join(artifactsDirFullPath, `${circuitName}_artifacts.json`), + ); expect(multiplierCircuit.getArtifactsFilePath("wasm")).to.be.eq( path.join(artifactsDirFullPath, `${circuitName}_js`, `${circuitName}.wasm`), ); diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.r1cs b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.r1cs new file mode 100644 index 0000000000000000000000000000000000000000..789ec80828265a41f451bfdf867811d01ef05eac GIT binary patch literal 928 zcmXRiOfF_*U|?VdVkRJV01-d{qPV~;h7Xg!K6IW~u(Q(Rg|S9#L}TMN*MJ?G3k)9? z`K1`h0@Z-@;{((*3)vo!xlp_Dx={k54p}=^Hq`sz@W847DhO4F*It-@n3-%a0UR_a z4uF6pGkG9-aFQ$#8IsHdg%>`+3X#NXCMaGUpoS;_X&@i3dO4sPkh$VO31$2dcE1&?~1Kvs!sCo;Mw<7)Qvw#&% zA`mm|WF2oC_{~r!FtABdrG++!b<#X`+b zW7&(4c&Covmu+tiJ$PH>MFu8o|Sp*fxhO{19FKZ90;+H_kYd<0v zpq~3BosN*@kU7CLJAU>Nk_|1`uP$5c#a#*!=dMshaOSVWv|RBRN5#PoabqaP+-KoW z&J+(EcY|mH1xuUixuubAm>e>9rQV1XI3;dhW}ZZvTJMMT$)k038LtLL%OUo9>8MEB z0aJ~^vCiP1WjS$=R@U(Xze!WIJo2lgREzRxlG-LRdwX|OmnJ*GpMBxYyLyP zmyPURd&M1vlf9GkUNgx2IdM0q0CBRo$pDfbBP8~e`@#BaNhjG;RNfskT&o4gbz-zV z6`mKkV{R#vYGiaI2d1V6xy+3yi(Du|I_(#XDpvwD9Y_vMgFmVz2GoCqZ7JwwXMhtP z{cZS_BExV%Oc6duUs!%^S4DwghVYF_;08TW?P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jdVb*l9aCTw-XyR;RW8!V?ZsK6~iCMzN#nsuy)Xmkx lT*1VY+04e-?9)d^dmB?`Z#x@TW)o*u8%q;2SC_X>{uh^f#?$}+ literal 0 HcmV?d00001 diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_artifacts.json b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_artifacts.json new file mode 100644 index 0000000..db5e373 --- /dev/null +++ b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_artifacts.json @@ -0,0 +1,75 @@ +{ + "_format": "hh-zkit-artifacts-1", + "circuitTemplateName": "MultiDimensionalArray", + "circuitFileName": "MultiDimensionalArray", + "circuitSourceName": "circuits/MultiDimensionalArray.circom", + "baseCircuitInfo": { + "constraintsNumber": 6, + "signals": [ + { + "name": "a", + "dimension": [ + "4" + ], + "type": "Input", + "visibility": "Public" + }, + { + "name": "b", + "dimension": [], + "type": "Input", + "visibility": "Public" + }, + { + "name": "c", + "dimension": [ + "2", + "9" + ], + "type": "Input", + "visibility": "Public" + }, + { + "name": "out1", + "dimension": [], + "type": "Output", + "visibility": "Public" + }, + { + "name": "out2", + "dimension": [ + "2", + "2" + ], + "type": "Output", + "visibility": "Public" + } + ] + }, + "compilerOutputFiles": { + "wasm": { + "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray_js/MultiDimensionalArray.wasm", + "fileHash": "0d51cea05b97bb9f769f974062f91ec7" + }, + "r1cs": { + "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray.r1cs", + "fileHash": "768b49733ca9da3f2f757c1d293ab371" + }, + "sym": { + "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray.sym", + "fileHash": "3a0a46e8b7aa5dd94320c2ccb943fc8d" + }, + "json": { + "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json", + "fileHash": "587bce7649a55a66e07c1df47e20e51a" + }, + "zkey": { + "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray.zkey", + "fileHash": "d0efd1d58820df55f4e5eed93c77ce36" + }, + "vkey": { + "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray.vkey.json", + "fileHash": "bb24f1b998a2f35ad87c6c642609785f" + } + } +} diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json new file mode 100644 index 0000000..2e052d5 --- /dev/null +++ b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json @@ -0,0 +1,10 @@ +{ +"constraints": [ +[{"10":"21888242871839275222246405745257275088548364400416034343698204186575808495616","29":"1"},{"10":"21888242871839275222246405745257275088548364400416034343698204186575808495616","29":"1"},{}], +[{},{},{"1":"21888242871839275222246405745257275088548364400416034343698204186575808495616","24":"1"}], +[{},{},{"0":"3","2":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}], +[{},{},{"0":"6","3":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}], +[{},{},{"0":"12","4":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}], +[{},{},{"0":"24","5":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}] +] +} \ No newline at end of file diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/MultiDimensionalArray.wasm b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/MultiDimensionalArray.wasm new file mode 100644 index 0000000000000000000000000000000000000000..e5727d86b2947609c51f8e14807d54ff9522ff7b GIT binary patch literal 34872 zcmeHwdyrgLdFOrg^Y-IT&qF;=-EK=*k}YXwG?M(*+>s^ASdwMQma&a3je1&AkNPpw z-I8V~TN)79kg%zwfIuZ|EP^TXhaHv;MLEFk4&<>=Az5!~E9+uOkSn|70W1y+yX2|; zedj*<-oE$rjD$<6P#UT4J?DJqeCPXq-*?VEukI^MH!7ka2;#}^GUw~1W^wB5$&V2zUG!1W6D>(I{>qDI$uZBuG*y zB+JNP{t2N_EEW%iL_2|%3<+Hc{H3&1GM&nFsR$>N$%K|nrIe632Sy=Tgvh@rY2gZ! zLK5Pqip`_NdIS0jN7INLC{=59JLPdoIW*lYoVHWm)rSSHjk7}Rj13s@eFvo5{{JKQxv9EBp#kVf2a=Q2q!ee z_Lhp}nS*C5`-|0W<3b^Yq{mCmDonyk6ca5rU@$`}T6EzgWwwmB8wL?dv4|)bf+|+x z-}_y0c9Wosy0B3ecFI;Lx>JstY1&R%Geg;(a#kG?bYY6+W4EXo)682|-3IbTIeSQ% zq`PL_qt;zGlnxm}T5Vk@##o9}bs)XZDWX{s$hlFDS`mm3H6977<~bLi zN0mv`9AdIE#z&DLnhDSr%w0Lm1Xm8TMpq6q!Ii@l<7irCf28D%ul-3^?f(s};DRn} zmmnA}&*o%Z(&hUQMVdls%CovWrGL<&C`5r?xU^AV^6gTBD2X;of+#=>mo^IgW4qKt zl%6(94^gs2$+l6lL>VH=P#a~4iTbkoVacP_bEZ~PSMis=Odi{|5PbvyKkP8GSua!9Bs znvb!H+;rx$Q6`s9>_k4%CYB?1L?;>C5<8?AlOd1<84`IlSlL9dvRXdH(i!r4FNh;qQNxnJK9nF!=cLkdx8*GlDd=C%vh)((jVjg4q29i|15tDo)rujzf z>S)BFe0Q)B&FLBh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nApTvXHBooSKSK zEuL?N#ClkopN~lM^(ZCOV{+sCTwGjGLk+xUzL|*9jdCVg!a|R1*I4gu1+neM#9b2- z#3sa+luAG%(ks z%6OMFKb`?j-N3#_s%-0(=C}0$vo)|mR;o<&OY;*0z;6(?7?LX6ho$-LBfxSkY@$n* z9XV-!M;^G|0^6*UDm&Lp^E><3nnH7J#H56k+9a$%!g)xzFrI>BX-K9)vMxxKfmHB- z2}n2r2`3=o_BD_u3u*cx%>X1Bgd{_dWEfJ6K#Bnix)E=+ZXBy~bYEz|VV=QDPjEBvH@rYQu|C&qeVW!yIl9kNuvcv-| zQN`-MRs`rh=!w0PV$3e+dk#P3q3!q34tQt>J+y~Cv_rOq4?p6-df1cWh$r@_lj|{@ zFE3zVAj+j$<4O4T+*3ez4i5WnMF>|t^N#r`g9d6t0hS+$@28sg=3;1H%fEIV}f$J(l{Y1r^}5Kk~~*y z$WpbTNR_z|(ZdQZm56cq|J8XFslVe@VaU+ERB6fs;dwN}mih}4^M7=zYA zWlo8kcN&|A!lhcNda@Q)%IBu*kuZkiP&um5WH+WDI2xzxm`d02M5ItVTWuEW$ylRV z!=oOQloK3Jt2D&0vS?BCaAo4!rJ19Ga;-LJ)|_#rm@0I4wenaDdMpr?7o=`MJqAUN zl`yQ?HZDf(h?KBHb)?H_JBA1)C>d9Rl@>~Q)55LzjtS(6v})Qh5$*D320dm~g3LQ6 z>iERHweFZuBgdM@&ecjY2?~%L$uI)Ar{d "); +} else { + const input = JSON.parse(readFileSync(process.argv[3], "utf8")); + + const buffer = readFileSync(process.argv[2]); + wc(buffer).then(async witnessCalculator => { + // const w= await witnessCalculator.calculateWitness(input,0); + // for (let i=0; i< w.length; i++){ + // console.log(w[i]); + // } + const buff= await witnessCalculator.calculateWTNSBin(input,0); + writeFile(process.argv[4], buff, function(err) { + if (err) throw err; + }); + }); +} diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/witness_calculator.js b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/witness_calculator.js new file mode 100644 index 0000000..20e6e20 --- /dev/null +++ b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/witness_calculator.js @@ -0,0 +1,337 @@ +module.exports = async function builder(code, options) { + + options = options || {}; + + let wasmModule; + try { + wasmModule = await WebAssembly.compile(code); + } catch (err) { + console.log(err); + console.log("\nTry to run circom --c in order to generate c++ code instead\n"); + throw new Error(err); + } + + let wc; + + let errStr = ""; + let msgStr = ""; + + const instance = await WebAssembly.instantiate(wasmModule, { + runtime: { + exceptionHandler : function(code) { + let err; + if (code == 1) { + err = "Signal not found.\n"; + } else if (code == 2) { + err = "Too many signals set.\n"; + } else if (code == 3) { + err = "Signal already set.\n"; + } else if (code == 4) { + err = "Assert Failed.\n"; + } else if (code == 5) { + err = "Not enough memory.\n"; + } else if (code == 6) { + err = "Input signal array access exceeds the size.\n"; + } else { + err = "Unknown error.\n"; + } + throw new Error(err + errStr); + }, + printErrorMessage : function() { + errStr += getMessage() + "\n"; + // console.error(getMessage()); + }, + writeBufferMessage : function() { + const msg = getMessage(); + // Any calls to `log()` will always end with a `\n`, so that's when we print and reset + if (msg === "\n") { + console.log(msgStr); + msgStr = ""; + } else { + // If we've buffered other content, put a space in between the items + if (msgStr !== "") { + msgStr += " " + } + // Then append the message to the message we are creating + msgStr += msg; + } + }, + showSharedRWMemory : function() { + printSharedRWMemory (); + } + + } + }); + + const sanityCheck = + options +// options && +// ( +// options.sanityCheck || +// options.logGetSignal || +// options.logSetSignal || +// options.logStartComponent || +// options.logFinishComponent +// ); + + + wc = new WitnessCalculator(instance, sanityCheck); + return wc; + + function getMessage() { + var message = ""; + var c = instance.exports.getMessageChar(); + while ( c != 0 ) { + message += String.fromCharCode(c); + c = instance.exports.getMessageChar(); + } + return message; + } + + function printSharedRWMemory () { + const shared_rw_memory_size = instance.exports.getFieldNumLen32(); + const arr = new Uint32Array(shared_rw_memory_size); + for (let j=0; j { + const h = fnvHash(k); + const hMSB = parseInt(h.slice(0,8), 16); + const hLSB = parseInt(h.slice(8,16), 16); + const fArr = flatArray(input[k]); + let signalSize = this.instance.exports.getInputSignalSize(hMSB, hLSB); + if (signalSize < 0){ + throw new Error(`Signal ${k} not found\n`); + } + if (fArr.length < signalSize) { + throw new Error(`Not enough values for input signal ${k}\n`); + } + if (fArr.length > signalSize) { + throw new Error(`Too many values for input signal ${k}\n`); + } + for (let i=0; i0) { + res.unshift(0); + i--; + } + } + return res; +} + +function fromArray32(arr) { //returns a BigInt + var res = BigInt(0); + const radix = BigInt(0x100000000); + for (let i = 0; i Date: Tue, 17 Sep 2024 11:54:05 +0300 Subject: [PATCH 2/7] refactoring --- package-lock.json | 794 ++++++++++++++++++ package.json | 1 + src/core/CircuitZKit.ts | 37 +- src/core/templates/verifier_groth16.sol.ejs | 168 +--- src/types/circuit-zkit.ts | 10 + test/CircuitZKit.test.ts | 8 +- .../MultiDimensionalArray_artifacts.json | 26 - .../Multiplier_artifacts.json | 11 +- 8 files changed, 870 insertions(+), 185 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5807c44..e8686da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "chai-as-promised": "^7.1.1", "ethers": "6.11.1", "hardhat": "2.22.7", + "hardhat-gas-reporter": "^2.2.1", "husky": "^9.0.11", "mocha": "^10.3.0", "nyc": "^15.1.0", @@ -359,6 +360,16 @@ "node": ">=6.9.0" } }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.1.90" + } + }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -750,6 +761,27 @@ "@ethersproject/signing-key": "^5.7.0" } }, + "node_modules/@ethersproject/units": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", + "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, "node_modules/@ethersproject/web": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", @@ -796,6 +828,102 @@ "ffjavascript": "^0.2.48" } }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1345,6 +1473,16 @@ "hardhat": "^2.22.62.8.3" } }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@scure/base": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", @@ -1549,6 +1687,12 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/@solidity-parser/parser": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.18.0.tgz", + "integrity": "sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==", + "dev": true + }, "node_modules/@tsconfig/node10": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", @@ -1648,6 +1792,27 @@ "integrity": "sha512-x37Jsv1vx6I6RMJdfvYEmDUOLYgzYMecwlk13gniDOcN20xLVe9hy9DlQxWeCPirqpDY/jwugQSqCi2RxehU3g==", "dev": true }, + "node_modules/abitype": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz", + "integrity": "sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "typescript": ">=5.0.4", + "zod": "^3 >=3.22.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, "node_modules/acorn": { "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", @@ -1823,6 +1988,23 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, + "node_modules/axios": { + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/b4a": { "version": "1.6.6", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", @@ -2026,6 +2208,12 @@ "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", "dev": true }, + "node_modules/brotli-wasm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brotli-wasm/-/brotli-wasm-2.0.1.tgz", + "integrity": "sha512-+3USgYsC7bzb5yU0/p2HnnynZl0ak0E6uoIm4UW4Aby/8s8HFCq6NCfrrf1E9c3O8OCSzq3oYO1tUVqIi61Nww==", + "dev": true + }, "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -2210,6 +2398,15 @@ "node": ">=4" } }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/check-error": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", @@ -2309,6 +2506,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cli-table3": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz", + "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -2335,6 +2547,18 @@ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/command-exists": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", @@ -2423,6 +2647,15 @@ "node": ">= 8" } }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/debug": { "version": "4.3.5", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", @@ -2481,6 +2714,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -2499,6 +2741,12 @@ "node": ">=0.3.1" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -2934,6 +3182,20 @@ "node": ">=8.0.0" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fp-ts": { "version": "1.19.3", "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz", @@ -3144,6 +3406,237 @@ } } }, + "node_modules/hardhat-gas-reporter": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-2.2.1.tgz", + "integrity": "sha512-3AfPDGBn6VPmRKU65W28qVvG5x+qYL2gH9PAivd31oGj/ZHpZTutqXh6wq46993Vz35rnPDnrGo028U4/NP/Vw==", + "dev": true, + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/units": "^5.7.0", + "@solidity-parser/parser": "^0.18.0", + "axios": "^1.6.7", + "brotli-wasm": "^2.0.1", + "chalk": "4.1.2", + "cli-table3": "^0.6.3", + "ethereum-cryptography": "^2.1.3", + "glob": "^10.3.10", + "jsonschema": "^1.4.1", + "lodash": "^4.17.21", + "markdown-table": "2.0.0", + "sha1": "^1.1.1", + "viem": "2.7.14" + }, + "peerDependencies": { + "hardhat": "^2.16.0" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/hardhat-gas-reporter/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/foreground-child": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/hardhat/node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", @@ -3498,6 +3991,21 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/isows": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz", + "integrity": "sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wagmi-dev" + } + ], + "peerDependencies": { + "ws": "*" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -3652,6 +4160,21 @@ "node": ">=8" } }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/jake": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.1.tgz", @@ -3799,6 +4322,15 @@ "underscore": "1.12.1" } }, + "node_modules/jsonschema": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz", + "integrity": "sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/keccak": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.4.tgz", @@ -3963,6 +4495,12 @@ "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==", "dev": true }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -3984,6 +4522,19 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, + "node_modules/markdown-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", + "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", + "dev": true, + "dependencies": { + "repeat-string": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -4004,6 +4555,27 @@ "node": ">= 0.10.0" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -4027,6 +4599,15 @@ "node": "*" } }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/mnemonist": { "version": "0.38.5", "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.5.tgz", @@ -4613,6 +5194,12 @@ "node": ">=8" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "dev": true + }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -4646,6 +5233,22 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -4806,6 +5409,12 @@ "node": ">=8" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "node_modules/r1csfile": { "version": "0.0.47", "resolved": "https://registry.npmjs.org/r1csfile/-/r1csfile-0.0.47.tgz", @@ -4889,6 +5498,15 @@ "node": ">=4" } }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -5045,6 +5663,19 @@ "sha.js": "bin.js" } }, + "node_modules/sha1": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz", + "integrity": "sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA==", + "dev": true, + "dependencies": { + "charenc": ">= 0.0.1", + "crypt": ">= 0.0.1" + }, + "engines": { + "node": "*" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -5245,6 +5876,21 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -5257,6 +5903,19 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -5586,6 +6245,90 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "node_modules/viem": { + "version": "2.7.14", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.7.14.tgz", + "integrity": "sha512-5b1KB1gXli02GOQHZIUsRluNUwssl2t4hqdFAzyWPwJ744N83jAOBOjOkrGz7K3qMIv9b0GQt3DoZIErSQTPkQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.0", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@scure/bip32": "1.3.2", + "@scure/bip39": "1.2.1", + "abitype": "1.0.0", + "isows": "1.0.3", + "ws": "8.13.0" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/viem/node_modules/@adraffy/ens-normalize": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==", + "dev": true + }, + "node_modules/viem/node_modules/@scure/bip32": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", + "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", + "dev": true, + "dependencies": { + "@noble/curves": "~1.2.0", + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/@scure/bip39": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", + "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "dev": true, + "dependencies": { + "@noble/hashes": "~1.3.0", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/wasmbuilder": { "version": "0.0.16", "resolved": "https://registry.npmjs.org/wasmbuilder/-/wasmbuilder-0.0.16.tgz", @@ -5668,6 +6411,57 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", diff --git a/package.json b/package.json index 9e3fc7b..74bfca7 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "devDependencies": { "@nomicfoundation/hardhat-ethers": "3.0.5", "@nomiclabs/hardhat-vyper": "^3.0.7", + "hardhat-gas-reporter": "^2.2.1", "@types/chai": "^4.3.12", "@types/chai-as-promised": "^7.1.8", "@types/ejs": "^3.1.5", diff --git a/src/core/CircuitZKit.ts b/src/core/CircuitZKit.ts index 07dda9b..44a6318 100644 --- a/src/core/CircuitZKit.ts +++ b/src/core/CircuitZKit.ts @@ -14,6 +14,7 @@ import { VerifierLanguageType, PublicSignalInfo, ArtifactSignal, + CircuitArtifacts, } from "../types/circuit-zkit"; /** @@ -214,31 +215,23 @@ export class CircuitZKit { public getPublicSignalsInfo(): Array { const artifactsFilePath: string = this.mustGetArtifactsFilePath("artifacts"); - const artifacts = JSON.parse(fs.readFileSync(artifactsFilePath, "utf-8")); + const artifacts: CircuitArtifacts = JSON.parse(fs.readFileSync(artifactsFilePath, "utf-8")); - const signals = artifacts.baseCircuitInfo?.signals; + const signals: ArtifactSignal[] = artifacts.baseCircuitInfo.signals; if (signals) { - const publicInputs = signals - .filter((signal: ArtifactSignal) => signal.type === "Input" && signal.visibility === "Public") - .map((signal: ArtifactSignal) => ({ - name: signal.name, - dimension: [...signal.dimension].reverse(), - })); - - const outputSignals = signals.filter((signal: ArtifactSignal) => signal.type === "Output"); - - const calculateDimensionSize = (dimensions: string[]): number => { - return dimensions.length === 0 ? 1 : dimensions.reduce((acc, dim) => acc * parseInt(dim, 10), 1); - }; - - const totalOutputSize = outputSignals - .map((signal: ArtifactSignal) => calculateDimensionSize(signal.dimension)) - .reduce((total: number, size: number) => total + size, 0); - - const output: PublicSignalInfo = { name: "output", dimension: [totalOutputSize.toString()] }; - - return [output, ...publicInputs]; + const getSignals = (signalType: string) => + signals + .filter((signal) => signal.type === signalType && signal.visibility === "Public") + .map((signal) => ({ + name: signal.name, + dimension: [...signal.dimension].reverse(), + })); + + const outputSignals = getSignals("Output"); + const publicInputs = getSignals("Input"); + + return [...outputSignals, ...publicInputs]; } return []; diff --git a/src/core/templates/verifier_groth16.sol.ejs b/src/core/templates/verifier_groth16.sol.ejs index ccf4b1c..3654162 100644 --- a/src/core/templates/verifier_groth16.sol.ejs +++ b/src/core/templates/verifier_groth16.sol.ejs @@ -179,153 +179,53 @@ contract <%=verifier_id%> { uint256[2] memory pointC_, PubSignals memory publicSignals_ ) public view returns (bool verified_) { - assembly { - <% - const globalIndent = ' '.repeat(4); - - function generateLoops(dimensions, pointerVars, depth = 0, indexVars = []) { - let code = ''; - let indent = ' '.repeat(depth + 1) + ' '.repeat(3); - - let dimVar = `dim${depth}`; - let pointerVar = `arrayPntrLvl${depth}_`; - indexVars.push(dimVar); - - code += `${indent}for { let ${dimVar} := 0 } lt(${dimVar}, ${dimensions[depth]}) { ${dimVar} := add(${dimVar}, 1) } {\n`; - - if (depth === dimensions.length - 1) { - code += `${indent} mstore(add(pointer_, currentOffset), mload(add(${pointerVars[pointerVars.length - 1]}, mul(${dimVar}, 32))))\n`; - code += `${indent} currentOffset := add(currentOffset, 32)\n`; - } else { - pointerVars.push(pointerVar); - - code += `${indent} let ${pointerVar} := mload(add(${pointerVars[depth]}, mul(${dimVar}, 32)))\n\n`; - code += generateLoops(dimensions, pointerVars, depth + 1, indexVars); - } - code += `${indent}}\n`; - - return code; - } - - let linearizeCode = 'let currentOffset := 0\n'; - - for (let i = 0; i < signals.length; i++) { - linearizeCode += `\n${globalIndent}// ${signals[i].name}\n`; - - if (signals[i].dimension.length) { - linearizeCode += `${globalIndent}let ${signals[i].name}Ptr_ := mload(add(pubSignals_, ${i * 32}))\n`; - - linearizeCode += generateLoops(signals[i].dimension.reverse(), [`${signals[i].name}Ptr_`]); - } else { - linearizeCode += `${globalIndent}mstore(add(pointer_, currentOffset), mload(add(pubSignals_, ${i * 32})))\n`; - linearizeCode += `${globalIndent}currentOffset := add(currentOffset, 32)\n`; - } - } - - %>function linearizePubSignals(pubSignals_, pointer_) { - <%= linearizeCode %> } - - function checkField(signal_) -> res_ { - res_ := lt(signal_, BASE_FIELD_SIZE) - } - - function g1MulAdd(pR_, x_, y_, s_) -> res_ { - let pointer_ := mload(64) // free pointer - - mstore(pointer_, x_) - mstore(add(pointer_, 32), y_) - mstore(add(pointer_, 64), s_) - - res_ := staticcall(sub(gas(), 2000), 7, pointer_, 96, pointer_, 64) // ecMul - res_ := and(res_, gt(returndatasize(), 0)) // check that multiplication succeeded - - if iszero(res_) { - leave - } - - mstore(add(pointer_, 64), mload(pR_)) - mstore(add(pointer_, 96), mload(add(pR_, 32))) - - res_ := staticcall(sub(gas(), 2000), 6, pointer_, 128, pR_, 64) // ecAdd - res_ := and(res_, gt(returndatasize(), 0)) // check that addition succeeded - } - - function checkPairing(pA_, pB_, pC_, pubSignals_, pointer_) -> res_ { - let pPairing_ := add(pointer_, P_PUBLIC_SIGNALS_ACCUMULATOR_SIZE) - - mstore(pointer_, IC0_X) - mstore(add(pointer_, 32), IC0_Y) - - /// @dev compute the linear combination of public signals - <% for (let i = 1; i <= nPublic; i++) { %>if iszero(g1MulAdd(pointer_, IC<%=i%>_X, IC<%=i%>_Y, mload(add(pubSignals_, <%=(i-1)*32%>)))) { - leave - } - <% } -%> + return verifyProof(pointA_, pointB_, pointC_, _linearizePubSignals(publicSignals_)); + } - /// @dev -A - mstore(pPairing_, mload(pA_)) - mstore( - add(pPairing_, 32), - mod(sub(BASE_FIELD_SIZE, mload(add(pA_, 32))), BASE_FIELD_SIZE) - ) + function _linearizePubSignals(PubSignals memory publicSignals_) private pure returns (uint256[28] memory linearizedArray_) { + assembly { + <% + const globalIndent = ' '.repeat(3); - /// @dev B - mstore(add(pPairing_, 64), mload(mload(pB_))) - mstore(add(pPairing_, 96), mload(add(mload(pB_), 32))) - mstore(add(pPairing_, 128), mload(mload(add(pB_, 32)))) - mstore(add(pPairing_, 160), mload(add(mload(add(pB_, 32)), 32))) + function generateLoops(dimensions, pointerVars, depth = 0, indexVars = []) { + let code = ''; + let indent = ' '.repeat(depth + 1) + ' '.repeat(2); - /// @dev alpha1 - mstore(add(pPairing_, 192), ALPHA_X) - mstore(add(pPairing_, 224), ALPHA_Y) + let dimVar = `dim${depth}`; + let pointerVar = `arrayPntrLvl${depth}_`; + indexVars.push(dimVar); - /// @dev beta2 - mstore(add(pPairing_, 256), BETA_X1) - mstore(add(pPairing_, 288), BETA_X2) - mstore(add(pPairing_, 320), BETA_Y1) - mstore(add(pPairing_, 352), BETA_Y2) + code += `${indent}for { let ${dimVar} := 0 } lt(${dimVar}, ${dimensions[depth]}) { ${dimVar} := add(${dimVar}, 1) } {\n`; - /// @dev public signals - mstore(add(pPairing_, 384), mload(pointer_)) - mstore(add(pPairing_, 416), mload(add(pointer_, 32))) + if (depth === dimensions.length - 1) { + code += `${indent} mstore(add(linearizedArray_, currentOffset), mload(add(${pointerVars[pointerVars.length - 1]}, mul(${dimVar}, 32))))\n`; + code += `${indent} currentOffset := add(currentOffset, 32)\n`; + } else { + pointerVars.push(pointerVar); - /// @dev gamma2 - mstore(add(pPairing_, 448), GAMMA_X1) - mstore(add(pPairing_, 480), GAMMA_X2) - mstore(add(pPairing_, 512), GAMMA_Y1) - mstore(add(pPairing_, 544), GAMMA_Y2) - - /// @dev C - mstore(add(pPairing_, 576), mload(pC_)) - mstore(add(pPairing_, 608), mload(add(pC_, 32))) - - /// @dev delta2 - mstore(add(pPairing_, 640), DELTA_X1) - mstore(add(pPairing_, 672), DELTA_X2) - mstore(add(pPairing_, 704), DELTA_Y1) - mstore(add(pPairing_, 736), DELTA_Y2) - - res_ := staticcall(sub(gas(), 2000), 8, pPairing_, 768, pPairing_, 32) // ecPairing - res_ := and(res_, mload(pPairing_)) // check that pairing succeeded + code += `${indent} let ${pointerVar} := mload(add(${pointerVars[depth]}, mul(${dimVar}, 32)))\n\n`; + code += generateLoops(dimensions, pointerVars, depth + 1, indexVars); } + code += `${indent}}\n`; - let pointer_ := mload(64) // free pointer - mstore(64, add(pointer_, P_TOTAL_SIZE)) + return code; + } - let pubSignalsArray_ := mload(64) // free pointer - mstore(64, add(pubSignalsArray_, <%=32 * (IC.length - 1)%>)) + let linearizeCode = ' let currentOffset := 0\n'; - linearizePubSignals(publicSignals_, pubSignalsArray_) + for (let i = 0; i < signals.length; i++) { + linearizeCode += `\n${globalIndent}// ${signals[i].name}\n`; - /// @dev check that all public signals are in F - verified_ := 1 - <% for (let i = 0; i < IC.length; i++) { %>verified_ := and(verified_, checkField(mload(add(publicSignals_, <%=i*32%>)))) - <% } -%> + if (signals[i].dimension.length) { + linearizeCode += `${globalIndent}let ${signals[i].name}Ptr_ := mload(add(publicSignals_, ${i * 32}))\n`; - /// @dev check pairings - if not(iszero(verified_)) { - verified_ := checkPairing(pointA_, pointB_, pointC_, pubSignalsArray_, pointer_) + linearizeCode += generateLoops(signals[i].dimension.reverse(), [`${signals[i].name}Ptr_`]); + } else { + linearizeCode += `${globalIndent}mstore(add(linearizedArray_, currentOffset), mload(add(publicSignals_, ${i * 32})))\n`; + linearizeCode += `${globalIndent}currentOffset := add(currentOffset, 32)\n`; } } + + %><%= linearizeCode %> } } <% } %> } diff --git a/src/types/circuit-zkit.ts b/src/types/circuit-zkit.ts index 0b4e349..4f97f19 100644 --- a/src/types/circuit-zkit.ts +++ b/src/types/circuit-zkit.ts @@ -17,6 +17,16 @@ export type Calldata = [ PublicSignals, ]; +export type CircuitArtifacts = { + circuitTemplateName: string; + circuitFileName: string; + circuitSourceName: string; + baseCircuitInfo: { + constraintsNumber: number; + signals: ArtifactSignal[]; + }; +}; + export type ArtifactSignal = { name: string; dimension: string[]; diff --git a/test/CircuitZKit.test.ts b/test/CircuitZKit.test.ts index e10988a..6124d78 100644 --- a/test/CircuitZKit.test.ts +++ b/test/CircuitZKit.test.ts @@ -211,9 +211,13 @@ describe("CircuitZKit", () => { const MdArrayVerifierFactory = await this.hre.ethers.getContractFactory("MultiDimensionalArrayVerifier"); const verifier = await MdArrayVerifierFactory.deploy(); - const output = data[3].slice(0, 5); + const out1 = 2; + const out2 = [ + [3, 6], + [12, 24], + ]; - const calldata = [data[0], data[1], data[2], { output, a, b, c }]; + const calldata = [data[0], data[1], data[2], { out1, out2, a, b, c }]; expect(await verifier.verifyProofWithStruct(...calldata)).to.be.true; }); diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_artifacts.json b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_artifacts.json index db5e373..2613861 100644 --- a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_artifacts.json +++ b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_artifacts.json @@ -45,31 +45,5 @@ "visibility": "Public" } ] - }, - "compilerOutputFiles": { - "wasm": { - "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray_js/MultiDimensionalArray.wasm", - "fileHash": "0d51cea05b97bb9f769f974062f91ec7" - }, - "r1cs": { - "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray.r1cs", - "fileHash": "768b49733ca9da3f2f757c1d293ab371" - }, - "sym": { - "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray.sym", - "fileHash": "3a0a46e8b7aa5dd94320c2ccb943fc8d" - }, - "json": { - "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json", - "fileHash": "587bce7649a55a66e07c1df47e20e51a" - }, - "zkey": { - "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray.zkey", - "fileHash": "d0efd1d58820df55f4e5eed93c77ce36" - }, - "vkey": { - "fileSourcePath": "/Users/mariiazhvanko/DistributedLab/circom-lib/zkit/artifacts/circuits/MultiDimensionalArray.circom/MultiDimensionalArray.vkey.json", - "fileHash": "bb24f1b998a2f35ad87c6c642609785f" - } } } diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/Multiplier.circom/Multiplier_artifacts.json b/test/fixture-projects/simple-circuits/zkit/artifacts/Multiplier.circom/Multiplier_artifacts.json index 0967ef4..a71e66d 100644 --- a/test/fixture-projects/simple-circuits/zkit/artifacts/Multiplier.circom/Multiplier_artifacts.json +++ b/test/fixture-projects/simple-circuits/zkit/artifacts/Multiplier.circom/Multiplier_artifacts.json @@ -1 +1,10 @@ -{} +{ + "_format": "hh-zkit-artifacts-1", + "circuitTemplateName": "Multiplier", + "circuitFileName": "Multiplier", + "circuitSourceName": "circuits/Multiplier.circom", + "baseCircuitInfo": { + "constraintsNumber": 1, + "signals": [] + } +} From 8680dbbe17d69297391c3e9c381dc47e4ae78550 Mon Sep 17 00:00:00 2001 From: mllwchrry Date: Wed, 18 Sep 2024 12:48:47 +0300 Subject: [PATCH 3/7] modified solidity template, fixed arrays inside vyper template --- src/core/templates/verifier_groth16.sol.ejs | 89 ++++++++++++--------- src/core/templates/verifier_groth16.vy.ejs | 2 +- 2 files changed, 52 insertions(+), 39 deletions(-) diff --git a/src/core/templates/verifier_groth16.sol.ejs b/src/core/templates/verifier_groth16.sol.ejs index 3654162..2caf27d 100644 --- a/src/core/templates/verifier_groth16.sol.ejs +++ b/src/core/templates/verifier_groth16.sol.ejs @@ -182,50 +182,63 @@ contract <%=verifier_id%> { return verifyProof(pointA_, pointB_, pointC_, _linearizePubSignals(publicSignals_)); } - function _linearizePubSignals(PubSignals memory publicSignals_) private pure returns (uint256[28] memory linearizedArray_) { - assembly { - <% - const globalIndent = ' '.repeat(3); - - function generateLoops(dimensions, pointerVars, depth = 0, indexVars = []) { - let code = ''; - let indent = ' '.repeat(depth + 1) + ' '.repeat(2); - - let dimVar = `dim${depth}`; - let pointerVar = `arrayPntrLvl${depth}_`; - indexVars.push(dimVar); - - code += `${indent}for { let ${dimVar} := 0 } lt(${dimVar}, ${dimensions[depth]}) { ${dimVar} := add(${dimVar}, 1) } {\n`; - - if (depth === dimensions.length - 1) { - code += `${indent} mstore(add(linearizedArray_, currentOffset), mload(add(${pointerVars[pointerVars.length - 1]}, mul(${dimVar}, 32))))\n`; - code += `${indent} currentOffset := add(currentOffset, 32)\n`; + <% + const generateLinearizationFunction = (name, dimension, offsetVar) => { + if (dimension.length === 0) { + return `currentOffset := _linearizeUint(linearizedArray_, currentOffset, add(publicSignals_, ${offsetVar}))`; + } else if (dimension.length === 1) { + return `currentOffset := _linearize1DArray(linearizedArray_, currentOffset, mload(add(publicSignals_, ${offsetVar})), ${dimension[0]})`; } else { - pointerVars.push(pointerVar); - - code += `${indent} let ${pointerVar} := mload(add(${pointerVars[depth]}, mul(${dimVar}, 32)))\n\n`; - code += generateLoops(dimensions, pointerVars, depth + 1, indexVars); + return `currentOffset := _linearize${dimension.length}DArray(linearizedArray_, currentOffset, mload(add(publicSignals_, ${offsetVar})), ${dimension.reverse().join(', ')})`; } - code += `${indent}}\n`; - - return code; - } + }; - let linearizeCode = ' let currentOffset := 0\n'; + const generateHelperFunctions = (maxDimension) => { + let helperFunctions = ''; + const indent = ' '; - for (let i = 0; i < signals.length; i++) { - linearizeCode += `\n${globalIndent}// ${signals[i].name}\n`; + if (maxDimension >= 1) { + helperFunctions += ` + \n${indent}function _linearize1DArray(resultArray_, currentOffset_, ptr_, arrayLength_) -> offset_ { + for { let i := 0 } lt(i, arrayLength_) { i := add(i, 1) } { + currentOffset_ := _linearizeUint(resultArray_, currentOffset_, add(ptr_, mul(i, 32))) + } - if (signals[i].dimension.length) { - linearizeCode += `${globalIndent}let ${signals[i].name}Ptr_ := mload(add(publicSignals_, ${i * 32}))\n`; + offset_ := currentOffset_ + }`; + } - linearizeCode += generateLoops(signals[i].dimension.reverse(), [`${signals[i].name}Ptr_`]); - } else { - linearizeCode += `${globalIndent}mstore(add(linearizedArray_, currentOffset), mload(add(publicSignals_, ${i * 32})))\n`; - linearizeCode += `${globalIndent}currentOffset := add(currentOffset, 32)\n`; + for (let d = 2; d <= maxDimension; d++) { + let func = ` + \n${indent}function _linearize${d}DArray(resultArray_, currentOffset_, ptr_, ${Array.from({ length: d }, (_, i) => `dim${i}Length`).join(', ')}) -> offset_ { + for { let i := 0 } lt(i, dim0Length) { i := add(i, 1) } { + let outerArrayPtr_ := mload(add(ptr_, mul(i, 32))) + currentOffset_ := _linearize${d - 1}DArray(resultArray_, currentOffset_, outerArrayPtr_, ${Array.from({ length: d - 1 }, (_, i) => `dim${i + 1}Length`).join(', ')}) + } + + offset_ := currentOffset_ + }`; + helperFunctions += func; } - } - %><%= linearizeCode %> } - } <% } %> + return helperFunctions; + }; + + const maxDimension = Math.max(...signals.map(signal => signal.dimension.length), 0); + %>function _linearizePubSignals(PubSignals memory publicSignals_) private pure returns (uint256[<%= IC.length - 1 %>] memory linearizedArray_) { + assembly { + let currentOffset := 0 + + function _linearizeUint(resultArray_, currentOffset_, valuePtr_) -> offset_ { + mstore(add(resultArray_, currentOffset_), mload(valuePtr_)) + offset_ := add(currentOffset_, 32) + }<%- generateHelperFunctions(maxDimension) %><% + signals.forEach((signal, index) => { + const linearizationCode = generateLinearizationFunction(signal.name, signal.dimension, index * 32); + %> + + // <%= signal.name %> + <%= linearizationCode %><%}); %> + } + }<% } %> } diff --git a/src/core/templates/verifier_groth16.vy.ejs b/src/core/templates/verifier_groth16.vy.ejs index d19af08..77afde0 100644 --- a/src/core/templates/verifier_groth16.vy.ejs +++ b/src/core/templates/verifier_groth16.vy.ejs @@ -22,7 +22,7 @@ DELTA_Y1: constant(uint256) = <%=vk_delta_2[1][1]%> DELTA_Y2: constant(uint256) = <%=vk_delta_2[1][0] -%> -IC: constant(uint256[<%=IC.length%>][2]) = [ +IC: constant(uint256[2][<%=IC.length%>]) = [ <% IC.forEach(function(innerArray, index) { %> [ <%= innerArray[0] %>, <%= innerArray[1] %> From 77d183a20c2c1b7391ba2b3e2d49b17a752a5e8c Mon Sep 17 00:00:00 2001 From: mllwchrry Date: Wed, 18 Sep 2024 17:14:06 +0300 Subject: [PATCH 4/7] solidity template refactoring --- src/core/CircuitZKit.ts | 31 ++++++----- src/core/templates/verifier_groth16.sol.ejs | 55 ++++++++++--------- .../Multiplier_artifacts.json | 9 ++- 3 files changed, 55 insertions(+), 40 deletions(-) diff --git a/src/core/CircuitZKit.ts b/src/core/CircuitZKit.ts index 44a6318..8f5daff 100644 --- a/src/core/CircuitZKit.ts +++ b/src/core/CircuitZKit.ts @@ -213,27 +213,30 @@ export class CircuitZKit { return path.join(fileDir, fileName); } + /** + * Returns the public signals information from the circuit artifacts. + * + * @dev Dimensions are reversed to align with the declaration order of multidimensional arrays in Solidity and Vyper. + * + * @returns {Array} An array of objects containing the public signal names and their reversed dimensions. + */ public getPublicSignalsInfo(): Array { const artifactsFilePath: string = this.mustGetArtifactsFilePath("artifacts"); const artifacts: CircuitArtifacts = JSON.parse(fs.readFileSync(artifactsFilePath, "utf-8")); const signals: ArtifactSignal[] = artifacts.baseCircuitInfo.signals; - if (signals) { - const getSignals = (signalType: string) => - signals - .filter((signal) => signal.type === signalType && signal.visibility === "Public") - .map((signal) => ({ - name: signal.name, - dimension: [...signal.dimension].reverse(), - })); - - const outputSignals = getSignals("Output"); - const publicInputs = getSignals("Input"); + const getSignals = (signalType: string) => + signals + .filter((signal) => signal.type === signalType && signal.visibility === "Public") + .map((signal) => ({ + name: signal.name, + dimension: [...signal.dimension].reverse(), + })); - return [...outputSignals, ...publicInputs]; - } + const outputSignals = getSignals("Output"); + const publicInputs = getSignals("Input"); - return []; + return [...outputSignals, ...publicInputs]; } } diff --git a/src/core/templates/verifier_groth16.sol.ejs b/src/core/templates/verifier_groth16.sol.ejs index 2caf27d..8f0950c 100644 --- a/src/core/templates/verifier_groth16.sol.ejs +++ b/src/core/templates/verifier_groth16.sol.ejs @@ -50,23 +50,23 @@ contract <%=verifier_id%> { uint16 public constant P_TOTAL_SIZE = 896; <%function generateType(dimension) { if (dimension.length === 0) { - return 'uint256'; + return "uint256"; } else { - return 'uint256' + dimension.map(d => `[${d}]`).join(''); + return "uint256" + dimension.map(d => `[${d}]`).join(""); } } - if (signals.length > 0) { - const structFields = signals - .map(signal => { - return `${generateType(signal.dimension)} ${signal.name};` - }) - .join('\n '); - %> + const structFields = signals + .map(signal => { + return `${generateType(signal.dimension)} ${signal.name};` + }) + .join("\n\t\t"); + -%> + struct PubSignals { <%= structFields %> } - <% } %> + function verifyProof( uint256[2] memory pointA_, uint256[2][2] memory pointB_, @@ -163,15 +163,16 @@ contract <%=verifier_id%> { /// @dev check that all public signals are in F verified_ := 1 - <% for (let i = 0; i < nPublic; i++) { %>verified_ := and(verified_, checkField(mload(add(publicSignals_, <%=i * 32%>)))) - <% } -%> + for { let i := 0 } lt(i, <%= nPublic %>) { i := add(i, 32) } { + verified_ := and(verified_, checkField(mload(add(publicSignals_, i)))) + } /// @dev check pairings if not(iszero(verified_)) { verified_ := checkPairing(pointA_, pointB_, pointC_, publicSignals_, pointer_) } } - } <%if (signals.length > 0) {%> + } function verifyProofWithStruct( uint256[2] memory pointA_, @@ -189,13 +190,13 @@ contract <%=verifier_id%> { } else if (dimension.length === 1) { return `currentOffset := _linearize1DArray(linearizedArray_, currentOffset, mload(add(publicSignals_, ${offsetVar})), ${dimension[0]})`; } else { - return `currentOffset := _linearize${dimension.length}DArray(linearizedArray_, currentOffset, mload(add(publicSignals_, ${offsetVar})), ${dimension.reverse().join(', ')})`; + return `currentOffset := _linearize${dimension.length}DArray(linearizedArray_, currentOffset, mload(add(publicSignals_, ${offsetVar})), ${dimension.reverse().join(", ")})`; } }; const generateHelperFunctions = (maxDimension) => { - let helperFunctions = ''; - const indent = ' '; + let helperFunctions = ""; + const indent = "\t\t\t"; if (maxDimension >= 1) { helperFunctions += ` @@ -208,15 +209,18 @@ contract <%=verifier_id%> { }`; } + const generateDimensionParams = (dimensionsNumber, startIndex = 0) => { + return Array.from({ length: dimensionsNumber }, (_, i) => `dim${i + startIndex}Length`).join(", "); + } + for (let d = 2; d <= maxDimension; d++) { let func = ` - \n${indent}function _linearize${d}DArray(resultArray_, currentOffset_, ptr_, ${Array.from({ length: d }, (_, i) => `dim${i}Length`).join(', ')}) -> offset_ { - for { let i := 0 } lt(i, dim0Length) { i := add(i, 1) } { - let outerArrayPtr_ := mload(add(ptr_, mul(i, 32))) - currentOffset_ := _linearize${d - 1}DArray(resultArray_, currentOffset_, outerArrayPtr_, ${Array.from({ length: d - 1 }, (_, i) => `dim${i + 1}Length`).join(', ')}) - } + \n${indent}function _linearize${d}DArray(resultArray_, currentOffset_, ptr_, ${generateDimensionParams(d)}) -> offset_ { + for { let i := 0 } lt(i, dim0Length) { i := add(i, 1) } { + currentOffset_ := _linearize${d - 1}DArray(resultArray_, currentOffset_, mload(add(ptr_, mul(i, 32))), ${generateDimensionParams(d - 1, 1)}) + } - offset_ := currentOffset_ + offset_ := currentOffset_ }`; helperFunctions += func; } @@ -224,8 +228,9 @@ contract <%=verifier_id%> { return helperFunctions; }; - const maxDimension = Math.max(...signals.map(signal => signal.dimension.length), 0); - %>function _linearizePubSignals(PubSignals memory publicSignals_) private pure returns (uint256[<%= IC.length - 1 %>] memory linearizedArray_) { + const maxDimension = Math.max(...signals.map(signal => signal.dimension.length)); + -%> +function _linearizePubSignals(PubSignals memory publicSignals_) private pure returns (uint256[<%= IC.length - 1 %>] memory linearizedArray_) { assembly { let currentOffset := 0 @@ -240,5 +245,5 @@ contract <%=verifier_id%> { // <%= signal.name %> <%= linearizationCode %><%}); %> } - }<% } %> + } } diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/Multiplier.circom/Multiplier_artifacts.json b/test/fixture-projects/simple-circuits/zkit/artifacts/Multiplier.circom/Multiplier_artifacts.json index a71e66d..2d68feb 100644 --- a/test/fixture-projects/simple-circuits/zkit/artifacts/Multiplier.circom/Multiplier_artifacts.json +++ b/test/fixture-projects/simple-circuits/zkit/artifacts/Multiplier.circom/Multiplier_artifacts.json @@ -5,6 +5,13 @@ "circuitSourceName": "circuits/Multiplier.circom", "baseCircuitInfo": { "constraintsNumber": 1, - "signals": [] + "signals": [ + { + "name": "out", + "dimension": [], + "type": "Output", + "visibility": "Public" + } + ] } } From a6adf78f39b798787ccfa4ddd63ce94e2675c351 Mon Sep 17 00:00:00 2001 From: mllwchrry Date: Wed, 18 Sep 2024 17:25:03 +0300 Subject: [PATCH 5/7] removed unused circuit artifacts files --- .../MultiDimensionalArray.sym | 30 -- .../MultiDimensionalArray_constraints.json | 10 - .../generate_witness.js | 20 -- .../witness_calculator.js | 337 ------------------ 4 files changed, 397 deletions(-) delete mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.sym delete mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json delete mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/generate_witness.js delete mode 100644 test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/witness_calculator.js diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.sym b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.sym deleted file mode 100644 index f896adf..0000000 --- a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray.sym +++ /dev/null @@ -1,30 +0,0 @@ -1,1,0,main.out1 -2,2,0,main.out2[0][0] -3,3,0,main.out2[0][1] -4,4,0,main.out2[1][0] -5,5,0,main.out2[1][1] -6,6,0,main.a[0] -7,7,0,main.a[1] -8,8,0,main.a[2] -9,9,0,main.a[3] -10,10,0,main.b -11,11,0,main.c[0][0] -12,12,0,main.c[0][1] -13,13,0,main.c[0][2] -14,14,0,main.c[0][3] -15,15,0,main.c[0][4] -16,16,0,main.c[0][5] -17,17,0,main.c[0][6] -18,18,0,main.c[0][7] -19,19,0,main.c[0][8] -20,20,0,main.c[1][0] -21,21,0,main.c[1][1] -22,22,0,main.c[1][2] -23,23,0,main.c[1][3] -24,24,0,main.c[1][4] -25,25,0,main.c[1][5] -26,26,0,main.c[1][6] -27,27,0,main.c[1][7] -28,28,0,main.c[1][8] -29,29,0,main.m -30,-1,0,main.isEqual diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json deleted file mode 100644 index 2e052d5..0000000 --- a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_constraints.json +++ /dev/null @@ -1,10 +0,0 @@ -{ -"constraints": [ -[{"10":"21888242871839275222246405745257275088548364400416034343698204186575808495616","29":"1"},{"10":"21888242871839275222246405745257275088548364400416034343698204186575808495616","29":"1"},{}], -[{},{},{"1":"21888242871839275222246405745257275088548364400416034343698204186575808495616","24":"1"}], -[{},{},{"0":"3","2":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}], -[{},{},{"0":"6","3":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}], -[{},{},{"0":"12","4":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}], -[{},{},{"0":"24","5":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}] -] -} \ No newline at end of file diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/generate_witness.js b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/generate_witness.js deleted file mode 100644 index eabb86e..0000000 --- a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/generate_witness.js +++ /dev/null @@ -1,20 +0,0 @@ -const wc = require("./witness_calculator.js"); -const { readFileSync, writeFile } = require("fs"); - -if (process.argv.length != 5) { - console.log("Usage: node generate_witness.js "); -} else { - const input = JSON.parse(readFileSync(process.argv[3], "utf8")); - - const buffer = readFileSync(process.argv[2]); - wc(buffer).then(async witnessCalculator => { - // const w= await witnessCalculator.calculateWitness(input,0); - // for (let i=0; i< w.length; i++){ - // console.log(w[i]); - // } - const buff= await witnessCalculator.calculateWTNSBin(input,0); - writeFile(process.argv[4], buff, function(err) { - if (err) throw err; - }); - }); -} diff --git a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/witness_calculator.js b/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/witness_calculator.js deleted file mode 100644 index 20e6e20..0000000 --- a/test/fixture-projects/simple-circuits/zkit/artifacts/MultiDimensionalArray.circom/MultiDimensionalArray_js/witness_calculator.js +++ /dev/null @@ -1,337 +0,0 @@ -module.exports = async function builder(code, options) { - - options = options || {}; - - let wasmModule; - try { - wasmModule = await WebAssembly.compile(code); - } catch (err) { - console.log(err); - console.log("\nTry to run circom --c in order to generate c++ code instead\n"); - throw new Error(err); - } - - let wc; - - let errStr = ""; - let msgStr = ""; - - const instance = await WebAssembly.instantiate(wasmModule, { - runtime: { - exceptionHandler : function(code) { - let err; - if (code == 1) { - err = "Signal not found.\n"; - } else if (code == 2) { - err = "Too many signals set.\n"; - } else if (code == 3) { - err = "Signal already set.\n"; - } else if (code == 4) { - err = "Assert Failed.\n"; - } else if (code == 5) { - err = "Not enough memory.\n"; - } else if (code == 6) { - err = "Input signal array access exceeds the size.\n"; - } else { - err = "Unknown error.\n"; - } - throw new Error(err + errStr); - }, - printErrorMessage : function() { - errStr += getMessage() + "\n"; - // console.error(getMessage()); - }, - writeBufferMessage : function() { - const msg = getMessage(); - // Any calls to `log()` will always end with a `\n`, so that's when we print and reset - if (msg === "\n") { - console.log(msgStr); - msgStr = ""; - } else { - // If we've buffered other content, put a space in between the items - if (msgStr !== "") { - msgStr += " " - } - // Then append the message to the message we are creating - msgStr += msg; - } - }, - showSharedRWMemory : function() { - printSharedRWMemory (); - } - - } - }); - - const sanityCheck = - options -// options && -// ( -// options.sanityCheck || -// options.logGetSignal || -// options.logSetSignal || -// options.logStartComponent || -// options.logFinishComponent -// ); - - - wc = new WitnessCalculator(instance, sanityCheck); - return wc; - - function getMessage() { - var message = ""; - var c = instance.exports.getMessageChar(); - while ( c != 0 ) { - message += String.fromCharCode(c); - c = instance.exports.getMessageChar(); - } - return message; - } - - function printSharedRWMemory () { - const shared_rw_memory_size = instance.exports.getFieldNumLen32(); - const arr = new Uint32Array(shared_rw_memory_size); - for (let j=0; j { - const h = fnvHash(k); - const hMSB = parseInt(h.slice(0,8), 16); - const hLSB = parseInt(h.slice(8,16), 16); - const fArr = flatArray(input[k]); - let signalSize = this.instance.exports.getInputSignalSize(hMSB, hLSB); - if (signalSize < 0){ - throw new Error(`Signal ${k} not found\n`); - } - if (fArr.length < signalSize) { - throw new Error(`Not enough values for input signal ${k}\n`); - } - if (fArr.length > signalSize) { - throw new Error(`Too many values for input signal ${k}\n`); - } - for (let i=0; i0) { - res.unshift(0); - i--; - } - } - return res; -} - -function fromArray32(arr) { //returns a BigInt - var res = BigInt(0); - const radix = BigInt(0x100000000); - for (let i = 0; i Date: Wed, 18 Sep 2024 21:46:34 +0300 Subject: [PATCH 6/7] added the struct support inside the Vyper template --- README.md | 4 ++ src/core/templates/verifier_groth16.vy.ejs | 75 +++++++++++++++++++++- test/CircuitZKit.test.ts | 46 +++++++++++++ 3 files changed, 124 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5502c03..50f06f9 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,10 @@ const templateContent = CircuitZKit.getTemplate("groth16", "sol"); Creates a Solidity | Vyper verifier contract on `verifierDirPath` path, which was specified in the config. +Two functions are available for proof verification within the contract: +- `verifyProof`: accepts an array of public inputs for verification. +- `verifyProofWithStruct`: allows passing public signals as a struct, enabling easier access and typization. + ```typescript await multiplier.createVerifier("sol"); ``` diff --git a/src/core/templates/verifier_groth16.vy.ejs b/src/core/templates/verifier_groth16.vy.ejs index 77afde0..c5af948 100644 --- a/src/core/templates/verifier_groth16.vy.ejs +++ b/src/core/templates/verifier_groth16.vy.ejs @@ -33,10 +33,39 @@ EC_ADD_PRECOMPILED_ADDRESS: constant(address) = 0x000000000000000000000000000000 EC_MUL_PRECOMPILED_ADDRESS: constant(address) = 0x0000000000000000000000000000000000000007 EC_PAIRING_PRECOMPILED_ADDRESS: constant(address) = 0x0000000000000000000000000000000000000008 +<%function generateType(dimension) { + if (dimension.length === 0) { + return "uint256"; + } else { + return "uint256" + dimension.map(d => `[${d}]`).join(""); + } +} + +const structFields = signals + .map(signal => { + return `\t${signal.name}: ${generateType(signal.dimension)}` + }) + .join("\n"); +-%> +struct PubSignals: +<%= structFields %> + + +@view +@external +def verifyProof(pointA: uint256[2], pointB: uint256[2][2], pointC: uint256[2], publicSignals: uint256[<%= IC.length - 1 %>]) -> bool: + return self._verifyProof(pointA, pointB, pointC, publicSignals) + @view @external -def verifyProof(pointA: uint256[2], pointB: uint256[2][2], pointC: uint256[2], publicSignals: uint256[<%=IC.length-1%>]) -> bool: +def verifyProofWithStruct(pointA: uint256[2], pointB: uint256[2][2], pointC: uint256[2], publicSignals: PubSignals) -> bool: + return self._verifyProof(pointA, pointB, pointC, self._linearizePubSignals(publicSignals)) + + +@view +@internal +def _verifyProof(pointA: uint256[2], pointB: uint256[2][2], pointC: uint256[2], publicSignals: uint256[<%= IC.length - 1 %>]) -> bool: # @dev check that all public signals are in F for signal: uint256 in publicSignals: if signal >= BASE_FIELD_SIZE: @@ -44,6 +73,50 @@ def verifyProof(pointA: uint256[2], pointB: uint256[2][2], pointC: uint256[2], p return self._checkPairing(pointA, pointB, pointC, publicSignals) +<% +function generateLoops(dimensions, signalName, depth = 0, indices = []) { + let loopCode = ''; + let indent = '\t'.repeat(depth + 1); + let currentIndex = `i_${depth}`; + + if (depth < dimensions.length) { + loopCode += `${indent}for ${currentIndex}: uint256 in range(${dimensions[depth]}):\n`; + + indices.push(currentIndex); + + loopCode += generateLoops(dimensions, signalName, depth + 1, indices); + } else { + let accessExpression = indices.map(idx => `[${idx}]`).join(''); + + loopCode += `${indent}linearizedArray[idx] = publicSignals.${signalName}${accessExpression}\n`; + loopCode += `${indent}idx += 1\n`; + } + + return loopCode; +} + +let linearizeCode = "\tidx: uint256 = 0\n"; +linearizeCode += `\tlinearizedArray: uint256[${nPublic}] = empty(uint256[${nPublic}])\n`; + +for (let i = 0; i < signals.length; i++) { + linearizeCode += `\n\t# ${signals[i].name}\n`; + + if (signals[i].dimension.length) { + linearizeCode += generateLoops(signals[i].dimension.reverse(), signals[i].name); + } else { + linearizeCode += `\tlinearizedArray[idx] = publicSignals.${signals[i].name}\n`; + linearizeCode += `\tidx += 1\n`; + } +} + +linearizeCode += "\n\treturn linearizedArray"; +-%> + +@view +@internal +def _linearizePubSignals(publicSignals: PubSignals) -> uint256[<%= IC.length - 1 %>]: +<%= linearizeCode %> + @view @internal diff --git a/test/CircuitZKit.test.ts b/test/CircuitZKit.test.ts index 6124d78..fca58ec 100644 --- a/test/CircuitZKit.test.ts +++ b/test/CircuitZKit.test.ts @@ -139,6 +139,7 @@ describe("CircuitZKit", () => { const template = CircuitZKit.getTemplate("groth16", "vy"); const templateParams = JSON.parse(fs.readFileSync(expectedVKeyFilePath, "utf-8")); templateParams["verifier_id"] = multiplierCircuit.getVerifierName(); + templateParams["signals"] = multiplierCircuit.getPublicSignalsInfo(); expect(fs.readFileSync(expectedVerifierFilePath, "utf-8")).to.be.eq(ejs.render(template, templateParams)); }); @@ -256,6 +257,51 @@ describe("CircuitZKit", () => { expect(await verifier.verifyProof(...data)).to.be.true; }); + it("should correctly create Vyper verifier and verify proof with public signals struct", async function () { + const circuitName = "MultiDimensionalArray"; + const verifierDirPath = getVerifiersDirFullPath(); + const artifactsDirFullPath = getArtifactsFullPath(`${circuitName}.circom`); + + const mdArrayCircuit: CircuitZKit = new CircuitZKit({ + circuitName, + circuitArtifactsPath: artifactsDirFullPath, + verifierDirPath, + }); + + const expectedVerifierFilePath = path.join(verifierDirPath, `${mdArrayCircuit.getVerifierName()}.vy`); + + await mdArrayCircuit.createVerifier("vy"); + expect(fs.existsSync(expectedVerifierFilePath)).to.be.true; + + await this.hre.run("compile", { quiet: true }); + + const a = [77, 32, 1, 90]; + const b = 1414; + const c = [ + [2, 3, 4, 5, 6, 12, 11, 10, 9], + [1, 11, 111, 1111, 1414, 4444, 444, 44, 4], + ]; + + const proof: any = await mdArrayCircuit.generateProof({ a, b, c }); + + expect(await mdArrayCircuit.verifyProof(proof)).to.be.true; + + const data = await mdArrayCircuit.generateCalldata(proof); + + const MdArrayVerifierFactory = await this.hre.ethers.getContractFactory("MultiDimensionalArrayVerifier"); + const verifier = await MdArrayVerifierFactory.deploy(); + + const out1 = 1414; + const out2 = [ + [3, 6], + [12, 24], + ]; + + const calldata = [data[0], data[1], data[2], { out1, out2, a, b, c }]; + + expect(await verifier.verifyProofWithStruct(...calldata)).to.be.true; + }); + it("should correctly create verifier several times", async () => { const circuitName = "Multiplier"; const verifierDirPath = getVerifiersDirFullPath(); From 86fab171ea524ebbaaa1e442c0b3c3057b3e35f4 Mon Sep 17 00:00:00 2001 From: mllwchrry Date: Thu, 19 Sep 2024 13:47:53 +0300 Subject: [PATCH 7/7] readme and version updated --- README.md | 4 + package-lock.json | 798 +--------------------------------------------- package.json | 3 +- 3 files changed, 7 insertions(+), 798 deletions(-) diff --git a/README.md b/README.md index 50f06f9..7594e29 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,10 @@ Two functions are available for proof verification within the contract: - `verifyProof`: accepts an array of public inputs for verification. - `verifyProofWithStruct`: allows passing public signals as a struct, enabling easier access and typization. +> [!TIP] +> It’s recommended to create structs using the `{ fieldName: value }` syntax. This ensures that your code +> continues to work correctly even if the order of outputs in the circuit changes. + ```typescript await multiplier.createVerifier("sol"); ``` diff --git a/package-lock.json b/package-lock.json index e8686da..a1ffe54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@solarity/zkit", - "version": "0.2.6", + "version": "0.2.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@solarity/zkit", - "version": "0.2.6", + "version": "0.2.7", "license": "MIT", "dependencies": { "ejs": "3.1.10", @@ -24,7 +24,6 @@ "chai-as-promised": "^7.1.1", "ethers": "6.11.1", "hardhat": "2.22.7", - "hardhat-gas-reporter": "^2.2.1", "husky": "^9.0.11", "mocha": "^10.3.0", "nyc": "^15.1.0", @@ -360,16 +359,6 @@ "node": ">=6.9.0" } }, - "node_modules/@colors/colors": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", - "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.1.90" - } - }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -761,27 +750,6 @@ "@ethersproject/signing-key": "^5.7.0" } }, - "node_modules/@ethersproject/units": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", - "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, "node_modules/@ethersproject/web": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", @@ -828,102 +796,6 @@ "ffjavascript": "^0.2.48" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1473,16 +1345,6 @@ "hardhat": "^2.22.62.8.3" } }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "optional": true, - "engines": { - "node": ">=14" - } - }, "node_modules/@scure/base": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", @@ -1687,12 +1549,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/@solidity-parser/parser": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.18.0.tgz", - "integrity": "sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==", - "dev": true - }, "node_modules/@tsconfig/node10": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", @@ -1792,27 +1648,6 @@ "integrity": "sha512-x37Jsv1vx6I6RMJdfvYEmDUOLYgzYMecwlk13gniDOcN20xLVe9hy9DlQxWeCPirqpDY/jwugQSqCi2RxehU3g==", "dev": true }, - "node_modules/abitype": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz", - "integrity": "sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/wevm" - }, - "peerDependencies": { - "typescript": ">=5.0.4", - "zod": "^3 >=3.22.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - }, - "zod": { - "optional": true - } - } - }, "node_modules/acorn": { "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", @@ -1988,23 +1823,6 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true - }, - "node_modules/axios": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", - "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", - "dev": true, - "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/b4a": { "version": "1.6.6", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", @@ -2208,12 +2026,6 @@ "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", "dev": true }, - "node_modules/brotli-wasm": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brotli-wasm/-/brotli-wasm-2.0.1.tgz", - "integrity": "sha512-+3USgYsC7bzb5yU0/p2HnnynZl0ak0E6uoIm4UW4Aby/8s8HFCq6NCfrrf1E9c3O8OCSzq3oYO1tUVqIi61Nww==", - "dev": true - }, "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -2398,15 +2210,6 @@ "node": ">=4" } }, - "node_modules/charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/check-error": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", @@ -2506,21 +2309,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/cli-table3": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz", - "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0" - }, - "engines": { - "node": "10.* || >= 12.*" - }, - "optionalDependencies": { - "@colors/colors": "1.5.0" - } - }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -2547,18 +2335,6 @@ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/command-exists": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", @@ -2647,15 +2423,6 @@ "node": ">= 8" } }, - "node_modules/crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/debug": { "version": "4.3.5", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", @@ -2714,15 +2481,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -2741,12 +2499,6 @@ "node": ">=0.3.1" } }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -3182,20 +2934,6 @@ "node": ">=8.0.0" } }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fp-ts": { "version": "1.19.3", "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz", @@ -3406,237 +3144,6 @@ } } }, - "node_modules/hardhat-gas-reporter": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-2.2.1.tgz", - "integrity": "sha512-3AfPDGBn6VPmRKU65W28qVvG5x+qYL2gH9PAivd31oGj/ZHpZTutqXh6wq46993Vz35rnPDnrGo028U4/NP/Vw==", - "dev": true, - "dependencies": { - "@ethersproject/abi": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/units": "^5.7.0", - "@solidity-parser/parser": "^0.18.0", - "axios": "^1.6.7", - "brotli-wasm": "^2.0.1", - "chalk": "4.1.2", - "cli-table3": "^0.6.3", - "ethereum-cryptography": "^2.1.3", - "glob": "^10.3.10", - "jsonschema": "^1.4.1", - "lodash": "^4.17.21", - "markdown-table": "2.0.0", - "sha1": "^1.1.1", - "viem": "2.7.14" - }, - "peerDependencies": { - "hardhat": "^2.16.0" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/@noble/curves": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", - "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", - "dev": true, - "dependencies": { - "@noble/hashes": "1.4.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/@noble/hashes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", - "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", - "dev": true, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/@scure/bip32": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", - "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", - "dev": true, - "dependencies": { - "@noble/curves": "~1.4.0", - "@noble/hashes": "~1.4.0", - "@scure/base": "~1.1.6" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/@scure/bip39": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", - "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", - "dev": true, - "dependencies": { - "@noble/hashes": "~1.4.0", - "@scure/base": "~1.1.6" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/hardhat-gas-reporter/node_modules/ethereum-cryptography": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", - "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", - "dev": true, - "dependencies": { - "@noble/curves": "1.4.2", - "@noble/hashes": "1.4.0", - "@scure/bip32": "1.4.0", - "@scure/bip39": "1.3.0" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "dev": true, - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/hardhat-gas-reporter/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/hardhat/node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", @@ -3991,21 +3498,6 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, - "node_modules/isows": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz", - "integrity": "sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wagmi-dev" - } - ], - "peerDependencies": { - "ws": "*" - } - }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -4160,21 +3652,6 @@ "node": ">=8" } }, - "node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "dev": true, - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, "node_modules/jake": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.1.tgz", @@ -4322,15 +3799,6 @@ "underscore": "1.12.1" } }, - "node_modules/jsonschema": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz", - "integrity": "sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/keccak": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.4.tgz", @@ -4495,12 +3963,6 @@ "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==", "dev": true }, - "node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true - }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -4522,19 +3984,6 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, - "node_modules/markdown-table": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", - "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", - "dev": true, - "dependencies": { - "repeat-string": "^1.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -4555,27 +4004,6 @@ "node": ">= 0.10.0" } }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -4599,15 +4027,6 @@ "node": "*" } }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/mnemonist": { "version": "0.38.5", "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.5.tgz", @@ -5194,12 +4613,6 @@ "node": ">=8" } }, - "node_modules/package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", - "dev": true - }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -5233,22 +4646,6 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, - "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -5409,12 +4806,6 @@ "node": ">=8" } }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true - }, "node_modules/r1csfile": { "version": "0.0.47", "resolved": "https://registry.npmjs.org/r1csfile/-/r1csfile-0.0.47.tgz", @@ -5498,15 +4889,6 @@ "node": ">=4" } }, - "node_modules/repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", - "dev": true, - "engines": { - "node": ">=0.10" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -5663,19 +5045,6 @@ "sha.js": "bin.js" } }, - "node_modules/sha1": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz", - "integrity": "sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA==", - "dev": true, - "dependencies": { - "charenc": ">= 0.0.1", - "crypt": ">= 0.0.1" - }, - "engines": { - "node": "*" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -5876,21 +5245,6 @@ "node": ">=8" } }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -5903,19 +5257,6 @@ "node": ">=8" } }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -6245,90 +5586,6 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, - "node_modules/viem": { - "version": "2.7.14", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.7.14.tgz", - "integrity": "sha512-5b1KB1gXli02GOQHZIUsRluNUwssl2t4hqdFAzyWPwJ744N83jAOBOjOkrGz7K3qMIv9b0GQt3DoZIErSQTPkQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wevm" - } - ], - "dependencies": { - "@adraffy/ens-normalize": "1.10.0", - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.2", - "@scure/bip32": "1.3.2", - "@scure/bip39": "1.2.1", - "abitype": "1.0.0", - "isows": "1.0.3", - "ws": "8.13.0" - }, - "peerDependencies": { - "typescript": ">=5.0.4" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/viem/node_modules/@adraffy/ens-normalize": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", - "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==", - "dev": true - }, - "node_modules/viem/node_modules/@scure/bip32": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", - "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", - "dev": true, - "dependencies": { - "@noble/curves": "~1.2.0", - "@noble/hashes": "~1.3.2", - "@scure/base": "~1.1.2" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/viem/node_modules/@scure/bip39": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", - "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", - "dev": true, - "dependencies": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/viem/node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "dev": true, - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/wasmbuilder": { "version": "0.0.16", "resolved": "https://registry.npmjs.org/wasmbuilder/-/wasmbuilder-0.0.16.tgz", @@ -6411,57 +5668,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", diff --git a/package.json b/package.json index 74bfca7..8c35e6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@solarity/zkit", - "version": "0.2.6", + "version": "0.2.7", "license": "MIT", "author": "Distributed Lab", "readme": "README.md", @@ -44,7 +44,6 @@ "devDependencies": { "@nomicfoundation/hardhat-ethers": "3.0.5", "@nomiclabs/hardhat-vyper": "^3.0.7", - "hardhat-gas-reporter": "^2.2.1", "@types/chai": "^4.3.12", "@types/chai-as-promised": "^7.1.8", "@types/ejs": "^3.1.5",