-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from AztecProtocol/zpedro/ultrahonk
ultrahonk finally
- Loading branch information
Showing
16 changed files
with
150 additions
and
551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ jobs: | |
run: bunx hardhat compile | ||
|
||
- name: Run tests | ||
run: bun test | ||
run: bun run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,6 @@ on: | |
schedule: | ||
# Run a nightly release at 2 AM UTC | ||
- cron: '0 2 * * *' | ||
pull_request: | ||
paths: | ||
- 'vite-hardhat/**' | ||
|
||
jobs: | ||
vite-hardhat-setup: | ||
|
@@ -86,7 +83,7 @@ jobs: | |
run: bunx hardhat compile | ||
|
||
- name: Run tests | ||
run: bun test | ||
run: bun run test | ||
|
||
- name: Send GitHub Action trigger data to Slack workflow - Stable | ||
uses: slackapi/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ package-lock.json | |
|
||
# To use with nektos/act | ||
.github/event.json | ||
bun.lockb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,8 @@ crs | |
artifacts | ||
.yarn/ | ||
|
||
circuit/target/ | ||
noir/target/ | ||
contracts | ||
dist | ||
deployment.json | ||
bun.lockb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,10 @@ | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react-swc'; | ||
|
||
export default defineConfig({ | ||
export default { | ||
optimizeDeps: { | ||
esbuildOptions: { | ||
target: 'esnext', | ||
}, | ||
}, | ||
build: { | ||
target: 'esnext', | ||
}, | ||
plugins: [react()], | ||
server: { | ||
port: 1337, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { expect, beforeAll, describe, test } from 'bun:test'; | ||
import { Noir } from '@noir-lang/noir_js'; | ||
import { ProofData } from '@noir-lang/types'; | ||
import { UltraHonkBackend } from '@aztec/bb.js'; | ||
import fs from 'fs'; | ||
import { resolve } from 'path'; | ||
|
||
describe('UltraHonk', () => { | ||
let correctProof: ProofData; | ||
let noir: Noir; | ||
let backend: UltraHonkBackend; | ||
|
||
beforeAll(async () => { | ||
const contractsDir = resolve('packages', 'contracts'); | ||
if (fs.existsSync(contractsDir)) fs.rmdirSync(contractsDir, { recursive: true }); | ||
|
||
const hre = require('hardhat'); | ||
|
||
hre.run('node'); | ||
hre.config.noirenberg = { provingSystem: 'UltraHonk' }; | ||
|
||
console.log(hre); | ||
({ noir, backend } = await hre.noirenberg.compile()); | ||
await hre.noirenberg.getSolidityVerifier(); | ||
}); | ||
|
||
test('Should generate valid proof for correct input', async () => { | ||
const input = { x: 1, y: 2 }; | ||
const { witness } = await noir.execute(input); | ||
correctProof = await backend.generateProof(witness); | ||
expect(correctProof.proof instanceof Uint8Array).toBeTrue; | ||
}); | ||
|
||
test('Should verify valid proof for correct input', async () => { | ||
const verification = await backend.verifyProof(correctProof); | ||
expect(verification).toBeTrue; | ||
}); | ||
|
||
test('Should fail to generate valid proof for incorrect input', async () => { | ||
try { | ||
const input = { x: 1, y: 1 }; | ||
const { witness } = await noir.execute(input); | ||
const incorrectProof = await backend.generateProof(witness); | ||
} catch (err) { | ||
expect(err instanceof Error).toBeTrue; | ||
const error = err as Error; | ||
expect(error.message).toContain('Cannot satisfy constraint'); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.