Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: PXE browser proving #10704

Merged
merged 96 commits into from
Dec 17, 2024
Merged
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
e0be78b
Playwright ReferenceError
codygunton Dec 5, 2024
6ac7cc5
Prove flow executes
codygunton Dec 6, 2024
f0194b0
Verify flow fails, proof size read into bb is long 140B
codygunton Dec 6, 2024
6597f6c
Verify failing, logs not printing(..?)
codygunton Dec 6, 2024
74420bb
wait for pxe to synch before checking balances
Thunkar Dec 9, 2024
92ba769
actually commit
Thunkar Dec 9, 2024
0337f73
comment
Thunkar Dec 9, 2024
a0483db
fix
Thunkar Dec 9, 2024
d989cad
Merge branch 'master' into gj/deflate_e2e_2_pxes
Thunkar Dec 9, 2024
823921e
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 9, 2024
0fde995
merge
Thunkar Dec 9, 2024
0d58475
Merge branch 'gj/deflate_e2e_2_pxes' of github.com:AztecProtocol/azte…
Thunkar Dec 9, 2024
0c6e72a
it works
codygunton Dec 9, 2024
589c402
Clean up
codygunton Dec 9, 2024
d445cb5
Rename and shuffle
codygunton Dec 9, 2024
98ca403
Tweak comments
codygunton Dec 9, 2024
9940485
Revert playright version bump
codygunton Dec 9, 2024
eb3bd89
Revert yarn.lock change
codygunton Dec 9, 2024
e6da9bd
Merge remote-tracking branch 'origin/master' into cg/browser-civc-pro…
codygunton Dec 9, 2024
65e3897
Remove unused import
codygunton Dec 9, 2024
2500fe2
Maybe Each is safer
codygunton Dec 10, 2024
fe40d4f
fmt
Thunkar Dec 10, 2024
3721212
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 10, 2024
4c1f459
Merge branch 'cg/browser-civc-prove-then-verify' of github.com:AztecP…
Thunkar Dec 10, 2024
9540975
Merge branch 'master' into gj/deflate_e2e_2_pxes
Thunkar Dec 10, 2024
2028f3c
initial approach
Thunkar Dec 10, 2024
782902a
Merge branch 'master' into gj/deflate_e2e_2_pxes
Thunkar Dec 10, 2024
5f96383
working proving
Thunkar Dec 10, 2024
4a180a0
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 10, 2024
9499176
Merge branch 'master' into gj/deflate_e2e_2_pxes
Thunkar Dec 10, 2024
d5a1126
wip
Thunkar Dec 10, 2024
a09c9b5
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 10, 2024
f91e77e
Merge branch 'master' into gj/deflate_e2e_2_pxes
Thunkar Dec 11, 2024
4835dec
increased crs size
Thunkar Dec 11, 2024
babc451
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 11, 2024
2e16af9
updated contract
Thunkar Dec 11, 2024
11a8b71
Merge branch 'gj/deflate_e2e_2_pxes' of github.com:AztecProtocol/azte…
Thunkar Dec 11, 2024
712f25e
synchronize on demand
Thunkar Dec 11, 2024
64b4996
Merge branch 'master' into gj/deflate_e2e_2_pxes
Thunkar Dec 11, 2024
307b76b
Merge branch 'gj/deflate_e2e_2_pxes' of github.com:AztecProtocol/azte…
Thunkar Dec 11, 2024
a120e99
improvements and comments
Thunkar Dec 11, 2024
5a2a6f7
don't sync on note sync
Thunkar Dec 11, 2024
0673191
remove auto verify in cbind ivc prove
ledwards2225 Dec 11, 2024
13ff2a6
fmt
Thunkar Dec 11, 2024
3ddccf1
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 11, 2024
47fc817
Merge branch 'gj/pxe_sync_on_demand' of github.com:AztecProtocol/azte…
Thunkar Dec 11, 2024
6388f0e
comment hack to run yarn proj
ledwards2225 Dec 11, 2024
d23a0a1
consolidation
Thunkar Dec 11, 2024
10c5924
undo
ledwards2225 Dec 11, 2024
a9ce0d8
updated to schnorr account contract
Thunkar Dec 11, 2024
e3e4fd8
Merge branch 'master' into lde/fix_wasm_ivc_integration
ledwards2225 Dec 11, 2024
7e5387d
Update package.json
ludamad Dec 11, 2024
2f9a2ee
fix
Thunkar Dec 11, 2024
e0508f6
Merge branch 'lde/fix_wasm_ivc_integration' of github.com:AztecProtoc…
Thunkar Dec 11, 2024
289d938
Merge branch 'gj/pxe_sync_on_demand' of github.com:AztecProtocol/azte…
Thunkar Dec 11, 2024
d4adc17
ffs
Thunkar Dec 11, 2024
278c6fe
ffs
Thunkar Dec 11, 2024
98939a5
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 11, 2024
9268f84
bb wasm cli
Thunkar Dec 12, 2024
da9353f
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 12, 2024
cf57523
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 12, 2024
2ea035c
Merge branch 'gj/pxe_sync_on_demand' of github.com:AztecProtocol/azte…
Thunkar Dec 12, 2024
21fe1be
more tests
Thunkar Dec 12, 2024
725759e
removed jobqueue, stop, etc
Thunkar Dec 12, 2024
f50c8e9
fmt
Thunkar Dec 12, 2024
00fd955
renaming
Thunkar Dec 12, 2024
bc56c9c
fix
Thunkar Dec 12, 2024
ff200de
typo
Thunkar Dec 12, 2024
77f8ddb
fmt
Thunkar Dec 12, 2024
a2385ba
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 12, 2024
d2d172a
Merge branch 'gj/pxe_sync_on_demand' of github.com:AztecProtocol/azte…
Thunkar Dec 12, 2024
05a5343
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 12, 2024
24eff66
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 13, 2024
2db73d3
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 13, 2024
3746d38
env attempt
Thunkar Dec 13, 2024
5bcb42a
more logging
Thunkar Dec 13, 2024
a80370e
trim the fat
Thunkar Dec 13, 2024
9ffe5a0
fmt
Thunkar Dec 13, 2024
e24da8a
Merge branch 'master' into gj/pxe_browser_proving
Thunkar Dec 13, 2024
80ce438
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 13, 2024
861a2ad
Merge branch 'gj/pxe_browser_proving' of github.com:AztecProtocol/azt…
Thunkar Dec 13, 2024
2a6a045
updated lock
Thunkar Dec 16, 2024
8e9d6b8
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 16, 2024
465077f
more module splitting
Thunkar Dec 16, 2024
10600ac
more stripping
Thunkar Dec 16, 2024
c2f88ac
more fat-trimming
Thunkar Dec 16, 2024
87e9f7c
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 16, 2024
f2c881f
removed await
Thunkar Dec 16, 2024
ea4249e
fixes
Thunkar Dec 16, 2024
e1a95cf
Merge branch 'master' into gj/pxe_browser_proving
Thunkar Dec 16, 2024
11013ce
Merge branch 'master' into gj/pxe_browser_proving
Thunkar Dec 16, 2024
5988902
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 16, 2024
94e41ad
Merge branch 'master' of github.com:AztecProtocol/aztec-packages into…
Thunkar Dec 16, 2024
ac0679d
changed cheatcodes
Thunkar Dec 16, 2024
35cef66
bad merge
Thunkar Dec 16, 2024
a1c2c81
fmt
Thunkar Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prove flow executes
codygunton committed Dec 6, 2024
commit 6ac7cc577b3254019a18ee7c0024f3806c8a4e83
5 changes: 3 additions & 2 deletions barretenberg/ts/src/barretenberg_api/index.ts
Original file line number Diff line number Diff line change
@@ -559,14 +559,15 @@ export class BarretenbergApi {

async acirProveAztecClient(acirVec: Uint8Array[], witnessVec: Uint8Array[]): Promise<[Uint8Array, Uint8Array]> {
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
const outTypes: OutputType[] = [BufferDeserializer()];
const outTypes: OutputType[] = [BufferDeserializer(), BufferDeserializer()];
const result = await this.wasm.callWasmExport(
'acir_prove_aztec_client',
inArgs,
outTypes.map(t => t.SIZE_IN_BYTES),
);
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
// console.log(`number of things in out: ${out.length}`);
console.log(`number of things in outTypes: ${outTypes.length}`);
console.log(`number of things in out: ${out.length}`);
return [out[0], out[1]];
}

2 changes: 1 addition & 1 deletion yarn-project/ivc-integration/package.json
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@
"chalk": "^5.3.0",
"change-case": "^5.4.4",
"pako": "^2.1.0",
"playwright": "^1.48.2",
"playwright": "^1.49.0",
"puppeteer": "^22.4.1",
"tslib": "^2.4.0"
},
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import chalk from 'chalk';
import createDebug from 'debug';
import { type Browser, type Page, chromium } from 'playwright';

import { generate3FunctionTestingIVCStack, proveThenVerifyAztecClient } from './index.js';
import { generate3FunctionTestingIVCStack, proveAndVerifyAztecClient } from './index.js';

/* eslint-disable camelcase */

@@ -64,7 +64,7 @@ describe('Client IVC Integration', () => {
const [bytecodes, witnessStack] = await generate3FunctionTestingIVCStack();

logger(`calling prove then verify...`);
const result = await proveThenVerifyAztecClient(page, bytecodes, witnessStack);
const result = await proveAndVerifyAztecClient(page, bytecodes, witnessStack);
expect(result).toEqual(true);
});
});
42 changes: 3 additions & 39 deletions yarn-project/ivc-integration/src/index.ts
Original file line number Diff line number Diff line change
@@ -243,27 +243,14 @@ function base64ToUint8Array(base64: string): Uint8Array {
}

export async function proveAndVerifyBrowser(bytecodes: string[], witnessStack: Uint8Array[], threads?: number) {
const { AztecClientBackend } = await import('@aztec/bb.js');
const preparedBytecodes = bytecodes.map(base64ToUint8Array).map((arr: Uint8Array) => ungzip(arr));
const backend = new AztecClientBackend(preparedBytecodes, { threads });
const verified = await backend.proveAndVerify(witnessStack.map((arr: Uint8Array) => ungzip(arr)));

await backend.destroy();
return verified;
}

export async function proveBrowser(
bytecodes: string[],
witnessStack: Uint8Array[],
threads?: number,
): Promise<[Uint8Array, Uint8Array]> {
const { AztecClientBackend } = await import('@aztec/bb.js');
const preparedBytecodes = bytecodes.map(base64ToUint8Array).map((arr: Uint8Array) => ungzip(arr));
const backend = new AztecClientBackend(preparedBytecodes, { threads });
const [proof, vk] = await backend.prove(witnessStack.map((arr: Uint8Array) => ungzip(arr)));

logger(`proof length: ${proof.length}`);
logger(`vk length: ${vk.length}`);
await backend.destroy(); // WORKTODO: share backend?
return [proof, vk];
return true;
}

// export async function verifyBrowser(proof: Uint8Array, threads?: number): Promise<boolean> {
@@ -293,26 +280,3 @@ export async function proveAndVerifyAztecClient(

return result;
}

// WORKTODO: This functions will construct a proof using the `prove` flow, then verify
// the proof using the accompanying vk using the `verify` flow. proveAndVerify instead just
// receives a boolean signal via a single call to a backend function.
export async function proveThenVerifyAztecClient(
page: Page,
bytecodes: string[],
witnessStack: Uint8Array[],
): Promise<boolean> {
const threads = 16;

const result: boolean = await page.evaluate(
([acir, witness, numThreads]) => {
console.log('trying to assign proveBrowser');
(window as any).proveBrowser = proveBrowser;
const _proof = (window as any).proveBrowser(acir, witness, numThreads);
return true;
},
[bytecodes, witnessStack, threads],
);

return result;
}
3 changes: 1 addition & 2 deletions yarn-project/ivc-integration/src/serve.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import createDebug from 'debug';

import { generate3FunctionTestingIVCStack, proveAndVerifyBrowser, proveBrowser } from './index.js';
import { generate3FunctionTestingIVCStack, proveAndVerifyBrowser } from './index.js';

createDebug.enable('*');
const logger = createDebug('aztec:ivc-test');
@@ -79,7 +79,6 @@ function setupConsoleOutput() {
}

(window as any).proveAndVerifyBrowser = proveAndVerifyBrowser;
(window as any).proveBroswer = proveBrowser;

document.addEventListener('DOMContentLoaded', function () {
setupConsoleOutput(); // Initialize console output capture
28 changes: 26 additions & 2 deletions yarn-project/yarn.lock
Original file line number Diff line number Diff line change
@@ -730,7 +730,7 @@ __metadata:
levelup: ^5.1.1
memdown: ^6.1.1
pako: ^2.1.0
playwright: ^1.48.2
playwright: ^1.49.0
puppeteer: ^22.4.1
resolve-typescript-plugin: ^2.0.1
serve: ^14.2.1
@@ -14827,7 +14827,16 @@ __metadata:
languageName: node
linkType: hard

"playwright@npm:1.48.2, playwright@npm:^1.48.2":
"playwright-core@npm:1.49.0":
version: 1.49.0
resolution: "playwright-core@npm:1.49.0"
bin:
playwright-core: cli.js
checksum: d8423ad0cab2e672856529bf6b98b406e7e605da098b847b9b54ee8ebd8d716ed8880a9afff4b38f0a2e3f59b95661c74589116ce3ff2b5e0ae3561507086c94
languageName: node
linkType: hard

"playwright@npm:1.48.2":
version: 1.48.2
resolution: "playwright@npm:1.48.2"
dependencies:
@@ -14842,6 +14851,21 @@ __metadata:
languageName: node
linkType: hard

"playwright@npm:^1.49.0":
version: 1.49.0
resolution: "playwright@npm:1.49.0"
dependencies:
fsevents: 2.3.2
playwright-core: 1.49.0
dependenciesMeta:
fsevents:
optional: true
bin:
playwright: cli.js
checksum: f1bfb2fff65cad2ce996edab74ec231dfd21aeb5961554b765ce1eaec27efb87eaba37b00e91ecd27727b82861e5d8c230abe4960e93f6ada8be5ad1020df306
languageName: node
linkType: hard

"pluralize@npm:^8.0.0":
version: 8.0.0
resolution: "pluralize@npm:8.0.0"