Skip to content

Commit 89a3575

Browse files
author
AztecBot
committed
chore: sync public-v5-next with upstream v5-next
2 parents 75ffc40 + 02b0f7b commit 89a3575

22 files changed

Lines changed: 927 additions & 144 deletions
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Spartan network teardown"
2+
description: >
3+
Tear down a deployed Spartan network (delete any Chaos Mesh experiments and
4+
the Kubernetes namespace) directly on the GitHub runner. This replaces the
5+
EC2-backed `ci3.sh network-teardown` path for cleanup: teardown is pure
6+
gcloud/kubectl work, so there is no need to provision a build instance.
7+
inputs:
8+
env_file:
9+
description: "Spartan environment file name (e.g. tps-scenario), used to source CLUSTER and GCP_REGION."
10+
required: true
11+
namespace:
12+
description: "Kubernetes namespace to tear down."
13+
required: true
14+
gcp_sa_key:
15+
description: "GCP service account key JSON (secrets.GCP_SA_KEY)."
16+
required: true
17+
gcp_project_id:
18+
description: "GCP project id (secrets.GCP_PROJECT_ID)."
19+
required: true
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Setup gcloud and install GKE auth plugin
24+
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v2.1.4
25+
with:
26+
install_components: "gke-gcloud-auth-plugin"
27+
28+
- name: Tear down network
29+
shell: bash
30+
env:
31+
GCP_SA_KEY: ${{ inputs.gcp_sa_key }}
32+
GCP_PROJECT_ID: ${{ inputs.gcp_project_id }}
33+
NAMESPACE: ${{ inputs.namespace }}
34+
ENV_FILE: ${{ inputs.env_file }}
35+
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gcp-key.json
36+
CI: "1"
37+
run: |
38+
set -euo pipefail
39+
# Store the GCP service account key for gcloud auth and the teardown.
40+
set +x
41+
umask 077
42+
printf '%s' "$GCP_SA_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS"
43+
jq -e . "$GOOGLE_APPLICATION_CREDENTIALS" >/dev/null
44+
45+
cd "$(git rev-parse --show-toplevel)/spartan"
46+
# Reuse the same env + auth + teardown scripts the EC2 path runs, but
47+
# execute them directly on the runner instead of via bootstrap_ec2.
48+
source ./scripts/source_env_basic.sh
49+
source ./scripts/gcp_auth.sh
50+
source_env_basic "$ENV_FILE"
51+
gcp_auth
52+
./scripts/network_teardown.sh

.github/workflows/nightly-bench-10tps.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,12 @@ jobs:
173173
ref: ${{ needs.select-image.outputs.source_ref }}
174174

175175
- name: Cleanup network resources
176-
env:
177-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
178-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
179-
GITHUB_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
180-
BUILD_INSTANCE_SSH_KEY: ${{ secrets.BUILD_INSTANCE_SSH_KEY }}
181-
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
182-
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
183-
NO_SPOT: 1
184-
run: ./.github/ci3.sh network-teardown bench-10tps bench-10tps
176+
uses: ./.github/actions/network-teardown
177+
with:
178+
env_file: bench-10tps
179+
namespace: bench-10tps
180+
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
181+
gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
185182

186183
notify-failure:
187184
if: ${{ always() && failure() && github.event_name != 'workflow_dispatch' }}

.github/workflows/nightly-spartan-bench.yml

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,12 @@ jobs:
178178
ref: ${{ needs.select-image.outputs.source_ref }}
179179

180180
- name: Cleanup network resources
181-
env:
182-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
183-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
184-
GITHUB_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
185-
BUILD_INSTANCE_SSH_KEY: ${{ secrets.BUILD_INSTANCE_SSH_KEY }}
186-
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
187-
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
188-
NO_SPOT: 1
189-
run: ./.github/ci3.sh network-teardown tps-scenario nightly-bench
181+
uses: ./.github/actions/network-teardown
182+
with:
183+
env_file: tps-scenario
184+
namespace: nightly-bench
185+
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
186+
gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
190187

191188
notify-bench-failure:
192189
if: ${{ always() && failure() && github.event_name != 'workflow_dispatch' }}
@@ -329,15 +326,12 @@ jobs:
329326
ref: ${{ needs.select-image.outputs.source_ref }}
330327

331328
- name: Cleanup network resources
332-
env:
333-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
334-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
335-
GITHUB_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
336-
BUILD_INSTANCE_SSH_KEY: ${{ secrets.BUILD_INSTANCE_SSH_KEY }}
337-
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
338-
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
339-
NO_SPOT: 1
340-
run: ./.github/ci3.sh network-teardown prove-n-tps-fake prove-n-tps-fake
329+
uses: ./.github/actions/network-teardown
330+
with:
331+
env_file: prove-n-tps-fake
332+
namespace: prove-n-tps-fake
333+
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
334+
gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
341335

342336
notify-proving-failure:
343337
if: ${{ always() && failure() && github.event_name != 'workflow_dispatch' }}
@@ -480,15 +474,12 @@ jobs:
480474
ref: ${{ needs.select-image.outputs.source_ref }}
481475

482476
- name: Cleanup network resources
483-
env:
484-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
485-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
486-
GITHUB_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
487-
BUILD_INSTANCE_SSH_KEY: ${{ secrets.BUILD_INSTANCE_SSH_KEY }}
488-
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
489-
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
490-
NO_SPOT: 1
491-
run: ./.github/ci3.sh network-teardown block-capacity nightly-block-capacity
477+
uses: ./.github/actions/network-teardown
478+
with:
479+
env_file: block-capacity
480+
namespace: nightly-block-capacity
481+
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
482+
gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
492483

493484
notify-block-capacity-failure:
494485
if: ${{ always() && failure() && github.event_name != 'workflow_dispatch' }}

.github/workflows/test-network-scenarios.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,13 @@ jobs:
6060
6161
- name: Cleanup network resources
6262
if: always()
63-
env:
64-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
65-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
66-
GITHUB_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
67-
BUILD_INSTANCE_SSH_KEY: ${{ secrets.BUILD_INSTANCE_SSH_KEY }}
68-
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
69-
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
70-
NO_SPOT: 1
71-
run: |
72-
./.github/ci3.sh network-teardown "${{ inputs.env_file }}" "${NAMESPACE}-${{ matrix.test_set }}" || true
63+
continue-on-error: true
64+
uses: ./.github/actions/network-teardown
65+
with:
66+
env_file: ${{ inputs.env_file }}
67+
namespace: ${{ env.NAMESPACE }}-${{ matrix.test_set }}
68+
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
69+
gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
7370

7471
- name: Notify Slack and dispatch ClaudeBox on failure
7572
if: failure()

CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Do write jsdoc, rustdoc, or natspec comments for documenting public methods.
113113
Do not explain *what* the code does — well-named identifiers cover that. Comments of the form `// increment counter` / `// loop over peers` / `// return early on error` are noise and should be deleted rather than added.
114114

115115
Do not reference the current task, PR, caller, or author (`// used by X`, `// fix for issue #123`, `// AI-generated`), and do not add banner-style section comments (`// ===== HELPERS =====`). Both rot the moment the surrounding code is moved.
116+
117+
Keep comments self-contained: whatever a comment points to must be understandable from the repo alone. The repo is public but Linear issues are private, so never cite them (`// see A-1234`). Likewise do not reference an implementation plan that lives outside the repo (`// this fixes item 4`, `// tackles section C`) — describe the actual constraint or behavior instead.
116118
</writing_comments>
117119

118120
<jargon>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
name: network-deployed-version
3+
description: Determine which git commit an Aztec network (next-net, devnet, staging) is running now or was running at a past time T, and whether a specific fix or PR is live on it. Use for incident triage ("was the fix deployed when X happened?"), confirming a fix reached a network, or identifying the exact deployed commit.
4+
---
5+
6+
# Determine an Aztec network's deployed commit
7+
8+
Aztec networks deploy via **scheduled GitHub Actions workflows**. Depending on the network, the run history lives in **either** the PRIVATE repo `AztecProtocol/aztec-packages-private` **or** the PUBLIC repo `AztecProtocol/aztec-packages` — see the table below for which repo each network deploys from (`gh` needs auth with access to both). The commit a network runs at time T is the **headSha of the last *successful* deploy run at or before T** — failed runs leave the previous commit live, so a string of failed nightlies can keep a network on a days-old commit.
9+
10+
> The local working clone is usually the **public mirror** (`aztec-packages`), which has *different commits and PR numbers*. Do not infer deployed code from local `origin/next`.
11+
12+
## Run the investigation in a subagent
13+
14+
Do **not** run the `gh`/`gcloud` commands below in the main conversation — they flood context with run lists and raw file dumps for what is ultimately a one-line answer. Instead, **spawn a `general-purpose` subagent**, hand it the query parameters, and point it at this file. Relay only its condensed answer to the user.
15+
16+
Subagent prompt template (fill in the bracketed parts):
17+
18+
> Determine [which commit `next-net` was running at 2026-06-20 14:00 UTC / whether the fix from public PR #23940 is live on `devnet` now / which commit `staging` is running now]. The working directory is `yarn-project`. Read the file `.claude/skills/network-deployed-version/SKILL.md` and follow its "Procedure" steps exactly, using the "Network → deploy workflow" table to pick the right repo and workflow id.
19+
>
20+
> Return **only**: the deployed commit (full SHA + short), the deploy run id and the time it finished, whether the target fix/PR is present and the evidence you used to decide, and any relevant caveat. Do not paste raw `gh run list` output or file contents.
21+
22+
If the optional live cross-check (step 4) is needed, the subagent can itself delegate to the `network-logs` agent.
23+
24+
## Network → deploy workflow
25+
26+
| Network | Workflow | id | Repo with run history | Source | Cadence |
27+
|---|---|---|---|---|---|
28+
| next-net | Deploy Next Net | 235418088 | aztec-packages-private | `next` branch (latest nightly tag) | nightly, cron `0 6 * * *` UTC (runs typically start/finish ~07:30–08:25 UTC due to GitHub schedule lag) |
29+
| devnet | Devnet Auto-Deploy | 235418089 | aztec-packages-private | `v*-devnet-*` branch | on push to the devnet branch; that branch is created on demand by "Create Devnet" (id 235418083, `workflow_dispatch` only) from a chosen nightly tag |
30+
| staging (public) | Deploy to staging public | 244296513 | aztec-packages (PUBLIC) | `next``v5.0.0-nightly.<date>` tag | nightly, cron `0 6 * * *` UTC |
31+
| staging (internal) | Deploy to staging internal | 292462388 | aztec-packages-private | `next``v5.0.0-nightly.<date>` tag | nightly, cron `0 6 * * *` UTC |
32+
33+
> Watch the repo column. The scheduled "Deploy to staging public" run is gated to `github.repository == 'AztecProtocol/aztec-packages'`, so in the **private** repo those runs show as `skipped` — its real run history lives in the **public** `aztec-packages` repo. The other three deploy from the private repo.
34+
35+
Re-confirm ids/branches with `gh workflow list -R AztecProtocol/aztec-packages-private --all` and the YAML under `.github/workflows/`.
36+
37+
## Procedure
38+
39+
The subagent runs these steps. Use the repo from the table above for each network — private for most, public (`AztecProtocol/aztec-packages`) for staging-public — substituting it for `-R AztecProtocol/aztec-packages-private` in the commands below.
40+
41+
1. **Find the live commit at time T.** Use the repo from the table above (either private or public):
42+
```bash
43+
gh run list -R AztecProtocol/aztec-packages-private --workflow <id> --limit 20 \
44+
--json databaseId,headSha,conclusion,createdAt \
45+
--jq '.[] | "\(.createdAt) \(.conclusion) \(.headSha[0:12]) run=\(.databaseId)"'
46+
```
47+
Take the most recent line with conclusion `success` at/before T; skip `failure`/`cancelled`. Note the full headSha. Confirm it finished before the event you're investigating:
48+
```bash
49+
gh run view <run-id> -R AztecProtocol/aztec-packages-private --json startedAt,updatedAt,conclusion
50+
```
51+
52+
2. **Inspect code at that commit (no clone needed):**
53+
```bash
54+
gh api "repos/AztecProtocol/aztec-packages-private/contents/<path>?ref=<sha>" \
55+
-H "Accept: application/vnd.github.raw+json"
56+
```
57+
Read the actual file content at the ref — more reliable than commit-ancestry because fixes get ported across branches/repos with different hashes.
58+
59+
3. **Is fix X present?** Match by the *code change* or commit message, not the PR number — public and private PR numbers differ (e.g. public #23940 == private port #23975). Do not rely on commit SHA either, these may change when squashing. For an ancestry check instead:
60+
```bash
61+
gh api "repos/AztecProtocol/aztec-packages-private/compare/<base>...<head>"
62+
```
63+
and read `status` (`ahead`/`identical` ⇒ base contains head).
64+
65+
4. **(Optional) Live cross-check** via GCP Cloud Logging (project `testnet-440309`, namespace = the network name, e.g. `next-net`): grep for the bug's runtime log signature over the last ~24h; its absence while the namespace is actively logging corroborates the fix is live. This is the `network-logs` agent's domain — delegate to it for a thorough query.
66+
67+
## Caveats
68+
- A deploy run's `headSha` is the source branch tip at deploy-trigger time. Runs often finish in minutes, implying they deploy **prebuilt images** for that commit rather than building from scratch — if you need byte-level certainty, confirm the deployed image was built from that SHA.
69+
- Always check run `conclusion`; never assume "the nightly for date D" succeeded. (eg at the time of writing, staging-internal nightlies were failing for several days straight — exactly the case where the live commit is older than the latest run.)

0 commit comments

Comments
 (0)