Skip to content

Commit b3997db

Browse files
authored
Merge branch 'v5-next' into chore/merge-public-v5-next
2 parents b4c00bc + d5cfa2a commit b3997db

911 files changed

Lines changed: 103046 additions & 21495 deletions

File tree

Some content is hidden

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

.github/ci3_labels_to_env.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ function main {
127127
echo "WARNING: Skipping main CI because Chonk input refresh was requested; the update step will run after this step succeeds." >&2
128128
ci_mode="skip"
129129
elif has_label "ci-release-pr"; then
130+
# Release-PR mode creates and pushes a release tag for this PR's head (ci3.sh::handle_release_pr).
131+
# In the private repo that tag triggers a private release via the safety gate below — this is the
132+
# manual way to cut a private release from a PR, alongside the nightly tag cron.
130133
ci_mode="release-pr"
131134
elif has_label "ci-full"; then
132135
ci_mode="full"
@@ -141,6 +144,9 @@ function main {
141144
elif has_label "ci-barretenberg" || [ "$target_branch" == "merge-train/barretenberg" ]; then
142145
ci_mode="barretenberg"
143146
elif [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
147+
# A pushed semver tag is a release; REF_NAME is the tag (see ci3/source_refname). In the private
148+
# repo this is the nightly path (nightly-release-tag*.yml push v<ver>-nightly.<date> tags on next and
149+
# v5-next); the private-repo safety gate below routes it to the internal Artifact Registry.
144150
ci_mode="release"
145151
else
146152
ci_mode="fast"
@@ -149,6 +155,17 @@ function main {
149155
echo "CI_MODE=$ci_mode" >> $GITHUB_ENV
150156
echo "CI mode: $ci_mode"
151157

158+
# Private-repo safety gate. The release flow can publish to DockerHub/npmjs/crates.io/github; that
159+
# MUST NEVER run in the private fork. So whenever this repo would release — for ANY trigger (a pushed
160+
# nightly tag, a ci-release-pr tag, anything future) — force the private path: publish only the docker
161+
# image and npm packages to our internal Artifact Registry (bootstrap.sh::private_release). Keyed on
162+
# the repo name (case-insensitive) so it can't be reached in the public repo.
163+
if [ "$ci_mode" = "release" ] &&
164+
[ "$(printf '%s' "${GITHUB_REPOSITORY:-}" | tr 'A-Z' 'a-z')" = "aztecprotocol/aztec-packages-private" ]; then
165+
echo "PRIVATE_RELEASE=1" >> $GITHUB_ENV
166+
echo "SKIP_COMPAT_E2E=1" >> $GITHUB_ENV
167+
fi
168+
152169
# Determine if benchmarks should be uploaded (merge-queue, full, or full-no-test-cache modes)
153170
if [[ "$ci_mode" == "merge-queue" || "$ci_mode" == "merge-queue-heavy" || "$ci_mode" == "full" || "$ci_mode" == "full-no-test-cache" ]]; then
154171
echo "SHOULD_UPLOAD_BENCHMARKS=1" >> $GITHUB_ENV

.github/workflows/ci3.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ name: CI3
77
on:
88
workflow_dispatch:
99
push:
10+
branches:
11+
- next
1012
tags:
1113
- "v*"
1214
pull_request:
@@ -115,6 +117,9 @@ jobs:
115117
EXTERNAL_ETHEREUM_CONSENSUS_HOST_API_KEY: ${{ secrets.GCP_SEPOLIA_API_KEY }}
116118
EXTERNAL_ETHEREUM_CONSENSUS_HOST_API_KEY_HEADER: "X-goog-api-key"
117119
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
120+
# Internal GCP Artifact Registry the private repo's release pushes the docker image to (see
121+
# bootstrap.sh::private_release). Empty in the public repo, where releases publish normally.
122+
INTERNAL_DOCKER_REGISTRY: ${{ vars.INTERNAL_DOCKER_REGISTRY }}
118123
MERGE_GROUP_BASE_REF: ${{ github.event.merge_group.base_ref }}
119124
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
120125
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}

.github/workflows/docs-typesense.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ jobs:
3939
run: |
4040
set -euo pipefail
4141
42+
if [ -z "$TYPESENSE_API_KEY" ] || [ -z "$TYPESENSE_HOST" ]; then
43+
echo "Typesense secrets are not configured; skipping docs search reindex."
44+
exit 0
45+
fi
46+
4247
docker run \
4348
-e "TYPESENSE_API_KEY=$TYPESENSE_API_KEY" \
4449
-e "TYPESENSE_HOST=$TYPESENSE_HOST" \
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Nightly Release Tag (v4-next)
1+
name: Nightly Release Tag (v5-next)
22
on:
33
schedule:
44
# Run the workflow every night at 5:00 AM UTC.
@@ -9,24 +9,24 @@ permissions:
99
contents: write
1010

1111
concurrency:
12-
group: ${{ github.workflow }}-v4-next
12+
group: ${{ github.workflow }}-v5-next
1313

1414
jobs:
15-
nightly-release-tag-v4-next:
15+
nightly-release-tag-v5-next:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
1919
with:
20-
ref: v4-next
20+
ref: v5-next
2121
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
2222

23-
- name: Create v4-next Nightly Tag
23+
- name: Create v5-next Nightly Tag
2424
run: |
2525
git config --global user.email "tech@aztecprotocol.com"
2626
git config --global user.name "AztecBot"
2727
current_version=$(jq -r '."."' .release-please-manifest.json)
2828
echo "Current version: $current_version"
2929
nightly_tag="v${current_version}-nightly.$(date -u +%Y%m%d)"
30-
echo "v4-next nightly tag: $nightly_tag"
30+
echo "v5-next nightly tag: $nightly_tag"
3131
git tag -a "$nightly_tag" -m "$nightly_tag"
3232
git push origin "$nightly_tag"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Public Next PR Body
2+
3+
on:
4+
push:
5+
branches:
6+
- next
7+
- public-next
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: public-next-pr-body
12+
cancel-in-progress: true
13+
14+
jobs:
15+
update-public-next-pr-body:
16+
name: Update next to public-next PR body
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
pull-requests: write
21+
steps:
22+
- name: Checkout public-next workflow scripts
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
24+
with:
25+
ref: public-next
26+
fetch-depth: 0
27+
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
28+
29+
- name: Update holding PR body
30+
env:
31+
GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
32+
BASE_BRANCH: public-next
33+
HEAD_BRANCH: next
34+
run: ./scripts/merge-train/update-public-next-pr-body.sh
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Public Next Auto-Pull
2+
3+
on:
4+
push:
5+
branches:
6+
- public-next
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: public-next-to-next
11+
cancel-in-progress: false
12+
13+
jobs:
14+
merge-to-next:
15+
name: Merge public-next to next
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout public-next automation
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
20+
with:
21+
ref: public-next
22+
fetch-depth: 0
23+
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
24+
persist-credentials: true
25+
26+
- name: Configure Git
27+
run: |
28+
git config user.name AztecBot
29+
git config user.email tech@aztecprotocol.com
30+
31+
- name: Merge public-next into next
32+
env:
33+
GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
34+
SOURCE_BRANCH: public-next
35+
TARGET_BRANCH: next
36+
CONFLICT_EXIT_CODE: 1
37+
run: ./scripts/merge-train/merge-public-next.sh

.github/workflows/release-canary-pr-update.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ jobs:
125125
126126
# Add labels based on what changed
127127
labels=""
128-
if [[ "${{ steps.detect.outputs.release_pr }}" == "true" ]]; then
128+
if [[ "${{ github.repository }}" != "AztecProtocol/aztec-packages-private" && "${{ steps.detect.outputs.release_pr }}" == "true" ]]; then
129129
labels="$labels --add-label ci-release-pr"
130130
fi
131-
if [[ "${{ steps.detect.outputs.network_kind }}" == "true" ]]; then
131+
if [[ "${{ github.repository }}" != "AztecProtocol/aztec-packages-private" && "${{ steps.detect.outputs.network_kind }}" == "true" ]]; then
132132
labels="$labels --add-label ci-network-kind"
133133
fi
134134
if [[ -n "$labels" ]]; then
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Sync public-next to upstream next while preserving private automation.
2+
#
3+
# Uses AZTEC_BOT_GITHUB_TOKEN (PAT) because GITHUB_TOKEN cannot push
4+
# commits that modify .github/workflows/ files.
5+
name: Sync Upstream Next
6+
7+
on:
8+
schedule:
9+
- cron: "*/15 * * * *"
10+
workflow_dispatch:
11+
12+
jobs:
13+
sync:
14+
name: Sync public-next
15+
runs-on: ubuntu-latest
16+
concurrency:
17+
group: sync-public-next
18+
cancel-in-progress: false
19+
steps:
20+
- name: Checkout public-next
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
with:
23+
ref: public-next
24+
fetch-depth: 0
25+
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
26+
persist-credentials: true
27+
28+
- name: Configure Git
29+
run: |
30+
git config user.name "AztecBot"
31+
git config user.email "tech@aztecprotocol.com"
32+
33+
- name: Sync public-next with upstream
34+
run: ./scripts/merge-train/sync-public-next.sh

avm-transpiler/src/procedures/msm.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ OUTER_BODY: MUL d6, d13, d16; Compute the pointer to the point
2929
EQ i17, d8, d19; Check if the scalar lo is zero
3030
EQ i18, d8, d20; Check if the scalar hi is zero
3131
AND d19, d20, d19; Check if both scalars are zero
32-
JUMPI d19, OUTER_INC; If both scalar limbs are zero, continue
32+
JUMPI d19, VALIDATE_ZERO_SCALAR_POINT; If both scalar limbs are zero, validate the point then continue
3333
; Decompose the scalars to an array of 254 bits
3434
; Allocate a 254 bit array
3535
MOV $1, d19; Move the free memory pointer to d19, where we'll store the bits
@@ -75,6 +75,15 @@ OUTER_INC: ADD d6, $2, d6; Increment the outer loop variable
7575
JUMP OUTER_HEAD
7676
; After the outer loop we have computed the msm. We can return since we wrote the result in i3, i4
7777
OUTER_END: INTERNALRETURN
78+
79+
; A zero scalar skips the loop where point validation takes place (inside ECADD), but Brillig/native validates /before/ the loop.
80+
; To mirror this we perform a 'dummy' ECADD (P + O = P) which throws if the point is not on the curve.
81+
VALIDATE_ZERO_SCALAR_POINT: MOV i16, d22; x
82+
ADD d16, $2, d25; pointer to y
83+
MOV i25, d23; y
84+
; Note: d8 (=0) used as the (0,0) infinity coords here - if the infinity rep changes, update this.
85+
ECADD d22, d23, d8, d8, /*not indirect, so the result (= point) is stored in d22, d23*/ d22; Add the original point to infinity
86+
JUMP OUTER_INC; Skip this zero-scalar term
7887
";
7988

8089
#[cfg(test)]

avm-transpiler/src/transpile.rs

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -324,37 +324,29 @@ pub fn brillig_to_avm(brillig_bytecode: &[BrilligOpcode<FieldElement>]) -> (Vec<
324324
));
325325
}
326326
BrilligOpcode::ConditionalMov { destination, source_a, source_b, condition } => {
327-
// Move source_a to destination, if condition is true jump to the next brillig opcode, else move source_b to destination
328-
avm_instrs.push(generate_mov_instruction(
329-
Some(
330-
AddressingModeBuilder::default()
331-
.direct_operand(source_a)
332-
.direct_operand(destination)
333-
.build(),
334-
),
335-
source_a.to_u32(),
336-
destination.to_u32(),
337-
));
338-
339-
unresolved_jumps.insert(
340-
UnresolvedPCLocation {
341-
instruction_index: avm_instrs.len(),
342-
immediate_index: 0,
343-
},
344-
Label::BrilligPC { pc: brillig_pcs_to_avm_pcs.len() as u32 }, // We want to jump to the next brillig opcode
345-
);
346-
347-
avm_instrs.push(AvmInstruction {
327+
// Alias-safe lowering of the atomic `destination = condition ? source_a : source_b`.
328+
//
329+
// JUMPI condition, then
330+
// MOV source_b -> destination ; false branch
331+
// JUMP end
332+
// then: MOV source_a -> destination ; true branch
333+
// end: (next brillig opcode)
334+
//
335+
// `destination` is written exactly once, on the branch actually taken, after
336+
// `condition` has been read.
337+
338+
// JUMPI condition, then
339+
let mut jumpi = AvmInstruction {
348340
opcode: AvmOpcode::JUMPI_32,
349341
addressing_mode: Some(
350342
AddressingModeBuilder::default().direct_operand(condition).build(),
351343
),
352344
operands: vec![make_operand(16, &condition.to_u32())],
353345
immediates: vec![make_unresolved_pc()],
354346
..Default::default()
355-
});
356-
357-
avm_instrs.push(generate_mov_instruction(
347+
};
348+
// MOV source_b -> destination
349+
let mov_b = generate_mov_instruction(
358350
Some(
359351
AddressingModeBuilder::default()
360352
.direct_operand(source_b)
@@ -363,7 +355,36 @@ pub fn brillig_to_avm(brillig_bytecode: &[BrilligOpcode<FieldElement>]) -> (Vec<
363355
),
364356
source_b.to_u32(),
365357
destination.to_u32(),
366-
));
358+
);
359+
// JUMP end
360+
let mut jump_end = AvmInstruction {
361+
opcode: AvmOpcode::JUMP_32,
362+
immediates: vec![make_unresolved_pc()],
363+
..Default::default()
364+
};
365+
// MOV source_a -> destination
366+
let mov_a = generate_mov_instruction(
367+
Some(
368+
AddressingModeBuilder::default()
369+
.direct_operand(source_a)
370+
.direct_operand(destination)
371+
.build(),
372+
),
373+
source_a.to_u32(),
374+
destination.to_u32(),
375+
);
376+
377+
// Calculate jump pc targets
378+
let then_pc = current_avm_pc + jumpi.size() + mov_b.size() + jump_end.size();
379+
let end_pc = then_pc + mov_a.size();
380+
// Update immediates with correct jump targets
381+
jumpi.immediates = vec![AvmOperand::U32 { value: then_pc as u32 }];
382+
jump_end.immediates = vec![AvmOperand::U32 { value: end_pc as u32 }];
383+
384+
avm_instrs.push(jumpi);
385+
avm_instrs.push(mov_b);
386+
avm_instrs.push(jump_end);
387+
avm_instrs.push(mov_a);
367388
}
368389
BrilligOpcode::Load { destination, source_pointer } => {
369390
avm_instrs.push(generate_mov_instruction(

0 commit comments

Comments
 (0)