Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/01_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ body:
label: What are the steps to reproduce this issue?
placeholder: |
1. Clone repo
2. Run `yarn compact`
2. Run `yarn compile`
3. …
4. See error
validations:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
skip-compact: "true"

- name: Format & Lint
run: yarn fmt-and-lint:ci
run: yarn lint:ci
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: ./.github/actions/setup

- name: Compile contracts
run: yarn compact
run: yarn compile

- name: Run type checks
run: yarn types
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add EcdhMask (#655)

### Changed

- Rename the contract-compilation scripts and Turbo tasks from `compact` / `compact:*` to `compile` / `compile:*`, and the Biome scripts from `fmt-and-lint` / `fmt-and-lint:*` to `lint` / `lint:*`. (#680)

## 0.3.0-alpha (2026-06-30)

### Added
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ While the prerequisites above must be satisfied prior to having your pull reques

All TypeScript code is linted with [Biomejs](https://biomejs.dev/).

Quickly fix all formatting and linting errors with the `yarn fmt-and-lint:fix` command.
Quickly fix all formatting and linting errors with the `yarn lint:fix` command.

## Opening an issue

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ git clone git@github.com:OpenZeppelin/compact-contracts.git
```bash
nvm install && \
yarn && \
yarn compact
yarn compile
```

### Run tests
Expand All @@ -226,17 +226,17 @@ yarn test
### Check/apply Biome formatter

```bash
yarn fmt-and-lint
yarn fmt-and-lint:fix
yarn lint
yarn lint:fix
```

### Advanced

#### Targeted compilation

```bash
yarn compact:access
yarn compact:archive
yarn compile:access
yarn compile:archive
...
```

Expand All @@ -246,10 +246,10 @@ ZK key generation is slow and usually unnecessary during development.

```bash
# Full compilation with skip-zk (use environment variable)
SKIP_ZK=true yarn compact
SKIP_ZK=true yarn compile

# Access compilation with skip-zk (this compiles security first as a dependency)
SKIP_ZK=true yarn compact:access
SKIP_ZK=true yarn compile:access
```

#### Clean environment
Expand Down
26 changes: 13 additions & 13 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
"#test-utils/zswap.js": "./test-utils/zswap.js"
},
"scripts": {
"compact": "compact-compiler --exclude '*/archive/*'",
"compact:access": "compact-compiler --dir access",
"compact:archive": "compact-compiler --dir archive",
"compact:crypto": "compact-compiler --dir crypto",
"compact:multisig": "compact-compiler --dir multisig",
"compact:security": "compact-compiler --dir security",
"compact:token": "compact-compiler --dir token",
"compact:utils": "compact-compiler --dir utils",
"compile": "compact-compiler --exclude '*/archive/*'",
"compile:access": "compact-compiler --dir access",
"compile:archive": "compact-compiler --dir archive",
"compile:crypto": "compact-compiler --dir crypto",
"compile:multisig": "compact-compiler --dir multisig",
"compile:security": "compact-compiler --dir security",
"compile:token": "compact-compiler --dir token",
"compile:utils": "compact-compiler --dir utils",
"build": "compact-builder --hierarchical --out dist --clean-dist --exclude '*/archive/*' --exclude 'Mock*' --exclude '*.mock.compact' --copy package.json --copy ../README.md && find dist -type d -empty -delete",
"test": "SKIP_ZK=true yarn run compact && vitest run",
"test:coverage": "SKIP_ZK=true yarn run compact && vitest run --coverage",
"test:live": "yarn run compact && MIDNIGHT_BACKEND=live vitest run --config vitest.live.config.ts",
"compact:integration": "SKIP_ZK=true compact compile test/integration/_mocks/SharedInitCollision.compact artifacts/SharedInitCollision && SKIP_ZK=true compact compile test/integration/_mocks/ComposedTokens.compact artifacts/ComposedTokens",
"test:integration": "yarn run compact:integration && vitest run --config vitest.integration.config.ts",
"test": "SKIP_ZK=true yarn run compile && vitest run",
"test:coverage": "SKIP_ZK=true yarn run compile && vitest run --coverage",
"test:live": "yarn run compile && MIDNIGHT_BACKEND=live vitest run --config vitest.live.config.ts",
"compile:integration": "SKIP_ZK=true compact compile test/integration/_mocks/SharedInitCollision.compact artifacts/SharedInitCollision && SKIP_ZK=true compact compile test/integration/_mocks/ComposedTokens.compact artifacts/ComposedTokens",
"test:integration": "yarn run compile:integration && vitest run --config vitest.integration.config.ts",
"types": "tsc -p tsconfig.json --noEmit",
"clean": "git clean -fXd"
},
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
"packages/*"
],
"scripts": {
"compact": "turbo run compact --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compact:access": "turbo run compact:access --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compact:archive": "turbo run compact:archive --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compact:crypto": "turbo run compact:crypto --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compact:security": "turbo run compact:security --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compact:token": "turbo run compact:token --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compact:utils": "turbo run compact:utils --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile": "turbo run compile --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:access": "turbo run compile:access --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:archive": "turbo run compile:archive --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:crypto": "turbo run compile:crypto --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:multisig": "turbo run compile:multisig --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:security": "turbo run compile:security --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:token": "turbo run compile:token --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:utils": "turbo run compile:utils --filter=@openzeppelin/compact-contracts --log-prefix=none",
Comment on lines +11 to +18

@coderabbitai coderabbitai Bot Jul 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Expose compile:multisig at the workspace root.

contracts/package.json and turbo.json define this task, but yarn compile:multisig currently fails because Line 11-17 omits its root wrapper.

Proposed fix
     "compile:crypto": "turbo run compile:crypto --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
+    "compile:multisig": "turbo run compile:multisig --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
     "compile:security": "turbo run compile:security --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"compile": "turbo run compile --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:access": "turbo run compile:access --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:archive": "turbo run compile:archive --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:crypto": "turbo run compile:crypto --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:security": "turbo run compile:security --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:token": "turbo run compile:token --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile:utils": "turbo run compile:utils --filter=@openzeppelin/compact-contracts --log-prefix=none",
"compile": "turbo run compile --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
"compile:access": "turbo run compile:access --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
"compile:archive": "turbo run compile:archive --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
"compile:crypto": "turbo run compile:crypto --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
"compile:multisig": "turbo run compile:multisig --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
"compile:security": "turbo run compile:security --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
"compile:token": "turbo run compile:token --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
"compile:utils": "turbo run compile:utils --filter=`@openzeppelin/compact-contracts` --log-prefix=none",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 11 - 17, Add a root-level compile:multisig script
alongside the existing compile:access, compile:archive, and other compile
wrappers, invoking the matching Turbo task with the
`@openzeppelin/compact-contracts` filter and log-prefix setting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't fail bc of how yarn 4 resolves. From yarn's docs for yarn run:

...if the specified name contains a colon character and if one of the workspaces in the project contains exactly one script with a matching name, then this script will get executed.

That said, we should still include a wrapper for multisig

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrew-fleming, good catch — thanks for the clarification on Yarn 4's colon-resolution fallback. That explains why yarn compile:multisig doesn't hard-fail today. Agreed that adding the explicit root wrapper for compile:multisig is still worthwhile for consistency with the other compile:* scripts and to avoid relying on the implicit workspace fallback.


✏️ Learnings added
Learnt from: andrew-fleming
Repo: OpenZeppelin/compact-contracts PR: 680
File: package.json:11-17
Timestamp: 2026-07-15T16:22:24.718Z
Learning: In this repository (OpenZeppelin compact-contracts), Yarn 4 resolves `yarn run <name>` for scripts containing a colon by falling back to a workspace script if exactly one workspace defines a script with that matching name, even if no root-level script wrapper exists. This is documented Yarn behavior, not a bug, but the project still adds explicit root-level wrapper scripts (e.g., in package.json `scripts`) for each `compile:*` task for consistency.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

"build": "turbo run build --log-prefix=none",
"test": "turbo run test --filter=@openzeppelin/compact-contracts --log-prefix=none",
"fmt-and-lint": "biome check .",
"fmt-and-lint:fix": "biome check . --write",
"fmt-and-lint:ci": "biome ci . --no-errors-on-unmatched",
"lint": "biome check .",
"lint:fix": "biome check . --write",
"lint:ci": "biome ci . --no-errors-on-unmatched",
"types": "turbo run types",
"clean": "turbo run clean"
},
Expand Down
44 changes: 22 additions & 22 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
{
"$schema": "https://turbo.build/schema.json",
"tasks": {
"compact:crypto": {
"compile:crypto": {
"dependsOn": ["^build"],
"env": ["COMPACT_HOME", "SKIP_ZK"],
"inputs": ["src/crypto/**/*.compact"],
"outputLogs": "new-only",
"outputs": ["artifacts/**/"]
},
"compact:security": {
"compile:security": {
"dependsOn": ["^build"],
"env": ["COMPACT_HOME", "SKIP_ZK"],
"inputs": ["src/security/**/*.compact"],
"outputLogs": "new-only",
"outputs": ["artifacts/**/"]
},
"compact:utils": {
"compile:utils": {
"dependsOn": ["^build"],
"env": ["COMPACT_HOME", "SKIP_ZK"],
"inputs": ["src/utils/**/*.compact"],
"outputLogs": "new-only",
"outputs": ["artifacts/**/"]
},
"compact:access": {
"dependsOn": ["^build", "compact:utils"],
"compile:access": {
"dependsOn": ["^build", "compile:utils"],
"env": ["COMPACT_HOME", "SKIP_ZK"],
"inputs": ["src/access/**/*.compact"],
"outputLogs": "new-only",
"outputs": ["artifacts/**/"]
},
"compact:archive": {
"dependsOn": ["^build", "compact:utils"],
"compile:archive": {
"dependsOn": ["^build", "compile:utils"],
"env": ["COMPACT_HOME", "SKIP_ZK"],
"inputs": ["src/archive/**/*.compact"],
"outputLogs": "new-only",
"outputs": ["artifacts/**/"]
},
"compact:multisig": {
"dependsOn": ["^build", "compact:utils"],
"compile:multisig": {
"dependsOn": ["^build", "compile:utils"],
"env": ["COMPACT_HOME", "SKIP_ZK"],
"inputs": ["src/multisig/**/*.compact"],
"outputLogs": "new-only",
"outputs": ["artifacts/**/"]
},
"compact:token": {
"dependsOn": ["^build", "compact:utils"],
"compile:token": {
"dependsOn": ["^build", "compile:utils"],
"env": ["COMPACT_HOME", "SKIP_ZK"],
"inputs": ["src/token/**/*.compact"],
"outputLogs": "new-only",
"outputs": ["artifacts/**/"]
},
"compact": {
"compile": {
"dependsOn": [
"compact:crypto",
"compact:security",
"compact:utils",
"compact:access",
"compact:multisig",
"compact:token"
"compile:crypto",
"compile:security",
"compile:utils",
"compile:access",
"compile:multisig",
"compile:token"
],
"env": ["COMPACT_HOME", "SKIP_ZK"],
"inputs": ["src/**/*.compact", "test/**/*.compact"],
Expand Down Expand Up @@ -89,13 +89,13 @@
"outputs": ["dist/**"]
},
"types": {
"dependsOn": ["@openzeppelin/compact-contracts#compact"],
"dependsOn": ["@openzeppelin/compact-contracts#compile"],
"outputs": [],
"cache": false
},
"//#fmt-and-lint": {},
"//#fmt-and-lint:ci": {},
"//#fmt-and-lint:fix": {
"//#lint": {},
"//#lint:ci": {},
"//#lint:fix": {
"cache": false
},
"clean": {
Expand Down