Skip to content

Commit

Permalink
No JS proving (#62)
Browse files Browse the repository at this point in the history
* Add proof test fixtures generated by rust

* Install toml

* Add an e2e test to verify in JS the state proof from nagro

* Separate oracle and noir_js encoding

* Add noir ABI dependency

* Rewrite e2e tests to only verify proofs
  • Loading branch information
LogvinovLeon authored Jan 24, 2024
1 parent 50e59e9 commit 2c1199f
Show file tree
Hide file tree
Showing 15 changed files with 679 additions and 599 deletions.
1,074 changes: 546 additions & 528 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file modified .yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion contracts/test/fixtures/example.proof
Original file line number Diff line number Diff line change
@@ -1 +1 @@
011274fddc57437e2503f2a95956214ed76e6cf4d5fbc370c375efa3ffa5fafd0071e953f6f4d01056154ca1b7de33c78a7f3bfee9e811c010a589ae617552640fe8f06955295b9c700a458d39d88a3f82871ca52e95bf2a006426c0c8e143db02239805a0a78048af7c71a0cd66a1dac3808e4acc8524f0408fea2a2c84ab7a0a394e96a3d1a7b5bc3fc33b1cd4541161f772136548338060391ca06106d1471257f75f5970db5ad69b3d3c37afde0d160a588b5b335e9b3be4c7c9e658b58d1638330bd6a1898cce64201850017e605d5c22f1b97f9d7af210dee745bdeb8e29351a4f1e8eb8c46ee0a3cb8f80b901cba7c253ae468470c246c0d1c731fd9e13d757831f1679c1ff90ae8b600bb6fc1e3a4a668f78b9284901c7457ffc8aa60c6e0bcdcb24f2025c95f621342e96279ac81c987f439506b582331b81a803ee0b8c68e78be62274460befccf6d9d5752a141ac279663f2d223c01cd5cd5227c00c55c039e98f503917002910c1ad15eb8708489041a73230393fcd00e9a363813917e0fd28aec6412bc4c9382e7d71e0a08a4b07815488abfffce906e83cd0513ddbbaa59cc64ca8927bbbf010a0d957c253bad86645ab5b00c33b4eeb1e98210d52972a0ec13841e40d2c6e2fa1b15393fde81fdf59c7b9811ea087c6d4fc90b73332900bf32b075c6f2cbfb597f9aa9e2c063f6b57bcf6e7e2ee4ddba83401d5c2424e9ae3b5bda6bf8bede9d080604b927a958efcd3b53cf9b01b79bb843067d2c6d579e7856a1d2147b15b1d8bc842df9b55c1dd42bada2ae26da6294000418bbf98b6628f424eeaad95ed0592db2a15bba677fdaef92a07a73b12af0320d2864439eb1e285eebabcd84bc2a86072e5b2d8c7f25099e79b1758e750d83009fb3efb39c33356760645a44774f8e256b42654bc3bd53c5137bffa37ea48d515bd5b954d538d8a80e9aec0be7a5568aa7df66a79d7986bfc310212b84ad21c0147d1b268708bfbf655734dcffa8953472d38df6f5ec28876fc0f8bebbb32d90c6ca446358095e8b8933f64240b043d346f005574cffc51bda1e335c8359d89093684fba3df2fd00e0d8ffe92e1b54dd5826a378d22110fc2a63191da1c630f29a095ce4d62e9b3e7163d96c8baa82e5ab7de11dc9470fd09b82cdb5f741fd50140d8531495f112d5bbada8dbbf86bccffc1d6dd35fb0e8c682259107ba79d513ae6f4aa98554153e998aa334ac65aad147ce55e663eaa3d7a54ce7261cfa432f1f2e2248704aeee9311ab391e449e071cc85b57a7d351a717b435a507bcf0c04efb36bc558cc8206cccd64b0ed9a5433efbe798da319a9eb0bd56fed56522828ea5088e6c4f8dcf931513d59847347c463b7b0505ae10987b1ace9aef5b6291990cc316bae9f4169b8ff7ba7ee42cf337ca69ec3d6fc5601630829e9e652f401a4c5f66080923576add58d489d1b2725a9a2f96ec5eb433f55a9a6557ac9f118784837d603931dc5451bc8223030b51a60e4a324a85f7e81d497105b9476fe2436529f35f706f1f06782ec4f8ae37af87345ba68d7e1bd97b720ed946f0589060837655b03d8a5ab40b11836abac6e4d0b80752cd1b6816a9a46897ba82e1e300e8b46b4c4ce6a1c4247f46d73c134abe1669f2b1226878ba98dfea7a17eca1aa9502b0159ab650e2ce32f2dac54e94c98689a6305992d80f1794378382eea02bd49eff62b9e591b21b940ce5b2d413ec564f50df4881abee41abfe3cca5e71251b662ddd3f1f68549f58750118323efa848aa2b55cc5d54a481e7b18f302b0e3cc0f5c60a250224c08b6b7527470b55960ce06ab250dcc8cf1389105847a02bb4370e8a451663d1206fdd2733a173e20fccdd6d55f979c8e602152af9aa7624391022877d9473edbc6e9bfbb9268f8ee27dba34dffbce6f2017bf88645b4c03498becc101246aed5bab1a913a364e4b5345f2dd8bd6867eab534caaf593e21bc1d4249704b788b2a0c6e2b36a670365b42a9602343605007fea5d068a0ae003d5cde98bd6aa7cbf959cf454193f5b57e126f0ad2324f23e728bd9721e81dd1c4e162161da3d9a84dab8bc7649701072420b93d1cb8470c04722e9cdb2f8db1b359227cc2f3176e066d508f08b5df659264998329ce79940b8b1d03f611ce51f1e29535102a542e83db00a5c05c208562e93a2f8e143597d8756047ad7663c1402a26a37a818e87fc287e956aa278a3d0bace51e106a4f9f46be7d4b82f5eb1b3a7c7b4f2d39098667ec1cf0ab3ff8a15e45d5ef28a16b6901557120b070ee09024e28aa9e513d48f555e8ef6254cff9e9fe41a919a8d736f2241db295f91018f653e592c47aa2abe08f2e92986f2e0f83fcf60d7c06e4c0d04214bf1d5de10a481751ff6bf51a7519204600bf730c0f0f35a834061f9913d3d9173019af5714d767d028fe75f14f131f532124931d9c7abaeb6ca84a0c05380253d130a85a00084dd531bd1e31bb8492b229d5a8c6e23c9535740abe4b7efdf3c0f98fab621c4f4eb3183075ece69b4a287d56397c4462acbeafb607434ce5b3e666fc31d72ec2db75da3c88350b9a78783cc7b312b22682620a444cabbf352d0f9676e5572817470c68e72624800dce6fb9cfb42e8637fa4e9336f2ef7224f997f2c47b240f63320dfaf8cf32f9db1b44893c49b9bf1a7c00773a1f48534234c19acda16c20cce5b57048c0852172ca1c6a81c2a84718a918a9bcc76970d30b030d096ee001d24aea046711ad90ba333dca45e339a6e2ede86285fef94a81ebb08f453c53133bfe9179b702ffb851e215ab8b5c282ee11b009508a71a6812c1f2018109c702a99e435c285870cdee371bda8517abe99d919c0110aa2017f665a18d7d8e0c264816d68415fe0c082f6b47a1f559cd08967007213579902ffb75dc70a4bec62a12206fa8de13f325e7f64fd6fffd9e9567684835b8b3309b699b149bed7aaa1c53a9fbf9d24f6927823893d3ba4828f922bfd08a0768592aff206e8d7274fb
0x011274fddc57437e2503f2a95956214ed76e6cf4d5fbc370c375efa3ffa5fafd0071e953f6f4d01056154ca1b7de33c78a7f3bfee9e811c010a589ae617552640fe8f06955295b9c700a458d39d88a3f82871ca52e95bf2a006426c0c8e143db02239805a0a78048af7c71a0cd66a1dac3808e4acc8524f0408fea2a2c84ab7a0a394e96a3d1a7b5bc3fc33b1cd4541161f772136548338060391ca06106d1471257f75f5970db5ad69b3d3c37afde0d160a588b5b335e9b3be4c7c9e658b58d1638330bd6a1898cce64201850017e605d5c22f1b97f9d7af210dee745bdeb8e29351a4f1e8eb8c46ee0a3cb8f80b901cba7c253ae468470c246c0d1c731fd9e13d757831f1679c1ff90ae8b600bb6fc1e3a4a668f78b9284901c7457ffc8aa60c6e0bcdcb24f2025c95f621342e96279ac81c987f439506b582331b81a803ee0b8c68e78be62274460befccf6d9d5752a141ac279663f2d223c01cd5cd5227c00c55c039e98f503917002910c1ad15eb8708489041a73230393fcd00e9a363813917e0fd28aec6412bc4c9382e7d71e0a08a4b07815488abfffce906e83cd0513ddbbaa59cc64ca8927bbbf010a0d957c253bad86645ab5b00c33b4eeb1e98210d52972a0ec13841e40d2c6e2fa1b15393fde81fdf59c7b9811ea087c6d4fc90b73332900bf32b075c6f2cbfb597f9aa9e2c063f6b57bcf6e7e2ee4ddba83401d5c2424e9ae3b5bda6bf8bede9d080604b927a958efcd3b53cf9b01b79bb843067d2c6d579e7856a1d2147b15b1d8bc842df9b55c1dd42bada2ae26da6294000418bbf98b6628f424eeaad95ed0592db2a15bba677fdaef92a07a73b12af0320d2864439eb1e285eebabcd84bc2a86072e5b2d8c7f25099e79b1758e750d83009fb3efb39c33356760645a44774f8e256b42654bc3bd53c5137bffa37ea48d515bd5b954d538d8a80e9aec0be7a5568aa7df66a79d7986bfc310212b84ad21c0147d1b268708bfbf655734dcffa8953472d38df6f5ec28876fc0f8bebbb32d90c6ca446358095e8b8933f64240b043d346f005574cffc51bda1e335c8359d89093684fba3df2fd00e0d8ffe92e1b54dd5826a378d22110fc2a63191da1c630f29a095ce4d62e9b3e7163d96c8baa82e5ab7de11dc9470fd09b82cdb5f741fd50140d8531495f112d5bbada8dbbf86bccffc1d6dd35fb0e8c682259107ba79d513ae6f4aa98554153e998aa334ac65aad147ce55e663eaa3d7a54ce7261cfa432f1f2e2248704aeee9311ab391e449e071cc85b57a7d351a717b435a507bcf0c04efb36bc558cc8206cccd64b0ed9a5433efbe798da319a9eb0bd56fed56522828ea5088e6c4f8dcf931513d59847347c463b7b0505ae10987b1ace9aef5b6291990cc316bae9f4169b8ff7ba7ee42cf337ca69ec3d6fc5601630829e9e652f401a4c5f66080923576add58d489d1b2725a9a2f96ec5eb433f55a9a6557ac9f118784837d603931dc5451bc8223030b51a60e4a324a85f7e81d497105b9476fe2436529f35f706f1f06782ec4f8ae37af87345ba68d7e1bd97b720ed946f0589060837655b03d8a5ab40b11836abac6e4d0b80752cd1b6816a9a46897ba82e1e300e8b46b4c4ce6a1c4247f46d73c134abe1669f2b1226878ba98dfea7a17eca1aa9502b0159ab650e2ce32f2dac54e94c98689a6305992d80f1794378382eea02bd49eff62b9e591b21b940ce5b2d413ec564f50df4881abee41abfe3cca5e71251b662ddd3f1f68549f58750118323efa848aa2b55cc5d54a481e7b18f302b0e3cc0f5c60a250224c08b6b7527470b55960ce06ab250dcc8cf1389105847a02bb4370e8a451663d1206fdd2733a173e20fccdd6d55f979c8e602152af9aa7624391022877d9473edbc6e9bfbb9268f8ee27dba34dffbce6f2017bf88645b4c03498becc101246aed5bab1a913a364e4b5345f2dd8bd6867eab534caaf593e21bc1d4249704b788b2a0c6e2b36a670365b42a9602343605007fea5d068a0ae003d5cde98bd6aa7cbf959cf454193f5b57e126f0ad2324f23e728bd9721e81dd1c4e162161da3d9a84dab8bc7649701072420b93d1cb8470c04722e9cdb2f8db1b359227cc2f3176e066d508f08b5df659264998329ce79940b8b1d03f611ce51f1e29535102a542e83db00a5c05c208562e93a2f8e143597d8756047ad7663c1402a26a37a818e87fc287e956aa278a3d0bace51e106a4f9f46be7d4b82f5eb1b3a7c7b4f2d39098667ec1cf0ab3ff8a15e45d5ef28a16b6901557120b070ee09024e28aa9e513d48f555e8ef6254cff9e9fe41a919a8d736f2241db295f91018f653e592c47aa2abe08f2e92986f2e0f83fcf60d7c06e4c0d04214bf1d5de10a481751ff6bf51a7519204600bf730c0f0f35a834061f9913d3d9173019af5714d767d028fe75f14f131f532124931d9c7abaeb6ca84a0c05380253d130a85a00084dd531bd1e31bb8492b229d5a8c6e23c9535740abe4b7efdf3c0f98fab621c4f4eb3183075ece69b4a287d56397c4462acbeafb607434ce5b3e666fc31d72ec2db75da3c88350b9a78783cc7b312b22682620a444cabbf352d0f9676e5572817470c68e72624800dce6fb9cfb42e8637fa4e9336f2ef7224f997f2c47b240f63320dfaf8cf32f9db1b44893c49b9bf1a7c00773a1f48534234c19acda16c20cce5b57048c0852172ca1c6a81c2a84718a918a9bcc76970d30b030d096ee001d24aea046711ad90ba333dca45e339a6e2ede86285fef94a81ebb08f453c53133bfe9179b702ffb851e215ab8b5c282ee11b009508a71a6812c1f2018109c702a99e435c285870cdee371bda8517abe99d919c0110aa2017f665a18d7d8e0c264816d68415fe0c082f6b47a1f559cd08967007213579902ffb75dc70a4bec62a12206fa8de13f325e7f64fd6fffd9e9567684835b8b3309b699b149bed7aaa1c53a9fbf9d24f6927823893d3ba4828f922bfd08a0768592aff206e8d7274fb
2 changes: 2 additions & 0 deletions packages/noir-ethereum-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
"dependencies": {
"@noir-lang/backend_barretenberg": "0.22.0-179c90d.nightly",
"@noir-lang/noir_js": "0.22.0-179c90d.nightly",
"@noir-lang/noirc_abi": "^0.22.0",
"body-parser": "^1.20.2",
"dotenv": "^16.3.1",
"fastify": "^4.25.2",
"json-bigint": "^1.0.0",
"json-rpc-2.0": "^1.7.0",
"lodash.isequal": "^4.5.0",
"toml": "^3.0.0",
"viem": "^2.0.0"
},
"devDependencies": {
Expand Down
45 changes: 30 additions & 15 deletions packages/noir-ethereum-api/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
import { BarretenbergBackend, type CompiledCircuit } from '@noir-lang/backend_barretenberg';
import { type InputMap, Noir } from '@noir-lang/noir_js';
import { BarretenbergBackend, ProofData, type CompiledCircuit } from '@noir-lang/backend_barretenberg';
import { Noir, WitnessMap } from '@noir-lang/noir_js';
import { promises as fs } from 'fs';
import toml from 'toml';
import noir_ethereum_history_api from '../../../circuit/target/noir_ethereum_history_api.json';
import { type Oracles, defaultOracles } from './noir/oracles/oracles.js';
import { decodeHexString } from './noir/encode.js';
import { decodeHexString, encodeHexString } from './noir/noir_js/encode.js';
import { abiEncode, type InputMap } from '@noir-lang/noirc_abi';

export const circuit = noir_ethereum_history_api as unknown as CompiledCircuit;

export interface MainInputs extends InputMap {
block_no: number;
address: string[];
state_root: string[];
}

export async function generateAndVerifyStorageProof(
input: MainInputs,
oracles: Oracles = defaultOracles
): Promise<boolean> {
const circuit = noir_ethereum_history_api as unknown as CompiledCircuit;
const backend = new BarretenbergBackend(circuit);
const noir = new Noir(circuit, backend);
const proof = await noir.generateFinalProof(input, oracles);
return await noir.verifyFinalProof(proof);
}

/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
export async function recordStorageProof(
input: MainInputs,
oracles: Oracles = defaultOracles,
name: string
): Promise<boolean> {
const circuit = noir_ethereum_history_api as unknown as CompiledCircuit;
const backend = new BarretenbergBackend(circuit);
const noir = new Noir(circuit, backend);
const proof = await noir.generateFinalProof(input, oracles);
Expand All @@ -42,3 +34,26 @@ export async function recordStorageProof(
const isCorrect = await noir.verifyFinalProof(proof);
return isCorrect;
}

export async function verifyStorageProof(proof: ProofData): Promise<boolean> {
const backend = new BarretenbergBackend(circuit);
const noir = new Noir(circuit, backend);
return await noir.verifyFinalProof(proof);
}

export async function readProof(path: string): Promise<Uint8Array> {
const proofHex = await fs.readFile(path, 'utf-8');
return encodeHexString('0x' + proofHex);
}

export async function readWitnessMap(path: string): Promise<WitnessMap> {
const inputMap = await readInputMap(path);
const witnessMap = abiEncode(circuit.abi, inputMap, inputMap['return']);
return witnessMap;
}

export async function readInputMap(path: string): Promise<InputMap> {
const verifierData = await fs.readFile(path, 'utf-8');
const inputMap = toml.parse(verifierData);
return inputMap;
}
17 changes: 17 additions & 0 deletions packages/noir-ethereum-api/src/noir/noir_js/encode.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { describe, expect, it } from 'vitest';
import { encodeHexString, decodeHexString } from './encode.js';

describe('encodeHexString', () => {
it('throws on invalid input', () => {
expect(() => encodeHexString('1234')).toThrow('Invalid hexstring: 1234');
});
it('encodes hex string', () => {
expect(encodeHexString('0x1234')).toStrictEqual(new Uint8Array([0x12, 0x34]));
});
});

describe('decodeHexString', () => {
it('decodes hex string', () => {
expect(decodeHexString(new Uint8Array([0x12, 0x34]))).toStrictEqual('0x1234');
});
});
23 changes: 23 additions & 0 deletions packages/noir-ethereum-api/src/noir/noir_js/encode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { isHex } from 'viem';

// ENCODERS
export function encodeHexString(value: string): Uint8Array {
if (!isHex(value)) {
throw new Error(`Invalid hexstring: ${value}`);
}
const arr = [];
for (let i = 2; i < value.length; i += 2) {
arr.push(parseInt(value.substr(i, 2), 16));
}
return new Uint8Array(arr);
}

// DECODERS
export function decodeHexString(proof: Uint8Array): string {
return (
'0x' +
Array.from(proof)
.map((byte) => byte.toString(16).padStart(2, '0'))
.join('')
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type ForeignCallOutput } from '@noir-lang/noir_js';
import { fromRlp, type GetProofReturnType, type Hex, isHex, type PublicClient } from 'viem';
import { assert } from '../../util/assert.js';
import { decodeField, decodeHexAddress, encodeField, encodeHex } from '../encode.js';
import { decodeField, decodeHexAddress, encodeField, encodeHex } from './encode.js';
import { padArray } from '../../util/array.js';
import { NoirArguments } from './oracles.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Address, isAddress, isHex } from 'viem';
import { assert } from '../util/assert.js';
import { assert } from '../../util/assert.js';

export const MODULUS = 21888242871839275222246405745257275088696311157297823662689037894645226208583n;

Expand Down Expand Up @@ -60,9 +60,3 @@ export function decodeHexAddress(arg: string[]): Address {
export function decodeField(arg: string): bigint {
return BigInt(arg);
}

export function decodeHexString(proof: Uint8Array): string {
return Array.from(proof)
.map((byte) => byte.toString(16).padStart(2, '0'))
.join('');
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type ForeignCallOutput } from '@noir-lang/noir_js';
import { type BlockHeader, blockToHeader, headerToRlp } from '../../ethereum/blockHeader.js';
import { decodeField, encodeField, encodeHex } from '../encode.js';
import { decodeField, encodeField, encodeHex } from './encode.js';
import { padArray } from '../../util/array.js';
import { type GetBlockReturnType, hexToBytes, isHex, keccak256, type PublicClient } from 'viem';
import { assert } from '../../util/assert.js';
Expand Down
74 changes: 28 additions & 46 deletions packages/noir-ethereum-api/test/e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,62 +1,44 @@
import { PublicClient } from 'viem';
import { beforeAll, describe, expect, it } from 'vitest';
import { alterArray } from '../src/util/array.js';
import { describe, expect, it } from 'vitest';
import { incHexStr } from '../src/util/string.js';
import { createMockClient } from '../src/ethereum/mockClient.js';
import { Call } from '../src/ethereum/recordingClient.js';
import { generateAndVerifyStorageProof, type MainInputs } from '../src/main.js';
import { encodeAddress } from '../src/noir/encode.js';
import { createOracles, defaultOraclesMap, type Oracles } from '../src/noir/oracles/oracles.js';
import { ADDRESS } from '../src/ethereum/recordingClient.test.js';
import { expectCircuitFail } from './helpers.js';
import { verifyStorageProof, readProof, readWitnessMap, readInputMap, circuit } from '../src/main.js';
import { updateNestedField } from '../src/util/object.js';
import { abiEncode } from '@noir-lang/noirc_abi';

const defaultTestCircuitInputParams: MainInputs = {
block_no: 14194126,
address: encodeAddress(ADDRESS),
// prettier-ignore
state_root: ['0xd7', '0x8d', '0x4f', '0x18', '0x2e', '0xbd', '0x7f', '0xd', '0xc8', '0x6c', '0x5b', '0x32', '0x8b',
'0x73', '0xf9', '0xea', '0x3d', '0xfe', '0x17', '0xee', '0x56', '0xfb', '0xb4', '0x90', '0xd9', '0xb6', '0x7e',
'0xda', '0xc4', '0x8e', '0x2b', '0x4']
};

function alterCall(callName: string, path: string[]) {
return (call: Call): Call => {
if (call.method === callName) {
updateNestedField(call, path, incHexStr);
}
return call;
};
}
describe(
'e2e',
() => {
let client: PublicClient;
let oracles: Oracles;

beforeAll(async () => {
client = await createMockClient('./test/fixtures/mockClientData.json');
oracles = createOracles(client)(defaultOraclesMap);
});

it('proof successes', async () => {
expect(await generateAndVerifyStorageProof(defaultTestCircuitInputParams, oracles)).toEqual(true);
it('proof verification successes', async () => {
const proof = await readProof('test/fixtures/proof/noir_ethereum_history_api.proof');
const witnessMap = await readWitnessMap('test/fixtures/proof/Verifier.toml');
const proofData = {
proof,
publicInputs: Array.from(witnessMap.values())
};
expect(await verifyStorageProof(proofData)).toEqual(true);
});

it('proof fails: invalid proof', async () => {
const resultModifier = alterCall('getProof', ['result', 'accountProof', '0']);
const oracles = createOracles(await createMockClient('./test/fixtures/mockClientData.json', resultModifier))(
defaultOraclesMap
);
await expectCircuitFail(generateAndVerifyStorageProof(defaultTestCircuitInputParams, oracles));
const proof = await readProof('test/fixtures/proof/noir_ethereum_history_api.proof');
const inputMap = await readInputMap('test/fixtures/proof/Verifier.toml');
updateNestedField(inputMap, ['return', 'proof', '0'], incHexStr);
const witnessMap = abiEncode(circuit.abi, inputMap, inputMap['return']);
const proofData = {
proof,
publicInputs: Array.from(witnessMap.values())
};
expect(await verifyStorageProof(proofData)).toEqual(false);
});

it('proof fails: invalid state root', async () => {
const inputParams = {
...defaultTestCircuitInputParams,
state_root: alterArray(defaultTestCircuitInputParams.state_root)
const proof = await readProof('test/fixtures/proof/noir_ethereum_history_api.proof');
const inputMap = await readInputMap('test/fixtures/proof/Verifier.toml');
updateNestedField(inputMap, ['state_root', '0'], incHexStr);
const witnessMap = abiEncode(circuit.abi, inputMap, inputMap['return']);
const proofData = {
proof,
publicInputs: Array.from(witnessMap.values())
};
await expectCircuitFail(generateAndVerifyStorageProof(inputParams, oracles));
expect(await verifyStorageProof(proofData)).toEqual(false);
});
},
{
Expand Down
Loading

0 comments on commit 2c1199f

Please sign in to comment.