Skip to content

Commit 692b839

Browse files
PhilWindlespalladinospypsyThunkarludamad
authored
chore: Merge changes to testnet (#13861)
PR containing the changesets for updating alpha-testnet --------- Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com> Co-authored-by: spypsy <spypsy@users.noreply.github.com> Co-authored-by: Gregorio Juliana <gregojquiros@gmail.com> Co-authored-by: ludamad <adam.domurad@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: maramihali <mara@aztecprotocol.com> Co-authored-by: ledwards2225 <l.edwards.d@gmail.com> Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com> Co-authored-by: saleel <saleel@aztecprotocol.com> Co-authored-by: Alex Gherghisan <alexghr@users.noreply.github.com>
1 parent 31801e1 commit 692b839

File tree

245 files changed

+7111
-3208
lines changed

Some content is hidden

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

245 files changed

+7111
-3208
lines changed

.test_patterns.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ tests:
4141
error_regex: "field_t::range_constraint"
4242
owners:
4343
- *luke
44-
- regex: "barretenberg/acir_tests/scripts/run_test_browser.sh"
45-
owners:
46-
- *luke
4744
- regex: "barretenberg/acir_tests/scripts/run_test_browser.sh"
4845
error_regex: "Failed to fetch"
4946
owners:
@@ -189,11 +186,6 @@ tests:
189186
owners:
190187
- *grego
191188

192-
- regex: "boxes/scripts/run_test.sh"
193-
error_regex: "expect(locator).toBeVisible()"
194-
owners:
195-
- *esau
196-
197189
# kind tests
198190
- regex: "spartan/bootstrap.sh"
199191
# Will skip all kind tests for now. Too unstable, blocking merge queue.

aztec-up/bin/.aztec-run

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ function run {
141141
${arg_env_vars:-} \
142142
${arg_host_binds:-} \
143143
${arg_user:-} \
144+
--entrypoint "" \
144145
aztecprotocol/aztec:$VERSION "${args[@]}"
145146
}
146147

aztec-up/bin/aztec

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ while [ "$#" -gt 0 ]; do
2222
ANVIL_PORT="$2"
2323
shift 2
2424
;;
25+
--admin-port)
26+
ADMIN_PORT="$2"
27+
shift 2
28+
;;
2529
--pxe.network)
2630
# Set version to user-specified network (e.g. 'devnet')
2731
VERSION="$2"
@@ -99,6 +103,12 @@ case ${1:-} in
99103

100104
PORTS_TO_EXPOSE="${PORTS_TO_EXPOSE:-} $P2P_TCP_LISTEN_MAPPING $P2P_UDP_LISTEN_MAPPING"
101105

106+
if [ -n "${ADMIN_PORT:-}" ]; then
107+
export ADMIN_PORT
108+
ADMIN_MAPPING="$ADMIN_PORT:$ADMIN_PORT"
109+
PORTS_TO_EXPOSE="${PORTS_TO_EXPOSE:-} $ADMIN_MAPPING"
110+
fi
111+
102112
exec $(dirname $0)/.aztec-run aztec-start \
103113
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js "$@"
104114
fi

barretenberg/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ To do a single benchmark you can do e.g.
477477
`IVC_BENCH=amm-add-liquidity ./bootstrap.sh bench_ivc origin/master~3`
478478

479479
If one doesn't provide the commit, it generates these IVC inputs on the fly (depends on yarn-project having been bootstrapped).
480-
To use these inputs manually, just abort after input download and run ClientIVC proving with --input runtime_stack on those inputs (stored in `yarn-project/end-to-end/example-app-ivc-inputs-out`).
480+
To use these inputs manually, just abort after input download and run ClientIVC proving on those inputs (stored in `yarn-project/end-to-end/example-app-ivc-inputs-out`).
481481

482482
#### Using Tracy to Profile Memory/CPU/Gate Counts
483483

@@ -532,7 +532,7 @@ By default, the barretenberg.wasm.gz that is used by bb.js (aka barretenberg/ts)
532532
One can get stack traces working from WASM by running root level ./bootstrap.sh (or otherwise building what you need) and then doing:
533533
```
534534
cmake --build --preset wasm-threads --target barretenberg-debug.wasm.gz
535-
mv build-wasm-threads/barretenberg-debug.wasm.gz build-wasm-threads/barretenberg.wasm.gz
535+
cp build-wasm-threads/bin/barretenberg-debug.wasm.gz ../ts/dest/node/barretenberg_wasm/barretenberg-threads.wasm.gz
536536
```
537537

538538
This will mean that any yarn-project or barretenberg/ts tests that run will get stack traces with function names.
@@ -541,5 +541,5 @@ To get more detailed information use the following (NOTE: takes >10 minutes!):
541541
```
542542
cmake --preset wasm-threads-dbg
543543
cmake --build --preset wasm-threads-dbg --target barretenberg-debug.wasm.gz
544-
mv build-wasm-threads-dbg/barretenberg-debug.wasm.gz build-wasm-threads/barretenberg.wasm.gz
544+
cp build-wasm-threads-dbg/bin/barretenberg-debug.wasm.gz ../ts/dest/node/barretenberg_wasm/barretenberg-threads.wasm.gz
545545
```

barretenberg/acir_tests/bbjs-test/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ program
109109
.option("-w, --witness-path <path>", "witness path")
110110
.option("-o, --output-directory <path>", "output directory")
111111
.option("-h, --oracle-hash <hash>", "oracle hash")
112-
.option("-multi-threaded", "multi-threaded")
112+
.option("--multi-threaded", "multi-threaded")
113113
.action((args) => generateProof(args));
114114

115115
program

barretenberg/acir_tests/bootstrap.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ function test_cmds_internal {
149149

150150
# barretenberg-acir-tests-bb.js:
151151
# Browser tests.
152-
echo BROWSER=chrome THREAD_MODEL=mt $run_test_browser verify_honk_proof
153-
echo BROWSER=chrome THREAD_MODEL=st $run_test_browser 1_mul
154-
echo BROWSER=webkit THREAD_MODEL=mt $run_test_browser verify_honk_proof
155-
echo BROWSER=webkit THREAD_MODEL=st $run_test_browser 1_mul
152+
echo BROWSER=chrome $run_test_browser verify_honk_proof
153+
echo BROWSER=chrome $run_test_browser 1_mul
154+
echo BROWSER=webkit $run_test_browser verify_honk_proof
155+
echo BROWSER=webkit $run_test_browser 1_mul
156156
# echo ecdsa_secp256r1_3x through bb.js on node to check 256k support.
157157
echo BIN=$bbjs_bin FLOW=prove_then_verify $run_test ecdsa_secp256r1_3x
158158
# echo the prove then verify flow for UltraHonk. This makes sure we have the same circuit for different witness inputs.
@@ -186,7 +186,7 @@ function test_cmds_internal {
186186

187187
# prove and verify using bb.js classes
188188
echo SYS=ultra_honk FLOW=bbjs_prove_verify $run_test 1_mul
189-
echo SYS=ultra_honk FLOW=bbjs_prove_verify THREAD_MODEL=mt $run_test assert_statement
189+
echo SYS=ultra_honk FLOW=bbjs_prove_verify $run_test assert_statement
190190

191191
# prove with bb.js and verify with solidity verifier
192192
echo SYS=ultra_honk FLOW=bbjs_prove_sol_verify $run_test 1_mul
@@ -215,9 +215,6 @@ function run_benchmark {
215215

216216
# TODO(https://github.com/AztecProtocol/barretenberg/issues/1254): More complete testing, including failure tests
217217
function bench {
218-
# TODO(https://github.com/AztecProtocol/barretenberg/issues/1265) fix acir benchmarking
219-
# LOG_FILE=bench-acir.jsonl ./bench_acir_tests.sh
220-
221218
export HARDWARE_CONCURRENCY=16
222219

223220
rm -rf bench-out && mkdir -p bench-out

barretenberg/acir_tests/browser-test-app/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"type": "module",
77
"scripts": {
88
"build": "rm -rf dest && webpack",
9-
"serve:dest:st": "serve -n -L -p ${PORT:-8080} -c ../serve.json dest",
10-
"serve:dest:mt": "serve -n -L -p ${PORT:-8080} -c ../serve.json dest"
9+
"serve": "serve -n -L -p ${PORT:-8080} -c ../serve.json dest"
1110
},
1211
"devDependencies": {
1312
"@aztec/bb.js": "portal:../../ts",
@@ -19,9 +18,9 @@
1918
"serve": "^14.2.1",
2019
"ts-loader": "^9.5.1",
2120
"typescript": "^5.4.2",
22-
"webpack": "^5.90.3",
23-
"webpack-cli": "^5.1.4",
24-
"webpack-dev-server": "^5.2.0"
21+
"webpack": "^5.99.6",
22+
"webpack-cli": "^6.0.1",
23+
"webpack-dev-server": "^5.2.1"
2524
},
2625
"packageManager": "yarn@4.5.2"
2726
}

barretenberg/acir_tests/browser-test-app/serve.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
{
1111
"key": "Cross-Origin-Opener-Policy",
1212
"value": "same-origin"
13+
},
14+
{
15+
"key": "Access-Control-Allow-Origin",
16+
"value": "*"
17+
},
18+
{
19+
"key": "Access-Control-Allow-Methods",
20+
"value": "GET, POST, PUT, DELETE, OPTIONS"
21+
},
22+
{
23+
"key": "Access-Control-Allow-Headers",
24+
"value": "Content-Type, Authorization"
1325
}
1426
]
1527
}

barretenberg/acir_tests/browser-test-app/src/index.ts

Lines changed: 23 additions & 13 deletions
Large diffs are not rendered by default.

barretenberg/acir_tests/browser-test-app/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"inlineSourceMap": true,
1212
"declarationMap": true,
1313
"importHelpers": true,
14+
"isolatedModules": true,
1415
"resolveJsonModule": true,
1516
"composite": true,
1617
"outDir": "dest",

barretenberg/acir_tests/browser-test-app/webpack.config.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,25 @@ export default {
1313
rules: [
1414
{
1515
test: /\.tsx?$/,
16-
use: [{ loader: "ts-loader" }],
16+
loader: 'ts-loader',
1717
},
1818
],
1919
},
2020
output: {
2121
path: resolve(dirname(fileURLToPath(import.meta.url)), "./dest"),
22-
publicPath: "/",
2322
filename: "[name].js",
24-
library: {
25-
type: 'module',
26-
},
2723
chunkFormat: 'module',
2824
},
2925
experiments: {
3026
outputModule: true,
3127
},
28+
optimization: {
29+
splitChunks: {
30+
// Cannot use async due to https://github.com/webpack/webpack/issues/17014
31+
// messing with module workers loaded asynchronously.
32+
chunks: /barretenberg.*.js/,
33+
},
34+
},
3235
plugins: [
3336
new HtmlWebpackPlugin({ inject: false, template: "./src/index.html" }),
3437
new webpack.DefinePlugin({ "process.env.NODE_DEBUG": false }),
@@ -42,9 +45,5 @@ export default {
4245
logging: "none",
4346
overlay: false,
4447
},
45-
headers: {
46-
"Cross-Origin-Opener-Policy": "same-origin",
47-
"Cross-Origin-Embedder-Policy": "require-corp",
48-
},
4948
},
5049
};

barretenberg/acir_tests/flows/bbjs_prove_verify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ node ../../bbjs-test prove \
2020
-b $artifact_dir/program.json \
2121
-w $artifact_dir/witness.gz \
2222
-o $output_dir \
23-
${THREAD_MODEL:-st} = "mt" && echo "--multi-threaded"
23+
--multi-threaded
2424

2525
# Verify the proof by reading the files in ./target
2626
node ../../bbjs-test verify \

barretenberg/acir_tests/flows/prove_then_verify.sh

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,6 @@ BFLAG="-b ./target/program.json"
66
FLAGS="-c $CRS_PATH ${VERBOSE:+-v}"
77
[ "${RECURSIVE}" = "true" ] && FLAGS+=" --recursive"
88

9-
# TODO: Use this when client ivc support write_vk. Currently it keeps its own flow.
10-
# case ${SYS:-} in
11-
# "")
12-
# prove_cmd=prove
13-
# verify_cmd=verify
14-
# ;;
15-
# "client_ivc")
16-
# prove_cmd=prove
17-
# verify_cmd=verify
18-
# flags+=" --scheme client_ivc --input_type ${INPUT_TYPE:-single_circuit}"
19-
# ;;
20-
# *)
21-
# prove_cmd=prove_$SYS
22-
# verify_cmd=verify_$SYS
23-
# ;;
24-
# esac
25-
269
# Test we can perform the proof/verify flow.
2710
# This ensures we test independent pk construction through real/garbage witness data paths.
2811
# We use process substitution pipes to avoid temporary files, which need cleanup, and can collide with parallelism.
Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
#!/usr/bin/env bash
22
# Create intermediate state in a directory. Uses a temp dir to ensure parallel safe and cleans up on exit.
3+
# TODO this is unused
34
set -eux
45

5-
INFLAG=${INPUT_TYPE:---input_type runtime_stack}
6-
7-
if [ "$INFLAG" = "--input_type runtime_stack" ]; then
8-
BFLAG=target/acir.msgpack
9-
WFLAG=target/witness.msgpack
10-
else
11-
BFLAG=target/program.json
12-
WFLAG=target/witness.gz
13-
fi
14-
156
CRS_PATH=${CRS_PATH:-$HOME/.bb-crs}
167
BIN=$(realpath ${BIN:-../cpp/build/bin/bb})
178

@@ -23,6 +14,6 @@ trap "rm -rf $outdir" EXIT
2314
flags="--scheme client_ivc -c $CRS_PATH ${VERBOSE:+-v}"
2415

2516
parallel ::: \
26-
"$BIN prove $flags -b $BFLAG -w $WFLAG $INFLAG --output_format proof -o $outdir" \
27-
"$BIN write_vk $flags -b $BFLAG $INFLAG --verifier_type ivc -o $outdir"
17+
"$BIN prove $flags -i target/ivc-inputs.msgpack $INFLAG --output_format proof -o $outdir" \
18+
"$BIN write_vk $flags -i target/ivc-inputs.msgpack $INFLAG --verifier_type ivc -o $outdir"
2819
$BIN verify $flags -p $outdir/proof -k $outdir/vk

barretenberg/acir_tests/flows/sol_honk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eu
44
VFLAG=${VERBOSE:+-v}
55
BFLAG="-b ./target/program.json"
66
FLAGS="-c $CRS_PATH $VFLAG --scheme ultra_honk"
7-
PROVE_FLAGS="$FLAGS $BFLAG --oracle_hash keccak --output_format bytes_and_fields --write_vk --input_type single_circuit"
7+
PROVE_FLAGS="$FLAGS $BFLAG --oracle_hash keccak --output_format bytes_and_fields --write_vk"
88
VERIFY_FLAGS="$FLAGS --oracle_hash keccak"
99

1010
outdir=$(mktemp -d)

barretenberg/acir_tests/headless-test/src/index.ts

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import fs from "fs";
33
import { Command } from "commander";
44
import chalk from "chalk";
55
import os from "os";
6+
import type { ProofData } from "@aztec/bb.js";
67

78
const { BROWSER, PORT = "8080" } = process.env;
89

@@ -66,7 +67,7 @@ program
6667
"Specify the path to the gzip encoded ACIR witness",
6768
"./target/witness.gz"
6869
)
69-
.action(async ({ bytecodePath, witnessPath, }) => {
70+
.action(async ({ bytecodePath, witnessPath }) => {
7071
const acir = readBytecodeFile(bytecodePath);
7172
const witness = readWitnessFile(witnessPath);
7273
const threads = Math.min(os.cpus().length, 16);
@@ -81,28 +82,75 @@ program
8182
const browser = await browserType.launch();
8283

8384
const context = await browser.newContext();
84-
const page = await context.newPage();
85+
const provingPage = await context.newPage();
8586

8687
if (program.opts().verbose) {
87-
page.on("console", (msg) => formatAndPrintLog(msg.text()));
88+
provingPage.on("console", (msg) => formatAndPrintLog(msg.text()));
8889
}
8990

90-
await page.goto(`http://localhost:${PORT}`);
91-
92-
const result: boolean = await page.evaluate(
93-
([acir, witnessData, threads]: [string, number[], number]) => {
91+
await provingPage.goto(`http://localhost:${PORT}`);
92+
93+
const {
94+
publicInputs,
95+
proof,
96+
verificationKey,
97+
}: {
98+
publicInputs: string[];
99+
proof: number[];
100+
verificationKey: number[];
101+
} = await provingPage.evaluate(
102+
async ([acir, witnessData, threads]: [string, number[], number]) => {
94103
// Convert the input data to Uint8Arrays within the browser context
95104
const witnessUint8Array = new Uint8Array(witnessData);
96105

97106
// Call the desired function and return the result
98-
return (window as any).runTest(acir, witnessUint8Array, threads);
107+
const {
108+
proofData,
109+
verificationKey,
110+
}: { proofData: ProofData; verificationKey: Uint8Array } = await (
111+
window as any
112+
).prove(acir, witnessUint8Array, threads);
113+
114+
return {
115+
publicInputs: proofData.publicInputs,
116+
proof: Array.from(proofData.proof),
117+
verificationKey: Array.from(verificationKey),
118+
};
99119
},
100120
[acir, Array.from(witness), threads]
101121
);
122+
await provingPage.close();
123+
124+
// Creating a new page to verify the proof, so this bug is avoided
125+
// https://bugs.webkit.org/show_bug.cgi?id=245346
126+
// Present at least on playwright 1.49.0
127+
128+
const verificationPage = await context.newPage();
129+
await verificationPage.goto(`http://localhost:${PORT}`);
130+
131+
if (program.opts().verbose) {
132+
verificationPage.on("console", (msg) => formatAndPrintLog(msg.text()));
133+
}
134+
135+
const verificationResult: boolean = await verificationPage.evaluate(
136+
([publicInputs, proof, verificationKey]: [
137+
string[],
138+
number[],
139+
number[]
140+
]) => {
141+
const verificationKeyUint8Array = new Uint8Array(verificationKey);
142+
const proofData: ProofData = {
143+
publicInputs,
144+
proof: new Uint8Array(proof),
145+
};
146+
return (window as any).verify(proofData, verificationKeyUint8Array);
147+
},
148+
[publicInputs, proof, verificationKey]
149+
);
102150

103151
await browser.close();
104152

105-
if (!result) {
153+
if (!verificationResult) {
106154
process.exit(1);
107155
}
108156
}

0 commit comments

Comments
 (0)