Skip to content

Commit da998e2

Browse files
committed
use better contract to verify
1 parent 45931b8 commit da998e2

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

test/fixture-projects/hardhat-project/contracts/MyContract.sol

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ pragma solidity ^0.8.27;
44
import {HonkVerifier} from "../noir2/target/my_circuit.sol";
55

66
contract 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
}

test/noir.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)