Skip to content

Commit

Permalink
fixing conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Nov 12, 2024
2 parents e4be21f + ae3919d commit 2983a8e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ When contributing to this repository, please first discuss the change you wish t
## Contributing to an existing example project

If you would like to contribute to an existing example project, please open an issue and tag one of the original
authors or maintainers (@critesjosh, @signorecello) with your suggestion.
authors or maintainers ([@critesjosh](https://github.com/critesjosh), [@signorecello](https://github.com/signorecello)) with your suggestion.

## Adding a new example project

Expand All @@ -18,4 +18,4 @@ If you want to contribute with unique ideas, check out Awesome Noir to see what'
- A Svelte example
- A server-side-rendered Go or Python app

Basically anything that combines different technologies would be adding a lot to the ecosystem. If you'd like to discuss further, please message @signorecello or @critesjosh!
Basically anything that combines different technologies would be adding a lot to the ecosystem. If you'd like to discuss further, please message [@signorecello](https://github.com/signorecello) or [@critesjosh](https://github.com/critesjosh)!
Binary file modified vite-hardhat/bun.lockb
Binary file not shown.
11 changes: 9 additions & 2 deletions vite-hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
"scripts": {
"deploy": "bunx hardhat compile && bunx hardhat deploy",
"dev": "bun --filter vite dev",
"test:hardhat": "bunx hardhat test"
"test:hardhat": "bunx hardhat test",
"node": "bunx hardhat node"
},
"type": "module",
"devDependencies": {
"hardhat-plugin-noir": "0.1.3",
"@types/bun": "^1.1.12",
"hardhat": "^2.19.2",
"hardhat": "^2.19.2"
},
"dependencies": {
"@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",
"commander": "^12.1.0",
Expand Down
10 changes: 7 additions & 3 deletions vite-hardhat/packages/vite/hooks/useOffChainVerification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
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, noir?: Noir, proofData?: ProofData) {
export function useOffChainVerification(
backend: UltraPlonkBackend,
noir?: Noir,
proofData?: ProofData,
) {
useEffect(() => {
if (!proofData || !noir) return;

toast.promise(backend.verifyProof(proofData), {
toast.promise(backend.verifyProof(proofData.proof), {
pending: 'Verifying proof off-chain',
success: 'Proof verified off-chain',
error: 'Error verifying proof off-chain',
Expand Down
8 changes: 4 additions & 4 deletions vite-hardhat/packages/vite/hooks/useProofGeneration.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { toast } from 'react-toastify';
import { useEffect, useState } from 'react';
import { getCircuit } from '../../noir/compile.js';
import { BarretenbergBackend, ProofData } from '@noir-lang/backend_barretenberg';
import { UltraPlonkBackend } 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 [proofData, setProofData] = useState<Uint8Array | undefined>();
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, {
const backend = new UltraPlonkBackend(circuit.bytecode, {
threads: navigator.hardwareConcurrency,
});
const noir = new Noir(circuit);
Expand Down
1 change: 1 addition & 0 deletions vite-hardhat/packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@noir-lang/noir_js": "0.36.0",
"@noir-lang/noir_wasm": "0.36.0",
"@noir-lang/types": "0.36.0",
"@aztec/bb.js": "^0.62.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-toastify": "^9.1.1",
Expand Down

0 comments on commit 2983a8e

Please sign in to comment.