diff --git a/README.md b/README.md index 8047317..5502c03 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ **A zero knowledge kit that helps you interact with Circom circuits.** - Generate and verify ZK proofs with a single line of code. -- Render optimized Solidity verifiers. +- Render optimized Solidity | Vyper verifiers. - Build and work with ZK witnesses. ## Installation @@ -33,7 +33,7 @@ CircuitZKitConfig = { circuitName: string; circuitArtifactsPath: string; verifierDirPath: string; - templateType?: VerifierTemplateType; + provingSystem?: VerifierProvingSystem; }; ``` @@ -41,23 +41,23 @@ This config contains all the information required to work with the circuit, name - `circuitName` - Name of the circuit file without extension - `circuitArtifactsPath` - Full path to compilation artifacts for the desired circuit -- `verifierDirPath` - Full path to the directory where Solidity verifier file will be generated -- `templateType` - The type of template that will be used to generate the Solidity verifier contract. Right now only `groth16` is supported +- `verifierDirPath` - Full path to the directory where Solidity | Vyper verifier file will be generated +- `provingSystem` - The proving system that will be used to generate the verifier contract. Right now only `groth16` is supported #### getTemplate() Static `CircuitZKit` function that returns the contents of a template file by the passed type. ```typescript -const templateContent = CircuitZKit.getTemplate("groth16"); +const templateContent = CircuitZKit.getTemplate("groth16", "sol"); ``` #### createVerifier() -Creates a Solidity verifier contract on `verifierDirPath` path, which was specified in the config. +Creates a Solidity | Vyper verifier contract on `verifierDirPath` path, which was specified in the config. ```typescript -await multiplier.createVerifier(); +await multiplier.createVerifier("sol"); ``` #### calculateWitness() @@ -89,7 +89,7 @@ const isValidProof = await multiplier.verifyProof(proof); #### generateCalldata() -Generates calldata by proof for the Solidity verifier's `verifyProof()` method. +Generates calldata by proof for the Solidity | Vyper verifier's `verifyProof()` method. ```typescript /// You can use this calldata to call the verifier contract diff --git a/package-lock.json b/package-lock.json index 34d57a0..d0de23d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ }, "devDependencies": { "@nomicfoundation/hardhat-ethers": "3.0.5", + "@nomiclabs/hardhat-vyper": "^3.0.7", "@types/chai": "^4.3.12", "@types/chai-as-promised": "^7.1.8", "@types/ejs": "^3.1.5", @@ -22,7 +23,7 @@ "chai": "^4.4.1", "chai-as-promised": "^7.1.1", "ethers": "6.11.1", - "hardhat": "2.20.1", + "hardhat": "2.22.7", "husky": "^9.0.11", "mocha": "^10.3.0", "nyc": "^15.1.0", @@ -358,6 +359,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", @@ -749,6 +760,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", @@ -795,6 +827,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", @@ -1034,178 +1162,94 @@ } ] }, - "node_modules/@nomicfoundation/ethereumjs-block": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.4.tgz", - "integrity": "sha512-AcyacJ9eX/uPEvqsPiB+WO1ymE+kyH48qGGiGV+YTojdtas8itUTW5dehDSOXEEItWGbbzEJ4PRqnQZlWaPvDw==", + "node_modules/@nomicfoundation/edr": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.5.2.tgz", + "integrity": "sha512-hW/iLvUQZNTVjFyX/I40rtKvvDOqUEyIi96T28YaLfmPL+3LW2lxmYLUXEJ6MI14HzqxDqrLyhf6IbjAa2r3Dw==", "dev": true, "dependencies": { - "@nomicfoundation/ethereumjs-common": "4.0.4", - "@nomicfoundation/ethereumjs-rlp": "5.0.4", - "@nomicfoundation/ethereumjs-trie": "6.0.4", - "@nomicfoundation/ethereumjs-tx": "5.0.4", - "@nomicfoundation/ethereumjs-util": "9.0.4", - "ethereum-cryptography": "0.1.3" + "@nomicfoundation/edr-darwin-arm64": "0.5.2", + "@nomicfoundation/edr-darwin-x64": "0.5.2", + "@nomicfoundation/edr-linux-arm64-gnu": "0.5.2", + "@nomicfoundation/edr-linux-arm64-musl": "0.5.2", + "@nomicfoundation/edr-linux-x64-gnu": "0.5.2", + "@nomicfoundation/edr-linux-x64-musl": "0.5.2", + "@nomicfoundation/edr-win32-x64-msvc": "0.5.2" }, "engines": { - "node": ">=18" + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-block/node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "node_modules/@nomicfoundation/edr-darwin-arm64": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.5.2.tgz", + "integrity": "sha512-Gm4wOPKhbDjGTIRyFA2QUAPfCXA1AHxYOKt3yLSGJkQkdy9a5WW+qtqKeEKHc/+4wpJSLtsGQfpzyIzggFfo/A==", "dev": true, - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" + "engines": { + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-blockchain": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.4.tgz", - "integrity": "sha512-jYsd/kwzbmpnxx86tXsYV8wZ5xGvFL+7/P0c6OlzpClHsbFzeF41KrYA9scON8Rg6bZu3ZTv6JOAgj3t7USUfg==", + "node_modules/@nomicfoundation/edr-darwin-x64": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.5.2.tgz", + "integrity": "sha512-ClyABq2dFCsrYEED3/UIO0c7p4H1/4vvlswFlqUyBpOkJccr75qIYvahOSJRM62WgUFRhbSS0OJXFRwc/PwmVg==", "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-block": "5.0.4", - "@nomicfoundation/ethereumjs-common": "4.0.4", - "@nomicfoundation/ethereumjs-ethash": "3.0.4", - "@nomicfoundation/ethereumjs-rlp": "5.0.4", - "@nomicfoundation/ethereumjs-trie": "6.0.4", - "@nomicfoundation/ethereumjs-tx": "5.0.4", - "@nomicfoundation/ethereumjs-util": "9.0.4", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "lru-cache": "^10.0.0" - }, "engines": { - "node": ">=18" + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-blockchain/node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "node_modules/@nomicfoundation/edr-linux-arm64-gnu": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.5.2.tgz", + "integrity": "sha512-HWMTVk1iOabfvU2RvrKLDgtFjJZTC42CpHiw2h6rfpsgRqMahvIlx2jdjWYzFNy1jZKPTN1AStQ/91MRrg5KnA==", "dev": true, - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" + "engines": { + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-common": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz", - "integrity": "sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg==", + "node_modules/@nomicfoundation/edr-linux-arm64-musl": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.5.2.tgz", + "integrity": "sha512-CwsQ10xFx/QAD5y3/g5alm9+jFVuhc7uYMhrZAu9UVF+KtVjeCvafj0PaVsZ8qyijjqVuVsJ8hD1x5ob7SMcGg==", "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-util": "9.0.4" + "engines": { + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-ethash": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-3.0.4.tgz", - "integrity": "sha512-xvIrwIMl9sSaiYKRem68+O7vYdj7Q2XWv5P7JXiIkn83918QzWHvqbswTRsH7+r6X1UEvdsURRnZbvZszEjAaQ==", + "node_modules/@nomicfoundation/edr-linux-x64-gnu": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.5.2.tgz", + "integrity": "sha512-CWVCEdhWJ3fmUpzWHCRnC0/VLBDbqtqTGTR6yyY1Ep3S3BOrHEAvt7h5gx85r2vLcztisu2vlDq51auie4IU1A==", "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-block": "5.0.4", - "@nomicfoundation/ethereumjs-rlp": "5.0.4", - "@nomicfoundation/ethereumjs-util": "9.0.4", - "bigint-crypto-utils": "^3.2.2", - "ethereum-cryptography": "0.1.3" - }, "engines": { - "node": ">=18" + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-ethash/node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "node_modules/@nomicfoundation/edr-linux-x64-musl": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.5.2.tgz", + "integrity": "sha512-+aJDfwhkddy2pP5u1ISg3IZVAm0dO836tRlDTFWtvvSMQ5hRGqPcWwlsbobhDQsIxhPJyT7phL0orCg5W3WMeA==", "dev": true, - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" + "engines": { + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-evm": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-2.0.4.tgz", - "integrity": "sha512-lTyZZi1KpeMHzaO6cSVisR2tjiTTedjo7PcmhI/+GNFo9BmyY6QYzGeSti0sFttmjbEMioHgXxl5yrLNRg6+1w==", + "node_modules/@nomicfoundation/edr-win32-x64-msvc": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.5.2.tgz", + "integrity": "sha512-CcvvuA3sAv7liFNPsIR/68YlH6rrybKzYttLlMr80d4GKJjwJ5OKb3YgE6FdZZnOfP19HEHhsLcE0DPLtY3r0w==", "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-common": "4.0.4", - "@nomicfoundation/ethereumjs-statemanager": "2.0.4", - "@nomicfoundation/ethereumjs-tx": "5.0.4", - "@nomicfoundation/ethereumjs-util": "9.0.4", - "@types/debug": "^4.1.9", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "rustbn-wasm": "^0.2.0" - }, "engines": { - "node": ">=18" + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-evm/node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "node_modules/@nomicfoundation/ethereumjs-common": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz", + "integrity": "sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg==", "dev": true, "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" + "@nomicfoundation/ethereumjs-util": "9.0.4" } }, "node_modules/@nomicfoundation/ethereumjs-rlp": { @@ -1220,93 +1264,6 @@ "node": ">=18" } }, - "node_modules/@nomicfoundation/ethereumjs-statemanager": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-2.0.4.tgz", - "integrity": "sha512-HPDjeFrxw6llEi+BzqXkZ+KkvFnTOPczuHBtk21hRlDiuKuZz32dPzlhpRsDBGV1b5JTmRDUVqCS1lp3Gghw4Q==", - "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-common": "4.0.4", - "@nomicfoundation/ethereumjs-rlp": "5.0.4", - "@nomicfoundation/ethereumjs-trie": "6.0.4", - "@nomicfoundation/ethereumjs-util": "9.0.4", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "js-sdsl": "^4.1.4", - "lru-cache": "^10.0.0" - }, - "peerDependencies": { - "@nomicfoundation/ethereumjs-verkle": "0.0.2" - }, - "peerDependenciesMeta": { - "@nomicfoundation/ethereumjs-verkle": { - "optional": true - } - } - }, - "node_modules/@nomicfoundation/ethereumjs-statemanager/node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", - "dev": true, - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" - } - }, - "node_modules/@nomicfoundation/ethereumjs-trie": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.4.tgz", - "integrity": "sha512-3nSwQiFMvr2VFe/aZUyinuohYvtytUqZCUCvIWcPJ/BwJH6oQdZRB42aNFBJ/8nAh2s3OcroWpBLskzW01mFKA==", - "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-rlp": "5.0.4", - "@nomicfoundation/ethereumjs-util": "9.0.4", - "@types/readable-stream": "^2.3.13", - "ethereum-cryptography": "0.1.3", - "lru-cache": "^10.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@nomicfoundation/ethereumjs-trie/node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", - "dev": true, - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" - } - }, "node_modules/@nomicfoundation/ethereumjs-tx": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.4.tgz", @@ -1397,66 +1354,6 @@ "setimmediate": "^1.0.5" } }, - "node_modules/@nomicfoundation/ethereumjs-verkle": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-verkle/-/ethereumjs-verkle-0.0.2.tgz", - "integrity": "sha512-bjnfZElpYGK/XuuVRmLS3yDvr+cDs85D9oonZ0YUa5A3lgFgokWMp76zXrxX2jVQ0BfHaw12y860n1+iOi6yFQ==", - "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-rlp": "5.0.4", - "@nomicfoundation/ethereumjs-util": "9.0.4", - "lru-cache": "^10.0.0", - "rust-verkle-wasm": "^0.0.1" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@nomicfoundation/ethereumjs-vm": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-7.0.4.tgz", - "integrity": "sha512-gsA4IhmtWHI4BofKy3kio9W+dqZQs5Ji5mLjLYxHCkat+JQBUt5szjRKra2F9nGDJ2XcI/wWb0YWUFNgln4zRQ==", - "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-block": "5.0.4", - "@nomicfoundation/ethereumjs-blockchain": "7.0.4", - "@nomicfoundation/ethereumjs-common": "4.0.4", - "@nomicfoundation/ethereumjs-evm": "2.0.4", - "@nomicfoundation/ethereumjs-rlp": "5.0.4", - "@nomicfoundation/ethereumjs-statemanager": "2.0.4", - "@nomicfoundation/ethereumjs-trie": "6.0.4", - "@nomicfoundation/ethereumjs-tx": "5.0.4", - "@nomicfoundation/ethereumjs-util": "9.0.4", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@nomicfoundation/ethereumjs-vm/node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", - "dev": true, - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" - } - }, "node_modules/@nomicfoundation/hardhat-ethers": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.5.tgz", @@ -1556,7 +1453,33 @@ "dev": true, "optional": true, "engines": { - "node": ">= 12" + "node": ">= 12" + } + }, + "node_modules/@nomiclabs/hardhat-vyper": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-vyper/-/hardhat-vyper-3.0.7.tgz", + "integrity": "sha512-jgwSmdVR1Mpt7thIHBNP4RETH3+DvccLEqNrG6ugqCQt1OjKUWjWgAnNUFdFJ+ZzL246XIJXSETXot9jOsX1JA==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^7.0.1", + "io-ts": "1.10.4", + "lodash": "^4.17.11", + "semver": "^6.3.0" + }, + "peerDependencies": { + "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": { @@ -1763,6 +1686,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", @@ -1811,15 +1740,6 @@ "@types/chai": "*" } }, - "node_modules/@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", - "dev": true, - "dependencies": { - "@types/ms": "*" - } - }, "node_modules/@types/ejs": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/@types/ejs/-/ejs-3.1.5.tgz", @@ -1838,12 +1758,6 @@ "integrity": "sha512-GN8yJ1mNTcFcah/wKEFIJckJx9iJLoMSzWcfRRuxz/Jk+U6KQNnml+etbtxFK8lPjzOw3zp4Ha/kjSst9fsHYw==", "dev": true }, - "node_modules/@types/ms": { - "version": "0.7.34", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", - "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==", - "dev": true - }, "node_modules/@types/node": { "version": "20.14.10", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.10.tgz", @@ -1862,16 +1776,6 @@ "@types/node": "*" } }, - "node_modules/@types/readable-stream": { - "version": "2.3.15", - "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-2.3.15.tgz", - "integrity": "sha512-oM5JSKQCcICF1wvGgmecmHldZ48OZamtMxcGGVICOJA8o8cahXC1zEVAif8iwoc5j8etxFaRFnf095+CDsuoFQ==", - "dev": true, - "dependencies": { - "@types/node": "*", - "safe-buffer": "~5.1.1" - } - }, "node_modules/@types/secp256k1": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.6.tgz", @@ -1887,6 +1791,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", @@ -2062,6 +1987,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", @@ -2096,15 +2038,6 @@ "node": ">= 8.0.0" } }, - "node_modules/bigint-crypto-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/bigint-crypto-utils/-/bigint-crypto-utils-3.3.0.tgz", - "integrity": "sha512-jOTSb+drvEDxEq6OuUybOAv/xxoh3cuYRUIPyu8sSHQNKM303UQ2R1DAo45o1AkcIXw6fzbaFI1+xGGdaXs2lg==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", @@ -2274,6 +2207,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", @@ -2458,6 +2397,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", @@ -2557,6 +2505,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", @@ -2583,6 +2546,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", @@ -2590,10 +2565,13 @@ "dev": true }, "node_modules/commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==", - "dev": true + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true, + "engines": { + "node": ">= 12" + } }, "node_modules/commondir": { "version": "1.0.1", @@ -2668,6 +2646,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", @@ -2726,6 +2713,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", @@ -2744,6 +2740,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", @@ -3179,6 +3181,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", @@ -3324,24 +3340,17 @@ "dev": true }, "node_modules/hardhat": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.20.1.tgz", - "integrity": "sha512-q75xDQiQtCZcTMBwjTovrXEU5ECr49baxr4/OBkIu/ULTPzlB20yk1dRWNmD2IFbAeAeXggaWvQAdpiScaHtPw==", + "version": "2.22.7", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.22.7.tgz", + "integrity": "sha512-nrXQAl+qUr75TsCLDo8P41YXLc+5U7qQMMCIrbbmy1/uQaVPncdjDrD5BR0CENvHRj7EBqO+JkofpozXoIfJKg==", "dev": true, "dependencies": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", - "@nomicfoundation/ethereumjs-block": "5.0.4", - "@nomicfoundation/ethereumjs-blockchain": "7.0.4", + "@nomicfoundation/edr": "^0.5.0", "@nomicfoundation/ethereumjs-common": "4.0.4", - "@nomicfoundation/ethereumjs-evm": "2.0.4", - "@nomicfoundation/ethereumjs-rlp": "5.0.4", - "@nomicfoundation/ethereumjs-statemanager": "2.0.4", - "@nomicfoundation/ethereumjs-trie": "6.0.4", "@nomicfoundation/ethereumjs-tx": "5.0.4", "@nomicfoundation/ethereumjs-util": "9.0.4", - "@nomicfoundation/ethereumjs-verkle": "0.0.2", - "@nomicfoundation/ethereumjs-vm": "7.0.4", "@nomicfoundation/solidity-analyzer": "^0.1.0", "@sentry/node": "^5.18.1", "@types/bn.js": "^5.1.0", @@ -3372,7 +3381,7 @@ "raw-body": "^2.4.1", "resolve": "1.17.0", "semver": "^6.3.0", - "solc": "0.7.3", + "solc": "0.8.26", "source-map-support": "^0.5.13", "stacktrace-parser": "^0.1.10", "tsort": "0.0.1", @@ -3387,13 +3396,244 @@ "ts-node": "*", "typescript": "*" }, - "peerDependenciesMeta": { - "ts-node": { - "optional": true - }, - "typescript": { - "optional": true - } + "peerDependenciesMeta": { + "ts-node": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "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": { @@ -3750,6 +3990,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", @@ -3904,6 +4159,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", @@ -3985,16 +4255,6 @@ "node": ">=8" } }, - "node_modules/js-sdsl": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.2.tgz", - "integrity": "sha512-dwXFwByc/ajSV6m5bcKAPwe4yDDF6D614pxmIi5odytzxRlwqF6nwoiCek80Ixc7Cvma5awClxrzFtxCQvcM8w==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/js-sdsl" - } - }, "node_modules/js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", @@ -4061,6 +4321,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", @@ -4076,15 +4345,6 @@ "node": ">=10.0.0" } }, - "node_modules/klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.9" - } - }, "node_modules/levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -4261,6 +4521,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", @@ -4281,6 +4554,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", @@ -4304,6 +4598,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", @@ -4890,6 +5193,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", @@ -4923,6 +5232,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", @@ -5083,6 +5408,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", @@ -5166,19 +5497,19 @@ "node": ">=4" } }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "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.0" + "node": ">=0.10" } }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, "engines": { "node": ">=0.10.0" @@ -5249,21 +5580,6 @@ "rlp": "bin/rlp" } }, - "node_modules/rust-verkle-wasm": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/rust-verkle-wasm/-/rust-verkle-wasm-0.0.1.tgz", - "integrity": "sha512-BN6fiTsxcd2dCECz/cHtGTt9cdLJR925nh7iAuRcj8ymKw7OOaPmCneQZ7JePOJ/ia27TjEL91VdOi88Yf+mcA==", - "dev": true - }, - "node_modules/rustbn-wasm": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/rustbn-wasm/-/rustbn-wasm-0.2.0.tgz", - "integrity": "sha512-FThvYFNTqrEKGqXuseeg0zR7yROh/6U1617mCHF68OVqrN1tNKRN7Tdwy4WayPVsCmmK+eMxtIZX1qL6JxTkMg==", - "dev": true, - "dependencies": { - "@scure/base": "^1.1.1" - } - }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -5346,6 +5662,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", @@ -5394,61 +5723,24 @@ } }, "node_modules/solc": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz", - "integrity": "sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA==", + "version": "0.8.26", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.26.tgz", + "integrity": "sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g==", "dev": true, "dependencies": { "command-exists": "^1.2.8", - "commander": "3.0.2", + "commander": "^8.1.0", "follow-redirects": "^1.12.1", - "fs-extra": "^0.30.0", "js-sha3": "0.8.0", "memorystream": "^0.3.1", - "require-from-string": "^2.0.0", "semver": "^5.5.0", "tmp": "0.0.33" }, "bin": { - "solcjs": "solcjs" + "solcjs": "solc.js" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/solc/node_modules/fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - }, - "node_modules/solc/node_modules/jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/solc/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" + "node": ">=10.0.0" } }, "node_modules/solc/node_modules/semver": { @@ -5583,6 +5875,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", @@ -5595,6 +5902,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", @@ -5924,6 +6244,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", @@ -6006,6 +6410,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 eb72157..8ef295c 100644 --- a/package.json +++ b/package.json @@ -43,18 +43,19 @@ }, "devDependencies": { "@nomicfoundation/hardhat-ethers": "3.0.5", - "@types/ejs": "^3.1.5", - "@types/snarkjs": "^0.7.8", + "@nomiclabs/hardhat-vyper": "^3.0.7", "@types/chai": "^4.3.12", "@types/chai-as-promised": "^7.1.8", + "@types/ejs": "^3.1.5", "@types/mocha": "^10.0.6", + "@types/snarkjs": "^0.7.8", "chai": "^4.4.1", "chai-as-promised": "^7.1.1", - "mocha": "^10.3.0", - "nyc": "^15.1.0", "ethers": "6.11.1", - "hardhat": "2.20.1", + "hardhat": "2.22.7", "husky": "^9.0.11", + "mocha": "^10.3.0", + "nyc": "^15.1.0", "prettier": "^3.2.5", "ts-node": "^10.9.2", "typescript": "^5.4.5" diff --git a/src/core/CircuitZKit.ts b/src/core/CircuitZKit.ts index 357222b..ee59c81 100644 --- a/src/core/CircuitZKit.ts +++ b/src/core/CircuitZKit.ts @@ -3,30 +3,30 @@ import path from "path"; import * as os from "os"; import * as snarkjs from "snarkjs"; -import { ArtifactsFileType, CircuitZKitConfig } from "../types/circuit-zkit"; +import { ArtifactsFileType, CircuitZKitConfig, VerifierLanguageType } from "../types/circuit-zkit"; import { Signals } from "../types/proof-utils"; -import { CalldataByProtocol, IProtocolImplementer, ProofStructByProtocol, ProtocolType } from "../types/protocols"; +import { CalldataByProtocol, IProtocolImplementer, ProofStructByProtocol, ProvingSystemType } from "../types/protocols"; /** * `CircuitZKit` represents a single circuit and provides a high-level API to work with it. */ -export class CircuitZKit { +export class CircuitZKit { constructor( private readonly _config: CircuitZKitConfig, private readonly _implementer: IProtocolImplementer, ) {} /** - * Creates a Solidity verifier contract. + * Creates a verifier contract for the specified contract language. */ - public async createVerifier(): Promise { + public async createVerifier(languageExtension: VerifierLanguageType): Promise { const vKeyFilePath: string = this.mustGetArtifactsFilePath("vkey"); const verifierFilePath = path.join( this._config.verifierDirPath, - `${this._implementer.getVerifierName(this._config.circuitName)}.sol`, + `${this._implementer.getVerifierName(this._config.circuitName)}.${languageExtension}`, ); - this._implementer.createVerifier(this._config.circuitName, vKeyFilePath, verifierFilePath); + this._implementer.createVerifier(this._config.circuitName, vKeyFilePath, verifierFilePath, languageExtension); } /** @@ -113,10 +113,10 @@ export class CircuitZKit { /** * Returns the type of the proving protocol * - * @returns {ProtocolType} The protocol type. + * @returns {ProvingSystemType} The protocol proving system type. */ - public getProtocolType(): ProtocolType { - return this._implementer.getProtocolType(); + public getProvingSystemType(): ProvingSystemType { + return this._implementer.getProvingSystemType(); } /** @@ -124,8 +124,8 @@ export class CircuitZKit { * * @returns {string} The Solidity verifier template. */ - public getVerifierTemplate(): string { - return this._implementer.getTemplate(); + public getVerifierTemplate(languageExtension: VerifierLanguageType): string { + return this._implementer.getTemplate(languageExtension); } /** diff --git a/src/core/protocols/AbstractImplementer.ts b/src/core/protocols/AbstractImplementer.ts index 25ca557..63f4845 100644 --- a/src/core/protocols/AbstractImplementer.ts +++ b/src/core/protocols/AbstractImplementer.ts @@ -3,11 +3,22 @@ import ejs from "ejs"; import path from "path"; import { Signals } from "../../types/proof-utils"; -import { IProtocolImplementer, ProtocolType, ProofStructByProtocol, CalldataByProtocol } from "../../types/protocols"; +import { + IProtocolImplementer, + ProvingSystemType, + ProofStructByProtocol, + CalldataByProtocol, +} from "../../types/protocols"; +import { VerifierLanguageType } from "../../types/circuit-zkit"; -export abstract class AbstractProtocolImplementer implements IProtocolImplementer { - public async createVerifier(circuitName: string, vKeyFilePath: string, verifierFilePath: string): Promise { - const verifierTemplate: string = this.getTemplate(); +export abstract class AbstractProtocolImplementer implements IProtocolImplementer { + public async createVerifier( + circuitName: string, + vKeyFilePath: string, + verifierFilePath: string, + languageExtension: VerifierLanguageType, + ): Promise { + const verifierTemplate: string = this.getTemplate(languageExtension); if (!fs.existsSync(path.dirname(verifierFilePath))) { fs.mkdirSync(path.dirname(verifierFilePath), { recursive: true }); @@ -31,26 +42,26 @@ export abstract class AbstractProtocolImplementer implem public abstract generateCalldata(proof: ProofStructByProtocol): Promise>; - public abstract getProtocolType(): ProtocolType; + public abstract getProvingSystemType(): ProvingSystemType; - public getTemplate(): string { + public getTemplate(languageExtension: VerifierLanguageType): string { return fs.readFileSync( - path.join(__dirname, "..", "templates", `verifier_${this.getProtocolType()}.sol.ejs`), + path.join(__dirname, "..", "templates", `verifier_${this.getProvingSystemType()}.${languageExtension}.ejs`), "utf8", ); } public getVerifierName(circuitName: string): string { - const protocolType: ProtocolType = this.getProtocolType(); + const protocolType: ProvingSystemType = this.getProvingSystemType(); return `${circuitName}${protocolType.charAt(0).toUpperCase() + protocolType.slice(1)}Verifier`; } public getZKeyFileName(circuitName: string): string { - return `${circuitName}.${this.getProtocolType()}.zkey`; + return `${circuitName}.${this.getProvingSystemType()}.zkey`; } public getVKeyFileName(circuitName: string): string { - return `${circuitName}.${this.getProtocolType()}.vkey.json`; + return `${circuitName}.${this.getProvingSystemType()}.vkey.json`; } } diff --git a/src/core/protocols/Groth16Implementer.ts b/src/core/protocols/Groth16Implementer.ts index 6c745d1..f2ee3bd 100644 --- a/src/core/protocols/Groth16Implementer.ts +++ b/src/core/protocols/Groth16Implementer.ts @@ -4,7 +4,7 @@ import * as snarkjs from "snarkjs"; import { AbstractProtocolImplementer } from "./AbstractImplementer"; import { Signals } from "../../types/proof-utils"; -import { Groth16ProofStruct, ProtocolType, Groth16Calldata } from "../../types/protocols"; +import { Groth16ProofStruct, ProvingSystemType, Groth16Calldata } from "../../types/protocols"; export class Groth16Implementer extends AbstractProtocolImplementer<"groth16"> { public async generateProof(inputs: Signals, zKeyFilePath: string, wasmFilePath: string): Promise { @@ -23,7 +23,7 @@ export class Groth16Implementer extends AbstractProtocolImplementer<"groth16"> { return JSON.parse(`[${calldata}]`) as Groth16Calldata; } - public getProtocolType(): ProtocolType { + public getProvingSystemType(): ProvingSystemType { return "groth16"; } } diff --git a/src/core/protocols/PlonkImplementer.ts b/src/core/protocols/PlonkImplementer.ts index c2dd637..91adc0c 100644 --- a/src/core/protocols/PlonkImplementer.ts +++ b/src/core/protocols/PlonkImplementer.ts @@ -4,7 +4,7 @@ import * as snarkjs from "snarkjs"; import { AbstractProtocolImplementer } from "./AbstractImplementer"; import { Signals } from "../../types/proof-utils"; -import { PlonkCalldata, PlonkProofStruct, ProtocolType } from "../../types/protocols"; +import { PlonkCalldata, PlonkProofStruct, ProvingSystemType } from "../../types/protocols"; export class PlonkImplementer extends AbstractProtocolImplementer<"plonk"> { public async generateProof(inputs: Signals, zKeyFilePath: string, wasmFilePath: string): Promise { @@ -26,7 +26,7 @@ export class PlonkImplementer extends AbstractProtocolImplementer<"plonk"> { ) as PlonkCalldata; } - public getProtocolType(): ProtocolType { + public getProvingSystemType(): ProvingSystemType { return "plonk"; } } diff --git a/src/core/templates/verifier_groth16.sol.ejs b/src/core/templates/verifier_groth16.sol.ejs index 3228c98..1598130 100644 --- a/src/core/templates/verifier_groth16.sol.ejs +++ b/src/core/templates/verifier_groth16.sol.ejs @@ -39,7 +39,7 @@ contract <%=verifier_id%> { uint256 public constant DELTA_Y2 = <%=vk_delta_2[1][0] -%>; - <% for (let i=0; iuint256 public constant IC<%=i%>_X = + <% for (let i = 0; i < IC.length; i++) { %>uint256 public constant IC<%=i%>_X = <%=IC[i][0]%>; uint256 public constant IC<%=i%>_Y = <%=IC[i][1]%>; @@ -53,7 +53,7 @@ contract <%=verifier_id%> { uint256[2] memory pointA_, uint256[2][2] memory pointB_, uint256[2] memory pointC_, - uint256[<%=IC.length-1%>] memory publicSignals_ + uint256[<%=IC.length - 1%>] memory publicSignals_ ) public view returns (bool verified_) { assembly { function checkField(signal_) -> res_ { @@ -88,7 +88,7 @@ contract <%=verifier_id%> { 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%>)))) { + <% for (let i = 1; i <= nPublic; i++) { %>if iszero(g1MulAdd(pointer_, IC<%=i%>_X, IC<%=i%>_Y, mload(add(pubSignals_, <%=(i - 1) * 32%>)))) { leave } <% } -%> @@ -145,7 +145,7 @@ contract <%=verifier_id%> { /// @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%>)))) + <% for (let i = 0; i < nPublic; i++) { %>verified_ := and(verified_, checkField(mload(add(publicSignals_, <%=i * 32%>)))) <% } -%> /// @dev check pairings diff --git a/src/core/templates/verifier_groth16.vy.ejs b/src/core/templates/verifier_groth16.vy.ejs new file mode 100644 index 0000000..d19af08 --- /dev/null +++ b/src/core/templates/verifier_groth16.vy.ejs @@ -0,0 +1,118 @@ +# pragma version ~=0.4.0 + +# AUTOGENERATED FILE BY HARDHAT-ZKIT. DO NOT EDIT. + +# @dev base field size +BASE_FIELD_SIZE: constant(uint256) = 21888242871839275222246405745257275088696311157297823662689037894645226208583 + +# @dev verification key data +ALPHA_X: constant(uint256) = <%=vk_alpha_1[0]%> +ALPHA_Y: constant(uint256) = <%=vk_alpha_1[1]%> +BETA_X1: constant(uint256) = <%=vk_beta_2[0][1]%> +BETA_X2: constant(uint256) = <%=vk_beta_2[0][0]%> +BETA_Y1: constant(uint256) = <%=vk_beta_2[1][1]%> +BETA_Y2: constant(uint256) = <%=vk_beta_2[1][0]%> +GAMMA_X1: constant(uint256) = <%=vk_gamma_2[0][1]%> +GAMMA_X2: constant(uint256) = <%=vk_gamma_2[0][0]%> +GAMMA_Y1: constant(uint256) = <%=vk_gamma_2[1][1]%> +GAMMA_Y2: constant(uint256) = <%=vk_gamma_2[1][0]%> +DELTA_X1: constant(uint256) = <%=vk_delta_2[0][1]%> +DELTA_X2: constant(uint256) = <%=vk_delta_2[0][0]%> +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.forEach(function(innerArray, index) { %> [ + <%= innerArray[0] %>, + <%= innerArray[1] %> + ]<%= index < IC.length - 1 ? ',' : '' %> +<% }); %>] + +EC_ADD_PRECOMPILED_ADDRESS: constant(address) = 0x0000000000000000000000000000000000000006 +EC_MUL_PRECOMPILED_ADDRESS: constant(address) = 0x0000000000000000000000000000000000000007 +EC_PAIRING_PRECOMPILED_ADDRESS: constant(address) = 0x0000000000000000000000000000000000000008 + + +@view +@external +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: + return False + + return self._checkPairing(pointA, pointB, pointC, publicSignals) + + +@view +@internal +def _g1MulAdd(pR: uint256[2], pP: uint256[2], s: uint256) -> (bool, uint256[2]): + success: bool = True + response: Bytes[64] = b"" + success, response = raw_call( + EC_MUL_PRECOMPILED_ADDRESS, + abi_encode(pP, s), + max_outsize=64, + is_static_call=True, + revert_on_failure=False + ) + + if not success or len(response) != 64: + return (False, [0, 0]) + + x: uint256 = convert(slice(response, 0, 32), uint256) + y: uint256 = convert(slice(response, 32, 32), uint256) + pS: uint256[2] = [x, y] + + success, response = raw_call( + EC_ADD_PRECOMPILED_ADDRESS, + abi_encode(pR, pS), + max_outsize=64, + is_static_call=True, + revert_on_failure=False + ) + + if not success or len(response) != 64: + return (False, [0, 0]) + + x = convert(slice(response, 0, 32), uint256) + y = convert(slice(response, 32, 32), uint256) + + return (True, [x, y]) + + +@view +@internal +def _checkPairing(pA: uint256[2], pB: uint256[2][2], pC: uint256[2], pubSignals: uint256[<%=IC.length-1%>]) -> bool: + success: bool = True + mulAddResult: uint256[2] = IC[0] + + # @dev compute the linear combination of public signals + for i: uint256 in range(1, <%=IC.length%>): + success, mulAddResult = self._g1MulAdd(mulAddResult, IC[i], pubSignals[i - 1]) + if not success: + return False + + response: Bytes[32] = b"" + success, response = raw_call( + EC_PAIRING_PRECOMPILED_ADDRESS, + abi_encode( + pA[0], (BASE_FIELD_SIZE - pA[1]) % BASE_FIELD_SIZE, + pB, + ALPHA_X, ALPHA_Y, + BETA_X1, BETA_X2, BETA_Y1, BETA_Y2, + mulAddResult, + GAMMA_X1, GAMMA_X2, GAMMA_Y1, GAMMA_Y2, + pC, + DELTA_X1, DELTA_X2, DELTA_Y1, DELTA_Y2 + ), + max_outsize=32, + is_static_call=True, + revert_on_failure=False + ) + + if not success: + return False + + return convert(response, bool) diff --git a/src/types/circuit-zkit.ts b/src/types/circuit-zkit.ts index f4558a2..9f0a3e7 100644 --- a/src/types/circuit-zkit.ts +++ b/src/types/circuit-zkit.ts @@ -1,4 +1,5 @@ export type ArtifactsFileType = "r1cs" | "zkey" | "vkey" | "sym" | "json" | "wasm"; +export type VerifierLanguageType = "sol" | "vy"; export type CircuitZKitConfig = { circuitName: string; diff --git a/src/types/protocols/index.ts b/src/types/protocols/index.ts index 9742a6c..18bd840 100644 --- a/src/types/protocols/index.ts +++ b/src/types/protocols/index.ts @@ -2,12 +2,18 @@ import { Groth16ProofStruct, Groth16Calldata } from "./groth16"; import { PlonkProofStruct, PlonkCalldata } from "./plonk"; import { Signals } from "../proof-utils"; +import { VerifierLanguageType } from "../circuit-zkit"; export * from "./groth16"; export * from "./plonk"; -export interface IProtocolImplementer { - createVerifier(circuitName: string, vKeyFilePath: string, verifierFilePath: string): Promise; +export interface IProtocolImplementer { + createVerifier( + circuitName: string, + vKeyFilePath: string, + verifierFilePath: string, + languageExtension: VerifierLanguageType, + ): Promise; generateProof(inputs: Signals, zKeyFilePath: string, wasmFilePath: string): Promise>; @@ -15,9 +21,9 @@ export interface IProtocolImplementer { generateCalldata(proof: ProofStructByProtocol): Promise>; - getProtocolType(): ProtocolType; + getProvingSystemType(): ProvingSystemType; - getTemplate(): string; + getTemplate(fileExtension: VerifierLanguageType): string; getVerifierName(circuitName: string): string; @@ -26,7 +32,7 @@ export interface IProtocolImplementer { getVKeyFileName(circuitName: string): string; } -export interface ProofStructMap { +export interface ProvingSystemStructMap { groth16: { proofStruct: Groth16ProofStruct; calldata: Groth16Calldata; @@ -37,7 +43,7 @@ export interface ProofStructMap { }; } -export type ProtocolType = keyof ProofStructMap; +export type ProvingSystemType = keyof ProvingSystemStructMap; -export type ProofStructByProtocol = ProofStructMap[T]["proofStruct"]; -export type CalldataByProtocol = ProofStructMap[T]["calldata"]; +export type ProofStructByProtocol = ProvingSystemStructMap[T]["proofStruct"]; +export type CalldataByProtocol = ProvingSystemStructMap[T]["calldata"]; diff --git a/test/CircuitZKit.test.ts b/test/CircuitZKit.test.ts index 734e050..690e39b 100644 --- a/test/CircuitZKit.test.ts +++ b/test/CircuitZKit.test.ts @@ -11,7 +11,7 @@ import { CircuitZKitConfig, Groth16Implementer, PlonkImplementer, - ProtocolType, + ProvingSystemType, IProtocolImplementer, Groth16ProofStruct, PlonkProofStruct, @@ -28,9 +28,9 @@ describe("CircuitZKit", () => { return path.join(process.cwd(), "contracts", "verifiers"); } - function getCircuitZKit( + function getCircuitZKit( circuitName: string, - protocolType: ProtocolType, + protocolType: ProvingSystemType, config?: CircuitZKitConfig, ): CircuitZKit { let implementer: IProtocolImplementer; @@ -67,12 +67,12 @@ describe("CircuitZKit", () => { expect(multiplierCircuit.getCircuitName()).to.be.eq(circuitName); expect(multiplierCircuit.getVerifierName()).to.be.eq(`${circuitName}Groth16Verifier`); - expect(multiplierCircuit.getProtocolType()).to.be.eq("groth16"); + expect(multiplierCircuit.getProvingSystemType()).to.be.eq("groth16"); }); }); describe("getTemplate", () => { - it("should return correct 'groth16' template", async () => { + it("should return correct 'groth16' Solidity template", async () => { const multiplierCircuit = getCircuitZKit<"groth16">("Multiplier", "groth16"); const groth16TemplatePath: string = path.join( @@ -84,10 +84,25 @@ describe("CircuitZKit", () => { "verifier_groth16.sol.ejs", ); - expect(multiplierCircuit.getVerifierTemplate()).to.be.eq(fs.readFileSync(groth16TemplatePath, "utf-8")); + expect(multiplierCircuit.getVerifierTemplate("sol")).to.be.eq(fs.readFileSync(groth16TemplatePath, "utf-8")); }); - it("should return correct 'plonk' template", async () => { + it("should return correct 'groth16' Vyper template", async () => { + const multiplierCircuit = getCircuitZKit<"groth16">("Multiplier", "groth16"); + + const groth16TemplatePath: string = path.join( + __dirname, + "..", + "src", + "core", + "templates", + "verifier_groth16.vy.ejs", + ); + + expect(multiplierCircuit.getVerifierTemplate("vy")).to.be.eq(fs.readFileSync(groth16TemplatePath, "utf-8")); + }); + + it("should return correct 'plonk' Solidity template", async () => { const multiplierCircuit = getCircuitZKit<"plonk">("Multiplier", "plonk"); const plonkTemplatePath: string = path.join( @@ -99,7 +114,7 @@ describe("CircuitZKit", () => { "verifier_plonk.sol.ejs", ); - expect(multiplierCircuit.getVerifierTemplate()).to.be.eq(fs.readFileSync(plonkTemplatePath, "utf-8")); + expect(multiplierCircuit.getVerifierTemplate("sol")).to.be.eq(fs.readFileSync(plonkTemplatePath, "utf-8")); }); }); @@ -110,11 +125,11 @@ describe("CircuitZKit", () => { fs.rmSync(getVerifiersDirFullPath(), { recursive: true, force: true }); }); - it("should correctly create 'groth16' verifier file", async () => { + it("should correctly create 'groth16' Solidity verifier file", async () => { const circuitName = "Multiplier"; const verifierDirPath = getVerifiersDirFullPath(); const artifactsDirFullPath = getArtifactsFullPath(`${circuitName}.circom`); - const protocolType: ProtocolType = "groth16"; + const protocolType: ProvingSystemType = "groth16"; const multiplierCircuit = getCircuitZKit<"groth16">(circuitName, "groth16", { circuitName, @@ -128,14 +143,14 @@ describe("CircuitZKit", () => { expect(fs.existsSync(expectedVerifierFilePath)).to.be.false; - await multiplierCircuit.createVerifier(); + await multiplierCircuit.createVerifier("sol"); expect(fs.existsSync(expectedVerifierFilePath)).to.be.true; const expectedVKeyFilePath = path.join(artifactsDirFullPath, `${circuitName}.${protocolType}.vkey.json`); expect(multiplierCircuit.getArtifactsFilePath("vkey")).to.be.eq(expectedVKeyFilePath); - const template = multiplierCircuit.getVerifierTemplate(); + const template = multiplierCircuit.getVerifierTemplate("sol"); const templateParams = JSON.parse(fs.readFileSync(expectedVKeyFilePath, "utf-8")); templateParams["verifier_id"] = multiplierCircuit.getVerifierName(); @@ -146,7 +161,7 @@ describe("CircuitZKit", () => { const circuitName = "Multiplier"; const verifierDirPath = getVerifiersDirFullPath(); const artifactsDirFullPath = getArtifactsFullPath(`${circuitName}.circom`); - const protocolType: ProtocolType = "plonk"; + const protocolType: ProvingSystemType = "plonk"; const multiplierCircuit = getCircuitZKit<"plonk">(circuitName, "plonk", { circuitName, @@ -160,14 +175,14 @@ describe("CircuitZKit", () => { expect(fs.existsSync(expectedVerifierFilePath)).to.be.false; - await multiplierCircuit.createVerifier(); + await multiplierCircuit.createVerifier("sol"); expect(fs.existsSync(expectedVerifierFilePath)).to.be.true; const expectedVKeyFilePath = path.join(artifactsDirFullPath, `${circuitName}.${protocolType}.vkey.json`); expect(multiplierCircuit.getArtifactsFilePath("vkey")).to.be.eq(expectedVKeyFilePath); - const template = multiplierCircuit.getVerifierTemplate(); + const template = multiplierCircuit.getVerifierTemplate("sol"); const templateParams = JSON.parse(fs.readFileSync(expectedVKeyFilePath, "utf-8")); templateParams["verifier_id"] = multiplierCircuit.getVerifierName(); @@ -187,10 +202,10 @@ describe("CircuitZKit", () => { const expectedVerifierFilePath = path.join(verifierDirPath, `${multiplierCircuit.getVerifierName()}.sol`); - await multiplierCircuit.createVerifier(); + await multiplierCircuit.createVerifier("sol"); expect(fs.existsSync(expectedVerifierFilePath)).to.be.true; - await this.hre.run("compile", { quiet: true }); + await this.hre.run("compile", { quiet: true, force: true }); const proof = await multiplierCircuit.generateProof({ a: 10, @@ -221,7 +236,7 @@ describe("CircuitZKit", () => { const expectedVerifierFilePath = path.join(verifierDirPath, `${multiplierCircuit.getVerifierName()}.sol`); - await multiplierCircuit.createVerifier(); + await multiplierCircuit.createVerifier("sol"); expect(fs.existsSync(expectedVerifierFilePath)).to.be.true; await this.hre.run("compile", { quiet: true }); @@ -246,7 +261,7 @@ describe("CircuitZKit", () => { const circuitName = "Multiplier"; const verifierDirPath = getVerifiersDirFullPath(); const artifactsDirFullPath = getArtifactsFullPath(`${circuitName}.circom`); - const protocolType: ProtocolType = "groth16"; + const protocolType: ProvingSystemType = "groth16"; const multiplierCircuit = getCircuitZKit<"groth16">(circuitName, protocolType, { circuitName, @@ -256,16 +271,16 @@ describe("CircuitZKit", () => { const expectedVerifierFilePath = path.join(verifierDirPath, `${multiplierCircuit.getVerifierName()}.sol`); - await multiplierCircuit.createVerifier(); + await multiplierCircuit.createVerifier("sol"); expect(fs.existsSync(expectedVerifierFilePath)).to.be.true; - await multiplierCircuit.createVerifier(); + await multiplierCircuit.createVerifier("sol"); expect(fs.existsSync(expectedVerifierFilePath)).to.be.true; const expectedVKeyFilePath = path.join(artifactsDirFullPath, `${circuitName}.${protocolType}.vkey.json`); expect(multiplierCircuit.getArtifactsFilePath("vkey")).to.be.eq(expectedVKeyFilePath); - const template = multiplierCircuit.getVerifierTemplate(); + const template = multiplierCircuit.getVerifierTemplate("sol"); const templateParams = JSON.parse(fs.readFileSync(expectedVKeyFilePath, "utf-8")); templateParams["verifier_id"] = multiplierCircuit.getVerifierName(); @@ -283,7 +298,7 @@ describe("CircuitZKit", () => { const invalidVKeyFilePath = multiplierCircuit.getArtifactsFilePath("vkey"); - await expect(multiplierCircuit.createVerifier()).to.be.rejectedWith( + await expect(multiplierCircuit.createVerifier("sol")).to.be.rejectedWith( `Expected the file "${invalidVKeyFilePath}" to exist`, ); }); @@ -359,7 +374,7 @@ describe("CircuitZKit", () => { const multiplierCircuit = getCircuitZKit<"groth16">(circuitName, "groth16"); - await multiplierCircuit.createVerifier(); + await multiplierCircuit.createVerifier("sol"); await this.hre.run("compile", { quiet: true }); @@ -380,7 +395,7 @@ describe("CircuitZKit", () => { const multiplierCircuit = getCircuitZKit<"plonk">(circuitName, "plonk"); - await multiplierCircuit.createVerifier(); + await multiplierCircuit.createVerifier("sol"); await this.hre.run("compile", { quiet: true }); diff --git a/test/fixture-projects/hardhat.config.ts b/test/fixture-projects/hardhat.config.ts index 7911eb0..d7ece01 100644 --- a/test/fixture-projects/hardhat.config.ts +++ b/test/fixture-projects/hardhat.config.ts @@ -1,6 +1,7 @@ import { HardhatUserConfig } from "hardhat/config"; import "@nomicfoundation/hardhat-ethers"; +import "@nomiclabs/hardhat-vyper"; const config: HardhatUserConfig = { networks: { @@ -18,6 +19,9 @@ const config: HardhatUserConfig = { evmVersion: "paris", }, }, + vyper: { + version: "0.4.0", + }, }; export default config;