Skip to content

Commit

Permalink
Merge pull request #95 from AztecProtocol/jc/update-up-36
Browse files Browse the repository at this point in the history
36 working with ultraplonk
  • Loading branch information
signorecello authored Nov 4, 2024
2 parents 2d4034e + c97565a commit af1c8c0
Show file tree
Hide file tree
Showing 5 changed files with 7,382 additions and 12 deletions.
4 changes: 2 additions & 2 deletions vite-hardhat/hooks/useOffChainVerification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import { ProofData } from '@noir-lang/types';
import { useEffect } from 'react';
import { toast } from 'react-toastify';
import { BarretenbergBackend } from '@noir-lang/backend_barretenberg';
import { UltraPlonkBackend } from '@aztec/bb.js';
import { Noir } from '@noir-lang/noir_js';

export function useOffChainVerification(
backend: BarretenbergBackend,
backend: UltraPlonkBackend,
noir?: Noir,
proofData?: ProofData,
) {
Expand Down
8 changes: 5 additions & 3 deletions vite-hardhat/hooks/useProofGeneration.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { toast } from 'react-toastify';
import { useEffect, useState } from 'react';
import { getCircuit } from '../circuit/compile.js';
import { BarretenbergBackend, ProofData } from '@noir-lang/backend_barretenberg';
import { UltraPlonkBackend, ProofData } from '@aztec/bb.js';
import { Noir } from '@noir-lang/noir_js';

export function useProofGeneration(inputs?: { [key: string]: string }) {
const [proofData, setProofData] = useState<ProofData | undefined>();
const [backend, setBackend] = useState<BarretenbergBackend>();
const [backend, setBackend] = useState<UltraPlonkBackend>();
const [noir, setNoir] = useState<Noir | undefined>();

const proofGeneration = async () => {
if (!inputs) return;
const circuit = await getCircuit();
const backend = new BarretenbergBackend(circuit, { threads: navigator.hardwareConcurrency });
const backend = new UltraPlonkBackend(circuit.bytecode, {
threads: navigator.hardwareConcurrency,
});
const noir = new Noir(circuit);

await toast.promise(noir.init, {
Expand Down
8 changes: 4 additions & 4 deletions vite-hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"test": "test/test.sh"
},
"dependencies": {
"@noir-lang/backend_barretenberg": "0.33.0",
"@noir-lang/noir_js": "0.33.0",
"@noir-lang/noir_wasm": "0.33.0",
"@noir-lang/types": "0.33.0",
"@aztec/bb.js": "^0.62.0",
"@noir-lang/noir_js": "0.36.0",
"@noir-lang/noir_wasm": "0.36.0",
"@noir-lang/types": "0.36.0",
"@nomicfoundation/hardhat-ignition": "^0.15.5",
"@nomicfoundation/hardhat-ignition-viem": "^0.15.5",
"@tanstack/query-sync-storage-persister": "5.0.5",
Expand Down
7 changes: 4 additions & 3 deletions vite-hardhat/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import { expect } from 'chai';
import { BarretenbergBackend } from '@noir-lang/backend_barretenberg';
import { Noir } from '@noir-lang/noir_js';
import { UltraPlonkBackend } from '@aztec/bb.js';

import { ProofData } from '@noir-lang/types';
import { readFileSync } from 'fs';
import { resolve } from 'path';
import shelljs from 'shelljs';


shelljs.exec('npx hardhat compile');

describe('It compiles noir program code, receiving circuit bytes and abi object.', () => {
let noir: Noir;
let backend: BarretenbergBackend;
let backend: UltraPlonkBackend;
let correctProof: ProofData;

beforeEach(async () => {
const circuitFile = readFileSync(resolve('artifacts/circuit.json'), 'utf-8');
const circuit = JSON.parse(circuitFile);

backend = new BarretenbergBackend(circuit);
backend = new UltraPlonkBackend(circuit.bytecode);
noir = new Noir(circuit);
});

Expand Down
Loading

0 comments on commit af1c8c0

Please sign in to comment.