build: upgrade Compact toolchain to 0.31.0 and Midnight packages - #597
Conversation
WalkthroughBumps the Compact compiler toolchain from ChangesCompact 0.31.0 Toolchain Upgrade
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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).
1b33d6c to
10f8330
Compare
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
yarn.lockis 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.ymlCHANGELOG.mdcontracts/package.jsoncontracts/src/archive/test/utils/address.tscontracts/test-utils/address.tspackage.json
|
|
||
| ### 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`. |
There was a problem hiding this comment.
Document the compact-runtime dependency relocation.
The CHANGELOG entry lists the version bump for @midnight-ntwrk/compact-runtime (0.14.0 → 0.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.
| - 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.
| }, | ||
| "dependencies": { | ||
| "@midnight-ntwrk/compact-runtime": "0.14.0" | ||
| "@midnight-ntwrk/compact-runtime": "0.16.0" |
There was a problem hiding this comment.
🧩 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 -5Repository: 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.
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).
Types of changes
fixes #400 — deliberate toolchain/dependency upgrade for the
0.3.0cycle.Upgrades the Compact toolchain and all Midnight packages to their current versions:
0.29.00.31.0@midnight-ntwrk/compact-runtime0.14.00.16.0@midnight-ntwrk/ledger-v77.0.3@midnight-ntwrk/ledger-v88.1.0@openzeppelin/compact-simulator^0.0.1^0.1.0Dockerfile,devcontainer.json), thesetupcomposite action, thereleaseworkflow, and the bug-report template default.ledger-v7→ledger-v8is a package rename; the twoencodeContractAddressimports (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.0is unchanged —0.31.0accepts it, so no per-contract edits were needed.Validation
0.31.0.tsc --noEmitis clean againstcompact-runtime@0.16.0/ledger-v8@8.1.0.Dependency on #594
Based on
post-release. Until #594 (post-release → main) merges, the diff againstmainshows the multisig suite plus this upgrade; once #594 lands it collapses to the toolchain upgrade only (rebase ontomain). Merge #594 first.PR Checklist
Further comments
Verified end-to-end locally (compile + typecheck + full suite) before opening. The
ledger-v7 → ledger-v8andcompact-runtime 0.14 → 0.16bumps 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
Chores