File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
fixture-projects/hardhat-project/contracts Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,15 @@ pragma solidity ^0.8.27;
44import {HonkVerifier} from "../noir2/target/my_circuit.sol " ;
55
66contract MyContract {
7- HonkVerifier public verifier;
7+ HonkVerifier public verifier = new HonkVerifier () ;
88
9- constructor (HonkVerifier _verifier ) {
10- verifier = _verifier;
11- }
9+ function verify (
10+ bytes calldata proof ,
11+ uint256 y
12+ ) external view returns (bool ) {
13+ bytes32 [] memory publicInputs = new bytes32 [](1 );
14+ publicInputs[0 ] = bytes32 (y);
15+ bool result = verifier.verify (proof, publicInputs);
16+ return result;
17+ }
1218}
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ describe("Integration tests examples", function () {
5050
5151 // Deploy a verifier contract
5252 const contractFactory =
53- await this . hre . ethers . getContractFactory ( "HonkVerifier " ) ;
53+ await this . hre . ethers . getContractFactory ( "MyContract " ) ;
5454 const contract = await contractFactory . deploy ( ) ;
5555 await contract . waitForDeployment ( ) ;
5656
@@ -65,9 +65,7 @@ describe("Integration tests examples", function () {
6565 expect ( BigInt ( publicInputs [ 0 ] ) ) . to . eq ( BigInt ( input . y ) ) ;
6666
6767 // Verify the proof on-chain
68- const result = await contract . verify ( proof . slice ( 4 ) , [
69- this . hre . ethers . toBeHex ( input . y , 32 ) ,
70- ] ) ;
68+ const result = await contract . verify ( proof . slice ( 4 ) , input . y ) ;
7169 expect ( result ) . to . eq ( true ) ;
7270
7371 // You can also verify in JavaScript.
You can’t perform that action at this time.
0 commit comments