Skip to content

Commit d40708b

Browse files
committed
tweaks
1 parent 2f35670 commit d40708b

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

barretenberg/acir_tests/scripts/bb_prove_bbjs_verify.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ $bb prove \
2222
-b target/program.json \
2323
-w target/witness.gz \
2424
-k output-$$/vk \
25-
--output_format bytes_and_fields \
2625
-o output-$$
2726

2827
# Verify the proof with bb.js classes

barretenberg/acir_tests/scripts/bb_prove_sol_verify.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@ mkdir -p output-$$
2727
trap "rm -rf output-$$" EXIT
2828

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

3434
# Use solcjs to compile the generated key contract with the template verifier and test contract
3535
# index.js will start an anvil, on a random port
3636
# Deploy the verifier then send a test transaction
3737
PROOF="output-$$/proof" \
38-
PROOF_AS_FIELDS="output-$$/proof_fields.json" \
39-
PUBLIC_INPUTS_AS_FIELDS="output-$$/public_inputs_fields.json" \
38+
PUBLIC_INPUTS="output-$$/public_inputs" \
4039
VERIFIER_PATH="output-$$/Verifier.sol" \
4140
TEST_PATH="../../sol-test/HonkTest.sol" \
4241
HAS_ZK="$has_zk" \

barretenberg/acir_tests/scripts/bbjs_prove_bb_verify.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,7 @@ node ../../bbjs-test prove \
1414
-w target/witness.gz \
1515
-o output-$$
1616

17-
proof_bytes=$(cat output-$$/proof | xxd -p)
18-
public_inputs=$(cat output-$$/public_inputs_fields.json | jq -r '.[]')
19-
20-
public_inputs_bytes=""
21-
for input in $public_inputs; do
22-
public_inputs_bytes+=$input
23-
done
24-
25-
# Combine proof header and the proof to a single file
26-
echo -n $proof_bytes | xxd -r -p > output-$$/proof
27-
echo -n $public_inputs_bytes | xxd -r -p > output-$$/public_inputs
17+
# The proof and public_inputs are already in binary format from bbjs-test
2818

2919
bb=$(../../../cpp/scripts/find-bb)
3020
# Verify the proof with bb cli

barretenberg/acir_tests/scripts/bbjs_prove_sol_verify.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ $bb write_solidity_verifier --scheme ultra_honk -k output-$$/vk -o output-$$/Ver
3535

3636
# Verify the proof using the solidity verifier
3737
PROOF="output-$$/proof" \
38-
PROOF_AS_FIELDS="output-$$/proof_fields.json" \
39-
PUBLIC_INPUTS_AS_FIELDS="output-$$/public_inputs_fields.json" \
38+
PUBLIC_INPUTS="output-$$/public_inputs" \
4039
VERIFIER_PATH="output-$$/Verifier.sol" \
4140
TEST_PATH="../../sol-test/HonkTest.sol" \
4241
HAS_ZK="$has_zk" \

barretenberg/acir_tests/sol-test/src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ const binaryToFields = (buffer) => {
175175
for (let i = 0; i < buffer.length; i += 32) {
176176
const chunk = buffer.slice(i, Math.min(i + 32, buffer.length));
177177
// Pad with leading zeros if chunk is less than 32 bytes
178-
const padded = chunk.length < 32
178+
const padded = chunk.length < 32
179179
? Buffer.concat([Buffer.alloc(32 - chunk.length), chunk])
180180
: chunk;
181181
fields.push('0x' + padded.toString('hex'));
@@ -247,14 +247,14 @@ try {
247247
var publicInputs = [];
248248
let numExtraPublicInputs = 0;
249249
let extraPublicInputs = [];
250-
250+
251251
// For flows that use binary proof format, extract public inputs from the proof
252252
const proofAsFields = binaryToFields(proof);
253253
if (proofAsFields.length > NUMBER_OF_FIELDS_IN_PROOF) {
254254
// 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...
255255
[numExtraPublicInputs, extraPublicInputs] = readPublicInputs(proofAsFields);
256256
}
257-
257+
258258
// Read public inputs from binary file if available
259259
if (publicInputsPath) {
260260
const publicInputsBinary = readFileSync(publicInputsPath);

0 commit comments

Comments
 (0)