Skip to content

build: upgrade Compact toolchain to 0.31.0 and Midnight packages - #597

Merged
0xisk merged 1 commit into
mainfrom
chore/upgrade-compact-0.31.0
Jun 15, 2026
Merged

build: upgrade Compact toolchain to 0.31.0 and Midnight packages#597
0xisk merged 1 commit into
mainfrom
chore/upgrade-compact-0.31.0

Conversation

@0xisk

@0xisk 0xisk commented Jun 15, 2026

Copy link
Copy Markdown
Member

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

fixes #400 — deliberate toolchain/dependency upgrade for the 0.3.0 cycle.

Upgrades the Compact toolchain and all Midnight packages to their current versions:

Package From To
Compact compiler 0.29.0 0.31.0
@midnight-ntwrk/compact-runtime 0.14.0 0.16.0
@midnight-ntwrk/ledger-v7 7.0.3 @midnight-ntwrk/ledger-v8 8.1.0
@openzeppelin/compact-simulator ^0.0.1 ^0.1.0
  • Compiler pin updated in the devcontainer (Dockerfile, devcontainer.json), the setup composite action, the release workflow, and the bug-report template default.
  • ledger-v7ledger-v8 is a package rename; the two encodeContractAddress imports (contracts/test-utils/address.ts, contracts/src/archive/test/utils/address.ts) were updated.
  • @midnight-ntwrk/zswap (^4.0.0) and @openzeppelin/compact-cli (^0.0.2) are already at their latest.
  • pragma language_version >= 0.21.0 is unchanged — 0.31.0 accepts it, so no per-contract edits were needed.

Validation

  • All 41 contracts compile on 0.31.0.
  • tsc --noEmit is clean against compact-runtime@0.16.0 / ledger-v8@8.1.0.
  • Full vitest suite passes: 1156 tests across 27 files.

Dependency on #594

Based on post-release. Until #594 (post-release → main) merges, the diff against main shows the multisig suite plus this upgrade; once #594 lands it collapses to the toolchain upgrade only (rebase onto main). Merge #594 first.

Note: v0.1.0 / v0.2.0 pinned the audited toolchain (0.29.0 / 0.14.0 / ledger-v7). This PR intentionally moves the 0.3.0 line to the current toolchain; released contracts will run on the new toolchain pending any re-audit.

PR Checklist

  • I have read the Contributing Guide
  • I have added tests that prove my fix is effective or that my feature works. — N/A: no behavior change; the existing suite (1156 tests) passes on the new toolchain.
  • I have added documentation for new methods or changes to existing method behavior. — CHANGELOG updated.
  • CI Workflows Are Passing — pending first run.

Further comments

Verified end-to-end locally (compile + typecheck + full suite) before opening. The ledger-v7 → ledger-v8 and compact-runtime 0.14 → 0.16 bumps are API-compatible for the surface this repo uses (encodeContractAddress, WitnessContext, MerkleTreePath, CoinInfo/TokenType, sampleContractAddress), so no code changes beyond the two import paths were required.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added multisig contract suite with configurable signer management, proposal handling, treasury operations, and customizable forwarder modules with per-recipient presets.
    • Note: signature verification is currently stubbed pending cryptographic enhancements.
  • Chores

    • Upgraded Compact compiler to version 0.31.0 and supporting toolchain dependencies for improved compatibility.

@0xisk
0xisk requested review from a team as code owners June 15, 2026 14:48
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Bumps the Compact compiler toolchain from 0.29.0 to 0.31.0 across the devcontainer Dockerfile, devcontainer.json, the reusable CI setup action, the release workflow, and the bug-report issue template. Upgrades @midnight-ntwrk/compact-runtime to 0.16.0, replaces ledger-v7@7.0.3 with ledger-v8@8.1.0, bumps @openzeppelin/compact-simulator to ^0.1.0, and updates encodeContractAddress imports in two test-utility files.

Changes

Compact 0.31.0 Toolchain Upgrade

Layer / File(s) Summary
Compiler version bump across devcontainer, CI, and issue template
.devcontainer/Dockerfile, .devcontainer/devcontainer.json, .github/actions/setup/action.yml, .github/workflows/release.yml, .github/ISSUE_TEMPLATE/01_bug_report.yml
All references to the Compact compiler version are updated from 0.29.0 to 0.31.0, including the Docker build arg default, the postCreateCommand, the reusable setup action input, the release workflow step, and the bug-report dropdown (which also adds 0.30.0 as a listed option).
Package dependency upgrades and ledger-v8 import updates
package.json, contracts/package.json, contracts/test-utils/address.ts, contracts/src/archive/test/utils/address.ts, CHANGELOG.md
@midnight-ntwrk/compact-runtime is promoted from devDependencies to dependencies at 0.16.0; ledger-v7@7.0.3 is replaced by ledger-v8@8.1.0 in root devDependencies; @openzeppelin/compact-simulator is bumped to ^0.1.0; encodeContractAddress imports in both test-utility address files are updated to @midnight-ntwrk/ledger-v8; CHANGELOG records all version changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • andrew-fleming

Poem

🐇 Hop, hop, hooray, the toolchain grew!
From twenty-nine to thirty-one, brand new!
The ledger jumped from v7 to v8,
The runtime bumped — oh, isn't this great?
A little version dance across each file,
This bunny compiled it all with style! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective: upgrading the Compact toolchain to 0.31.0 and associated Midnight packages, which is reflected across all modified configuration files and dependencies.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/upgrade-compact-0.31.0

Comment @coderabbitai help to get the list of available commands and usage tips.

Bump the compiler 0.29.0 -> 0.31.0 (devcontainer, setup action, release
workflow, bug-report template default) and the Midnight packages:

* @midnight-ntwrk/compact-runtime 0.14.0 -> 0.16.0
* @midnight-ntwrk/ledger-v7 7.0.3 -> @midnight-ntwrk/ledger-v8 8.1.0
  (package rename; the two test-util imports of encodeContractAddress
  updated accordingly)
* @openzeppelin/compact-simulator ^0.0.1 -> ^0.1.0

zswap (^4.0.0) and compact-cli (^0.0.2) are already at their latest.
`pragma language_version >= 0.21.0` is unchanged (0.31.0 accepts it).

Verified locally: all 41 contracts compile on 0.31.0, tsc --noEmit is
clean, and the full vitest suite passes (1156 tests, 27 files).
@0xisk
0xisk force-pushed the chore/upgrade-compact-0.31.0 branch from 1b33d6c to 10f8330 Compare June 15, 2026 14:56
@0xisk 0xisk linked an issue Jun 15, 2026 that may be closed by this pull request
@0xisk
0xisk enabled auto-merge (squash) June 15, 2026 15:00
@0xisk
0xisk disabled auto-merge June 15, 2026 15:00

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🤖 Prompt for all review comments with 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.

Inline comments:
In `@CHANGELOG.md`:
- Line 16: The CHANGELOG.md entry documents the version upgrade for
`@midnight-ntwrk/compact-runtime` but fails to mention that this dependency was
relocated from devDependencies to dependencies in package.json. Update the
CHANGELOG entry to explicitly document this relocation alongside the version
bump, as this change significantly impacts consumers' production dependency
trees and should be transparently communicated.

In `@package.json`:
- Line 30: The package `@midnight-ntwrk/compact-runtime` is only used in test
files and test utilities, not in production code, so it should remain in
devDependencies rather than dependencies. Move the
`@midnight-ntwrk/compact-runtime` entry with version 0.16.0 from the dependencies
section back to the devDependencies section in package.json to avoid
unnecessarily expanding the bundle for consumers of the library.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 23269d31-0b5d-41a6-a3cc-c8de0bbe60fe

📥 Commits

Reviewing files that changed from the base of the PR and between 9e76742 and 10f8330.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (10)
  • .devcontainer/Dockerfile
  • .devcontainer/devcontainer.json
  • .github/ISSUE_TEMPLATE/01_bug_report.yml
  • .github/actions/setup/action.yml
  • .github/workflows/release.yml
  • CHANGELOG.md
  • contracts/package.json
  • contracts/src/archive/test/utils/address.ts
  • contracts/test-utils/address.ts
  • package.json

Comment thread CHANGELOG.md

### Changed

- Upgrade the Compact toolchain and Midnight dependencies: compiler `0.29.0` → `0.31.0`, `@midnight-ntwrk/compact-runtime` `0.14.0` → `0.16.0`, `@midnight-ntwrk/ledger-v7` `7.0.3` → `@midnight-ntwrk/ledger-v8` `8.1.0`, and `@openzeppelin/compact-simulator` `^0.0.1` → `^0.1.0`.

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Document the compact-runtime dependency relocation.

The CHANGELOG entry lists the version bump for @midnight-ntwrk/compact-runtime (0.14.00.16.0) but does not mention that it was also moved from devDependencies to dependencies in package.json. This relocation affects consumers' production dependency trees and should be explicitly documented for transparency.

📝 Suggested addition
-Upgrade the Compact toolchain and Midnight dependencies: compiler `0.29.0` → `0.31.0`, `@midnight-ntwrk/compact-runtime` `0.14.0` → `0.16.0`, `@midnight-ntwrk/ledger-v7` `7.0.3` → `@midnight-ntwrk/ledger-v8` `8.1.0`, and `@openzeppelin/compact-simulator` `^0.0.1` → `^0.1.0`.
+Upgrade the Compact toolchain and Midnight dependencies: compiler `0.29.0` → `0.31.0`, `@midnight-ntwrk/compact-runtime` `0.14.0` → `0.16.0` (moved from `devDependencies` to `dependencies`), `@midnight-ntwrk/ledger-v7` `7.0.3` → `@midnight-ntwrk/ledger-v8` `8.1.0`, and `@openzeppelin/compact-simulator` `^0.0.1` → `^0.1.0`.
📝 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
- Upgrade the Compact toolchain and Midnight dependencies: compiler `0.29.0``0.31.0`, `@midnight-ntwrk/compact-runtime` `0.14.0``0.16.0`, `@midnight-ntwrk/ledger-v7` `7.0.3``@midnight-ntwrk/ledger-v8` `8.1.0`, and `@openzeppelin/compact-simulator` `^0.0.1``^0.1.0`.
- Upgrade the Compact toolchain and Midnight dependencies: compiler `0.29.0``0.31.0`, `@midnight-ntwrk/compact-runtime` `0.14.0``0.16.0` (moved from `devDependencies` to `dependencies`), `@midnight-ntwrk/ledger-v7` `7.0.3``@midnight-ntwrk/ledger-v8` `8.1.0`, and `@openzeppelin/compact-simulator` `^0.0.1``^0.1.0`.
🤖 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 `@CHANGELOG.md` at line 16, The CHANGELOG.md entry documents the version
upgrade for `@midnight-ntwrk/compact-runtime` but fails to mention that this
dependency was relocated from devDependencies to dependencies in package.json.
Update the CHANGELOG entry to explicitly document this relocation alongside the
version bump, as this change significantly impacts consumers' production
dependency trees and should be transparently communicated.

Comment thread package.json
},
"dependencies": {
"@midnight-ntwrk/compact-runtime": "0.14.0"
"@midnight-ntwrk/compact-runtime": "0.16.0"

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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify compact-runtime usage in production vs test code

echo "=== Searching for compact-runtime imports in production source files (excluding tests/dev) ==="
rg -n --type=ts --type=js '`@midnight-ntwrk/compact-runtime`' \
  -g '!**/*.test.*' \
  -g '!**/*.spec.*' \
  -g '!**/test/**' \
  -g '!**/tests/**' \
  -g '!**/__tests__/**' \
  -g '!**/test-utils/**' \
  contracts/src/ contracts/dist/ 2>/dev/null || echo "No production imports found"

echo ""
echo "=== Comparing with test/dev file imports ==="
rg -l --type=ts --type=js '`@midnight-ntwrk/compact-runtime`' \
  -g '**/*.test.*' \
  -g '**/*.spec.*' \
  -g '**/test/**' \
  -g '**/test-utils/**' \
  contracts/ 2>/dev/null | head -5

Repository: OpenZeppelin/compact-contracts

Length of output: 532


Revert compact-runtime to devDependencies.

@midnight-ntwrk/compact-runtime is used exclusively in test files and test utilities (contracts/test-utils/, src/token/test/), not in production code. Moving it to dependencies unnecessarily expands the bundle for consumers. It should remain in devDependencies.

🤖 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` at line 30, The package `@midnight-ntwrk/compact-runtime` is only
used in test files and test utilities, not in production code, so it should
remain in devDependencies rather than dependencies. Move the
`@midnight-ntwrk/compact-runtime` entry with version 0.16.0 from the dependencies
section back to the devDependencies section in package.json to avoid
unnecessarily expanding the bundle for consumers of the library.

@0xisk
0xisk merged commit 336a622 into main Jun 15, 2026
9 checks passed
@0xisk
0xisk deleted the chore/upgrade-compact-0.31.0 branch June 15, 2026 15:19
0xisk added a commit that referenced this pull request Jun 15, 2026
Compiler 0.31.0 ships Compact language version 0.23.0. Raise the
`pragma language_version` floor >= 0.21.0 -> >= 0.23.0 across all 47
.compact files so the declared minimum matches the toolchain.

Depends on the toolchain upgrade in #597 (compiler 0.31.0). Verified:
all contracts compile on 0.31.0 and the full vitest suite passes
(1156 tests, 27 files).
@coderabbitai coderabbitai Bot mentioned this pull request Jun 30, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade Contracts to 0.31.0

2 participants