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
Show file tree
Hide file tree
Changes from 92 commits
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
2 changes: 1 addition & 1 deletion barretenberg/ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"dependencies": {
"comlink": "^4.4.1",
"commander": "^10.0.1",
"commander": "^12.1.0",
"debug": "^4.3.4",
"fflate": "^0.8.0",
"pako": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/ts/src/barretenberg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class Barretenberg extends BarretenbergApi {
async initSRSClientIVC(): Promise<void> {
// crsPath can be undefined
const crs = await Crs.new(2 ** 20 + 1, this.options.crsPath);
const grumpkinCrs = await GrumpkinCrs.new(2 ** 14 + 1, this.options.crsPath);
const grumpkinCrs = await GrumpkinCrs.new(2 ** 15 + 1, this.options.crsPath);

// Load CRS into wasm global CRS state.
// TODO: Make RawBuffer be default behavior, and have a specific Vector type for when wanting length prefixed.
Expand Down
9 changes: 8 additions & 1 deletion barretenberg/ts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ __metadata:
"@typescript-eslint/parser": ^5.54.1
buffer: ^6.0.3
comlink: ^4.4.1
commander: ^10.0.1
commander: ^12.1.0
copy-webpack-plugin: ^11.0.0
debug: ^4.3.4
eslint: ^8.35.0
Expand Down Expand Up @@ -2434,6 +2434,13 @@ __metadata:
languageName: node
linkType: hard

"commander@npm:^12.1.0":
version: 12.1.0
resolution: "commander@npm:12.1.0"
checksum: 68e9818b00fc1ed9cdab9eb16905551c2b768a317ae69a5e3c43924c2b20ac9bb65b27e1cab36aeda7b6496376d4da908996ba2c0b5d79463e0fb1e77935d514
languageName: node
linkType: hard

"commander@npm:^2.20.0":
version: 2.20.3
resolution: "commander@npm:2.20.3"
Expand Down
1 change: 1 addition & 0 deletions boxes/boxes/vite/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_AZTEC_NODE_URL=http://localhost:8080
15 changes: 7 additions & 8 deletions boxes/boxes/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"dependencies": {
"@aztec/accounts": "portal:../../../yarn-project/accounts",
"@aztec/aztec.js": "portal:../../../yarn-project/aztec.js",
"@aztec/bb-prover": "link:../../../yarn-project/bb-prover",
"@aztec/circuit-types": "portal:../../../yarn-project/circuit-types",
"@aztec/key-store": "link:../../../yarn-project/key-store",
"@aztec/kv-store": "portal:../../../yarn-project/kv-store",
Expand All @@ -31,18 +32,16 @@
"@eslint/js": "^9.13.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"@vitejs/plugin-react-swc": "^3.7.2",
"eslint": "^9.13.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.16",
"globals": "^15.11.0",
"memfs": "^4.14.0",
"node-stdlib-browser": "^1.3.0",
"typescript": "~5.6.2",
"typescript-eslint": "^8.11.0",
"vite": "^5.4.10",
"vite-plugin-externalize-deps": "^0.8.0",
"vite": "^6.0.3",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-strip-block": "^1.0.1",
"vite-plugin-top-level-await": "^1.4.4"
}
}
}
17 changes: 11 additions & 6 deletions boxes/boxes/vite/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ import {
} from "@aztec/aztec.js";
import { BoxReactContractArtifact } from "../artifacts/BoxReact";
import { AccountManager } from "@aztec/aztec.js/account";
import { SingleKeyAccountContract } from "@aztec/accounts/single_key";
import { SchnorrAccountContract } from "@aztec/accounts/schnorr";
import { createAztecNodeClient } from "@aztec/aztec.js";
import { PXEService } from "@aztec/pxe/service";
import { PXEServiceConfig, getPXEServiceConfig } from "@aztec/pxe/config";
import { KVPxeDatabase } from "@aztec/pxe/database";
import { TestPrivateKernelProver } from "@aztec/pxe/kernel_prover";
import { KeyStore } from "@aztec/key-store";
import { PrivateKernelProver } from "@aztec/circuit-types";
import { L2TipsStore } from "@aztec/kv-store/stores";
import { createStore } from "@aztec/kv-store/indexeddb";
import { BBWasmPrivateKernelProver } from "@aztec/bb-prover/wasm";

process.env = Object.keys(import.meta.env).reduce((acc, key) => {
Copy link
Contributor

@benesjan benesjan Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it would be nice to have here a comment regarding why this is done.

acc[key.replace("VITE_", "")] = import.meta.env[key];
return acc;
}, {});

const SECRET_KEY = Fr.random();

Expand All @@ -33,17 +38,18 @@ export class PrivateEnv {
const config = getPXEServiceConfig();
config.dataDirectory = "pxe";
const aztecNode = await createAztecNodeClient(this.nodeURL);
const proofCreator = new TestPrivateKernelProver();
const proofCreator = new BBWasmPrivateKernelProver(16);
this.pxe = await this.createPXEService(aztecNode, config, proofCreator);
const encryptionPrivateKey = deriveMasterIncomingViewingSecretKey(
this.secretKey,
);
this.accountContract = new SingleKeyAccountContract(encryptionPrivateKey);
this.accountContract = new SchnorrAccountContract(encryptionPrivateKey);
this.account = new AccountManager(
this.pxe,
this.secretKey,
this.accountContract,
);
await this.account.deploy().wait();
}

async createPXEService(
Expand Down Expand Up @@ -81,14 +87,13 @@ export class PrivateEnv {
}

async getWallet() {
// taking advantage that register is no-op if already registered
return await this.account.register();
}
}

export const deployerEnv = new PrivateEnv(
SECRET_KEY,
process.env.PXE_URL || "http://localhost:8080",
process.env.AZTEC_NODE_URL,
);

const IGNORE_FUNCTIONS = [
Expand Down
30 changes: 14 additions & 16 deletions boxes/boxes/vite/src/contracts/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ use dep::aztec::macros::aztec;
#[aztec]
contract BoxReact {
use dep::aztec::{
protocol_types::public_keys::OvpkM,
keys::getters::get_public_keys,
prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader, Point},
encrypted_logs::encrypted_note_emission::encode_and_encrypt_note,
macros::{storage::storage, functions::{private, public, initializer}}
macros::{functions::{initializer, private}, storage::storage},
prelude::{AztecAddress, Map, PrivateMutable},
};
use dep::value_note::value_note::ValueNote;

Expand All @@ -18,27 +16,27 @@ contract BoxReact {

#[private]
#[initializer]
fn constructor(
number: Field,
owner: AztecAddress
) {
fn constructor(number: Field, owner: AztecAddress) {
let numbers = storage.numbers;
let mut new_number = ValueNote::new(number, owner);

let owner_ovpk_m = get_public_keys(owner).ovpk_m;
numbers.at(owner).initialize(&mut new_number).emit(encode_and_encrypt_note(&mut context, owner_ovpk_m, owner, context.msg_sender()));
numbers.at(owner).initialize(&mut new_number).emit(encode_and_encrypt_note(
&mut context,
owner,
context.msg_sender(),
));
}

#[private]
fn setNumber(
number: Field,
owner: AztecAddress
) {
fn setNumber(number: Field, owner: AztecAddress) {
let numbers = storage.numbers;
let mut new_number = ValueNote::new(number, owner);

let owner_ovpk_m = get_public_keys(owner).ovpk_m;
numbers.at(owner).replace(&mut new_number).emit(encode_and_encrypt_note(&mut context, owner_ovpk_m, owner, context.msg_sender()));
numbers.at(owner).replace(&mut new_number).emit(encode_and_encrypt_note(
&mut context,
owner,
context.msg_sender(),
));
}

unconstrained fn getNumber(owner: AztecAddress) -> pub ValueNote {
Expand Down
17 changes: 10 additions & 7 deletions boxes/boxes/vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import { PolyfillOptions, nodePolyfills } from "vite-plugin-node-polyfills";
import topLevelAwait from "vite-plugin-top-level-await";
import stripBlock from "vite-plugin-strip-block";

// Unfortunate, but needed due to https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81
// Suspected to be because of the yarn workspace setup, but not sure
Expand All @@ -23,17 +24,19 @@ const nodePolyfillsFix = (options?: PolyfillOptions | undefined): Plugin => {

// https://vite.dev/config/
export default defineConfig({
server: {
headers: {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
},
},
plugins: [
stripBlock({ start: "testing-only-start", end: "testing-only-end" }),
react(),
nodePolyfillsFix({
overrides: {
fs: "memfs",
buffer: "buffer/",
},
}),
nodePolyfillsFix({ include: ["buffer", "process", "path"] }),
topLevelAwait(),
],
optimizeDeps: {
exclude: ["@noir-lang/acvm_js", "@noir-lang/noirc_abi"],
exclude: ["@noir-lang/acvm_js", "@noir-lang/noirc_abi", "@aztec/bb-prover"],
},
});
6 changes: 3 additions & 3 deletions boxes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"version": "0.5.0",
"type": "module",
"scripts": {
"compile": "yarn workspaces foreach --exclude vite -A -v run compile",
"build": "yarn workspaces foreach --exclude vite -A -v run build",
"compile": "yarn workspaces foreach -A -v run compile",
"build": "yarn workspaces foreach -A -v run build",
"install-browsers": "playwright install --with-deps",
"publish": "yarn npm publish",
"test": "vitest bin.test.js",
Expand Down Expand Up @@ -43,4 +43,4 @@
"devDependencies": {
"@playwright/test": "1.46.1"
}
}
}
Loading
Loading