From 9792556729c04c0e4e0a8ed680e37ffa443fcb3f Mon Sep 17 00:00:00 2001 From: Vasiliy Olekhov Date: Fri, 10 Nov 2023 10:51:24 +0300 Subject: [PATCH 1/6] Added events, added event handling in hardhat and moved gas estimation from solidity to hardhat #86 --- contracts/interfaces/modular_verifier.sol | 39 ++++++++++++++++++- .../zkllvm/circuit1/modular_verifier.sol | 18 ++++----- .../zkllvm/circuit2/modular_verifier.sol | 18 ++++----- .../zkllvm/circuit3/modular_verifier.sol | 18 ++++----- .../zkllvm/circuit4/modular_verifier.sol | 18 ++++----- .../zkllvm/circuit6/modular_verifier.sol | 18 ++++----- tasks/modular-test.ts | 16 ++++++-- 7 files changed, 95 insertions(+), 50 deletions(-) diff --git a/contracts/interfaces/modular_verifier.sol b/contracts/interfaces/modular_verifier.sol index 7624bbb..358c5eb 100644 --- a/contracts/interfaces/modular_verifier.sol +++ b/contracts/interfaces/modular_verifier.sol @@ -16,16 +16,51 @@ //---------------------------------------------------------------------------// pragma solidity ^0.8.0; +/** + * @dev Interface class to verify Placeholder proof + */ interface IModularVerifier { + + /** + * @dev Emitted when public input is wrong + */ + event WrongPublicInput(); + + /** + * @dev Emitted when commitment is wrong + */ + event WrongCommitment(); + + /** + * @dev Emitted when table does not satisfy constraint system + */ + event ConstraintSystemNotSatisfied(); + + /** + * @dev Emitted when proof is verified + */ + event ProofVerified(); + + /** + * @dev Emitted when proof verification failed + */ + event ProofVerificationFailed(); + + + /** + * @dev Initializes verifier + */ function initialize( -// address permutation_argument_contract_address, address lookup_argument_contract_address, address gate_argument_contract_address, address commitment_contract_address ) external; + /** + * @dev Verifies proof + */ function verify( bytes calldata blob, uint256[] calldata public_input - ) external view returns (bool result); + ) external returns (bool result); } diff --git a/contracts/zkllvm/circuit1/modular_verifier.sol b/contracts/zkllvm/circuit1/modular_verifier.sol index e9febc4..ce849e8 100644 --- a/contracts/zkllvm/circuit1/modular_verifier.sol +++ b/contracts/zkllvm/circuit1/modular_verifier.sol @@ -76,7 +76,6 @@ contract modular_verifier_circuit1 is IModularVerifier{ uint256 Z_at_xi; uint256 l0; uint256[f_parts] F; - uint256 gas; bool b; } @@ -124,10 +123,9 @@ contract modular_verifier_circuit1 is IModularVerifier{ function verify( bytes calldata blob, uint256[] calldata public_input - ) public view returns (bool result) { + ) public returns (bool result) { verifier_state memory state; state.b = true; - state.gas = gasleft(); state.xi = basic_marshalling.get_uint256_be(blob, 0x79); state.Z_at_xi = addmod(field.pow_small(state.xi, rows_amount, modulus), modulus-1, modulus); state.l0 = mulmod( @@ -139,7 +137,7 @@ contract modular_verifier_circuit1 is IModularVerifier{ //0. Direct public input check if(public_input.length > 0) { if (!public_input_direct(blob[865:865+320], public_input, state)) { - console.log("Wrong public input!"); + emit WrongPublicInput(); state.b = false; } } @@ -198,7 +196,6 @@ contract modular_verifier_circuit1 is IModularVerifier{ F_consolidated = addmod(F_consolidated, mulmod(state.F[i],transcript.get_field_challenge(tr_state, modulus), modulus), modulus); unchecked{i++;} } - uint256 points_num = basic_marshalling.get_length(blob, 0x79 + 0x20); transcript.update_transcript_b32_by_offset_calldata(tr_state, blob, 0x59); } @@ -214,7 +211,7 @@ contract modular_verifier_circuit1 is IModularVerifier{ if(!modular_commitment_scheme_circuit1.verify_eval( blob[z_offset - 0x8:], commitments, state.xi, tr_state.current_challenge )) { - console.log("Error from commitment scheme!"); + emit WrongCommitment(); state.b = false; } } @@ -233,13 +230,16 @@ contract modular_verifier_circuit1 is IModularVerifier{ unchecked{i++;} } if( F_consolidated != mulmod(T_consolidated, state.Z_at_xi, modulus) ) { - console.log("Error. Table does't satisfy constraint system"); + emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) console.log("SUCCESS!"); else console.log("FAILURE!"); + if(state.b) { + emit ProofVerified(); + } else { + emit ProofVerificationFailed(); + } } - console.log("Gas for verification:", state.gas-gasleft()); result = state.b; } } diff --git a/contracts/zkllvm/circuit2/modular_verifier.sol b/contracts/zkllvm/circuit2/modular_verifier.sol index 8fcdd4c..710c3db 100644 --- a/contracts/zkllvm/circuit2/modular_verifier.sol +++ b/contracts/zkllvm/circuit2/modular_verifier.sol @@ -76,7 +76,6 @@ contract modular_verifier_circuit2 is IModularVerifier{ uint256 Z_at_xi; uint256 l0; uint256[f_parts] F; - uint256 gas; bool b; } @@ -124,10 +123,9 @@ contract modular_verifier_circuit2 is IModularVerifier{ function verify( bytes calldata blob, uint256[] calldata public_input - ) public view returns (bool result) { + ) public returns (bool result) { verifier_state memory state; state.b = true; - state.gas = gasleft(); state.xi = basic_marshalling.get_uint256_be(blob, 0x79); state.Z_at_xi = addmod(field.pow_small(state.xi, rows_amount, modulus), modulus-1, modulus); state.l0 = mulmod( @@ -139,7 +137,7 @@ contract modular_verifier_circuit2 is IModularVerifier{ //0. Direct public input check if(public_input.length > 0) { if (!public_input_direct(blob[865:865+352], public_input, state)) { - console.log("Wrong public input!"); + emit WrongPublicInput(); state.b = false; } } @@ -198,7 +196,6 @@ contract modular_verifier_circuit2 is IModularVerifier{ F_consolidated = addmod(F_consolidated, mulmod(state.F[i],transcript.get_field_challenge(tr_state, modulus), modulus), modulus); unchecked{i++;} } - uint256 points_num = basic_marshalling.get_length(blob, 0x79 + 0x20); transcript.update_transcript_b32_by_offset_calldata(tr_state, blob, 0x59); } @@ -214,7 +211,7 @@ contract modular_verifier_circuit2 is IModularVerifier{ if(!modular_commitment_scheme_circuit2.verify_eval( blob[z_offset - 0x8:], commitments, state.xi, tr_state.current_challenge )) { - console.log("Error from commitment scheme!"); + emit WrongCommitment(); state.b = false; } } @@ -233,13 +230,16 @@ contract modular_verifier_circuit2 is IModularVerifier{ unchecked{i++;} } if( F_consolidated != mulmod(T_consolidated, state.Z_at_xi, modulus) ) { - console.log("Error. Table does't satisfy constraint system"); + emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) console.log("SUCCESS!"); else console.log("FAILURE!"); + if(state.b) { + emit ProofVerified(); + } else { + emit ProofVerificationFailed(); + } } - console.log("Gas for verification:", state.gas-gasleft()); result = state.b; } } diff --git a/contracts/zkllvm/circuit3/modular_verifier.sol b/contracts/zkllvm/circuit3/modular_verifier.sol index 2682eff..fdf554d 100644 --- a/contracts/zkllvm/circuit3/modular_verifier.sol +++ b/contracts/zkllvm/circuit3/modular_verifier.sol @@ -76,7 +76,6 @@ contract modular_verifier_circuit3 is IModularVerifier{ uint256 Z_at_xi; uint256 l0; uint256[f_parts] F; - uint256 gas; bool b; } @@ -124,10 +123,9 @@ contract modular_verifier_circuit3 is IModularVerifier{ function verify( bytes calldata blob, uint256[] calldata public_input - ) public view returns (bool result) { + ) public returns (bool result) { verifier_state memory state; state.b = true; - state.gas = gasleft(); state.xi = basic_marshalling.get_uint256_be(blob, 0xa1); state.Z_at_xi = addmod(field.pow_small(state.xi, rows_amount, modulus), modulus-1, modulus); state.l0 = mulmod( @@ -139,7 +137,7 @@ contract modular_verifier_circuit3 is IModularVerifier{ //0. Direct public input check if(public_input.length > 0) { if (!public_input_direct(blob[905:905+672], public_input, state)) { - console.log("Wrong public input!"); + emit WrongPublicInput(); state.b = false; } } @@ -216,7 +214,6 @@ contract modular_verifier_circuit3 is IModularVerifier{ F_consolidated = addmod(F_consolidated, mulmod(state.F[i],transcript.get_field_challenge(tr_state, modulus), modulus), modulus); unchecked{i++;} } - uint256 points_num = basic_marshalling.get_length(blob, 0xa1 + 0x20); transcript.update_transcript_b32_by_offset_calldata(tr_state, blob, 0x59); } @@ -232,7 +229,7 @@ contract modular_verifier_circuit3 is IModularVerifier{ if(!modular_commitment_scheme_circuit3.verify_eval( blob[z_offset - 0x8:], commitments, state.xi, tr_state.current_challenge )) { - console.log("Error from commitment scheme!"); + emit WrongCommitment(); state.b = false; } } @@ -251,13 +248,16 @@ contract modular_verifier_circuit3 is IModularVerifier{ unchecked{i++;} } if( F_consolidated != mulmod(T_consolidated, state.Z_at_xi, modulus) ) { - console.log("Error. Table does't satisfy constraint system"); + emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) console.log("SUCCESS!"); else console.log("FAILURE!"); + if(state.b) { + emit ProofVerified(); + } else { + emit ProofVerificationFailed(); + } } - console.log("Gas for verification:", state.gas-gasleft()); result = state.b; } } diff --git a/contracts/zkllvm/circuit4/modular_verifier.sol b/contracts/zkllvm/circuit4/modular_verifier.sol index c37b62f..adde601 100644 --- a/contracts/zkllvm/circuit4/modular_verifier.sol +++ b/contracts/zkllvm/circuit4/modular_verifier.sol @@ -76,7 +76,6 @@ contract modular_verifier_circuit4 is IModularVerifier{ uint256 Z_at_xi; uint256 l0; uint256[f_parts] F; - uint256 gas; bool b; } @@ -124,10 +123,9 @@ contract modular_verifier_circuit4 is IModularVerifier{ function verify( bytes calldata blob, uint256[] calldata public_input - ) public view returns (bool result) { + ) public returns (bool result) { verifier_state memory state; state.b = true; - state.gas = gasleft(); state.xi = basic_marshalling.get_uint256_be(blob, 0xa1); state.Z_at_xi = addmod(field.pow_small(state.xi, rows_amount, modulus), modulus-1, modulus); state.l0 = mulmod( @@ -139,7 +137,7 @@ contract modular_verifier_circuit4 is IModularVerifier{ //0. Direct public input check if(public_input.length > 0) { if (!public_input_direct(blob[905:905+736], public_input, state)) { - console.log("Wrong public input!"); + emit WrongPublicInput(); state.b = false; } } @@ -216,7 +214,6 @@ contract modular_verifier_circuit4 is IModularVerifier{ F_consolidated = addmod(F_consolidated, mulmod(state.F[i],transcript.get_field_challenge(tr_state, modulus), modulus), modulus); unchecked{i++;} } - uint256 points_num = basic_marshalling.get_length(blob, 0xa1 + 0x20); transcript.update_transcript_b32_by_offset_calldata(tr_state, blob, 0x59); } @@ -232,7 +229,7 @@ contract modular_verifier_circuit4 is IModularVerifier{ if(!modular_commitment_scheme_circuit4.verify_eval( blob[z_offset - 0x8:], commitments, state.xi, tr_state.current_challenge )) { - console.log("Error from commitment scheme!"); + emit WrongCommitment(); state.b = false; } } @@ -251,13 +248,16 @@ contract modular_verifier_circuit4 is IModularVerifier{ unchecked{i++;} } if( F_consolidated != mulmod(T_consolidated, state.Z_at_xi, modulus) ) { - console.log("Error. Table does't satisfy constraint system"); + emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) console.log("SUCCESS!"); else console.log("FAILURE!"); + if(state.b) { + emit ProofVerified(); + } else { + emit ProofVerificationFailed(); + } } - console.log("Gas for verification:", state.gas-gasleft()); result = state.b; } } diff --git a/contracts/zkllvm/circuit6/modular_verifier.sol b/contracts/zkllvm/circuit6/modular_verifier.sol index e8381db..6f6cad5 100644 --- a/contracts/zkllvm/circuit6/modular_verifier.sol +++ b/contracts/zkllvm/circuit6/modular_verifier.sol @@ -76,7 +76,6 @@ contract modular_verifier_circuit6 is IModularVerifier{ uint256 Z_at_xi; uint256 l0; uint256[f_parts] F; - uint256 gas; bool b; } @@ -124,10 +123,9 @@ contract modular_verifier_circuit6 is IModularVerifier{ function verify( bytes calldata blob, uint256[] calldata public_input - ) public view returns (bool result) { + ) public returns (bool result) { verifier_state memory state; state.b = true; - state.gas = gasleft(); state.xi = basic_marshalling.get_uint256_be(blob, 0xa1); state.Z_at_xi = addmod(field.pow_small(state.xi, rows_amount, modulus), modulus-1, modulus); state.l0 = mulmod( @@ -139,7 +137,7 @@ contract modular_verifier_circuit6 is IModularVerifier{ //0. Direct public input check if(public_input.length > 0) { if (!public_input_direct(blob[905:905+736], public_input, state)) { - console.log("Wrong public input!"); + emit WrongPublicInput(); state.b = false; } } @@ -216,7 +214,6 @@ contract modular_verifier_circuit6 is IModularVerifier{ F_consolidated = addmod(F_consolidated, mulmod(state.F[i],transcript.get_field_challenge(tr_state, modulus), modulus), modulus); unchecked{i++;} } - uint256 points_num = basic_marshalling.get_length(blob, 0xa1 + 0x20); transcript.update_transcript_b32_by_offset_calldata(tr_state, blob, 0x59); } @@ -232,7 +229,7 @@ contract modular_verifier_circuit6 is IModularVerifier{ if(!modular_commitment_scheme_circuit6.verify_eval( blob[z_offset - 0x8:], commitments, state.xi, tr_state.current_challenge )) { - console.log("Error from commitment scheme!"); + emit WrongCommitment(); state.b = false; } } @@ -251,13 +248,16 @@ contract modular_verifier_circuit6 is IModularVerifier{ unchecked{i++;} } if( F_consolidated != mulmod(T_consolidated, state.Z_at_xi, modulus) ) { - console.log("Error. Table does't satisfy constraint system"); + emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) console.log("SUCCESS!"); else console.log("FAILURE!"); + if(state.b) { + emit ProofVerified(); + } else { + emit ProofVerificationFailed(); + } } - console.log("Gas for verification:", state.gas-gasleft()); result = state.b; } } diff --git a/tasks/modular-test.ts b/tasks/modular-test.ts index c3949f4..598450a 100644 --- a/tasks/modular-test.ts +++ b/tasks/modular-test.ts @@ -199,7 +199,12 @@ task("verify-circuit-proof-all") console.log("Verify :",proof_path); let proof = loadProof(proof_path); let public_input = loadPublicInput(folder_path + "/input.json"); - await verifier_contract.verify(proof, public_input, {gasLimit: 30_500_000}); + let receipt = await(await verifier_contract.verify(proof, public_input, {gasLimit: 30_500_000})).wait(); + console.log("Gas used: ⛽ ", receipt.gasUsed.toNumber()); + console.log("Events received:"); + for(const e of receipt.events) { + console.log(e.event); + } console.log("===================================="); // proof_path = folder_path + "/proof2.bin"; @@ -236,11 +241,16 @@ task("verify-circuit-proof") console.log("Verify :",proof_path); let proof = loadProof(proof_path); let public_input = loadPublicInput(folder_path + "/input.json"); - await verifier_contract.verify(proof, public_input, {gasLimit: 30_500_000}); + let receipt = await (await verifier_contract.verify(proof, public_input, {gasLimit: 30_500_000})).wait(); + console.log("Gas used: ⛽ ", receipt.gasUsed.toNumber()); + console.log("Events received:"); + for(const e of receipt.events) { + console.log(e.event); + } console.log("===================================="); // proof_path = folder_path + "/proof2.bin"; // console.log("Verify :",proof_path); // proof = loadProof(proof_path); // await verifier_contract.verify(proof, {gasLimit: 30_500_000}); -}); \ No newline at end of file +}); From fde4cd071415e4ee6794ac8468836460f12104c9 Mon Sep 17 00:00:00 2001 From: Alexandra Mirzuitova Date: Fri, 25 Aug 2023 22:31:09 +0700 Subject: [PATCH 2/6] Update README.md --- README.md | 123 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 84 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 311eb8c..d3665fb 100644 --- a/README.md +++ b/README.md @@ -1,91 +1,136 @@ -# EVM Placeholder Proof System Verifier +# EVM Placeholder proof system verifier [![Discord](https://img.shields.io/discord/969303013749579846.svg?logo=discord&style=flat-square)](https://discord.gg/KmTAEjbmM3) [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=flat-square&logo=telegram&logoColor=dark)](https://t.me/nilfoundation) [![Twitter](https://img.shields.io/twitter/follow/nil_foundation)](https://twitter.com/nil_foundation) -This repository contains the smart contracts for validating zero knowledge proofs -generated in placeholder proof system in EVM. +An application for in-EVM validation of zero-knowledge proofs generated +with +the [Placeholder proof system](https://nil.foundation/blog/post/placeholder-proofsystem). ## Dependencies - [Hardhat](https://hardhat.org/) -- [nodejs](https://nodejs.org/en/) >= 16.0 +- [Node.js](https://nodejs.org/) - Hardhat requires an LTS version of Node.js; as of September 2023 it's v18 +## Contract Addresses -## Clone +| Network | Address | +| ----------- | ----------- | +| Sepolia | [`0x489dbc0762b3d9bd9843db11eecd2a177d84ba2b`](https://sepolia.etherscan.io/address/0x489dbc0762b3d9bd9843db11eecd2a177d84ba2b) | + +## Installing with npm + +You can install the package via `npm` from the command line: + +```bash +npm install @nilfoundation/evm-placeholder-verification@1.1.1 +``` + +or add it to the `package.json` file manually: + +```json +"@nilfoundation/evm-placeholder-verification": "1.1.1" ``` + +## Contributing + +Clone the project from GitHub: + +```bash git clone git@github.com:NilFoundation/evm-placeholder-verification.git +``` + +After that, navigate to the `evm-placeholder-verification` directory: + +```bash cd evm-placeholder-verification ``` ## Install dependency packages -``` + +```bash npm i ``` ## Compile contracts -``` + +```bash npx hardhat compile ``` ## Deploy -Launch a local-network using the following -``` +Launch a local network using the following command: + +```bash npx hardhat node ``` -To deploy to test environment (ex: Ganache) -``` -npx hardhat deploy --network localhost +Don't close the terminal and don't finish this process, the Hardhat node should be +running for the next steps. + +To deploy to a test environment (Ganache, for example), run the following +from another terminal: + +```bash +npx hardhat deploy --network localhost ``` -Hardhat re-uses old deployments, to force re-deploy add the `--reset` flag above +Hardhat reuses old deployments by default; to force re-deploy, +add the `--reset` flag to the command. + +## Testing + +Tests are located in the `test` directory. +To run tests: + +```bash +npx hardhat test # Execute tests +REPORT_GAS=true npx hardhat test # Test with gas reporting +``` -## Verification of zkLLVM circtuit compiler output +## Local verification of zkLLVM circuit compiler output -zkLLVM compiler prepares circuits in form of instantiated contracts, which have to be deployed to the blockchain. +[zkLLVM compiler](https://github.com/NilFoundation/zkllvm) prepares circuits +as instantiated contracts that can be deployed to a blockchain. -Once you got zkLLVM output - put a circuit directory it under `contracts/zkllvm`. The folder should contain following files: +Once you get zkLLVM output, create a circuit directory under `contracts/zkllvm` for your output. +That directory should contain the following files: ``` -* proof.bin -- placeholder proof file -* circuit_params.json -- parameters file in JSON format -* public_input.json -- public input file in JSON format -* linked_libs_list.json -- list of external libraries, have to be deployed for gate argument computation. -* gate_argument.sol, gate0.sol, ... gateN.sol -- solidity files with gate argument computation +* proof.bin — Placeholder proof file +* circuit_params.json — parameters file +* public_input.json — file with public input +* linked_libs_list.json — list of external libraries that have to be deployed for gate argument computation +* gate_argument.sol, gate0.sol, ... gateN.sol — Solidity files with gate argument computation ``` -If all the files are in place - you can deploy the circuit verifier to the blockchain and verify the proofs. +If all these files are in place, you can deploy the verifier app and verify the proofs. You only need to deploy the verifier once, and then you can verify as many proofs as you want. -Deploy contracts -``` +Deploying the contracts: + +```bash npx hardhat deploy ``` -If you've put the circuit under, let's say, `contracts/zkllvm/circuit-name` directory, you can verify the proofs with the following command: -``` -npx hardhat verify-circuit-proof --test circuit-name -``` +If you've put the files under, let's say, `contracts/zkllvm/circuit-name` directory, +you can verify the proofs with the following: -To verify all circuits from `contracts/zkllvm` directory: -``` -npx hardhat verify-circuit-proof-all +```bash +npx hardhat verify-circuit-proof --test circuit-name ``` -## Testing - -Tests are located in `test` directory. To run tests: +To verify all circuits from `contracts/zkllvm` directory, run: -``` -npx hardhat test #Execute tests -REPORT_GAS=true npx hardhat test # Test with gas reporting +```bash +npx hardhat verify-circuit-proof-all ``` ## Community -Issue reports are preferred to be done with Github Issues in here: https://github.com/NilFoundation/evm-placeholder-verification/issues. +Submit your issue reports to the project's [Github Issues](https://github.com/NilFoundation/evm-placeholder-verification/issues). -Usage and development questions are preferred to be asked in a Telegram chat: https://t.me/nilfoundation or in Discord (https://discord.gg/KmTAEjbmM3) +Join us on our [Discord server](https://discord.gg/KmTAEjbmM3) or in our [Telegram chat](https://t.me/nilfoundation) +and ask your questions about the verifier's usage and development. From f84763b235eedf7445e40fd361927e6aab668bb2 Mon Sep 17 00:00:00 2001 From: Vasiliy Olekhov Date: Wed, 15 Nov 2023 15:25:21 +0300 Subject: [PATCH 3/6] Reworked tests runner and public input reader --- tasks/modular-test.ts | 142 ++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 76 deletions(-) diff --git a/tasks/modular-test.ts b/tasks/modular-test.ts index 598450a..1492dcf 100644 --- a/tasks/modular-test.ts +++ b/tasks/modular-test.ts @@ -74,16 +74,31 @@ function loadFieldElement(element){ return result; } -function loadCurveElement(element){ +const limbs = (x: bigint, bits: number) => { + let result : BigInt[] = []; + while (bits > 0) { + result.push(x & 0xFFFFFFFFFFFFn); + x >>= 64n; + bits -= 64; + } + return result; +} + +function loadCurveElement(element, bits = 256){ let result = []; - if( element.isLosslessNumber ){ - result.push(BigInt(element)); + if( element.isLosslessNumber ) { + const l = limbs(BigInt(element), bits); + for (let e of l) result.push(e); } else if ( typeof(element) == 'string' ){ - result.push(BigInt(element)); + const l = limbs(BigInt(element), bits); + for (let e of l) result.push(e); } else { - for(let i in element){ - let e = loadFieldElement(element[i]); - for(let j in e) result.push(e[j]); + for(let i of element){ + for(let j of loadFieldElement(i)) { + for (let e of limbs(BigInt(j), bits)) { + result.push(e); + } + } } } return result; @@ -144,12 +159,13 @@ function loadPublicInput(public_input_path){ for(let i in public_input){ let field = public_input[i]; for(let k in field){ + console.log("parsing: ", k); let element; if( k == 'field' ){ element = loadFieldElement(field[k]); } if( k == 'curve' ){ - element = loadCurveElement(field[k]); + element = loadCurveElement(field[k], field["bits"]); } if( k == 'int' ){ element = loadIntegerElement(field[k]); @@ -171,47 +187,52 @@ function loadPublicInput(public_input_path){ return []; } +const verify_circuit_proof = async (modular_path: string, circuit: string) => { + let folder_path = modular_path + circuit; + await deployments.fixture(['ModularVerifierFixture']); + //const permutation_argument_contract = await ethers.getContract("modular_permutation_argument_"+circuit); + const lookup_argument_contract = await ethers.getContract("modular_lookup_argument_"+circuit); + const gate_argument_contract = await ethers.getContract("modular_gate_argument_"+circuit); + const commitment_contract = await ethers.getContract("modular_commitment_scheme_"+circuit); + + const verifier_contract = await ethers.getContract("modular_verifier_"+circuit); + await verifier_contract.initialize( + //permutation_argument_contract.address, + lookup_argument_contract.address, + gate_argument_contract.address, + commitment_contract.address + ); + + let proof_path = folder_path + "/proof.bin"; + console.log("Verify :",proof_path); + let proof = loadProof(proof_path); + let public_input = loadPublicInput(folder_path + "/public_input.json"); + console.log("public input: ", public_input); + let receipt = await (await verifier_contract.verify(proof, public_input, {gasLimit: 30_500_000})).wait(); + console.log("Gas used: ⛽ ", receipt.gasUsed.toNumber()); + console.log("Events received:"); + const event_icons : {[key:string] : string } = { + 'WrongPublicInput' : '🤔', + 'WrongCommitment' : '🤔', + 'ConstraintSystemNotSatisfied' : '🤔', + 'ProofVerified' : '✅', + 'ProofVerificationFailed' : '🛑', + }; + + for(const e of receipt.events) { + //console.log(e); + console.log("%s: %s", e.event, event_icons[e.event]); + } + console.log("===================================="); +} + task("verify-circuit-proof-all") .setAction(async (hre) => { - console.log("Verify proof in modular style"); + console.log("Verify proofs of all circuits"); let modular_path = "../contracts/zkllvm/"; let circuits = get_subfolders(path.resolve(__dirname, modular_path)); -// await deployments.fixture(['ModularVerifierFixture']); - for(const k in circuits){ - let circuit = circuits[k]; - let folder_path = modular_path + circuit; - await deployments.fixture(['ModularVerifierFixture']); -// const permutation_argument_contract = await ethers.getContract("modular_permutation_argument_"+circuit); - const lookup_argument_contract = await ethers.getContract("modular_lookup_argument_"+circuit); - const gate_argument_contract = await ethers.getContract("modular_gate_argument_"+circuit); - const commitment_contract = await ethers.getContract("modular_commitment_scheme_"+circuit); - - const verifier_contract = await ethers.getContract("modular_verifier_"+circuit); - await verifier_contract.initialize( -// permutation_argument_contract.address, - lookup_argument_contract.address, - gate_argument_contract.address, - commitment_contract.address - ); - - let proof_path = folder_path + "/proof.bin"; - console.log("Verify :",proof_path); - let proof = loadProof(proof_path); - let public_input = loadPublicInput(folder_path + "/input.json"); - let receipt = await(await verifier_contract.verify(proof, public_input, {gasLimit: 30_500_000})).wait(); - console.log("Gas used: ⛽ ", receipt.gasUsed.toNumber()); - console.log("Events received:"); - for(const e of receipt.events) { - console.log(e.event); - } - console.log("===================================="); - -// proof_path = folder_path + "/proof2.bin"; -// console.log("Verify :",proof_path); -// proof = loadProof(proof_path); -// await verifier_contract.verify(proof, {gasLimit: 30_500_000}); - + await verify_circuit_proof(modular_path, circuits[k]); } }); @@ -220,37 +241,6 @@ task("verify-circuit-proof") .setAction(async (test, hre) => { console.log("Run modular verifier for:",test.test); let modular_path = "../contracts/zkllvm/"; - let circuit = test.test; - let folder_path = modular_path + circuit; - await deployments.fixture(['ModularVerifierFixture']); -// const permutation_argument_contract = await ethers.getContract("modular_permutation_argument_"+circuit); - const lookup_argument_contract = await ethers.getContract("modular_lookup_argument_"+circuit); - const gate_argument_contract = await ethers.getContract("modular_gate_argument_"+circuit); - const commitment_contract = await ethers.getContract("modular_commitment_scheme_"+circuit); - - const verifier_contract = await ethers.getContract("modular_verifier_"+circuit); - await verifier_contract.initialize( -// permutation_argument_contract.address, - lookup_argument_contract.address, - gate_argument_contract.address, - commitment_contract.address - ); - - let proof_path = folder_path + "/proof.bin"; - console.log("Verify :",proof_path); - let proof = loadProof(proof_path); - let public_input = loadPublicInput(folder_path + "/input.json"); - let receipt = await (await verifier_contract.verify(proof, public_input, {gasLimit: 30_500_000})).wait(); - console.log("Gas used: ⛽ ", receipt.gasUsed.toNumber()); - console.log("Events received:"); - for(const e of receipt.events) { - console.log(e.event); - } - console.log("===================================="); - -// proof_path = folder_path + "/proof2.bin"; -// console.log("Verify :",proof_path); -// proof = loadProof(proof_path); -// await verifier_contract.verify(proof, {gasLimit: 30_500_000}); + await verify_circuit_proof(modular_path, circuit); }); From a8f211e054b814ca4ab00c7bed20fd0106269ef7 Mon Sep 17 00:00:00 2001 From: Vasiliy Olekhov Date: Thu, 30 Nov 2023 19:43:21 +0300 Subject: [PATCH 4/6] Update interfaces and tasks #86 --- contracts/interfaces/modular_commitment.sol | 7 ++++- contracts/interfaces/modular_verifier.sol | 13 ++++----- .../zkllvm/circuit1/modular_verifier.sol | 7 ++--- contracts/zkllvm/circuit1/params.json | 2 +- contracts/zkllvm/circuit2/input.json | 5 ---- .../zkllvm/circuit2/modular_verifier.sol | 7 ++--- contracts/zkllvm/circuit2/proof.bin | 2 +- .../zkllvm/circuit3/modular_verifier.sol | 7 ++--- .../zkllvm/circuit4/modular_verifier.sol | 7 ++--- .../zkllvm/circuit6/modular_verifier.sol | 7 ++--- tasks/modular-test.ts | 28 +++++++++++-------- 11 files changed, 40 insertions(+), 52 deletions(-) delete mode 100644 contracts/zkllvm/circuit2/input.json diff --git a/contracts/interfaces/modular_commitment.sol b/contracts/interfaces/modular_commitment.sol index e5925b1..7118514 100644 --- a/contracts/interfaces/modular_commitment.sol +++ b/contracts/interfaces/modular_commitment.sol @@ -20,6 +20,11 @@ pragma solidity >=0.8.4; import "../types.sol"; interface ICommitmentScheme { + /** + * @dev Emitted when proof does not contain valid eta point values + */ + event WrongEtaPointValues(); + function initialize( bytes32 tr_state_before ) external returns(bytes32 tr_state_after); @@ -31,4 +36,4 @@ interface ICommitmentScheme { uint256 challenge, bytes32 transcript_state_before ) external view returns (bool); -} \ No newline at end of file +} diff --git a/contracts/interfaces/modular_verifier.sol b/contracts/interfaces/modular_verifier.sol index 358c5eb..758599a 100644 --- a/contracts/interfaces/modular_verifier.sol +++ b/contracts/interfaces/modular_verifier.sol @@ -32,20 +32,19 @@ interface IModularVerifier { event WrongCommitment(); /** - * @dev Emitted when table does not satisfy constraint system + * @dev Emitted when proof does not contain valid eta point values */ - event ConstraintSystemNotSatisfied(); + event WrongEtaPointValues(); /** - * @dev Emitted when proof is verified + * @dev Emitted when table does not satisfy constraint system */ - event ProofVerified(); + event ConstraintSystemNotSatisfied(); /** - * @dev Emitted when proof verification failed + * @dev Emitted when proof verification completed */ - event ProofVerificationFailed(); - + event VerificationResult(bool result); /** * @dev Initializes verifier diff --git a/contracts/zkllvm/circuit1/modular_verifier.sol b/contracts/zkllvm/circuit1/modular_verifier.sol index ce849e8..a602889 100644 --- a/contracts/zkllvm/circuit1/modular_verifier.sol +++ b/contracts/zkllvm/circuit1/modular_verifier.sol @@ -233,13 +233,10 @@ contract modular_verifier_circuit1 is IModularVerifier{ emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) { - emit ProofVerified(); - } else { - emit ProofVerificationFailed(); - } } + emit VerificationResult(state.b); + result = state.b; } } diff --git a/contracts/zkllvm/circuit1/params.json b/contracts/zkllvm/circuit1/params.json index 2c7ed2e..1ee69fe 100644 --- a/contracts/zkllvm/circuit1/params.json +++ b/contracts/zkllvm/circuit1/params.json @@ -48,7 +48,7 @@ "17166126583027276163107155648953851600645935739886150467584901586847365754678" ], "grinding_params": { - "mask": "4294934528" + "mask": "4294901760" } } } diff --git a/contracts/zkllvm/circuit2/input.json b/contracts/zkllvm/circuit2/input.json deleted file mode 100644 index d7c12ac..0000000 --- a/contracts/zkllvm/circuit2/input.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - {"field": 49052524384703870792430850605823211740010368752655030397570455698676404652716 }, - {"field": 0 }, - {"field": 1 } -] \ No newline at end of file diff --git a/contracts/zkllvm/circuit2/modular_verifier.sol b/contracts/zkllvm/circuit2/modular_verifier.sol index 710c3db..5d69061 100644 --- a/contracts/zkllvm/circuit2/modular_verifier.sol +++ b/contracts/zkllvm/circuit2/modular_verifier.sol @@ -233,13 +233,10 @@ contract modular_verifier_circuit2 is IModularVerifier{ emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) { - emit ProofVerified(); - } else { - emit ProofVerificationFailed(); - } } + emit VerificationResult(state.b); + result = state.b; } } diff --git a/contracts/zkllvm/circuit2/proof.bin b/contracts/zkllvm/circuit2/proof.bin index 43c934c..8817683 100644 --- a/contracts/zkllvm/circuit2/proof.bin +++ b/contracts/zkllvm/circuit2/proof.bin @@ -1 +1 @@ -0x030000000000000020a9481a88dcb5222d52c68d295634ced8129a4b0711c426f5678d89772d477fe20000000000000020b512d5e1723b60d350f2c83179c1051dd01f0b1943c891a50969051c0bd88d6f000000000000002053c60cb628b515e490aa568f3cc8ca29891d9563b6cff13539314b5a7221711908983eda4d8c83f5c823195a9411f4dbc344aac7a8f33438d5f95aaac4be82f6000000000000002608983eda4d8c83f5c823195a9411f4dbc344aac7a8f33438d5f95aaac4be82f61b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd3c29b7f81ed79bb878f5b17a0c7db20256e0ab759ea66d8dd9d17aab613594ba4925359c68cba0ddaf87fd463f6daed7e844deb500155000cfe079de79e6639a495b11cf5b0cca32b50a523e3a8a560064ebc42e5691eae3f4ba5ab2a8771113304dd9fa371b70eeffd08ccb957867d20aeb86e7009bc009af235519554cb93231c6df5ed6e392422660df937340f9ed737bcd385e03fc3fb1187ae69b4177816a45a7312e851bf898402981030726b3a4f5684b04458845c9f753b35519105c08983eda4d8c83f5c823195a9411f4dbc344aac7a8f33438d5f95aaac4be82f61b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd3745efb7711754e6ed9337ec04c2dd1815ce41161d436ea45e5a0afe5352c63f3d9bd931d08eee60195862ede438d303f80e10fc9093f2a0920d1f3d2bed12c96898431c9ad254bd3e90b476871f8ed9097874da3b106727ea8e8af99a03ce305d118568c35ccff0c8e14aeb77fcd0a05ba585f78d646348b66c554b10625e60016f044ce3e3a2a1a4b9d3c122bc19247968c293a38cb8deb4d3c106af899e353a68771f10abc9d88dbdf7ce531cd3044141f573048011fdb1b76e4ec34435a61a49c21704e3faf3eebdbf7ca1bd95ce85bd034affa8f64d10657a048cc796c6012e0229800e317b4f95a23a9a5570a962fcb11f71fe5ac85106392f406eb9963f1b4adcabfaa14cf2ee7ec3990f58d91ae75bfaaefe1327313d89eb23baf96f4cf918e356aa96392c52753f8b866058054d9c843a86ad32b6f3cc45de86fd4401270624e54f5b858244ebdb4f7802a52d24992f47d11e9c86e0d4a67349e020662761bdeda7376d374c58b68475ecfa30064120c27daa97edfbda94eecaeaff5e5819220d06fcbde0018a1c97afa52d813d66c1e37b28146760ed7609dae194369369e984155e5f975bd41103c801ea569e500244152d768985604be0800b064ecd57045a9bc747a663a29b2862beb17075a302671266069ac62a09c7801d483cd3d24de7686966f8fa3577ea539d516c0a16d46d0e2c283db58b157952ca5330d0e87d5a90d42985d4b5da16c96ca2d6a70107fce35e91f6b3669d57f828e428b5b07e8d7fabe4f0671904e44e7095caad0ce87e4a1206ab02fcd1ee5f48122ff922d702799a98e2808d0412a6eb1d611c54f95c78b8dbd113d4785b8e49593af08b2d7d92860abc5dce65f91188b7a77bf1d3fb566ff578c99748a7b82e1e11993a80a285b2e1d39c24c7f1cbc8359af114243a13dd7cec7a76c6cec4bb5151d7fbdf97b80f63f2a13b7362e2b6eaa1716deeb1f5a9803382281ea63d658434724c28b78ae43ce6d61acb240e7fc29289b3a31071e8238b4307d7a2cf0ba43136a39f18e36cea081aa558e434e71274837f29bf43047f1ddd21edb9a66f6c672a0116495522c66ac4d368ec44e0e3f066b6e2f52828257441989076a0dd8b17128482ac08ae5cda683b00898bd8c8ad88d21dd9078558818303520c9474d454ba6455d2eb12b7092bfa2ecd2052ae85ced69033e7c5c4c483c55759f8a3fb35b23e240948c295f8005f8c45d58947237e7e8eeb8c10d4be76605a049477f20000000000000008000c010402010305000000000000001602020202020202020303020202010101020101010101000000000000000300000000000000207c555c3aa09898bcabb7854d82e0e828bc28d322bfc54e61f9d395928622c489000000000000002023b69f8f92ba3ead285acc6a688d8b22c3f3600fde34c782fe9d09b52f3f9bc900000000000000208f4176a895e1ccac9040370bc31ff98d07fe56a85183b1067a9198863bbeb9de0000000000000003010101000000000000002c1aa909b8f9797bc1d44db4c7e28c3f15cbfd4ee83f1b2499dbe21753938adf7459449d9a302401865eec2340271598ef87c0551ac0e33765241de8ab6c75208d46b19cbba8b4e5049ae6196f2833e193402f8456b9bfa436032ea34a08cc1c2b2d3c0a9780e898439853be98e16df672138e1fac463eb7c8fcd15cb4f733e3d61f24abd4f67c4dff6f6351e9f2e3caf172560e5314440d7e1646770a3d94c52954c8fb7e33212f48c3d6861e16be0d13e16795afebba4e80e9b988f4c26b3ad866130b7f93c8a4b3d87d655d9a98b494cc9cc0428dde02739bed4148af11641e0dda9bd395d4d8945abc72aa6f0923708720e3c07220598b6412beb650ee9be31aa909b8f9797bc1d44db4c7e28c3f15cbfd4ee83f1b2499dbe21753938adf7459449d9a302401865eec2340271598ef87c0551ac0e33765241de8ab6c75208d52061e3efce7d6a31c13adb6d32058c5e6f146e48bb62cc073c87c31947d2c57098075adfcf1b7a6c99a4162b11dc83f281d406cf941f0b333df0ea0d41918f819165cb1bef36c435f3cc0ce1670f796dc30fbf37d725244b35ed0068bf3eb0b6e6edc17ff8312bbea15c0acd860433b08b0780611745e64de96ca9086f2591f2b60a5c08b07811425a960d4011f29545b141179d7070f55c000de45e86a555f3e5f05bcd475ab6f415ff6d5973865f5a782325e0fc5100bc78b7faa51e9c95c678164c95551eb09e79cdd1a2bd563208567ddec90035da244ec56869a86018d0f72324e4b0ebd9cf57c82079cc9eca04ee13a23d09856ada685567c3b8d302a5dafb266d3e9f628388ec0e8d99c4c84fa35fa528304e52afc5445f3bb5bb1ba60a41dafb4b73a0bd7cf7b9dc0e4d2a518a76b75942c5fa7d3fb5e2ab95696d7474527427adda5b16a94aa3ab7f3a60a7ce8b9200bec2685dfaeb4f256a16e185b770570665379e8ca0bae6815730dfde681d04f8d5222554baec904fa3225e5497e0ae517d1c167367c08a568a0a10610d1878571cc356b84c1ca831ef6828271ebfbb2f6e61d05e865543c5b587058cd4896a3844a0f86249225bf862dbabc6231baa24a585f3ec6427708472393ae586f99809ce30fabefe085169832d4ce2093930948482e7fe2750237f8f0d5fbe138643c19ecc6f3c4274b467e4824c71cecd50528fd6bee44f7a8cfabe259b740d7433bafcc877efc371cb6e6d7a71d64e8715fdad47383c6c0aafc63ae2c34430eb8fc4b9d12cbd0dad78cbd7d5d4a365636099a836a818a413a4d94913253b90bf26b1cef39ac28f1accc37efc200586f114d9bbeedf7c1a160b43b3a7974ae7c95d96dfc72ac15a8db43ae8b2820035fc5992668f0fd135c7bec1eeb31ce142558a12f837fe3384964501a03e6975afb9166c9239109c54c9dfeb858bd92e6c0f779781cc60e829549d2aa5475176769fc26458d31307192b17e9274f06bdd7c5c775f69730b7438081c9137ef6c442f0503a6842f0e1d3cfb0bdb85575baa67641c7973ad3d3d5430c5b99717323a428252f15e396191a0b4405391d7205a9224fbdde8fc3651363b8ae315f2704fa488c95dc95c2c959e0b23630b9bc4f5464387f473b0e725223218238541fa2a43a522da4a4da3ca2b25c96fe1d9091f8d06e4ee2d4aac523735a48054cddd303a80bfb4e612e97a184be942d81845d65f6b4d11e46bdfd7312a96118eed83584d0ea09122cec8b47863d0f99f46ec0e8b718c9e303a1a5c60b08ed70cbb4d225e119a61042bbb62aa00bcc69395211ca74a228297d039506494dd1b681b930e07849f3844790937bf09ca0c62a81d9b4ea31f59a79333be368bec8f0a9fe32f1c5fcd5245decf7ac1a62550f09b790d3b488f30d7c3a34d36c01bbcac28ff6bc2970801a9ce846a02ef052a714e13f5d7fcf28a755a17c62aff3c5abb55914d83b80a61936198766d7184378ff7cc19b7f548182e6256f1316c1238c2e15a00000000000000064b9d7b4de6229a3032ab8366026dd422f2be937c1e6b6541e1d43693fd41d65b4b5392a75af0104d5564b00bc03c3be2460035dc21b5e3e65c2ce4c6539b3f8465ffdf7e7fd4f2d184d00c57cc64367d229b66cb784fad0d352ddccf4309ce9707e9e04f6affee8ac168d9b30d0303c3839fd321d4c1585272f359b05281f7d726c22f5e395d6029bfbc25977ceae65962fb21c3ba4ddc2ad8988c1b3672745c40095cb626202f85b75174525da458777823e9826cfef7b852066a18a12d85bd0000000000000004000000000000005a0000000000000020b024bd12fb5b07a167bc8a510f274a06946eac1240e823dd682ec71d18e04b4e00000000000000070000000000000001000000000000000100000000000000201dba87b548f296ea9efc52957e260ea1a785dd708b0458ff7f1ed74a3263a86d0000000000000001000000000000000000000000000000200670200ce8840d42c287eb3020f13a6f38a3edcce46c10cf3525c1dcb96d3f820000000000000001000000000000000100000000000000209dae199a4e50f8ed1b4aac58675d7c022a948d70707593b776f9ea726e1937230000000000000001000000000000000000000000000000208b4cfcd55a35f9bf1484306fbe9ca3c7d8eff4fdb35bf57fdbc04d2881ba460b00000000000000010000000000000000000000000000002089519a6d88a150b09627d8adb69500fcbed330b3fcd7c922d9d68ccafe3d00db000000000000000100000000000000010000000000000020c32a0d03207fdc70dd7f1a4f65654f7f921570d423753644507fb723e9043ef2000000000000000100000000000000000000000000000020a5791a4d1fb68b8c5de94b338a0e0ba2ce64eca86311b65648af6a74b0fb4d91000000000000005a0000000000000020a9481a88dcb5222d52c68d295634ced8129a4b0711c426f5678d89772d477fe2000000000000000700000000000000010000000000000001000000000000002057e970db724219567ba2cdc6e40d3680a038af0093b42a725998a6da508cfcbb000000000000000100000000000000000000000000000020d0b5511ef3caac40ccf24ed247fa21350b215940f877064ee479150c3683b6f9000000000000000100000000000000010000000000000020c8081ea46294607972fc8c86596d930de29118414bb71be4fd9ce2747216b8e70000000000000001000000000000000000000000000000209e872f337db431084da913380af75a1936330ca65781aa90bb01e69488f13b43000000000000000100000000000000000000000000000020ba6adcfeefd05bfff7195b821c0ce0c1077f3e96d104bfd13b71b98862f7f87d00000000000000010000000000000001000000000000002015438a12e36743f20ecc136a4275907220dadfc513469f7edc2a77ef3abc22d500000000000000010000000000000000000000000000002033d6144b36ca45503092f451d8ebc685cad2f8c90c97338dd2073fd2b54451be000000000000005a0000000000000020b512d5e1723b60d350f2c83179c1051dd01f0b1943c891a50969051c0bd88d6f0000000000000007000000000000000100000000000000010000000000000020bf4668138b85d2f7cd61d513e6b836bf0c91f937fb195e9b21ed307f3f0e2f3d000000000000000100000000000000000000000000000020b506484d8c0a32b2902c97440868b6fcf621f97ec3e5bc2db5e819ffed2a63ac0000000000000001000000000000000100000000000000207956fb7563d1d8edc1c31b0507a45ca963842945223b2968f306594124227d620000000000000001000000000000000000000000000000200f0911ff40841595361c7f29d46e3a2e6eef09a5e708506ca877eb6163630bf3000000000000000100000000000000000000000000000020d8e25d820866f2beb13183fff051de8ceae433e7812c5af04a607e1130331ed20000000000000001000000000000000100000000000000200bfd6d89c20023ffb75aca9182c12c60ff50a65edb29afd0302d0490c668264a000000000000000100000000000000000000000000000020bbd90a9748c45aeb7976c50f9539e6baebdee7c29eea9e71d3ad7ebeacb50710000000000000005a000000000000002053c60cb628b515e490aa568f3cc8ca29891d9563b6cff13539314b5a722171190000000000000007000000000000000100000000000000010000000000000020243dbc1ab00a1ab1191f8210672e7b79aac1565b35a6a6c860eb89e641d0e85d000000000000000100000000000000000000000000000020e2b8adf48734bbac00476e92b353eab57c23e6fb0876d7e9f99c9ef2f21ddee9000000000000000100000000000000010000000000000020d55dd3f7ae65c487983905054e9a5294f8f4e02f778e48ec14f4ed1e06a87be30000000000000001000000000000000000000000000000200aa814ddb3b1b15e14ba702f08a240dcc7293359374cbe0e8188bf67f7870f840000000000000001000000000000000000000000000000204eb0f206d6a791451818a1a49e295eece7842a33e540ecc18486e83537c399b0000000000000000100000000000000010000000000000020be12d559953f04b14fb4a5f2e37b32a6949f6e8508b4a7d711e178ff766d5dd10000000000000001000000000000000000000000000000201546a6e10b577d90c02af66694813cf010175cb9045f737037f8a14ddfe068260000000000000003000000000000005a00000000000000207c555c3aa09898bcabb7854d82e0e828bc28d322bfc54e61f9d395928622c4890000000000000007000000000000000100000000000000010000000000000020abc9732304eb58807e4a487dab4276b9ab3dbe3bb7499ee864f92aa08afea68d0000000000000001000000000000000000000000000000201e46badcd57f2392eeda85b567a9192e6e1a9bc66468e60315a2f75ddebea349000000000000000100000000000000010000000000000020a6c9ee8840d773f8b437a5223c886c3b7b55dc3a321ab6f661d6b2fcce55118400000000000000010000000000000000000000000000002075f02074ca216af09dd0367a42fea2bd162b137430e34607c0035f56d6986bb700000000000000010000000000000000000000000000002088dce71d2079b2b0950a4e3c3c0edc9db575729cec32f37684db1da0379727da000000000000000100000000000000010000000000000020e57828f96f3b73b9428a3c63af5a46099e67e84bf35ed87b3d55c2c7da46a61e0000000000000001000000000000000000000000000000203fac52a7d82b9409a1814d1265269607ef9c8d2077877dae9afbb42c5c0be8de000000000000001a000000000000002023b69f8f92ba3ead285acc6a688d8b22c3f3600fde34c782fe9d09b52f3f9bc90000000000000006000000000000000100000000000000010000000000000020a5bb91d42b166ed50abe53ab6b726ecfe9f66983d86acb5b99bcb2c4fa9116e6000000000000000100000000000000000000000000000020a1bf8d3962d804bbf9b6836530b939022e87b97ddacf718e1bffe99b5ba4fcf10000000000000001000000000000000100000000000000207274e676b35699e3fcbf016fc212b73430068ac868b0acd0dad2cb90142dcdf6000000000000000100000000000000000000000000000020cc3d62b02f3ad0810ece4920fbf5ad5452577124ebb6be1c31d3d7ec79b6e3eb00000000000000010000000000000000000000000000002018d9bdcd4619139084ac887d24402cf61913a18ac9c823e282227fc8c27349d6000000000000000100000000000000010000000000000020e075fd2c31e99181114bfb41171f749f0b62f75692b44ebbf7923bdb5f51b314000000000000001a00000000000000208f4176a895e1ccac9040370bc31ff98d07fe56a85183b1067a9198863bbeb9de0000000000000005000000000000000100000000000000010000000000000020d67042edbfbc11c2c791fe0a2ee1823064aeb1e7975853f5cc08513dfd4dc05500000000000000010000000000000000000000000000002031b4dbeed998c874bdee96dbb0edab3b842540b06380a5044c87c735dbac2972000000000000000100000000000000010000000000000020be0c6eac24c8089685c6c05d562e2546d0ec7ef7487cf2893903d4b6b86b0fef000000000000000100000000000000000000000000000020a4a120d887a780dc758f3b10fbc671fc563be5de180f9f7105091f664971150b000000000000000100000000000000000000000000000020097d565685c064f43d07e0e26545a84555d4027ccf4a558520d124c6b9c4327e00000000000000026d5c99b3c48d867bd523b8f8f2188b6b176e57a493a597f1154f7b196bcffd0d3ef3e4413ba5971273cd5d8815d104d647068755b951a1033a734e720c501996 \ No newline at end of file +0x03000000000000002026aba578a036bcd94ad5667964143f04c4321309e878119544c4949e3895489d000000000000002011047a78227d71cf0f64aeec07c4bfbbad5f2b9e5d510d915688445d74630fc50000000000000020bbd5863ed4ee6c4936198826f300625b6eb394f56e6f00be2c140181709f95cf5fd118740038aa746881f21c607bb98a61dfd4ff2f00ac8dc19624b126c78d4f00000000000000265fd118740038aa746881f21c607bb98a61dfd4ff2f00ac8dc19624b126c78d4f1b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd5b13668c317936c5db6c669e7338daae0a6a9eeb490cebe54b1b00dd0f74dd244925359c68cba0ddaf87fd463f6daed7e844deb500155000cfe079de79e6639a39e389358a3d0cffffd5962cf664c2a7a636245fff62a74a0dbd06106c320bf7304dd9fa371b70eeffd08ccb957867d20aeb86e7009bc009af235519554cb932396fca7d4ad2e327652993229fdbca8590421296fbb77f09602b2a75f55e53be6a45a7312e851bf898402981030726b3a4f5684b04458845c9f753b35519105c5fd118740038aa746881f21c607bb98a61dfd4ff2f00ac8dc19624b126c78d4f1b02b1d914ea72056989679d7826ca1f9adbc9880002cf6daffb7f1fa3b332cd6ad1c65d95046c69632028e2d00a5e3177880d9723d761925407649577b3c5d83d9bd931d08eee60195862ede438d303f80e10fc9093f2a0920d1f3d2bed12c93b3b67e9e4f16b41417b4d2de714452db3edd7232de882236b6c1b61f946cc765d118568c35ccff0c8e14aeb77fcd0a05ba585f78d646348b66c554b10625e60606bb59e16029189996343fa9635eec7bd28b3f33ede2f2342cbc60c8a32798f3a68771f10abc9d88dbdf7ce531cd3044141f573048011fdb1b76e4ec34435a613c507828c12f41541724633639f86cd6fe83a9665c3ffa8d10ea3a8b5784be51f97e97dcf8a9a7f18a775e68995e6c365dcb397ed6ca45fb142e200a35614903f1b4adcabfaa14cf2ee7ec3990f58d91ae75bfaaefe1327313d89eb23baf96f4895ed7769d911b8d4d177f4fe636158efd4751bf6a83f482786cd55152da0d025b190fc6d65a019094e04af81163cd3ece828b54ceac94963d24fbb58fd3ff6662761bdeda7376d374c58b68475ecfa30064120c27daa97edfbda94eecaeaff29d2d2abbb72d3a2cc99be904931afd100d070ba3b1a15ed6b2d1666b5c466c1369369e984155e5f975bd41103c801ea569e500244152d768985604be0800b061c522d1995cd90b60891ffb2ced8ed3b9e459a713a57e6295385385124efdccb3cd3d24de7686966f8fa3577ea539d516c0a16d46d0e2c283db58b157952ca536ac06cdef11a66d17bb4cb801b2609d92194a7bf61d980cc7438b6850054a033712b1c4bf00cc81aa390ca1221949eccadc1998845c00394185d24f83a73acc5396cd3ed18c7ec1e922da928d548cfd55580d3f6a50e1fc39f3c7979ef5b34822450b35385c9018b459eb3f90f4a507f2fc186d60b0e188e7adf4a7464d7667e07dc72ac582c7f2f8df72585b9eb26b3b691491adbb91318d4794037662270796cc2d22f9ffc4cf907f14d2c3ef52fe1cb38f1ff36eb0fd0fa01abbda809c72a4d8648680c549cf2d931b61de8eb0f042f2f3691c0b8f386b7d8b4430fbc8cb70367f4e35f84c4e47fc09152b6760cb5554240d33224394bea5f3ba320aee2565d3ccae48ca5218673b8b9d84a693458e1b1bd342dbc0e251aaa14968368414c03ec5bc0992defe69d39bb9f59c25a409e08ce3c6ac20171b9643e04b98f9c7d16bc82ede596c160cfb6702edcaddd6806f1d132e2f2b1451a6e4e75358fb81b07c04d79d725ebb8d2ef614ddcd68a9beac99377928890cb097a82d6d6ebde060000000000000008000c01040201030500000000000000160202020202020202030302020201010102010101010100000000000000030000000000000020891e9d0e2a703d73cbab6b39bc9764ec55d9db33906b9a5a3614655f40e0bf5500000000000000205a923cbecd9650a71fa7f33a9d7d0562e22b4ee26b3554d547096dbfc783a81500000000000000205319ab27e8ad2be390a0be9ec8159f8b5c89e3d3bd6a7eb66bac0fb1f4828d440000000000000003010101000000000000002c0df6e1cface780a62d34ccafd6d0ce6e2d0124a02ec3ede2c13af36ece5c935e65f6c5837cb5fca206050b5832d1099726bc7f62d13a6e1c3ec50c9031a36ca361c02cadba54848b3c7198cedfb5a5033b080061475b8133489ca807a4880792122d7aa56f48f8bcf6c83f3929ec330218b5a3a1b8a2dacbb76357f75b77f86f689cf420483c2d65a6f9f57fedce4afbfa83ce99f388bc6bfc48983a7fb834f90b50b332e1614fe28c3fe2881bd38d095939d5690c759f9303b767c48047cb0824b8c0eefff44e165d7aa64f46d8fcc3e328ce23a8c6fef9e5fc299f7e0972c94f34e66429a92f31d5bf31b8c2c8db417094d5df57375d051a03d65f81f68d380df6e1cface780a62d34ccafd6d0ce6e2d0124a02ec3ede2c13af36ece5c935e65f6c5837cb5fca206050b5832d1099726bc7f62d13a6e1c3ec50c9031a36ca36b7fe5cfeec922d9ce327665a444e5c29069cbaa3e632ca1d6312de113c6354938001273f9099c47fb11b3a8c460c832ecf1f46b63b1e7b01d9db1f40a9af19b4614c150c1838605be04c12b2055b2f848392a7086a100e511412c3a74ee7b0858d8ee59208a0f2e7270245b239426b61501fb123ff32a3039ae0b89c3b9887e5838067d597e2f3c46634c46dd4bce57872ad52ad58e5495e0588d5d0d97b6c1640c4efaea4ed83b6e3aab06fd0750c1be549431a278553dc9e89cb40fbeb23939c4d425308927d3cd0fa318852438c7550a8e33763b6b58c79969097b5c0bf26f3957f84c9cf79703aba15c695c01bd3323a71e1603ae37fc9c3b5505c0cb8a59a3d92c59bfcd8a8191c17bb58054f47985546e7249a89389ff05371a69ae85152603bf2fd3055d28c6f65c836fdedcc8bb4d8d1d5639602dcfccf1ceb0861e66ae976e5b405aa6dcfc77208f1fe00b29df86c806841e36c96ca6e0375e406d6dd0c1dd64f3c4ea9dd01eb7c76b7467c5884036ec3c64a94791cd44d8b2b7ec1a8e8ee19165c0db45d82575022a7662822cfba9d02980d2e7354fe8116dce8869c8afa9359e9d04251bd8c1e86e242f3a7d004eb07aa97a92f9a218a1a9f1a354f90288d79221bc652207bd3f58d88e8c5cc07cec36f35b596723b46da10f52432126ee615ed9f4b2d28ca4945c2b0c64e1796605946fedffbdb283fea53e754323e2f38447948b11a585bbe4f88cb0b853907d01580720ee53cff8a3df250e5e73ba6d3a3fa4799074d29227af258ecc5435e3c243d31e1343f0276e0d9bf350870cb5ddee557364f03dcb03f489a6fb9abf1d71b16442e6ae83bf42c151fd307f38ee2db3bcdb5f410e1d346b95cec72f69faed777aa3b0ea97b8ee6ca33b1024cf465aa9944aed593dcf3b90aeb9931d2f18789cb8f296e930965dc55b2c3389863eda8f6c18458b39493b542d1bf25996a118367f1322c75c0e5edcfaf435415cd8d743732fdf87f97110ef3e8e72e2f03d607d1e35d6164a951e77f2554941d4f70452a9ae78a7709bb40dfabcc7dd5ccf18f164f1fb68303d9d8034a648d0aa69deab643ee5b1d5f44470b97a013be2a4e7aa2be8b4edcfd3956c435d6de872354cbf4574e0d98224434cb59faab20d1b8de3ac13f85b1c4b9543dbfe719c80807360ac82a1b1978b36e1a7edd2cec8dae4631b341f019306dfa0403310bcab3a502786c044b984dd33a51281eee37efbea5ee699acf1b0810ccc30b737da1a384d0f17fcd98a71beeee0683ccea73c7068cb09dbe4cbad7df938430c53c60bdcc62742e8fa0939a3b9eaef2cd530a45a0909c1fd62ca5c6d1c7d2ea3192cd9f2d1e3c8304714ecc7d337115c97211f365aac71ed7730703019f827f0028df73b7742f4ddfb1c65f1462ac3b7a7f4d9428f74a39f1bbdc3152f11680431f8e2f99a86f11f8d356ea54c4152554e5c13833a9314634061f83be78c26d5435c5dc1c7e454588ba3017a203ba1ca7544436895b4e2bcbd8d20355fb4e91f00000000000000061a4563ed1d5f7cc9e53d49e2890617fba9afbd41a591aa66134c98aeae28ac8b1ce23710c4f132bd048e96e39f41617771db0b79ec4bd55e99457cd9d9ffa4aa094a686ae4dddf516a01310f8a25edd36d150675af0986441cd59c5d04dfa92f7116c55ec53fa6b2b0c8dc874dd205dd0de52f81c69c3ab5a836d426fbe46876577a42502ea797318cc8831ffef6300dce310e62d25fd1ee88e89b0d122e5cb7358478056c9ac17e6c895902ef437b0d361484d1d6b0a0e062b8a4ad3b7ff66a000000000000000400000000000000480000000000000020b024bd12fb5b07a167bc8a510f274a06946eac1240e823dd682ec71d18e04b4e0000000000000007000000000000000100000000000000010000000000000020f3ae86a7a2ff50b91cb78a445c0d4ef4f70e537500625100c46e94cbd342b1ec0000000000000001000000000000000100000000000000206840c01f04ed75d097bfda1d16c545f96a742cd31ba1f41ca8abb658afc381e1000000000000000100000000000000010000000000000020250e1c64a18f6212b6a945f816a7aa19a74c5412859e159a80d0d3b3c962e7a3000000000000000100000000000000000000000000000020ae39b4caf19460d61b2e9216964104f01cd1a093f497fdbe6ebc76bd9c8b461000000000000000010000000000000001000000000000002003449363278bf61c44b39ef55b9ea4cf53fd2a1342610607a303a38651aed84b000000000000000100000000000000010000000000000020c32a0d03207fdc70dd7f1a4f65654f7f921570d423753644507fb723e9043ef2000000000000000100000000000000000000000000000020a5791a4d1fb68b8c5de94b338a0e0ba2ce64eca86311b65648af6a74b0fb4d910000000000000048000000000000002026aba578a036bcd94ad5667964143f04c4321309e878119544c4949e3895489d000000000000000700000000000000010000000000000001000000000000002091dad32e7d7f0034523461412da56c1f8c1176758901db533c95d9fe010970750000000000000001000000000000000100000000000000206873224eefc926f317c5952e8bde8081e444d77b9e2708a6560b3d40f28f00810000000000000001000000000000000100000000000000203b0f1cca7e1c8521fb2516432d5080a25a6c182bdc01c83d36bcd1e6346b9a6c0000000000000001000000000000000000000000000000206a29775944c95b50d87d68f379d738d339d6799e156129c1cea11ba65a7753860000000000000001000000000000000100000000000000206205887177c9136e9e6e5fd6b7f8858790500099a88b4c9e6e1fe7283ba4d476000000000000000100000000000000010000000000000020716c289ade9ad30841a1c37fa676d250c39643a5c10b93df6a04ae2a653e305e0000000000000001000000000000000000000000000000205f9e5912c99d6d4e970d28c20592f595be472c0128100961b53a788942b498e30000000000000048000000000000002011047a78227d71cf0f64aeec07c4bfbbad5f2b9e5d510d915688445d74630fc500000000000000070000000000000001000000000000000100000000000000204d2176e311ebde32299791ff23f5ec0d77381e6c0f3c3e3fed9ab730c9a9eba60000000000000001000000000000000100000000000000200315b0c13a4f7dc02cceb284d3ddad7338863ec8f598a75ab9e0349e30bfad79000000000000000100000000000000010000000000000020dfad6dcc40089397f7f99590eb75fabbcdcdff709857c07a4042d97efcff480d000000000000000100000000000000000000000000000020bc9ccb7cae284282ac8541362b473f9f0989a97daf5f92846792be6efb6de2f700000000000000010000000000000001000000000000002061255daaef6bdf3f2eec3c776df5619cdb1631354eebd400bba732172729c97f0000000000000001000000000000000100000000000000205564bdfc9508aeb96acf522dcaa3dddcde4a2e929e90cb002b8fb7eb6436daba000000000000000100000000000000000000000000000020804aa32cbdc39a55ba4ee760b7cb0bf588c1a2d733af6d35faa8555c6711d24d00000000000000480000000000000020bbd5863ed4ee6c4936198826f300625b6eb394f56e6f00be2c140181709f95cf0000000000000007000000000000000100000000000000010000000000000020d6374f1e12ab4c6c0d08c8e74646a48ef4508c9a77d76b50ccbeff999638ab2b000000000000000100000000000000010000000000000020113847ddaf574efbb57822a4806c69919c9c34228d3031411845af807adae5e800000000000000010000000000000001000000000000002023bc4816bcbbf36b52bac03b0bfe353b7067e168a224dc2c246280ce3c7cd42e00000000000000010000000000000000000000000000002086d545e6d05f405eab38417387b9921249b038d7811f3bc18bc2ce9f0b3df892000000000000000100000000000000010000000000000020b3810f292f4b9040f7255502cbc1558d0dc6a3a42b434dfac036dfbfc899f6e50000000000000001000000000000000100000000000000204f8e73fa81a00fde9627b4bdbb009ad76cf973fbba7c7e18f2a744aad41cc6a7000000000000000100000000000000000000000000000020aeac74fcf78d3d0427742ff227ecfacd2390d7d2e667f34c119a561aad1ff12c000000000000000300000000000000480000000000000020891e9d0e2a703d73cbab6b39bc9764ec55d9db33906b9a5a3614655f40e0bf550000000000000007000000000000000100000000000000010000000000000020cb9929527e2320eb45261b6129615dd7211905c44221ab0ab9358b599e13c0a4000000000000000100000000000000010000000000000020638c36916593a4c9cc32096d2ee52d971230cde706e8fe50d3e5aaf333ad474f000000000000000100000000000000010000000000000020edb873d21b9b67e2c954f677b47c757e8efd4d5f9d31bb2e522d22d93709776c000000000000000100000000000000000000000000000020530c58b892de1ced8aa7f0a3fb8a169043a343c345145ff2c09ffc3617627fc700000000000000010000000000000001000000000000002094e2e597f2098e3925035c3285c6b70ae7ec1a6427f56d2f4d01206a0950d222000000000000000100000000000000010000000000000020f3fc933ded24beb3976a14c4301f7b311864d0ff5fb6f22e7587fd7de05dd38b000000000000000100000000000000000000000000000020035d99a26baac0a5ba8de83e96bf3039200706fa347ef89b3d09955ab2fce98d000000000000000800000000000000205a923cbecd9650a71fa7f33a9d7d0562e22b4ee26b3554d547096dbfc783a81500000000000000060000000000000001000000000000000100000000000000204a6a79b23ef6ddda7541d102c6a8533f82d8db6495ba5399017d000b2bfe1607000000000000000100000000000000010000000000000020c460f15308b17f6b7b51aeed10915cb7505ad9bab2bd6a878d8e8d093e6afac00000000000000001000000000000000100000000000000200c88d8d8aeca04fea655c9d6138e6892223a9d48ae2a42f8a62a4c1388c47d5f0000000000000001000000000000000000000000000000208123f4615ace00d23a24c4bc1a753175cb48e9678fa6c6b905b0b6e841394976000000000000000100000000000000010000000000000020aa3028a57ce0da9d72b8f5834c21dd23e21f62a35db608c04b2af3c1a8ae101d0000000000000001000000000000000100000000000000201600e1880b6b7130614d93a350f574fd308e3e1e0bf82fecf6d5e5e2f34f5e91000000000000000800000000000000205319ab27e8ad2be390a0be9ec8159f8b5c89e3d3bd6a7eb66bac0fb1f4828d440000000000000005000000000000000100000000000000010000000000000020fffdfa92961570fa1cba20f84e31a0e4f8d65373cddc2fa0a56c1cb546903b92000000000000000100000000000000010000000000000020a8758b014f831becfd957236d1153dcd5a8994b54b4e7cc33e778aafedd548fd000000000000000100000000000000010000000000000020ec5ba04e6b3b9cdbc4fabd8852389dcb384a6f91958971924743defea13bc10000000000000000010000000000000000000000000000002042c55711a8d2853e6e442079ab969fba126cda2d6b059943c2d532622bccc1bb000000000000000100000000000000010000000000000020d01e304d4e800a09f07fc9b61e94569ba98abc8e1bfbb70bb7802ad4079d62f900000000000000020c88898138d26db3e30c020d724be98ad843f798d4890b67f5d09fdda6d72990092d4a62151edd2d79638df31a0f8531c842a16d143287fd08b08b136531536f \ No newline at end of file diff --git a/contracts/zkllvm/circuit3/modular_verifier.sol b/contracts/zkllvm/circuit3/modular_verifier.sol index fdf554d..0b4e94b 100644 --- a/contracts/zkllvm/circuit3/modular_verifier.sol +++ b/contracts/zkllvm/circuit3/modular_verifier.sol @@ -251,13 +251,10 @@ contract modular_verifier_circuit3 is IModularVerifier{ emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) { - emit ProofVerified(); - } else { - emit ProofVerificationFailed(); - } } + emit VerificationResult(state.b); + result = state.b; } } diff --git a/contracts/zkllvm/circuit4/modular_verifier.sol b/contracts/zkllvm/circuit4/modular_verifier.sol index adde601..9ef53cb 100644 --- a/contracts/zkllvm/circuit4/modular_verifier.sol +++ b/contracts/zkllvm/circuit4/modular_verifier.sol @@ -251,13 +251,10 @@ contract modular_verifier_circuit4 is IModularVerifier{ emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) { - emit ProofVerified(); - } else { - emit ProofVerificationFailed(); - } } + emit VerificationResult(state.b); + result = state.b; } } diff --git a/contracts/zkllvm/circuit6/modular_verifier.sol b/contracts/zkllvm/circuit6/modular_verifier.sol index 6f6cad5..6f04e62 100644 --- a/contracts/zkllvm/circuit6/modular_verifier.sol +++ b/contracts/zkllvm/circuit6/modular_verifier.sol @@ -251,13 +251,10 @@ contract modular_verifier_circuit6 is IModularVerifier{ emit ConstraintSystemNotSatisfied(); state.b = false; } - if(state.b) { - emit ProofVerified(); - } else { - emit ProofVerificationFailed(); - } } + emit VerificationResult(state.b); + result = state.b; } } diff --git a/tasks/modular-test.ts b/tasks/modular-test.ts index 1492dcf..7e6896e 100644 --- a/tasks/modular-test.ts +++ b/tasks/modular-test.ts @@ -159,7 +159,6 @@ function loadPublicInput(public_input_path){ for(let i in public_input){ let field = public_input[i]; for(let k in field){ - console.log("parsing: ", k); let element; if( k == 'field' ){ element = loadFieldElement(field[k]); @@ -204,24 +203,29 @@ const verify_circuit_proof = async (modular_path: string, circuit: string) => { ); let proof_path = folder_path + "/proof.bin"; - console.log("Verify :",proof_path); + console.log("Verify :", proof_path); let proof = loadProof(proof_path); let public_input = loadPublicInput(folder_path + "/public_input.json"); - console.log("public input: ", public_input); let receipt = await (await verifier_contract.verify(proof, public_input, {gasLimit: 30_500_000})).wait(); - console.log("Gas used: ⛽ ", receipt.gasUsed.toNumber()); + console.log("⛽Gas used: ", receipt.gasUsed.toNumber()); console.log("Events received:"); - const event_icons : {[key:string] : string } = { - 'WrongPublicInput' : '🤔', - 'WrongCommitment' : '🤔', - 'ConstraintSystemNotSatisfied' : '🤔', - 'ProofVerified' : '✅', - 'ProofVerificationFailed' : '🛑', + const event_to_string = (event) => { + switch(event.event) { + case 'VerificationResult': { + if (BigInt(event.data) != 0n) { + return '✅ProofVerified'; + } else { + return '🛑ProofVerificationFailed'; + } + } + break; + default: + return '🤔'+event.event; + } }; for(const e of receipt.events) { - //console.log(e); - console.log("%s: %s", e.event, event_icons[e.event]); + console.log(event_to_string(e)); } console.log("===================================="); } From 7af75ae1eeaa07d9c83fd956553aa987870162a0 Mon Sep 17 00:00:00 2001 From: Vasiliy Olekhov Date: Thu, 30 Nov 2023 19:43:51 +0300 Subject: [PATCH 5/6] Circuit2 public input added #86 --- contracts/zkllvm/circuit2/public_input.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 contracts/zkllvm/circuit2/public_input.json diff --git a/contracts/zkllvm/circuit2/public_input.json b/contracts/zkllvm/circuit2/public_input.json new file mode 100644 index 0000000..d7c12ac --- /dev/null +++ b/contracts/zkllvm/circuit2/public_input.json @@ -0,0 +1,5 @@ +[ + {"field": 49052524384703870792430850605823211740010368752655030397570455698676404652716 }, + {"field": 0 }, + {"field": 1 } +] \ No newline at end of file From a8ed6962c97895d1cb1b73e2bede3201ead796ea Mon Sep 17 00:00:00 2001 From: Vasiliy Olekhov Date: Thu, 30 Nov 2023 19:48:09 +0300 Subject: [PATCH 6/6] Remove unused event #86 --- contracts/interfaces/modular_commitment.sol | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/interfaces/modular_commitment.sol b/contracts/interfaces/modular_commitment.sol index 7118514..c23d1c9 100644 --- a/contracts/interfaces/modular_commitment.sol +++ b/contracts/interfaces/modular_commitment.sol @@ -20,10 +20,6 @@ pragma solidity >=0.8.4; import "../types.sol"; interface ICommitmentScheme { - /** - * @dev Emitted when proof does not contain valid eta point values - */ - event WrongEtaPointValues(); function initialize( bytes32 tr_state_before