-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy path1115.0.61.0-dev.1740070057913.js
2 lines (2 loc) · 2 KB
/
1115.0.61.0-dev.1740070057913.js
1
2
"use strict";(self["webpackChunk"]=self["webpackChunk"]||[]).push([[1115],{231115:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});const __WEBPACK_DEFAULT_EXPORT__="// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { expect } = require('chai')\nimport { compile, createFileManager } from '@noir-lang/noir_wasm'\nimport { Noir } from '@noir-lang/noir_js'\nimport { UltraPlonkBackend } from '@aztec/bb.js'\n\nasync function getCircuit() {\n const fm = createFileManager('/')\n\n const circuit = await remix.call('fileManager', 'readFile', 'src/main.nr')\n const nargoToml = await remix.call('fileManager', 'readFile', 'Nargo.toml')\n const tomlBytes = new TextEncoder().encode(nargoToml)\n const mainBytes = new TextEncoder().encode(circuit)\n await fm.writeFile('./src/main.nr', new Blob([mainBytes]).stream())\n await fm.writeFile('Nargo.toml', new Blob([tomlBytes]).stream())\n\n const result = await compile(fm)\n if (!('program' in result)) {\n throw new Error('Compilation failed')\n }\n\n return result.program\n}\n\ndescribe('Noir Program Test', () => {\n it('should compile, execute, prove, and verify', async () => {\n const noir_program = await getCircuit()\n\n const inputs = {\n pub_key: '',\n signature: '',\n hashed_message: '',\n nullifier: '',\n merkle_path: '',\n index: '',\n merkle_root: '',\n claimer_priv: '',\n claimer_pub: ''\n }\n\n // JS Proving\n const program = new Noir(noir_program)\n const { witness } = await program.execute(inputs)\n\n const backend = new UltraPlonkBackend(noir_program.bytecode)\n const proof = await backend.generateProof(witness)\n\n // JS verification\n const verified = await backend.verifyProof(proof)\n expect(verified, 'Proof fails verification in JS').to.be.true\n })\n})"}}]);
//# sourceMappingURL=1115.0.61.0-dev.1740070057913.js.map