Skip to content

Commit

Permalink
chore: Perform lazy initialization inside noir_js (#2951)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobyhallx authored Oct 3, 2023
1 parent 2a33950 commit 4abd328
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@ import { TEST_LOG_LEVEL } from '../../environment.js';
import { Logger } from 'tslog';
import { initializeResolver } from '@noir-lang/source-resolver';
import newCompiler, { compile, init_log_level as compilerLogLevel } from '@noir-lang/noir_wasm';
import { acvm, abi, Noir } from '@noir-lang/noir_js';
import { Noir } from '@noir-lang/noir_js';
import { BarretenbergBackend } from '@noir-lang/backend_barretenberg';
import { ethers } from 'ethers';
import * as TOML from 'smol-toml';

const provider = new ethers.JsonRpcProvider('http://localhost:8545');
const logger = new Logger({ name: 'test', minLevel: TEST_LOG_LEVEL });

const { default: initACVM } = acvm;
const { default: newABICoder } = abi;

await newCompiler();
await newABICoder();
await initACVM();

compilerLogLevel('INFO');

Expand Down
1 change: 1 addition & 0 deletions tooling/noir_js/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class Noir {

// Initial inputs to your program
async generateFinalProof(inputs: any): Promise<Uint8Array> {
await this.init();
const serializedWitness = await generateWitness(this.circuit, inputs);
return this.backend.generateFinalProof(serializedWitness);
}
Expand Down

0 comments on commit 4abd328

Please sign in to comment.