Skip to content

Commit 79f810d

Browse files
authored
feat: gaztec (#11229)
Initial version of an "everything app" that can be used to test and benchmark Aztec. - PXE in the browser with client proofs - Connect to local sandbox or any network (scoped data) - Lazy loading of most assets (think contract artifacts) and WASM (bb still loads at start due to top-level await, but in parallel as it is separated from the main index,js) - Bundled by vite, 1MB compressed - Drop any contract artifact, interpret its ABI, simulate and send - Acts as a barebones wallet, managing auth scopes and separating accounts - Stores artifacts, accounts and all that's required to pick up where you left off without having to redeploy everything (indexeddb) - Supports basic aliasing of addresses - Allows loading an artifact, provide the address and go (instead of having to deploy it) - Add senders/contact management - Authwits Missing: - Benchmarking window where simulation/proving stats are displayed This initial PR just puts it out there so other people can use it. Next up is hooking it up to CI and adding hard limits to bundle sizes, so we can control if something gets into the client packages that shouldn't be there. Both this app (that includes PXE, bb-prover, etc) and `aztec.js` will force CI to fail if a size threshold is surpassed (CC @spalladino @charlielye)
1 parent 90f5e8f commit 79f810d

42 files changed

Lines changed: 7488 additions & 105 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

barretenberg/ts/src/barretenberg/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class Barretenberg extends BarretenbergApi {
6969
async initSRSClientIVC(): Promise<void> {
7070
// crsPath can be undefined
7171
const crs = await Crs.new(2 ** 20 + 1, this.options.crsPath);
72-
const grumpkinCrs = await GrumpkinCrs.new(2 ** 15 + 1, this.options.crsPath);
72+
const grumpkinCrs = await GrumpkinCrs.new(2 ** 16 + 1, this.options.crsPath);
7373

7474
// Load CRS into wasm global CRS state.
7575
// TODO: Make RawBuffer be default behavior, and have a specific Vector type for when wanting length prefixed.

boxes/boxes/vite/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"typescript": "~5.6.2",
3939
"typescript-eslint": "^8.11.0",
4040
"vite": "^6.0.3",
41-
"vite-plugin-node-polyfills": "^0.22.0",
42-
"vite-plugin-top-level-await": "^1.4.4"
41+
"vite-plugin-node-polyfills": "^0.22.0"
4342
}
4443
}

boxes/boxes/vite/vite.config.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { defineConfig, searchForWorkspaceRoot } from "vite";
22
import react from "@vitejs/plugin-react-swc";
33
import { PolyfillOptions, nodePolyfills } from "vite-plugin-node-polyfills";
4-
import topLevelAwait from "vite-plugin-top-level-await";
54

65
// Unfortunate, but needed due to https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81
76
// Suspected to be because of the yarn workspace setup, but not sure
@@ -24,10 +23,14 @@ const nodePolyfillsFix = (options?: PolyfillOptions | undefined): Plugin => {
2423
// https://vite.dev/config/
2524
export default defineConfig({
2625
server: {
26+
// Headers needed for bb WASM to work in multithreaded mode
2727
headers: {
2828
"Cross-Origin-Opener-Policy": "same-origin",
2929
"Cross-Origin-Embedder-Policy": "require-corp",
3030
},
31+
// Allow vite to serve files from these directories, since they are symlinked
32+
// These are the protocol circuit artifacts
33+
// and noir WASMs.
3134
fs: {
3235
allow: [
3336
searchForWorkspaceRoot(process.cwd()),
@@ -40,9 +43,12 @@ export default defineConfig({
4043
plugins: [
4144
react(),
4245
nodePolyfillsFix({ include: ["buffer", "process", "path"] }),
43-
topLevelAwait(),
4446
],
4547
build: {
48+
// Needed to support bb.js top level await until
49+
// https://github.com/Menci/vite-plugin-top-level-await/pull/63 is merged
50+
// and we can use the plugin again (or we get rid of TLA)
51+
target: "esnext",
4652
rollupOptions: {
4753
output: {
4854
manualChunks(id: string) {

boxes/yarn.lock

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,18 +1740,6 @@ __metadata:
17401740
languageName: node
17411741
linkType: hard
17421742

1743-
"@rollup/plugin-virtual@npm:^3.0.2":
1744-
version: 3.0.2
1745-
resolution: "@rollup/plugin-virtual@npm:3.0.2"
1746-
peerDependencies:
1747-
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
1748-
peerDependenciesMeta:
1749-
rollup:
1750-
optional: true
1751-
checksum: 10c0/7115edb7989096d1ce334939fcf6e1ba365586b487bf61b2dd4f915386197f350db70904030342c0720fe58f5a52828975c645c4d415c1d432d9b1b6760a22ef
1752-
languageName: node
1753-
linkType: hard
1754-
17551743
"@rollup/pluginutils@npm:^5.0.1":
17561744
version: 5.1.3
17571745
resolution: "@rollup/pluginutils@npm:5.1.3"
@@ -2115,7 +2103,7 @@ __metadata:
21152103
languageName: node
21162104
linkType: hard
21172105

2118-
"@swc/core@npm:^1.7.0, @swc/core@npm:^1.7.26":
2106+
"@swc/core@npm:^1.7.26":
21192107
version: 1.9.3
21202108
resolution: "@swc/core@npm:1.9.3"
21212109
dependencies:
@@ -11967,15 +11955,6 @@ __metadata:
1196711955
languageName: node
1196811956
linkType: hard
1196911957

11970-
"uuid@npm:^10.0.0":
11971-
version: 10.0.0
11972-
resolution: "uuid@npm:10.0.0"
11973-
bin:
11974-
uuid: dist/bin/uuid
11975-
checksum: 10c0/eab18c27fe4ab9fb9709a5d5f40119b45f2ec8314f8d4cf12ce27e4c6f4ffa4a6321dc7db6c515068fa373c075b49691ba969f0010bf37f44c37ca40cd6bf7fe
11976-
languageName: node
11977-
linkType: hard
11978-
1197911958
"uuid@npm:^8.3.2":
1198011959
version: 8.3.2
1198111960
resolution: "uuid@npm:8.3.2"
@@ -12037,19 +12016,6 @@ __metadata:
1203712016
languageName: node
1203812017
linkType: hard
1203912018

12040-
"vite-plugin-top-level-await@npm:^1.4.4":
12041-
version: 1.4.4
12042-
resolution: "vite-plugin-top-level-await@npm:1.4.4"
12043-
dependencies:
12044-
"@rollup/plugin-virtual": "npm:^3.0.2"
12045-
"@swc/core": "npm:^1.7.0"
12046-
uuid: "npm:^10.0.0"
12047-
peerDependencies:
12048-
vite: ">=2.8"
12049-
checksum: 10c0/013e7b2e28632d93d04c4061187198e699064fc208a1657c100354b32da30921fa835879fc17779d5e0b074855237408da2fadd720fa0f4571137427a1efd5e3
12050-
languageName: node
12051-
linkType: hard
12052-
1205312019
"vite@npm:^5.0.0":
1205412020
version: 5.4.11
1205512021
resolution: "vite@npm:5.4.11"
@@ -12172,7 +12138,6 @@ __metadata:
1217212138
typescript-eslint: "npm:^8.11.0"
1217312139
vite: "npm:^6.0.3"
1217412140
vite-plugin-node-polyfills: "npm:^0.22.0"
12175-
vite-plugin-top-level-await: "npm:^1.4.4"
1217612141
languageName: unknown
1217712142
linkType: soft
1217812143

gaztec/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VITE_AZTEC_NODE_URL=http://localhost:8080
2+
VITE_LOG_LEVEL=debug

gaztec/.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
.yarn/*
27+
!.yarn/releases
28+
vite.config.ts.*
29+
*.module.css.d.ts

gaztec/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

gaztec/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# GAztec
2+
3+
Initial version of an "everything app" that can be used to test and benchmark Aztec.
4+
5+
* PXE in the browser with client proofs
6+
* Connect to local sandbox or any network (scoped data)
7+
* Lazy loading of most assets (think contract artifacts) and WASM (bb still loads at start due to top-level await, but in parallel as it is separated from the main index,js)
8+
* Bundled by vite, 1MB compressed
9+
* Drop any contract artifact, interpret its ABI, simulate and send
10+
* Acts as a barebones wallet, managing auth scopes and separating accounts
11+
* Stores artifacts, accounts and all that's required to pick up where you left off without having to redeploy everything (indexeddb)
12+
* Supports basic aliasing of addresses
13+
* Allows loading an artifact, provide the address and go (instead of having to deploy it)
14+
* Add senders/contact management
15+
* Authwits
16+
17+
Missing:
18+
19+
* Benchmarking window where simulation/proving stats are displayed
20+
21+
## To run
22+
23+
Dev:
24+
25+
```
26+
yarn dev
27+
```
28+
29+
Production:
30+
31+
```
32+
yarn build
33+
yarn preview
34+
``````

gaztec/eslint.config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
7+
export default tseslint.config(
8+
{ ignores: ['dist'] },
9+
{
10+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11+
files: ['**/*.{ts,tsx}'],
12+
languageOptions: {
13+
ecmaVersion: 2020,
14+
globals: globals.browser,
15+
},
16+
plugins: {
17+
'react-hooks': reactHooks,
18+
'react-refresh': reactRefresh,
19+
},
20+
rules: {
21+
...reactHooks.configs.recommended.rules,
22+
'react-refresh/only-export-components': [
23+
'warn',
24+
{ allowConstantExport: true },
25+
],
26+
},
27+
},
28+
)

gaztec/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>GAztec</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/main.tsx"></script>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)