Skip to content

Commit 6950b38

Browse files
committed
Merge remote-tracking branch 'origin/merge-train/barretenberg' into ad/bbapi/vk-simplified-buffer
2 parents 88581e3 + 1789e3b commit 6950b38

File tree

140 files changed

+11385
-686
lines changed

Some content is hidden

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

140 files changed

+11385
-686
lines changed

.github/workflows/deploy-aztec-infra.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ on:
100100
description: Whether to use an external ingress for the rpc
101101
required: true
102102
type: boolean
103+
otel_collector_url:
104+
description: The OpenTelemetry collector that will receive metrics from this deployment. Optional
105+
required: false
106+
type: string
103107
secrets:
104108
GCP_SA_KEY:
105109
description: The GCP service account key
@@ -207,6 +211,10 @@ on:
207211
description: Whether to use an external ingress for the rpc
208212
required: true
209213
type: boolean
214+
otel_collector_url:
215+
description: The OpenTelemetry collector that will receive metrics from this deployment. Optional
216+
required: false
217+
type: string
210218

211219
jobs:
212220
deploy_aztec_infra:
@@ -237,6 +245,7 @@ jobs:
237245
TF_VAR_PROVER_RESOURCE_PROFILE: ${{ inputs.prover_resource_profile }}
238246
TF_VAR_RPC_RESOURCE_PROFILE: ${{ inputs.rpc_resource_profile }}
239247
TF_VAR_RPC_EXTERNAL_INGRESS: ${{ inputs.rpc_external_ingress }}
248+
TF_VAR_OTEL_COLLECTOR_URL: ${{ inputs.otel_collector_url }}
240249

241250
steps:
242251
- name: Debug inputs

avm-transpiler/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

barretenberg/acir_tests/bootstrap.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ function test_cmds {
157157
for t in assert_statement a_1_mul slices verify_honk_proof; do
158158
echo "$sol_prefix $scripts/bb_prove_sol_verify.sh $t --disable_zk"
159159
echo "$sol_prefix $scripts/bb_prove_sol_verify.sh $t"
160+
echo "$sol_prefix USE_OPTIMIZED_CONTRACT=true $scripts/bb_prove_sol_verify.sh $t"
160161
done
161162
# prove with bb cli and verify with bb.js classes
162163
echo "$sol_prefix $scripts/bb_prove_bbjs_verify.sh a_1_mul"

barretenberg/acir_tests/scripts/bb_prove_sol_verify.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ for arg in "$@"; do
1616
flags+=" $arg"
1717
done
1818

19+
USE_OPTIMIZED_CONTRACT=${USE_OPTIMIZED_CONTRACT:-false}
20+
21+
write_contract_flags=$flags
22+
if [[ -z "$USE_OPTIMIZED_CONTRACT" ]]; then
23+
write_contract_flags+=" --optimized"
24+
fi
25+
1926
# Check if --disable_zk is in the flags to determine HAS_ZK
2027
if [[ "$flags" == *"--disable_zk"* ]]; then
2128
has_zk="false"
@@ -29,7 +36,7 @@ trap "rm -rf output-$$" EXIT
2936
# Create a proof, write the solidity contract, write the proof as fields in order to extract the public inputs
3037
$bb prove $flags -b target/program.json --oracle_hash keccak --write_vk -o output-$$
3138
$bb verify $flags --oracle_hash keccak -i output-$$/public_inputs -k output-$$/vk -p output-$$/proof
32-
$bb write_solidity_verifier $flags -k output-$$/vk -o output-$$/Verifier.sol
39+
$bb write_solidity_verifier $write_contract_flags -k output-$$/vk -o output-$$/Verifier.sol
3340

3441
# Use solcjs to compile the generated key contract with the template verifier and test contract
3542
# index.js will start an anvil, on a random port

barretenberg/acir_tests/sol-test/HonkTest.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ contract Test {
1212
verifier = new HonkVerifier();
1313
}
1414

15-
function test(bytes calldata proof, bytes32[] calldata publicInputs) public view returns (bool) {
15+
function test(bytes calldata proof, bytes32[] calldata publicInputs) public returns (bool) {
1616
return verifier.verify(proof, publicInputs);
1717
}
1818
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ try {
284284
// Deploy the library
285285
console.log("Deploying ZKTranscriptLib library...");
286286
const libraryAddress = await deploy(signer, libraryAbi, libraryBytecode);
287+
288+
// Wait for the library deployment - for some reason we have an issue with nonces here
289+
await new Promise((resolve) => setTimeout(resolve, 500));
287290
console.log("ZKTranscriptLib deployed at:", libraryAddress);
288291

289292
// Link the library to the verifier bytecode

barretenberg/cpp/pil/vm2/alu.pil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pol EXPECTED_C_TAG = (sel_op_add + sel_op_sub + sel_op_mul + sel_op_div + sel_op
119119
// Gating with (1 - sel_tag_err) is necessary because when an error occurs, we have to set the tag to 0,
120120
// which might not be equal to EXPECTED_C_TAG.
121121
#[C_TAG_CHECK]
122-
(1 - sel_tag_err) * (EXPECTED_C_TAG - ic_tag) = 0;
122+
(1 - sel_err) * (EXPECTED_C_TAG - ic_tag) = 0;
123123

124124
pol commit sel_tag_err;
125125
sel_tag_err * (1 - sel_tag_err) = 0;

barretenberg/cpp/pil/vm2/context.pil

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ namespace execution;
1212
#[skippable_if]
1313
sel = 0;
1414

15+
// TODO: make sure that all uses of `sel_error` here really should be "error" only
16+
// since `sel_error` will not be ` for the REVERT opcode. If we need "error or REVERT",
17+
// use `sel_failure`.
18+
1519
// Guaranteed to be boolean because sel_execute_call & sel_execute_static_call are mutually exclusive
1620
pol commit sel_enter_call;
1721
// The following selectors will be 0 if there is an error during execution (before the opcode execution step).
@@ -33,7 +37,9 @@ namespace execution;
3337
pol commit contract_address;
3438
pol commit bytecode_id;
3539
pol commit transaction_fee;
36-
// Constrained boolean by tx trace (for enqueued call) and #[NEXT_IS_STATIC] for nested
40+
// Constrained boolean by tx trace for enqueued call, #[IS_STATIC_NEXT_ROW] during normal execution,
41+
// IS_STATIC_IF_STATIC_CALL+IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT for nested calls,
42+
// and CTX_STACK_CALL for returns or failures.
3743
pol commit is_static;
3844

3945
pol commit parent_calldata_addr;
@@ -189,7 +195,12 @@ namespace execution;
189195
// otherwise = 0 ==> is_static' = is_static
190196
#[IS_STATIC_NEXT_ROW]
191197
NOT_LAST_EXEC * DEFAULT_CTX_ROW * (is_static' - is_static) = 0;
192-
NOT_LAST_EXEC * sel_enter_call * (is_static' - sel_execute_static_call) = 0;
198+
// An external call from a non-static context only creates a nested static context if the opcode is STATICCALL.
199+
#[IS_STATIC_IF_STATIC_CALL]
200+
NOT_LAST_EXEC * sel_enter_call * (1 - is_static) * (is_static' - sel_execute_static_call) = 0;
201+
// An external call from a static context always creates a nested static context.
202+
#[IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT]
203+
NOT_LAST_EXEC * sel_enter_call * is_static * (is_static' - 1) = 0;
193204

194205
// nested_exit_call = 1 ==> constraints come from lookup
195206
// sel_enter_call = 1 ==> parent_calldata_addr' = rop[4] (resolved operand 5 from execution trace)

barretenberg/cpp/pil/vm2/execution.pil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ sel_bytecode_retrieval_success {
147147

148148
pol commit sel_instruction_fetching_success;
149149
// If sel = 0, we want sel_instruction_fetching_success = 0. We shouldn't be using it.
150-
sel_instruction_fetching_success = sel * (1 - sel_instruction_fetching_failure);
150+
sel_instruction_fetching_success = sel_bytecode_retrieval_success * (1 - sel_instruction_fetching_failure);
151151

152152
#[INSTRUCTION_FETCHING_BODY]
153153
sel_instruction_fetching_success {

barretenberg/cpp/pil/vm2/tx.pil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ namespace tx;
306306
execution.enqueued_call_end {
307307
execution.context_id,
308308
execution.next_context_id,
309-
execution.sel_error,
309+
execution.sel_failure,
310310
execution.discard,
311311
// Tree State
312312
execution.note_hash_tree_root,

0 commit comments

Comments
 (0)