Skip to content

Commit 8e58858

Browse files
committed
Merge remote-tracking branch 'origin/next' into docs/define-atp-atv-staking-tokens
2 parents 4f96aeb + 8374744 commit 8e58858

3,774 files changed

Lines changed: 149764 additions & 47459 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.

.claude/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# `.claude/`
2+
3+
Project-level Claude Code configuration for aztec-packages. This file documents layout decisions; the filesystem describes the contents.
4+
5+
## Layout rules
6+
7+
1. Universal content lives at repository root: `CLAUDE.md`, `.claude/agents/`, `.claude/scripts/`, and the root `settings.json` hooks.
8+
2. Subdirectory `.claude/` directories hold only component-specific skills, permission allowlists, and settings. Content is not merged upward.
9+
3. A subdirectory that has its own `.claude/` must symlink `agents/` to the repository root's `.claude/agents/`. Claude Code's ancestor walk stops at the nearest `.claude/` and does not merge ancestors, so subdirectories otherwise shadow the root agents. Subdirectories without their own `.claude/` inherit the root automatically. `skills/` is intentionally *not* symlinked — skills are scoped to their subdir (root skills are repo-wide workflows; `yarn-project/.claude/skills/` are TS-specific; etc.).
10+
4. Tracked `.codex` symlinks point at the nearest `.claude/` directory. Keep `.claude/` canonical and do not duplicate agent or skill indexes in `AGENTS.md`.
11+
5. Prefer XML-tagged sections inside `CLAUDE.md` for prose guidance. A `.claude/rules/` directory is only warranted when a rule needs YAML frontmatter (e.g. path-scoped `paths:` metadata) that `CLAUDE.md` cannot express. `.claude/rules/` without frontmatter does not auto-load when Claude Code is started from a subdirectory, so plain rules files are strictly worse than inlining into `CLAUDE.md`.
12+
13+
## Tests
14+
15+
`tests/format_file_test` exercises each dispatch branch: hygiene (malformed hook input), C++, Rust, Solidity, TypeScript with plugin. Invocation via `./.claude/bootstrap.sh test_cmds` follows the same convention as `ci3/bootstrap.sh`.
16+
17+
## Adding new files
18+
19+
- A new agent used repository-wide: `.claude/agents/` at root.
20+
- A new skill scoped to one component: `component/.claude/skills/`.
21+
- A new hook: add a script to `.claude/scripts/`, register it in `.claude/settings.json` via `git rev-parse --show-toplevel` so the path resolves from any cwd, and add a test in `.claude/tests/`. You need to add it to each subdirectory where you want the hook active.
22+
- A new `.claude/` subdirectory: symlink `agents/` back to the repository root's `.claude/agents/`.

.claude/agents/retrospective.md

Lines changed: 0 additions & 179 deletions
This file was deleted.

.claude/bootstrap.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
# Bootstrap + test entry for the .claude/ tooling directory. Mirrors the shape
3+
# used by ci3/bootstrap.sh: emits test commands via `test_cmds`, runs them via
4+
# `test`. Keeps hook scripts and their tests as a self-contained component.
5+
source $(git rev-parse --show-toplevel)/ci3/source_bootstrap
6+
7+
hash=$(cache_content_hash ^.claude)
8+
9+
function test_cmds {
10+
# source_base cd's us into .claude/, so glob relative-to-here, but emit paths
11+
# relative to the git root (same convention used by ci3/bootstrap.sh).
12+
for f in tests/*; do
13+
[[ -x "$f" ]] || continue
14+
echo "$hash ./.claude/$f"
15+
done
16+
}
17+
18+
function test {
19+
echo_header ".claude tests"
20+
test_cmds | filter_test_cmds | parallelize
21+
}
22+
23+
case "$cmd" in
24+
"")
25+
test
26+
;;
27+
*)
28+
default_cmd_handler "$@"
29+
;;
30+
esac

.claude/scripts/format-file.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
# PostToolUse hook: format files after Edit/Write by dispatching to the right
3+
# formatter based on extension. Reads Claude Code's hook JSON from stdin.
4+
#
5+
# Never fails the edit — prints hints to stderr on missing tools and exits 0.
6+
7+
set -u
8+
9+
input=$(cat)
10+
file=$(printf '%s' "$input" | jq -r '.tool_input.file_path // empty')
11+
12+
[[ -z "$file" ]] && exit 0
13+
[[ ! -f "$file" ]] && exit 0
14+
15+
hint() { printf 'format-file.sh: %s\n' "$*" >&2; }
16+
17+
case "$file" in
18+
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.json)
19+
root=""
20+
if [[ -n "${CLAUDE_PROJECT_DIR:-}" ]] && [[ -f "$CLAUDE_PROJECT_DIR/yarn-project/package.json" ]]; then
21+
root="$CLAUDE_PROJECT_DIR"
22+
else
23+
root=$(git -C "$(dirname "$file")" rev-parse --show-toplevel 2>/dev/null || true)
24+
fi
25+
if [[ -n "$root" && -x "$root/yarn-project/node_modules/.bin/prettier" ]]; then
26+
"$root/yarn-project/node_modules/.bin/prettier" --write --log-level=warn "$file" \
27+
|| hint "prettier failed on $file"
28+
else
29+
hint "prettier not found — run yarn-project bootstrap to enable format-on-edit"
30+
fi
31+
;;
32+
*.cpp|*.cxx|*.cc|*.hpp|*.hxx|*.h)
33+
cf=""
34+
if command -v clang-format-20 >/dev/null 2>&1; then
35+
cf=clang-format-20
36+
elif [[ -x /opt/homebrew/opt/llvm/bin/clang-format ]] && /opt/homebrew/opt/llvm/bin/clang-format --version 2>/dev/null | grep -q 'version 20'; then
37+
cf=/opt/homebrew/opt/llvm/bin/clang-format
38+
elif [[ -x /usr/local/opt/llvm/bin/clang-format ]] && /usr/local/opt/llvm/bin/clang-format --version 2>/dev/null | grep -q 'version 20'; then
39+
cf=/usr/local/opt/llvm/bin/clang-format
40+
fi
41+
if [[ -n "$cf" ]]; then
42+
"$cf" -i "$file" || hint "$cf failed on $file"
43+
else
44+
hint "clang-format 20 not found — install via 'apt install clang-format-20' (Linux) or 'brew install llvm' (macOS)"
45+
fi
46+
;;
47+
*.rs)
48+
# rustfmt walks up from the file path to find .rustfmt.toml, which pins
49+
# edition and style. Don't pass --edition here; it would override that.
50+
if command -v rustfmt >/dev/null 2>&1; then
51+
rustfmt "$file" || hint "rustfmt failed on $file"
52+
else
53+
hint "rustfmt not found — install via 'rustup component add rustfmt'"
54+
fi
55+
;;
56+
*.sol)
57+
if command -v forge >/dev/null 2>&1; then
58+
(cd "$(dirname "$file")" && forge fmt "$file") || hint "forge fmt failed on $file"
59+
else
60+
hint "forge not found — install foundry via 'curl -L https://foundry.paradigm.xyz | bash && foundryup'"
61+
fi
62+
;;
63+
*.nr)
64+
# nargo fmt operates on whole crates, not individual files.
65+
hint "nargo fmt is crate-scoped — run 'nargo fmt' from the noir project directory before committing"
66+
;;
67+
esac
68+
69+
exit 0

.claude/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@
1010
}
1111
]
1212
}
13+
],
14+
"PostToolUse": [
15+
{
16+
"matcher": "Edit|Write|MultiEdit",
17+
"hooks": [
18+
{
19+
"type": "command",
20+
"command": "bash -c 'GITROOT=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0; [ -n \"$GITROOT\" ] && exec \"$GITROOT/.claude/scripts/format-file.sh\"; exit 0'"
21+
}
22+
]
23+
}
1324
]
1425
}
1526
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: chonk-inputs
3+
description: Manage pinned Chonk IVC inputs and the Chonk/rollup UltraHonk proving checks. Use when updating, testing, benchmarking, or reviewing the CI flow for Chonk input refreshes.
4+
argument-hint: <action> e.g. "download", "check", "refresh-pr", "benchmark", "ultrahonk"
5+
---
6+
7+
# Chonk Inputs
8+
9+
Pinned Chonk IVC inputs live in an S3 tarball keyed by `barretenberg/cpp/scripts/chonk-inputs.hash`. The owner scripts are:
10+
11+
- `barretenberg/cpp/scripts/pinned_chonk_inputs.sh` for shared shell helpers.
12+
- `barretenberg/cpp/scripts/chonk_inputs.sh` for download, check, and update.
13+
- `barretenberg/cpp/scripts/ci_update_chonk_inputs.sh` for the PR push-back step.
14+
15+
Use the scripts instead of open-coding URLs, hashes, temp paths, or bucket listings.
16+
17+
## Common Commands
18+
19+
Download or repair the local fixture directory:
20+
21+
```bash
22+
barretenberg/cpp/scripts/chonk_inputs.sh download
23+
```
24+
25+
Check pinned VK compatibility without updating:
26+
27+
```bash
28+
barretenberg/cpp/scripts/chonk_inputs.sh check
29+
```
30+
31+
Refresh the pin locally:
32+
33+
```bash
34+
barretenberg/cpp/scripts/chonk_inputs.sh update
35+
```
36+
37+
In PR CI, refresh via the `ci-refresh-chonk` label or a `--ci-refresh-chonk` head-commit marker. The follow-up refresh commit includes `--ci-skip`.
38+
Proving is handled by the pinned-input tests; the CI push-back step runs one small pinned flow before committing a refreshed hash.
39+
40+
## Benchmark and Proving Checks
41+
42+
Barretenberg owns the Chonk and rollup UltraHonk benchmark commands. Use `barretenberg/cpp/bootstrap.sh bench_cmds` to inspect the CI command list, or `bench_ivc` for a focused Chonk run.
43+
44+
The benchmark scripts restore or regenerate their inputs when missing:
45+
46+
```bash
47+
barretenberg/cpp/scripts/chonk_inputs.sh download
48+
barretenberg/cpp/scripts/ci_benchmark_ivc_flows.sh native
49+
50+
barretenberg/cpp/scripts/ci_benchmark_ultrahonk_circuits.sh parity_base \
51+
../../yarn-project/end-to-end/ultrahonk-bench-inputs 8
52+
```
53+
54+
Keep Chonk benchmark command enumeration in barretenberg; `yarn-project/end-to-end/bootstrap.sh build_bench_capture` is only for live input capture during pin refresh.
55+
56+
## Review Checklist
57+
58+
- Do not use `aws s3 ls` or depend on bucket listing. Verify exact object URLs.
59+
- Use `.cache/` for scratch state and clean job-specific subdirectories.
60+
- Keep refresh commits scoped to `barretenberg/cpp/scripts/chonk-inputs.hash`.
61+
- Run `bash -n` on edited shell scripts and `yq e . .github/workflows/ci3.yml` after workflow edits.
62+
- For update-step changes, run `.cache/chonk-ux-harness/run.sh` when available.

.claude/skills/merge-train-infra/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The merge-train system is fully automated via GitHub Actions in `.github/workflo
1313

1414
1. **PR Creation** (`merge-train-create-pr.yml`): Triggered on push to `merge-train/*` branches. Creates a PR targeting `next` with the `ci-no-squash` label (and `ci-full-no-test-cache` for spartan). Skips merge commits and commits already in `next`.
1515

16-
2. **Body Updates** (`merge-train-update-pr-body.yml`): Triggered on push to `merge-train/**` and `backport-to-*-staging` branches. Updates the PR body with meaningful commits (those containing PR references like `(#1234)`). The body uses `BEGIN_COMMIT_OVERRIDE` / `END_COMMIT_OVERRIDE` markers for release-please. Backport staging PRs also call `update-pr-body.sh` inline from `scripts/backport_to_staging.sh` to handle the first-push case (where the PR doesn't exist yet when the workflow fires).
16+
2. **Body Updates** (`merge-train-update-pr-body.yml`): Triggered on push to `merge-train/**` and `backport-to-*-staging` branches. Updates the PR body with meaningful commits (those containing PR references like `(#1234)`). The body wraps the commit list in `BEGIN_COMMIT_OVERRIDE` / `END_COMMIT_OVERRIDE` markers. Backport staging PRs also call `update-pr-body.sh` inline from `scripts/backport_to_staging.sh` to handle the first-push case (where the PR doesn't exist yet when the workflow fires).
1717

1818
3. **Next Integration** (`merge-train-next-to-branches.yml`): Triggered on push to `next`. Merges `next` into each active merge-train branch via `scripts/merge-train/merge-next.sh`. Uses `continue-on-error: true` so a conflict in one branch does not block others. Skips branches whose PR already has auto-merge enabled.
1919

0 commit comments

Comments
 (0)