Repository navigation
feat(deployer): add compact.toml patterns and per-deploy options - #193
Conversation
compact-contracts main already runs rc.5. With rc.3 pinned here, a consumer's resolution overrides the pin anyway, so the deployer would run on a ledger it was never tested against.
The 0.2.0 release shipped the fragmented deploy (#174), but its entries stayed under Unreleased and would have been published again as 0.3.0 changes.
A key with glob characters matches the contract name, and a key with "/" matches its .compact path under the new [profile].src_dir. Matching patterns apply in file order and the exact entry applies last, so one table can cover every test mock in a repo.
A test harness deploys once per test from parallel workers, with private state and witnesses built in code. initialPrivateState and witnesses override the TOML entry, and record: false skips the deployments ledger and its lock. Failure messages under record: false name the address and txIds instead of a record to resume from.
With no budget set, a later deploy of the same artifact on the same network starts at the size an earlier halving in the process settled on, so only the first deploy pays for the refused attempt. The size lives in memory; a pinned budget and a resume ignore it.
The spec has its own compact.toml with a pinned budget, so no halving here can reach fragmented.spec.ts through the remembered size: the suite runs every spec in one process.
Known issue 7 now records that one forced compact-runtime copy deploys: compact-contracts pins 0.19.0 and its live harness deployed a 24-circuit mock through the split path on that tree.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (30)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. WalkthroughThe deployer adds patterned contract configuration, in-code private state and witness options, a mode that disables deployment-ledger access, and reuse of fragment sizes reached through halving. The package also updates its Ledger v9 resolution and adds tests, integration coverage, and documentation for these changes. ChangesDeployer configuration and deployment
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~50 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Caller
participant runDeploy
participant DeployerPrepare as Deployer.prepare
participant ArtifactLoad as Artifact.load
participant StateLoad as InitialPrivateState.load
Caller->>runDeploy: initialPrivateState and witnesses options
runDeploy->>DeployerPrepare: forward deployment options
DeployerPrepare->>ArtifactLoad: load in-code witnesses
DeployerPrepare->>StateLoad: load in-code initial state
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is established for this change; it is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 24 files. (6 skipped: 6 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
A rabbit checks the pattern keys, Comment |
| "@midnight-ntwrk/midnight-js-utils": "5.0.0-beta.7", | ||
| "@midnight-ntwrk/testkit-js": "5.0.0-beta.7", | ||
| "@midnightntwrk/ledger-v9": "1.0.0-rc.3", | ||
| "@midnightntwrk/ledger-v9": "1.0.0-rc.5", |
There was a problem hiding this comment.
Blocker for 0.3.0 (claude, codex): npm consumers get two ledger copies.
This line pins @midnightntwrk/ledger-v9 to exactly 1.0.0-rc.5. The deployer's own dependencies pin exactly 1.0.0-rc.3: for example @midnightntwrk/wallet-sdk-facade@5.0.0-beta.2, the other wallet-sdk-* packages, and midnight-js-protocol. In this repo the root resolutions forces rc.5 on all of them, so CI passes. npm does not read resolutions. An npm resolution of the published stack gives one top-level rc.5 copy plus eight nested rc.3 copies. With 0.2.0 it gave one copy.
The deployer passes its own ledger objects into the other copy, for example ZswapSecretKeys.fromSeed and DustSecretKey.fromSeed in wallet/handler.ts:226-227, and the deploy txs that go through midnight-js. The README says it at line 54: "a second ledger copy breaks every deploy". The README gives the pin for yarn and pnpm, but not for npm, although the install line at README.md:30 uses npm i.
Suggested fix, one of:
- Add the npm form to the README next to the yarn and pnpm pins,
"overrides": { "@midnightntwrk/ledger-v9": "1.0.0-rc.5" }, and say that npm and bun users need it too. - Add a fail-fast check in
Deployer.prepare: resolve@midnightntwrk/ledger-v9/package.jsonfrom the deployer and from@midnightntwrk/wallet-sdk-facade, and throw aConfigErrorthat names both versions and the override when the paths differ. - Keep rc.3 until the midnight-js and wallet-sdk releases pin rc.5, and let compact-contracts override it locally.
Options 1 and 2 together are the safest.
The wallet SDK and midnight-js-protocol pin ledger-v9 1.0.0-rc.3 exactly, so npm nests rc.3 copies next to the deployer's rc.5. The README only gave the yarn and pnpm forms of the pin.
Types of changes
Prepares
@openzeppelin/compact-deployer0.3.0, the first release on the Ledger v9 stack (npm still serves 0.2.0 on v8). It also lets compact-contracts' live harness deploy every mock through the deployer, withcompact.tomlas the one source of truth.Unblocks OpenZeppelin/compact-contracts#953 once the harness moves to the deployer.
Not visible in the diff:
compact.toml.mainalready runs it, and its resolution would override this pin anyway.CompactConfigData.contractsentries are partial now. A config without patterns resolves exactly as before.2.0.0-rc.4/ indexer4.4.0-rc.2/ proof-server9.0.0-rc.6.Before running "Release Package" with
minor: re-date the changelog if this merges after 2026-09-24, and check that npm trusted publishing is registered for compact-deployer (still pending on 2026-09-15). compact-cli needs its own release afterwards.PR Checklist
Summary by CodeRabbit