Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
1c7cf5e
[empty] Start merge-train. Choo choo.
Jul 24, 2025
cecb12f
Merge branch 'next' into merge-train/barretenberg
Jul 24, 2025
3d6ec00
feat(bbapi): CIVC end to end (#15777)
ludamad Jul 24, 2025
c809d4f
Merge branch 'next' into merge-train/barretenberg
Jul 24, 2025
7add7c7
[empty] Start merge-train. Choo choo.
Jul 25, 2025
042a9bc
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
f5ec98e
chore: remove `logic` operations from `uint` (#15975)
suyash67 Jul 25, 2025
a671f86
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
78021ea
chore: Modify the `MergeVerifier` so that it gets the subtable commit…
federicobarbacovi Jul 25, 2025
bfaaad4
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
43c3219
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
7f9ee70
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
069a1c4
fix: delete tar generated by test-vk-havent-changed script (#15988)
johnathan79717 Jul 25, 2025
95c7e7c
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
b26c28f
chore: replace q_arith with q_3 in memory relation (#15953)
johnathan79717 Jul 25, 2025
01ed70c
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
96868aa
chore: simplify `uint` logic by removing `witness_status` (#15976)
suyash67 Jul 25, 2025
e8bd564
Revert "chore: remove `logic` operations from `uint`" (#15997)
suyash67 Jul 25, 2025
efd3528
Revert "chore: simplify `uint` logic by removing `witness_status`" (#…
suyash67 Jul 25, 2025
fd26dff
feat: Add the last merged table to the public inputs of the hiding ci…
federicobarbacovi Jul 25, 2025
bb77341
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
71d9c68
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
4204b4b
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
32e687a
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
b2563c0
feat(bb): Port UltraHonk API to use bbapi internally
ludamad Jul 25, 2025
e9f275f
feat(bbapi): add TypeScript BbApiUltraHonkBackend
ludamad Jul 25, 2025
fe8cace
feat(cli): add proof_as_fields and vk_as_fields CLI commands
ludamad Jul 25, 2025
32536da
docs(bbapi): add comprehensive README for BBAPI
ludamad Jul 25, 2025
5ad2a43
chore: remove README files
ludamad Jul 25, 2025
51627bb
Merge branch 'next' into merge-train/barretenberg
Jul 25, 2025
5cd02da
fix: ensure bb compiles in build-no-avm configuration
ludamad Jul 25, 2025
ca6bd29
test: add comprehensive proving and verifying tests to bbapi_ultra_honk
ludamad Jul 25, 2025
3bb4e9a
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
45132ab
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
fc25483
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
46b3510
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
c18ef5e
chore: combined `uint` audit (#16030)
suyash67 Jul 28, 2025
fde8bc0
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
44c81f4
chore: delete and ignore barretenberg/src/honk/keys/ (#16042)
johnathan79717 Jul 28, 2025
be6d91c
Merge remote-tracking branch 'origin/next' into ad/bbapi/e2ehonk
ludamad Jul 28, 2025
6e8eaec
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
bd0b716
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
751fbd8
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
e751e78
feat: Add fields member to VK computation responses
ludamad Jul 28, 2025
57fb7b1
refactor: Remove stdout output support and add bytes_and_fields format
ludamad Jul 28, 2025
bb74d4a
feat: Add vk_hash to CircuitComputeVk Response
ludamad Jul 28, 2025
e205d2e
fix: Fix tube proof construction (#16052)
federicobarbacovi Jul 28, 2025
99cd1c6
progress
ludamad Jul 28, 2025
8b7989c
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
14d6f62
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
48d8a8e
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
7f5b1a9
building
ludamad Jul 28, 2025
286d5bb
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
e256fcb
update
ludamad Jul 28, 2025
3528223
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
280c945
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
6607191
Merge branch 'next' into merge-train/barretenberg
Jul 28, 2025
220bfc9
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
aae3bc3
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
2a1726d
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
841c961
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
d4864ff
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
bc1c08a
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
63f7b79
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
6dbbca6
feat: Link successive recursive Merge verifications (#16032)
federicobarbacovi Jul 29, 2025
5edff18
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
6485485
simplify
ludamad Jul 29, 2025
3a1870a
More simplification
ludamad Jul 29, 2025
3b664a3
More simplification
ludamad Jul 29, 2025
968b31a
rejigger
ludamad Jul 29, 2025
93dfded
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
d344d36
Merge branch 'next' into merge-train/barretenberg
Jul 29, 2025
70218d3
fix
ludamad Jul 29, 2025
e2667f9
testing
ludamad Jul 29, 2025
32d72cf
bbapi
ludamad Jul 29, 2025
71a87e2
fix by ensuring unique test dir
ludamad Jul 29, 2025
4489bc5
try to match API
ludamad Jul 29, 2025
f667fbf
delete
ludamad Jul 29, 2025
c4d522a
Merge remote-tracking branch 'origin/merge-train/barretenberg' into a…
ludamad Jul 29, 2025
c9a9f3d
fix civc not producing vk fields
ludamad Jul 30, 2025
f15534e
attempt
ludamad Jul 30, 2025
2c3edfb
chore: Package inputs to Merge verifier into a single struct (#16075)
federicobarbacovi Jul 30, 2025
66fa7b1
.
ludamad Jul 30, 2025
321a0d4
revert
ludamad Jul 30, 2025
3088403
Merge remote-tracking branch 'origin/next' into merge-train/barretenberg
ludamad Jul 30, 2025
d054ead
Merge remote-tracking branch 'origin/merge-train/barretenberg' into a…
ludamad Jul 30, 2025
b3713f5
fix default zk impl
ludamad Jul 30, 2025
62a19c3
missing file
ludamad Jul 30, 2025
798a145
fix ivc
ludamad Jul 31, 2025
15b97fc
ivc vk as fields
ludamad Jul 31, 2025
1810fb4
.
ludamad Jul 31, 2025
50bab7b
speculative fix
ludamad Jul 31, 2025
2d48471
fix
ludamad Jul 31, 2025
606c31a
passing
ludamad Aug 1, 2025
008d4e1
branch works
ludamad Aug 1, 2025
264c4b9
compilation fix
ludamad Aug 1, 2025
1a81d5a
refactor(bb): refactor vk-serialization-as-fields (#16171)
ludamad Aug 1, 2025
3186e69
explore
ludamad Aug 1, 2025
686ba30
Add SerializeMetadata template parameter to NativeVerificationKey_
ludamad Aug 1, 2025
8f1c887
Fix SerializeMetadata categorization for verification keys
ludamad Aug 1, 2025
3b01d67
Replace bool SerializeMetadata with VKSerializationMode enum
ludamad Aug 1, 2025
9aebf54
add enum
ludamad Aug 1, 2025
3c143da
fixed serialization issue
ludamad Aug 1, 2025
338df70
unslop
ludamad Aug 4, 2025
31ef0b3
update
ludamad Aug 4, 2025
4fa1d5f
format
ludamad Aug 4, 2025
26c449e
hex string 0x
ludamad Aug 4, 2025
ce721e9
simplify
ludamad Aug 4, 2025
493d8ee
simplify
ludamad Aug 4, 2025
3f97e7d
for loop
ludamad Aug 4, 2025
dc90c1a
attempt to fix acir_tests
ludamad Aug 4, 2025
cb96afd
cleanup
ludamad Aug 5, 2025
c886a3b
cleanup
ludamad Aug 5, 2025
ad4b015
hex to fields
ludamad Aug 5, 2025
9d4cd6d
remove output_format flag everywhere
ludamad Aug 5, 2025
fa5d8d4
fixes
ludamad Aug 5, 2025
66f6484
fixes
ludamad Aug 5, 2025
e2e1361
fixes
ludamad Aug 5, 2025
1971201
0x prefix
ludamad Aug 5, 2025
f81117c
fix output format not being possible anymore
ludamad Aug 5, 2025
26046ba
fix
ludamad Aug 5, 2025
8060a36
Merge branch 'origin/merge-train/barretenberg' into ad/bbapi/vk-simpl…
ludamad Aug 25, 2025
725242e
fix
ludamad Aug 25, 2025
b4d20c9
Merge remote-tracking branch 'origin/next' into ad/bbapi/vk-simplifie…
ludamad Aug 25, 2025
34f46c0
.
ludamad Aug 25, 2025
41e84fa
progress
ludamad Aug 25, 2025
8ac3e88
Merge branch 'merge-train/barretenberg' into ad/bbapi/vk-simplified-b…
ludamad Aug 25, 2025
fc6f170
merge complete
ludamad Aug 25, 2025
b80c450
presets
ludamad Aug 25, 2025
33f3c44
fix api tests!
ludamad Aug 26, 2025
2671378
presets
ludamad Aug 26, 2025
9af1268
Merge remote-tracking branch 'origin/ad/bbapi/vk-simplified-buffer' i…
ludamad Aug 26, 2025
f6b5980
pinned
ludamad Aug 26, 2025
797a075
bootstrap flag
ludamad Aug 26, 2025
8514318
remove hack
ludamad Aug 26, 2025
b6a04ed
stash
ludamad Aug 26, 2025
e48263b
fix noir on mainframe
ludamad Aug 26, 2025
dd2f932
-
ludamad Aug 26, 2025
2f35670
merge fix
ludamad Aug 26, 2025
d40708b
tweaks
ludamad Aug 26, 2025
8d94966
fix
ludamad Aug 26, 2025
a428bcb
reverts and fixes
ludamad Aug 26, 2025
7474ce7
fixes
ludamad Aug 26, 2025
491b5dc
Merge branch 'merge-train/barretenberg' into ad/bbapi/vk-simplified-b…
ludamad Aug 26, 2025
480a024
pin vks
ludamad Aug 27, 2025
b764a4a
wtf its working
ludamad Aug 27, 2025
8b549b0
up
ludamad Aug 27, 2025
998870e
update
ludamad Aug 27, 2025
8987cbe
Discard changes to .vscode/launch.json
ludamad Aug 27, 2025
83fa1b8
Discard changes to .vscode/settings.json
ludamad Aug 27, 2025
ce6cff2
Discard changes to l1-contracts/gas_benchmark_results.json
ludamad Aug 27, 2025
25c87e8
Update proving command and output format explanation
ludamad Aug 27, 2025
c1f3c91
Discard changes to release-image/bootstrap.sh
ludamad Aug 27, 2025
aa280bc
Simplify binaryToFields by removing padding
ludamad Aug 27, 2025
db9902b
Merge remote-tracking branch 'origin/merge-train/barretenberg' into a…
ludamad Aug 27, 2025
918895d
hash
ludamad Aug 27, 2025
01cc9e7
vk size
ludamad Aug 28, 2025
9a0b69e
tweak
ludamad Aug 28, 2025
3074262
Merge branch 'merge-train/barretenberg' into ad/bbapi/vk-simplified-b…
ludamad Aug 28, 2025
1542b1c
Merge remote-tracking branch 'origin/merge-train/barretenberg' into a…
ludamad Sep 2, 2025
88581e3
Merge remote-tracking branch 'origin/ad/bbapi/vk-simplified-buffer' i…
ludamad Sep 2, 2025
6950b38
Merge remote-tracking branch 'origin/merge-train/barretenberg' into a…
ludamad Sep 2, 2025
c935ad5
Update
ludamad Sep 2, 2025
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
44 changes: 22 additions & 22 deletions barretenberg/acir_tests/bbjs-test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const logger = pino({
});

const proofPath = (dir: string) => path.join(dir, "proof");
const proofAsFieldsPath = (dir: string) => path.join(dir, "proof_fields.json");
const publicInputsAsFieldsPath = (dir: string) =>
path.join(dir, "public_inputs_fields.json");
const publicInputsPath = (dir: string) => path.join(dir, "public_inputs");
const vkeyPath = (dir: string) => path.join(dir, "vk");

async function generateProof({
Expand All @@ -27,7 +25,7 @@ async function generateProof({
oracleHash?: string;
multiThreaded?: boolean;
}) {
const { UltraHonkBackend, deflattenFields } = await import("@aztec/bb.js");
const { UltraHonkBackend } = await import("@aztec/bb.js");

logger.debug(`Generating proof for ${bytecodePath}...`);
const circuitArtifact = await fs.readFile(bytecodePath);
Expand All @@ -45,17 +43,16 @@ async function generateProof({
await fs.writeFile(proofPath(outputDirectory), Buffer.from(proof.proof));
logger.debug("Proof written to " + proofPath(outputDirectory));

await fs.writeFile(
publicInputsAsFieldsPath(outputDirectory),
JSON.stringify(proof.publicInputs)
// Convert public inputs from field strings to binary
const publicInputsBuffer = Buffer.concat(
proof.publicInputs.map((field: string) => {
const hex = field.startsWith('0x') ? field.slice(2) : field;
return Buffer.from(hex.padStart(64, '0'), 'hex');
})
);
await fs.writeFile(publicInputsPath(outputDirectory), publicInputsBuffer);
logger.debug(
"Public inputs written to " + publicInputsAsFieldsPath(outputDirectory)
);

await fs.writeFile(
proofAsFieldsPath(outputDirectory),
JSON.stringify(deflattenFields(proof.proof))
"Public inputs written to " + publicInputsPath(outputDirectory)
);

const verificationKey = await backend.getVerificationKey({
Expand All @@ -69,21 +66,24 @@ async function generateProof({
}

async function verifyProof({ directory }: { directory: string }) {
const { BarretenbergVerifier } = await import("@aztec/bb.js");
const { UltraHonkVerifierBackend } = await import("@aztec/bb.js");

const verifier = new BarretenbergVerifier();
const verifier = new UltraHonkVerifierBackend();

const proof = await fs.readFile(proofPath(directory));

const publicInputs = JSON.parse(
await fs.readFile(publicInputsAsFieldsPath(directory), "utf8")
);
// Read binary public inputs and convert to field strings
const publicInputsBinary = await fs.readFile(publicInputsPath(directory));
const publicInputs = [];
for (let i = 0; i < publicInputsBinary.length; i += 32) {
const chunk = publicInputsBinary.slice(i, Math.min(i + 32, publicInputsBinary.length));
publicInputs.push('0x' + chunk.toString('hex'));
}
logger.debug(`publicInputs: ${JSON.stringify(publicInputs)}`);
const vkey = await fs.readFile(vkeyPath(directory));
const verificationKey = await fs.readFile(vkeyPath(directory));

const verified = await verifier.verifyUltraHonkProof(
{ proof: new Uint8Array(proof), publicInputs },
new Uint8Array(vkey)
const verified = await verifier.verifyProof(
{ proof: new Uint8Array(proof), publicInputs, verificationKey},
);

await verifier.destroy();
Expand Down
39 changes: 22 additions & 17 deletions barretenberg/acir_tests/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ tests_hash=$(hash_str \
../ts/.rebuild_patterns \
../noir/))

function hex_to_fields_json {
# 1. split encoded hex into 64-character lines 3. encode as JSON array of hex strings
fold -w64 | jq -R -s -c 'split("\n") | map(select(length > 0)) | map("0x" + .)'
}

# Generate inputs for a given recursively verifying program.
function run_proof_generation {
local program=$1
local native_build_dir=$(../cpp/scripts/native-preset-build-dir)
local bb=$(realpath ../cpp/$native_build_dir/bin/bb)
local outdir=$(mktemp -d)
trap "rm -rf $outdir" EXIT
local adjustment=16
local ipa_accumulation_flag=""

cd ./acir_tests/assert_statement
Expand All @@ -37,35 +41,37 @@ function run_proof_generation {

# Adjust settings based on program type
if [[ $program == *"rollup"* ]]; then
adjustment=26
ipa_accumulation_flag="--ipa_accumulation"
fi
# If the test program has zk in it's name would like to use the zk prover, so we empty the flag in this case.
if [[ $program == *"zk"* ]]; then
disable_zk=""
fi
local prove_cmd="$bb prove --scheme ultra_honk $disable_zk $ipa_accumulation_flag --output_format fields --write_vk -o $outdir -b ./target/program.json -w ./target/witness.gz"
local prove_cmd="$bb prove --scheme ultra_honk $disable_zk $ipa_accumulation_flag --write_vk -o $outdir -b ./target/program.json -w ./target/witness.gz"
echo_stderr "$prove_cmd"
dump_fail "$prove_cmd"

local vk_fields=$(cat "$outdir/vk_fields.json")
local vk_hash_fields=$(cat "$outdir/vk_hash_fields.json")
local public_inputs_fields=$(cat "$outdir/public_inputs_fields.json")
local proof_fields=$(cat "$outdir/proof_fields.json")

generate_toml "$program" "$vk_fields" "$vk_hash_fields" "$proof_fields" "$public_inputs_fields"
# Split the hex-encoded vk bytes into fields boundaries (but still hex-encoded), first making 64-character lines and then encoding as JSON.
# This used to be done by barretenberg itself, but with serialization now always being in field elements we can do it outside of bb.
local vk_fields=$(cat "$outdir/vk" | xxd -p -c 0 | hex_to_fields_json)
local vk_hash_field="\"0x$(cat "$outdir/vk_hash" | xxd -p -c 0)\""
local public_inputs_fields=$(cat "$outdir/public_inputs" | xxd -p -c 0 | hex_to_fields_json)
local proof_fields=$(cat "$outdir/proof" | xxd -p -c 0 | hex_to_fields_json)

generate_toml "$program" "$vk_fields" "$vk_hash_field" "$proof_fields" "$public_inputs_fields"
}

function generate_toml {
local program=$1
local vk_fields=$2
local vk_hash_fields=$3
local vk_hash_field=$3
local proof_fields=$4
local num_inner_public_inputs=$5
local public_inputs_fields=$5
local output_file="../$program/Prover.toml"

jq -nr \
--arg key_hash "$vk_hash_fields" \
--arg key_hash "$vk_hash_field" \
--argjson vk_f "$vk_fields" \
--argjson public_inputs_f "$public_inputs_fields" \
--argjson proof_f "$proof_fields" \
Expand All @@ -79,7 +85,6 @@ function generate_toml {
}

function regenerate_recursive_inputs {
local program=$1
# Compile the assert_statement test as it's used for the recursive tests.
cd ./acir_tests/assert_statement
local nargo=$(realpath ../../../../noir/noir-repo/target/release/nargo)
Expand All @@ -91,7 +96,7 @@ function regenerate_recursive_inputs {
parallel 'run_proof_generation {}' ::: $(ls internal_test_programs)
}

export -f regenerate_recursive_inputs run_proof_generation generate_toml
export -f hex_to_fields_json regenerate_recursive_inputs run_proof_generation generate_toml

function compile {
echo_header "Compiling acir_tests"
Expand Down Expand Up @@ -160,10 +165,10 @@ function test_cmds {

# bb.js browser tests. Isolate because server.
local browser_prefix="$tests_hash:ISOLATE=1:NET=1:CPUS=8"
echo "$browser_prefix:NAME=chrome_verify_honk_proof $scripts/browser_prove.sh verify_honk_proof chrome"
echo "$browser_prefix:NAME=chrome_a_1_mul $scripts/browser_prove.sh a_1_mul chrome"
echo "$browser_prefix:NAME=webkit_verify_honk_proof $scripts/browser_prove.sh verify_honk_proof webkit"
echo "$browser_prefix:NAME=webkit_a_1_mul $scripts/browser_prove.sh a_1_mul webkit"
echo "$browser_prefix $scripts/browser_prove.sh verify_honk_proof chrome"
echo "$browser_prefix $scripts/browser_prove.sh a_1_mul chrome"
echo "$browser_prefix $scripts/browser_prove.sh verify_honk_proof webkit"
echo "$browser_prefix $scripts/browser_prove.sh a_1_mul webkit"

# bb.js tests.
# ecdsa_secp256r1_3x through bb.js on node to check 256k support.
Expand Down
11 changes: 5 additions & 6 deletions barretenberg/acir_tests/browser-test-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,16 @@ function installUltraHonkGlobals() {
}

async function verify(proofData: ProofData, verificationKey: Uint8Array) {
const { BarretenbergVerifier } = await import("@aztec/bb.js");
const { UltraHonkVerifierBackend } = await import("@aztec/bb.js");

logger.debug(`verifying...`);
const verifier = new BarretenbergVerifier();
const verified = await verifier.verifyUltraHonkProof(
proofData,
verificationKey
const backend = new UltraHonkVerifierBackend();
const verified = await backend.verifyProof(
{...proofData, verificationKey}
);
logger.debug(`verified: ${verified}`);

await verifier.destroy();
await backend.destroy();

logger.debug("test complete.");
return verified;
Expand Down
1 change: 0 additions & 1 deletion barretenberg/acir_tests/scripts/bb_prove_bbjs_verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ $bb prove \
-b target/program.json \
-w target/witness.gz \
-k output-$$/vk \
--output_format bytes_and_fields \
-o output-$$

# Verify the proof with bb.js classes
Expand Down
5 changes: 2 additions & 3 deletions barretenberg/acir_tests/scripts/bb_prove_sol_verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ mkdir -p output-$$
trap "rm -rf output-$$" EXIT

# Create a proof, write the solidity contract, write the proof as fields in order to extract the public inputs
$bb prove $flags -b target/program.json --oracle_hash keccak --output_format bytes_and_fields --write_vk -o output-$$
$bb prove $flags -b target/program.json --oracle_hash keccak --write_vk -o output-$$
$bb verify $flags --oracle_hash keccak -i output-$$/public_inputs -k output-$$/vk -p output-$$/proof
$bb write_solidity_verifier $write_contract_flags -k output-$$/vk -o output-$$/Verifier.sol

# Use solcjs to compile the generated key contract with the template verifier and test contract
# index.js will start an anvil, on a random port
# Deploy the verifier then send a test transaction
PROOF="output-$$/proof" \
PROOF_AS_FIELDS="output-$$/proof_fields.json" \
PUBLIC_INPUTS_AS_FIELDS="output-$$/public_inputs_fields.json" \
PUBLIC_INPUTS="output-$$/public_inputs" \
VERIFIER_PATH="output-$$/Verifier.sol" \
TEST_PATH="../../sol-test/HonkTest.sol" \
HAS_ZK="$has_zk" \
Expand Down
12 changes: 1 addition & 11 deletions barretenberg/acir_tests/scripts/bbjs_prove_bb_verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,7 @@ node ../../bbjs-test prove \
-w target/witness.gz \
-o output-$$

proof_bytes=$(cat output-$$/proof | xxd -p)
public_inputs=$(cat output-$$/public_inputs_fields.json | jq -r '.[]')

public_inputs_bytes=""
for input in $public_inputs; do
public_inputs_bytes+=$input
done

# Combine proof header and the proof to a single file
echo -n $proof_bytes | xxd -r -p > output-$$/proof
echo -n $public_inputs_bytes | xxd -r -p > output-$$/public_inputs
# The proof and public_inputs are already in binary format from bbjs-test

bb=$(../../../cpp/scripts/find-bb)
# Verify the proof with bb cli
Expand Down
3 changes: 1 addition & 2 deletions barretenberg/acir_tests/scripts/bbjs_prove_sol_verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ $bb write_solidity_verifier --scheme ultra_honk -k output-$$/vk -o output-$$/Ver

# Verify the proof using the solidity verifier
PROOF="output-$$/proof" \
PROOF_AS_FIELDS="output-$$/proof_fields.json" \
PUBLIC_INPUTS_AS_FIELDS="output-$$/public_inputs_fields.json" \
PUBLIC_INPUTS="output-$$/public_inputs" \
VERIFIER_PATH="output-$$/Verifier.sol" \
TEST_PATH="../../sol-test/HonkTest.sol" \
HAS_ZK="$has_zk" \
Expand Down
40 changes: 25 additions & 15 deletions barretenberg/acir_tests/sol-test/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@ const linkLibrary = (bytecode, libraryName, libraryAddress) => {
return bytecode.replace(regex, address);
};

/**
* Converts binary data to array of field elements (32-byte chunks as hex strings)
* @param {Buffer} buffer - Binary data
* @return {Array<String>} Array of hex strings with 0x prefix
*/
const binaryToFields = (buffer) => {
const fields = [];
for (let i = 0; i < buffer.length; i += 32) {
const chunk = buffer.slice(i, i + 32);
fields.push('0x' + chunk.toString('hex'));
}
return fields;
};

/**
* Takes in a proof as fields, and returns the public inputs, as well as the number of public inputs
* @param {Array<String>} proofAsFields
Expand Down Expand Up @@ -225,26 +239,22 @@ try {
const proof = readFileSync(proofPath);
proofStr = proof.toString("hex");

let publicInputsAsFieldsPath = getEnvVarCanBeUndefined(
"PUBLIC_INPUTS_AS_FIELDS"
); // PUBLIC_INPUTS_AS_FIELDS is not defined for bb plonk, but is for bb honk and bbjs honk.
var publicInputs;
let proofAsFieldsPath = getEnvVarCanBeUndefined("PROOF_AS_FIELDS"); // PROOF_AS_FIELDS is not defined for bbjs, but is for bb plonk and bb honk.
let publicInputsPath = getEnvVarCanBeUndefined("PUBLIC_INPUTS");
var publicInputs = [];
let numExtraPublicInputs = 0;
let extraPublicInputs = [];
if (proofAsFieldsPath) {
const proofAsFields = readFileSync(proofAsFieldsPath);

// For flows that use binary proof format, extract public inputs from the proof
const proofAsFields = binaryToFields(proof);
if (proofAsFields.length > NUMBER_OF_FIELDS_IN_PROOF) {
// We need to extract the public inputs from the proof. This might be empty, or just the pairing point object, or be the entire public inputs...
[numExtraPublicInputs, extraPublicInputs] = readPublicInputs(
JSON.parse(proofAsFields.toString())
);
[numExtraPublicInputs, extraPublicInputs] = readPublicInputs(proofAsFields);
}
// We need to do this because plonk doesn't define this path
if (publicInputsAsFieldsPath) {
const innerPublicInputs = JSON.parse(
readFileSync(publicInputsAsFieldsPath).toString()
); // assumes JSON array of PI hex strings

// Read public inputs from binary file if available
if (publicInputsPath) {
const publicInputsBinary = readFileSync(publicInputsPath);
const innerPublicInputs = binaryToFields(publicInputsBinary);
publicInputs = innerPublicInputs.concat(extraPublicInputs);
} else {
// for plonk, the extraPublicInputs are all of the public inputs
Expand Down
15 changes: 0 additions & 15 deletions barretenberg/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash
source $(git rev-parse --show-toplevel)/ci3/source


function bootstrap_all {
# To run bb we need a crs.
# Download ignition up front to ensure no race conditions at runtime.
Expand Down Expand Up @@ -32,20 +31,6 @@ case "$cmd" in
"release-preview")
./docs/bootstrap.sh release-preview
;;
bootstrap_e2e_hack)
echo "WARNING: This assumes your PR only changes barretenberg and the rest of the repository is unchanged from master."
echo "WARNING: This is only sound if you have not changed VK generation! (or noir-projects VKs will be incorrect)."
Copy link
Collaborator Author

@ludamad ludamad Aug 27, 2025

Choose a reason for hiding this comment

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

You can just do BOOTSTRAP_AFTER=barretenberg ./bootstrap.sh now

echo "WARNING: It builds up until yarn-project and allows end-to-end tests (not boxes/playground/release image etc)."
merge_base=$(git merge-base HEAD origin/master)
for project in noir barretenberg avm-transpiler noir-projects l1-contracts yarn-project ; do
if [ $project == barretenberg ]; then
../$project/bootstrap.sh # i.e. this script
else
AZTEC_CACHE_COMMIT=$merge_base ../$project/bootstrap.sh
fi
done
;;

*)
echo "Unknown command: $cmd"
exit 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
source $(git rev-parse --show-toplevel)/ci3/source

# export bb as it is needed when using exported functions
export bb=$(./find-bb)
cd ..

# NOTE: We pin the captured IVC inputs to a known master commit, exploiting that there won't be frequent changes.
Expand All @@ -11,7 +13,8 @@ cd ..
# - Generate a hash for versioning: sha256sum bb-civc-inputs.tar.gz
# - Upload the compressed results: aws s3 cp bb-civc-inputs.tar.gz s3://aztec-ci-artifacts/protocol/bb-civc-inputs-[hash(0:8)].tar.gz
# Note: In case of the "Test suite failed to run ... Unexpected token 'with' " error, need to run: docker pull aztecprotocol/build:3.0
pinned_short_hash="e5081516"

pinned_short_hash="9c83acbc"
pinned_civc_inputs_url="https://aztec-ci-artifacts.s3.us-east-2.amazonaws.com/protocol/bb-civc-inputs-${pinned_short_hash}.tar.gz"

function compress_and_upload {
Expand Down Expand Up @@ -44,7 +47,7 @@ if [[ "${1:-}" == "--update_inputs" ]]; then
# Generate new inputs
echo "Running bootstrap to generate new IVC inputs..."

../../bootstrap.sh # bootstrap aztec-packages from root
BOOTSTRAP_TO=yarn-project ../../bootstrap.sh # bootstrap aztec-packages from root
../../yarn-project/end-to-end/bootstrap.sh build_bench # build bench to generate IVC inputs

compress_and_upload ../../yarn-project/end-to-end/example-app-ivc-inputs-out
Expand All @@ -62,9 +65,9 @@ function check_circuit_vks {
local flow_folder="$inputs_tmp_dir/$1"

if [[ "${2:-}" == "--update_inputs" ]]; then
./build/bin/bb check --update_inputs --scheme client_ivc --ivc_inputs_path "$flow_folder/ivc-inputs.msgpack" || { echo_stderr "Error: Likely VK change detected in $flow_folder! Updating inputs."; exit 1; }
$bb check --update_inputs --scheme client_ivc --ivc_inputs_path "$flow_folder/ivc-inputs.msgpack" || { echo_stderr "Error: Likely VK change detected in $flow_folder! Updating inputs."; exit 1; }
else
./build/bin/bb check --scheme client_ivc --ivc_inputs_path "$flow_folder/ivc-inputs.msgpack" || { echo_stderr "Error: Likely VK change detected in $flow_folder!"; exit 1; }
$bb check --scheme client_ivc --ivc_inputs_path "$flow_folder/ivc-inputs.msgpack" || { echo_stderr "Error: Likely VK change detected in $flow_folder!"; exit 1; }
fi
}

Expand Down
Loading
Loading