@openzeppelin/compact-deployer 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +304 -0
- package/dist/config/compact-config.d.ts +31 -0
- package/dist/config/compact-config.js +123 -0
- package/dist/config/compact-config.js.map +1 -0
- package/dist/config/schema.d.ts +688 -0
- package/dist/config/schema.js +90 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/deployer.d.ts +154 -0
- package/dist/deployer.js +916 -0
- package/dist/deployer.js.map +1 -0
- package/dist/deployments.d.ts +119 -0
- package/dist/deployments.js +144 -0
- package/dist/deployments.js.map +1 -0
- package/dist/errors.d.ts +94 -0
- package/dist/errors.js +124 -0
- package/dist/errors.js.map +1 -0
- package/dist/loaders/args.d.ts +22 -0
- package/dist/loaders/args.js +72 -0
- package/dist/loaders/args.js.map +1 -0
- package/dist/loaders/argv.d.ts +36 -0
- package/dist/loaders/argv.js +101 -0
- package/dist/loaders/argv.js.map +1 -0
- package/dist/loaders/artifact-path.d.ts +16 -0
- package/dist/loaders/artifact-path.js +35 -0
- package/dist/loaders/artifact-path.js.map +1 -0
- package/dist/loaders/artifact.d.ts +43 -0
- package/dist/loaders/artifact.js +115 -0
- package/dist/loaders/artifact.js.map +1 -0
- package/dist/loaders/constructor-meta.d.ts +17 -0
- package/dist/loaders/constructor-meta.js +99 -0
- package/dist/loaders/constructor-meta.js.map +1 -0
- package/dist/loaders/context.d.ts +14 -0
- package/dist/loaders/context.js +43 -0
- package/dist/loaders/context.js.map +1 -0
- package/dist/loaders/contract-resolve.d.ts +15 -0
- package/dist/loaders/contract-resolve.js +53 -0
- package/dist/loaders/contract-resolve.js.map +1 -0
- package/dist/loaders/init-state.d.ts +8 -0
- package/dist/loaders/init-state.js +37 -0
- package/dist/loaders/init-state.js.map +1 -0
- package/dist/loaders/ref-resolver.d.ts +8 -0
- package/dist/loaders/ref-resolver.js +27 -0
- package/dist/loaders/ref-resolver.js.map +1 -0
- package/dist/loaders/signing-key.d.ts +10 -0
- package/dist/loaders/signing-key.js +23 -0
- package/dist/loaders/signing-key.js.map +1 -0
- package/dist/providers/build.d.ts +20 -0
- package/dist/providers/build.js +41 -0
- package/dist/providers/build.js.map +1 -0
- package/dist/providers/network.d.ts +6 -0
- package/dist/providers/network.js +36 -0
- package/dist/providers/network.js.map +1 -0
- package/dist/providers/private-state-password.d.ts +12 -0
- package/dist/providers/private-state-password.js +27 -0
- package/dist/providers/private-state-password.js.map +1 -0
- package/dist/providers/proof-server.d.ts +29 -0
- package/dist/providers/proof-server.js +97 -0
- package/dist/providers/proof-server.js.map +1 -0
- package/dist/runDeploy.d.ts +167 -0
- package/dist/runDeploy.js +228 -0
- package/dist/runDeploy.js.map +1 -0
- package/dist/services/atomic-json.d.ts +7 -0
- package/dist/services/atomic-json.js +34 -0
- package/dist/services/atomic-json.js.map +1 -0
- package/dist/services/chain-state.d.ts +75 -0
- package/dist/services/chain-state.js +151 -0
- package/dist/services/chain-state.js.map +1 -0
- package/dist/services/contract-state.d.ts +29 -0
- package/dist/services/contract-state.js +54 -0
- package/dist/services/contract-state.js.map +1 -0
- package/dist/services/deploy-plan.d.ts +36 -0
- package/dist/services/deploy-plan.js +45 -0
- package/dist/services/deploy-plan.js.map +1 -0
- package/dist/services/deploy-tx.d.ts +189 -0
- package/dist/services/deploy-tx.js +297 -0
- package/dist/services/deploy-tx.js.map +1 -0
- package/dist/services/error-format.d.ts +10 -0
- package/dist/services/error-format.js +91 -0
- package/dist/services/error-format.js.map +1 -0
- package/dist/services/file-lock.d.ts +23 -0
- package/dist/services/file-lock.js +90 -0
- package/dist/services/file-lock.js.map +1 -0
- package/dist/services/maintenance-tx.d.ts +49 -0
- package/dist/services/maintenance-tx.js +43 -0
- package/dist/services/maintenance-tx.js.map +1 -0
- package/dist/services/wallet-cache.d.ts +99 -0
- package/dist/services/wallet-cache.js +239 -0
- package/dist/services/wallet-cache.js.map +1 -0
- package/dist/services/wallet-sync.d.ts +89 -0
- package/dist/services/wallet-sync.js +249 -0
- package/dist/services/wallet-sync.js.map +1 -0
- package/dist/wallet/handler.d.ts +64 -0
- package/dist/wallet/handler.js +151 -0
- package/dist/wallet/handler.js.map +1 -0
- package/dist/wallet/keystore.d.ts +55 -0
- package/dist/wallet/keystore.js +213 -0
- package/dist/wallet/keystore.js.map +1 -0
- package/dist/wallet/seeds.d.ts +41 -0
- package/dist/wallet/seeds.js +84 -0
- package/dist/wallet/seeds.js.map +1 -0
- package/package.json +133 -0
- package/proof-server.yml +16 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@openzeppelin/compact-deployer` are documented in this
|
|
4
|
+
file.
|
|
5
|
+
|
|
6
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
7
|
+
and this package adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
|
+
|
|
9
|
+
## Unreleased
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Fragmented deploy for contracts too large for one block, driven by `--circuits-per-tx` / `[contracts.X].circuits_per_tx`, with resume from chain state and a strict verify before `confirmed`. See the README's "Large contracts" section
|
|
14
|
+
- `DeployResult` gains `fragments` and `circuits`; both appear in `--json`, alongside a failed fragmented deploy's `address`, `circuitsOnChain`, `circuitsPending`, and `txId`
|
|
15
|
+
- Exit codes `7` (`BlockLimitError`: the deploy tx was refused as too large at the configured or minimum fragment size) and `8` (`FragmentDeployError`: fragmented deploy incomplete and resumable)
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- `DeploymentRecord` gains a `partial` member. A single-tx deploy still writes only `pending` then `confirmed`, so an exhaustive `switch` on `status` needs a new arm only if it reads records from a split deploy
|
|
20
|
+
- A deploy that fits one transaction is unchanged: same transaction, same `pending` then `confirmed` records, no chain read and no maintenance transaction
|
|
21
|
+
|
|
22
|
+
## 0.1.0 (2026-09-09)
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- `@midnight-ntwrk/ledger-v8` is pinned to 8.1.0, the exact version `midnight-js-protocol` 4.1.1 requires, so an npm install of the package holds one ledger copy. With 8.1.2 a second copy was nested and every deploy failed with `expected instance of DustParameters`. yarn and pnpm users add the resolutions listed in the README's "Supported stack" section (#171)
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Initial package. `Deployer` and `runDeploy` build and submit a Compact deploy transaction from a `compact.toml` profile, resolving the artifact, constructor args, initial private state, and contract signing key, then record the result in `<deployments_dir>/<network>.json` (#86)
|
|
31
|
+
- Wallet support: seed-file / `MN_DEPLOYER_SEED` / keystore / prefunded-local seed resolution, a per-seed on-disk sync cache under `.states/`, and a `proof_server = "auto"` mode that boots a testkit-js proof-server container for the run (#86)
|
|
32
|
+
- Supported deploy stack is `@midnight-ntwrk/compact-runtime` 0.16.0 and `@midnight-ntwrk/ledger-v8` 8.1.0; artifacts must be compiled with `compact compile +0.31.1`. See the README's "Supported stack" section (#86)
|
|
33
|
+
- A packaged `proof-server.yml`, pinning `midnightntwrk/proof-server:8.0.3`, is what `proof_server = "auto"` boots. `auto` no longer depends on a compose file in the working directory, though one there still wins (#165)
|
package/README.md
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# @openzeppelin/compact-deployer
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
compact-deploy Token --network local
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
> **Status: developer-preview, testnet only.** Verified on local devnet and on preprod (dry run to chain tip, 2026-09-04); the preview endpoints are null-routed ([Known issues](#known-issues-may-2026)). Mainnet unsupported: unaudited, no hardware signer, no multisig, no tx retry, no upgrade tooling. See [Roadmap](#roadmap--todo).
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- Node.js >= 24 — the deployer uses explicit resource management (`await using` / `AsyncDisposableStack`), global only from Node 24.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
1. Compile your contract with `compact-compiler` so artifacts land under `src/artifacts/<Name>/`.
|
|
16
|
+
2. Drop a `compact.toml` at your repo root (see [Sample config](#sample-config)).
|
|
17
|
+
3. Generate a signing key per contract: `head -c 32 /dev/urandom | xxd -p -c 32 > deploy/Token.signingkey`.
|
|
18
|
+
4. Run:
|
|
19
|
+
```bash
|
|
20
|
+
compact-deploy Token --network local
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The deploy result lands in `deployments/compact/<network>.json`.
|
|
24
|
+
|
|
25
|
+
## Install & run
|
|
26
|
+
|
|
27
|
+
The `compact-deploy` bin ships in `@openzeppelin/compact-cli`. Install it as a dev dependency of the project that holds your compiled artifacts, then run it with `npx`:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm i -D @openzeppelin/compact-cli # or pnpm/yarn
|
|
31
|
+
npx compact-deploy Token --network local # resolves the local install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`npx` prefers the local `node_modules/.bin`, so the deployer and your compiled contracts share **one** `@midnight-ntwrk/compact-runtime` copy. A real deploy requires this: the deploy-tx builder creates a `ContractMaintenanceAuthority` from the runtime and hands it to your contract, and the WASM check rejects it unless both sides are the same physical copy.
|
|
35
|
+
|
|
36
|
+
> **Ephemeral `npx @openzeppelin/compact-cli compact-deploy …` (no local install)** is fine for `--help`, `--version`, and `--dry-run` / validation, but **not reliable for a real deploy**: npx fetches the CLI into its own cache tree, so its `compact-runtime` differs from your project's and the submit fails with `expected instance of ContractMaintenanceAuthority`. Install it locally for real deploys.
|
|
37
|
+
|
|
38
|
+
## Supported stack
|
|
39
|
+
|
|
40
|
+
The deployer pins one Midnight stack, and artifacts have to be compiled against a matching compiler.
|
|
41
|
+
|
|
42
|
+
| Component | Version |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `@midnight-ntwrk/compact-runtime` | 0.16.0 |
|
|
45
|
+
| `@midnight-ntwrk/ledger-v8` | 8.1.0 |
|
|
46
|
+
| `@midnight-ntwrk/midnight-js-*` | 4.1.1 |
|
|
47
|
+
| `@midnight-ntwrk/testkit-js` | 4.1.1 |
|
|
48
|
+
| `@midnight-ntwrk/wallet-sdk-facade` | 4.0.1 |
|
|
49
|
+
| Compact compiler | 0.31.1 |
|
|
50
|
+
|
|
51
|
+
`ledger-v8` is pinned to 8.1.0 because `midnight-js-protocol` 4.1.1 requires exactly that version. A second copy of the ledger WASM in the tree fails a deploy with `expected instance of DustParameters`. npm dedupes to the single pinned copy on its own. yarn and pnpm resolve each range to the newest version, so a project using them adds the same pins as this repo's root `package.json`:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
"resolutions": {
|
|
55
|
+
"@midnight-ntwrk/ledger-v8": "8.1.0",
|
|
56
|
+
"@midnight-ntwrk/wallet-sdk-address-format": "3.1.2",
|
|
57
|
+
"@midnight-ntwrk/wallet-sdk-dust-wallet": "4.1.0",
|
|
58
|
+
"@midnight-ntwrk/wallet-sdk-facade": "4.0.1",
|
|
59
|
+
"@midnight-ntwrk/wallet-sdk-shielded": "3.0.1",
|
|
60
|
+
"@midnight-ntwrk/wallet-sdk-unshielded-wallet": "3.1.0"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
(`pnpm.overrides` for pnpm.)
|
|
65
|
+
|
|
66
|
+
Compile with the pinned compiler: `compact compile +0.31.1`. The current default compactc (0.34.x) emits code for compact-runtime 0.19.0, and the deploy then fails with a `Version mismatch` runtime error.
|
|
67
|
+
|
|
68
|
+
- As of 2026-09, `OpenZeppelin/compact-contracts` `main` is on compact-runtime 0.19.0 / ledger-v9 1.0.0-rc.3, so contracts built there are not deployable with this tool today.
|
|
69
|
+
- Moving the deployer to the v9 stack is pending a published `@midnight-ntwrk/ledger-v9`: `@midnight-ntwrk/compact-js` 2.5.3 depends on an unpublished ledger-v9 alpha, which yarn rejects with `YN0082`.
|
|
70
|
+
|
|
71
|
+
## CLI
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
compact-deploy <Contract>
|
|
75
|
+
--network <name> required unless [profile].default_network is set
|
|
76
|
+
--config <path> default: walk up from CWD for compact.toml
|
|
77
|
+
--seed-file <path> seed override (raw hex or BIP39 mnemonic, one line)
|
|
78
|
+
--proof-server <url> override [networks.X].proof_server
|
|
79
|
+
--sync-timeout <seconds> max wait for wallet to reach chain tip (default 600)
|
|
80
|
+
--tx-timeout <seconds> max wait per tx finalization, indexer catch-up, and dust settle (default 600)
|
|
81
|
+
--sync-batch-size <n> dust/shielded sync batch size (default 5000)
|
|
82
|
+
--circuits-per-tx <n> verifier keys per tx; splits a large deploy (default: one tx)
|
|
83
|
+
--no-cache ignore on-disk wallet-state cache; force fresh sync
|
|
84
|
+
--force replace a pending or partial deploy record for this contract
|
|
85
|
+
--seed-cache-from-dust <path> import a pre-warmed dust state file into .states/
|
|
86
|
+
--seed-cache-from-shielded <path> import a pre-warmed shielded state file into .states/
|
|
87
|
+
--seed-cache-from-unshielded <path> import a pre-warmed unshielded state file into .states/
|
|
88
|
+
--dry-run load, validate, build providers, log plan, DO NOT submit
|
|
89
|
+
--json single JSON object on stdout (machine-readable)
|
|
90
|
+
-v, --verbose pino debug logs to .compact/logs/<timestamp>.log
|
|
91
|
+
-h, --help --version
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Exit codes: `0` ok · `2` config error (includes a pending or partial deploy record without `--force`) · `3` wallet error · `5` deploy tx failed or not confirmed · `6` deployments ledger unreadable or unwritable · `7` the deploy tx was refused as too large at the configured or minimum fragment size · `8` fragmented deploy incomplete · `1` unexpected.
|
|
95
|
+
|
|
96
|
+
A deploy writes a `status: "pending"` record (address, txId) to `deployments/<network>.json` as soon as the node accepts the tx, then promotes it to `status: "confirmed"` (txHash, blockHeight) on finalization. A dropped connection or `--tx-timeout` leaves the pending record in place and names the address and txId in the error; the next deploy of that contract refuses until you check the tx on chain and pass `--force`.
|
|
97
|
+
|
|
98
|
+
## Large contracts
|
|
99
|
+
|
|
100
|
+
The node rejects a deploy tx above the per-block extrinsic limit with `1010: Invalid Transaction: Transaction would exhaust the block limits`. Weight grows with circuit count, so past roughly 15 circuits a single-tx deploy stops landing on the local stack.
|
|
101
|
+
|
|
102
|
+
- `--circuits-per-tx <n>` (or `[contracts.X].circuits_per_tx`) splits the deploy: fragment 0's verifier keys ride the deploy tx, each further fragment is one `MaintenanceUpdate` batching `VerifierKeyInsert`s.
|
|
103
|
+
- Left unset, the deployer submits the largest batch it can and halves on a refusal, down to a single circuit. There is no pre-flight weight check.
|
|
104
|
+
- Set at or above the circuit count, it pins a single-tx deploy and disables halving: a refusal is exit 7, never a split. Use it as the never-fragment switch.
|
|
105
|
+
- One `deploy()` call does the deploy, every insert, and a byte-for-byte check of every on-chain verifier key against the artifact. Only that check writes `confirmed`.
|
|
106
|
+
- Fragments are ordered by sorted circuit name, so a rerun rebuilds the same plan.
|
|
107
|
+
- Between fragment 0 landing and the last insert the contract is live with a subset of its circuits, chosen by sorted name rather than by dependency. Keep every circuit safe to call on its own, or hold traffic until the deploy confirms.
|
|
108
|
+
- Each fragment waits for the wallet to apply the previous spend before the next tx is balanced.
|
|
109
|
+
- A constructor that creates or spends a Zswap coin cannot be split: exit 2.
|
|
110
|
+
- A maintenance committee with a threshold above 1 is refused: the deployer holds one key. Exit 2.
|
|
111
|
+
|
|
112
|
+
A split deploy writes `status: "partial"` (address, txId, `circuitsOnChain`, `circuitsPending`) instead of `pending`. Re-running the same deploy command resumes it: the remaining circuits come from chain state, not from the record. Resume is refused with exit 2 unless the recorded address exists, its maintenance committee holds this signing key, and every on-chain key matches the artifact. If the deploy tx is not seen within `--tx-timeout` and no state is readable yet, the run exits 8 instead: the tx may still be landing, so check the address on an explorer before reaching for `--force`. `--force` on a `partial` head abandons it (rotated into history) and deploys a new contract at a new address.
|
|
113
|
+
|
|
114
|
+
A resume confirms only once it knows the deploy tx's `txHash` and `blockHeight`, read from the indexer or carried in the `partial` record. If every circuit is on chain but the indexer never serves the deploy tx, each re-run exits 8 with the same message; the exit is to copy the two fields from an explorer into the record and re-run, which confirms without a new transaction. `--force` is not the answer there, since it abandons a fully landed contract.
|
|
115
|
+
|
|
116
|
+
A resume stores the signing key for the address if the private-state store lacks it. It does not restore `initialPrivateState`: that value only exists inside the constructor run the original deploy did, so a dApp that needs it must seed the store itself.
|
|
117
|
+
|
|
118
|
+
Results carry `fragments` (transactions the address has taken, counting an interrupted run's inserts; `0` on a dry-run) and `circuits` (keys verified on chain), printed by the CLI and included in `--json`. A `--json` failure of a fragmented deploy also carries `address`, `circuitsOnChain`, `circuitsPending`, and the failed insert's `txId`.
|
|
119
|
+
|
|
120
|
+
**Resume guard limit.** The guard proves the recorded address holds a contract this signing key maintains whose on-chain keys match this artifact; it cannot tell two deploys of the same artifact with the same key apart. Do not hand-edit a `partial` record's `address`, or a sibling deploy will receive this run's remaining keys.
|
|
121
|
+
|
|
122
|
+
The properties this path has to hold are listed in [docs/invariants.md](./docs/invariants.md).
|
|
123
|
+
|
|
124
|
+
## Deploying to real networks (preprod, preview, testnet)
|
|
125
|
+
|
|
126
|
+
> Preview is down (null-routed DNS); preprod is reachable. A first cold preprod sync takes ~37 min, so raise `--sync-timeout`. Local standalone (`make env-up`) is still the fastest target. See [Known issues](#known-issues-may-2026).
|
|
127
|
+
|
|
128
|
+
- **First sync is slow** (~3 min on preview, ~37 min on preprod from genesis, measured 2026-09-04). Cache makes reruns near-instant.
|
|
129
|
+
- **Bump sync timeout**: `--sync-timeout 3600` (default 10 min).
|
|
130
|
+
- **Bump Node heap** for long-history chains: `NODE_OPTIONS="--max-old-space-size=8192"`.
|
|
131
|
+
- **Tune the sync batch size**: `--sync-batch-size <n>` (default 5000). Larger replays a long dust history faster but uses more memory per batch; lower it on a memory-constrained host.
|
|
132
|
+
- **Persist the sync knobs in TOML**: set `sync_timeout` (seconds) and/or `sync_batch_size` under `[networks.X]` so you don't pass the flags every run. The matching CLI flag overrides the TOML value when both are present (CLI > TOML > default).
|
|
133
|
+
- **Tip gate is tolerant**: sync completes once every sub-wallet is within 50 events of the tip, not at an exact gap of 0. On a live network the global dust stream advances continuously, so an exact-match gate would never fire.
|
|
134
|
+
- **Seed source**: `--seed-file`, `MN_DEPLOYER_SEED`, or `[wallet].keystore`. The `wallet = { source = "local" }` shorthand is dev-preset only.
|
|
135
|
+
|
|
136
|
+
## Wallet cache
|
|
137
|
+
|
|
138
|
+
After each successful sync the deployer writes `<compact.toml dir>/.states/<network>-<seed-hash>-<kind>.gz` (one file per shielded / dust / unshielded sub-wallet). Next run restores from it instead of re-syncing from genesis.
|
|
139
|
+
|
|
140
|
+
- Contents: gzipped sub-wallet state (UTXOs, checkpoint). No private keys (re-derived from seed each run).
|
|
141
|
+
- Keyed by SHA-256(seed) + network ID, so `local` vs `preprod` keep separate caches.
|
|
142
|
+
- Bust it: `--no-cache` (force fresh) or `rm -rf .states/`. Auto-falls-back on corrupt or version-mismatched files.
|
|
143
|
+
- Best-effort writes; never block a deploy. Concurrent runs against the same seed race. Don't.
|
|
144
|
+
- Resolved against the `compact.toml` directory, not the shell CWD, so running from a subdirectory reuses the same cache. Same for the LevelDB private-state store (`<compact.toml dir>/midnight-level-db/`).
|
|
145
|
+
- Both live under the `compact.toml` directory, which makes the project the unit of deployer state. Run one `compact-deploy` at a time per project: a second concurrent run fails on the LevelDB lock.
|
|
146
|
+
- Library callers that run several deploys in one process must pass `privateStateProvider` (e.g. the SDK's in-memory provider) alongside `walletProvider`. The default LevelDB store holds its lock until the process exits.
|
|
147
|
+
- `.states/` is gitignored.
|
|
148
|
+
|
|
149
|
+
### Importing a pre-warmed state file
|
|
150
|
+
|
|
151
|
+
If cold sync OOMs on preprod (the known upstream bug) and you already have a `wallet.serializeState()` snapshot from a prior session, drop it in with:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
compact-deploy <Contract> --network preprod \
|
|
155
|
+
--seed-cache-from-dust /path/to/state.json \
|
|
156
|
+
--seed-cache-from-shielded /path/to/shielded.json \
|
|
157
|
+
--seed-cache-from-unshielded /path/to/unshielded.json
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
- The dust file is the one that matters on preprod; the shielded and unshielded imports are optional.
|
|
161
|
+
- Accepts either raw JSON (the direct `serializeState()` output) or its gzipped copy. Gzip is detected by magic bytes.
|
|
162
|
+
- The file is renamed to the seed-derived cache name and dropped into `.states/`.
|
|
163
|
+
- **The previous cache (if any) is preserved at `<target>.gz.bak`** — never deleted, never overwritten by the import. To roll back from a bad import, `mv .states/<target>.gz.bak .states/<target>.gz`.
|
|
164
|
+
- The write itself is atomic: payload lands in `<target>.gz.tmp` first, then is renamed over `<target>.gz`. A mid-write crash can never leave the live cache half-overwritten.
|
|
165
|
+
- Restore failure (e.g. schema mismatch) falls through to the normal "fresh sync from genesis" path with a `warn` log — so the deploy still completes if the import doesn't take.
|
|
166
|
+
- Ignored under `--no-cache` (with a warning), since load is disabled in that mode.
|
|
167
|
+
|
|
168
|
+
## Wallet seed resolution
|
|
169
|
+
|
|
170
|
+
Precedence, first non-null wins:
|
|
171
|
+
|
|
172
|
+
1. `--seed-file <path>`
|
|
173
|
+
2. `MN_DEPLOYER_SEED` env var (hex or BIP39 mnemonic)
|
|
174
|
+
3. `[wallet].keystore` (encrypted JSON, passphrase prompted)
|
|
175
|
+
4. `--network local` only: built-in prefunded standalone seed at `[networks.local].wallet.index` (0..4)
|
|
176
|
+
|
|
177
|
+
## Sample config
|
|
178
|
+
|
|
179
|
+
```toml
|
|
180
|
+
[profile]
|
|
181
|
+
default_network = "local"
|
|
182
|
+
artifacts_dir = "src/artifacts"
|
|
183
|
+
deployments_dir = "deployments/compact"
|
|
184
|
+
|
|
185
|
+
# ---------- Networks ----------
|
|
186
|
+
[networks.local]
|
|
187
|
+
network_id = "undeployed"
|
|
188
|
+
indexer = "http://127.0.0.1:8088/api/v3/graphql"
|
|
189
|
+
indexer_ws = "ws://127.0.0.1:8088/api/v3/graphql/ws"
|
|
190
|
+
node = "http://127.0.0.1:9944"
|
|
191
|
+
node_ws = "ws://127.0.0.1:9944"
|
|
192
|
+
proof_server = "http://127.0.0.1:6300"
|
|
193
|
+
wallet = { source = "local", index = 0 }
|
|
194
|
+
|
|
195
|
+
[networks.preview]
|
|
196
|
+
network_id = "preview"
|
|
197
|
+
indexer = "https://indexer.preview.midnight.network/api/v4/graphql"
|
|
198
|
+
indexer_ws = "wss://indexer.preview.midnight.network/api/v4/graphql/ws"
|
|
199
|
+
node = "https://rpc.preview.midnight.network"
|
|
200
|
+
node_ws = "wss://rpc.preview.midnight.network"
|
|
201
|
+
proof_server = "auto"
|
|
202
|
+
explorer = "https://preview.midnightexplorer.com"
|
|
203
|
+
|
|
204
|
+
[networks.preprod]
|
|
205
|
+
network_id = "preprod"
|
|
206
|
+
indexer = "https://indexer.preprod.midnight.network/api/v4/graphql"
|
|
207
|
+
indexer_ws = "wss://indexer.preprod.midnight.network/api/v4/graphql/ws"
|
|
208
|
+
node = "https://rpc.preprod.midnight.network"
|
|
209
|
+
node_ws = "wss://rpc.preprod.midnight.network"
|
|
210
|
+
proof_server = "auto"
|
|
211
|
+
explorer = "https://preprod.midnightexplorer.com"
|
|
212
|
+
sync_timeout = 5400 # seconds; overridden by --sync-timeout
|
|
213
|
+
sync_batch_size = 5000 # dust/shielded batch; overridden by --sync-batch-size
|
|
214
|
+
|
|
215
|
+
# ---------- Wallet (non-local) ----------
|
|
216
|
+
[wallet]
|
|
217
|
+
keystore = "./deployer.keystore.json"
|
|
218
|
+
|
|
219
|
+
# ---------- Contracts ----------
|
|
220
|
+
[contracts.Token]
|
|
221
|
+
artifact = "src/artifacts/Token/Token"
|
|
222
|
+
private_state_id = "tokenPrivateState"
|
|
223
|
+
init_private_state = { file = "./deploy/Token.private-state.json" }
|
|
224
|
+
args = ["MyToken", "MTK", 18]
|
|
225
|
+
signing_key_file = "./deploy/Token.signingkey"
|
|
226
|
+
|
|
227
|
+
[contracts.Vault]
|
|
228
|
+
artifact = "src/artifacts/Vault/Vault"
|
|
229
|
+
args = []
|
|
230
|
+
signing_key_file = "./deploy/Vault.signingkey"
|
|
231
|
+
# Split this deploy into fragments of 8 verifier keys. See "Large contracts".
|
|
232
|
+
circuits_per_tx = 8
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`proof_server`: a URL pins the server; `"auto"` spawns a `testcontainers`-managed proof-server container for the duration of the deploy; omitting it falls back to the env var `PROOF_SERVER_PORT` then to `http://127.0.0.1:6300`.
|
|
236
|
+
|
|
237
|
+
`"auto"` needs Docker and boots the `proof-server.yml` shipped in this package, which pins `midnightntwrk/proof-server:8.0.3` and publishes port 6300 on a free host port. To boot a different image, put your own `proof-server.yml` in the directory you run `compact-deploy` from; a compose file there wins over the packaged one.
|
|
238
|
+
|
|
239
|
+
## Keystore format
|
|
240
|
+
|
|
241
|
+
`compact-deploy` reads/writes a JSON keystore with the Ethereum V3 shape (scrypt + AES-128-CTR) but with `version: "midnight-1"` so other tooling does not silently mis-read it as an Ethereum key. The encrypted secret is a 32-byte Midnight wallet seed (hex).
|
|
242
|
+
|
|
243
|
+
## Known issues (May 2026)
|
|
244
|
+
|
|
245
|
+
1. **Preview endpoints null-routed.** `rpc.preview.midnight.network` and `indexer.preview.midnight.network` resolve to `0.0.0.0` on the authoritative AWS Route 53 nameservers for `midnight.network` (verified against Google, Cloudflare, and Quad9). Preview was alive on 2026-05-22, broken on 2026-05-24. Blocks every consumer of testkit-js's `PreviewTestEnvironment`. File at [midnightntwrk/servicedesk](https://github.com/midnightntwrk/servicedesk/issues/new?template=bug-report.yml). **Workaround:** none on public testnet. `make env-up` (local standalone) is the only working target until Midnight restores the endpoints.
|
|
246
|
+
|
|
247
|
+
2. **Preprod blocked: `Wallet.Sync: Could not deserialize Ledger Event` on `DustSpendProcessed`.** Dust sync aborts mid-stream on a `DustSpendProcessed` event whose `midnight:event[v9]:`-prefixed `raw` bytes fail `effect/Schema` parsing. The thrown `Wallet.Sync` corrupts `DustLocalState`. The next `walletBalance()` call hits `RuntimeError: unreachable` in the ledger WASM. Two independent runs, two different event IDs: 2026-05-22 id **565,975** (confirmed in Midnight dev Discord by `Knife`); 2026-05-24 id **571,224** with `maxId` 676,018. Affected stack: `wallet-sdk-dust-wallet@4.0.0`, `ledger-v8@8.0.3`, `testkit-js@4.1.0`. File at [midnightntwrk/midnight-wallet](https://github.com/midnightntwrk/midnight-wallet/issues/new). Distinct from [#361 `InvalidDustSpendProof`](https://github.com/midnightntwrk/midnight-wallet/issues/361), which is a chain-side tx rejection (this bug is client-side event ingest). **Workaround:** none. Preview is also down (see #1). Local standalone is the only working target today.
|
|
248
|
+
|
|
249
|
+
**2026-09-04, stack `wallet-sdk-dust-wallet@4.1.0` / `ledger-v8@8.1.2` / `testkit-js@4.1.1`:** not reproduced.
|
|
250
|
+
A cold preprod dry run reached chain tip on all three sub-wallets (~37 min) and ended at the expected `UnfundedWalletError`.
|
|
251
|
+
|
|
252
|
+
3. **Faucet is manual.** The deployer never hits a faucet. Fund the wallet's `unshielded` address (logged at startup) via the official Midnight faucet site or Discord bot before running.
|
|
253
|
+
|
|
254
|
+
4. **Dust fee overhead default breaks faucet wallets.** testkit-js default `additionalFeeOverhead` is `5e20` vs a faucet wallet's `~3e15` dust → `Insufficient Funds: could not balance dust`. Deployer overrides to `5e14` for non-mainnet. Library users constructing their own provider must mirror this.
|
|
255
|
+
|
|
256
|
+
5. **Long-history dust sync exhausts default Node heap.** The deployer now raises the dust/shielded sync batch size (`batchUpdates = { size: 5000, … }`) so the replay no longer OOMs mid-stream ([midnightntwrk/midnight-wallet#425](https://github.com/midnightntwrk/midnight-wallet/issues/425)). First hit on `wallet-sdk-dust-wallet@4.0.0`; the override is kept on the shipped 4.1.0 and has not been re-tested without it. The restored dust tree plus shielded trial-decryption can still spike past V8's ~2 GB default old-space on a first preprod sync, so set `NODE_OPTIONS="--max-old-space-size=8192"` for that run. Cache fixes subsequent runs.
|
|
257
|
+
|
|
258
|
+
6. **Root `resolutions` pin the wallet-SDK packages; do not drop them on a bump.** `testkit-js@4.1.1` pulls `@midnight-ntwrk/wallet-sdk@1.1.0`, which declares `wallet-sdk-facade ^4.0.1` and so resolves to 4.1.0 — a version that imports a nonexistent `Clock` export and fails to load. Without the pins the tree also duplicates `wallet-sdk-dust-wallet` (4.2.0) and `wallet-sdk-shielded` (3.0.2). The root `package.json` therefore pins `wallet-sdk-address-format 3.1.2`, `wallet-sdk-dust-wallet 4.1.0`, `wallet-sdk-facade 4.0.1`, `wallet-sdk-shielded 3.0.1`, `wallet-sdk-unshielded-wallet 3.1.0`.
|
|
259
|
+
|
|
260
|
+
## Programmatic API
|
|
261
|
+
|
|
262
|
+
The package has no barrel entrypoint: each module is its own subpath export, so an import names the module it comes from and pulls in only that module.
|
|
263
|
+
|
|
264
|
+
| Subpath | Exports |
|
|
265
|
+
|---|---|
|
|
266
|
+
| `/run-deploy` | `runDeploy`, `constructorArgs`, `ConstructorArgsOf`, `RunDeployOptions` |
|
|
267
|
+
| `/deployer` | `Deployer`, `DeployerOptions`, `DeployResult` |
|
|
268
|
+
| `/deployments` | `Deployments`, `DeploymentRecord` (`PendingDeploymentRecord` \| `PartialDeploymentRecord` \| `ConfirmedDeploymentRecord`, discriminated on `status`), `DeploymentsFile`, `DeploymentsHistory` |
|
|
269
|
+
| `/errors` | `DeployError` and every typed subclass |
|
|
270
|
+
| `/config/compact-config` | `CompactConfig` |
|
|
271
|
+
| `/config/schema` | `ContractConfig`, `NetworkConfig`, `Profile`, `WalletConfig` |
|
|
272
|
+
| `/loaders/args` · `/loaders/argv` · `/loaders/artifact` · `/loaders/init-state` · `/loaders/signing-key` | `ConstructorArgs`, `parseDeployArgv`, `Artifact`, `InitialPrivateState`, `SigningKey` |
|
|
273
|
+
| `/providers/proof-server` | `ProofServer` |
|
|
274
|
+
| `/wallet/handler` · `/wallet/keystore` · `/wallet/seeds` | `WalletHandler`, `Keystore`, `classifySeed`, `localPrefundedSeed` |
|
|
275
|
+
|
|
276
|
+
Curried form — pass the compiled `Contract` class and the constructor args are typed function parameters:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
import { runDeploy } from "@openzeppelin/compact-deployer/run-deploy";
|
|
280
|
+
import { Contract } from "./src/artifacts/Token/contract/index.js";
|
|
281
|
+
|
|
282
|
+
const result = await runDeploy(Contract, { network: "local" })(
|
|
283
|
+
"OpenZeppelin Token", // _name: string
|
|
284
|
+
"OZE", // _symbol: string
|
|
285
|
+
18n, // _decimals: bigint
|
|
286
|
+
);
|
|
287
|
+
console.log(result.address);
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Options-object form — name the contract as it appears in `compact.toml`, with args from the TOML or passed inline:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
import { runDeploy } from "@openzeppelin/compact-deployer/run-deploy";
|
|
294
|
+
|
|
295
|
+
const result = await runDeploy({
|
|
296
|
+
contract: "Token",
|
|
297
|
+
network: "local",
|
|
298
|
+
configPath: "./compact.toml",
|
|
299
|
+
args: ["OpenZeppelin Token", "OZE", 18n],
|
|
300
|
+
});
|
|
301
|
+
console.log(result.address);
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Every option has a `process.argv` default (`--network`, `--config`, `--dry-run`, …), so the same script works with flags at the call site. On failure `runDeploy` sets `process.exitCode` and rethrows the original error; it never calls `process.exit`, so catch it if you want that exit code to reach the shell.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ContractConfig, type NetworkConfig, type WalletConfig } from './schema.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Parsed + validated `compact.toml` with the resolved project root.
|
|
4
|
+
* Single source of truth for the pipeline; `network` / `contract`
|
|
5
|
+
* lookups throw {@link ConfigError} with the available set on miss.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CompactConfig {
|
|
8
|
+
#private;
|
|
9
|
+
readonly configPath: string;
|
|
10
|
+
/**
|
|
11
|
+
* Directory `compact.toml` was loaded from, and the anchor for every
|
|
12
|
+
* path the deployer writes: the `.states/` wallet-cache snapshots and
|
|
13
|
+
* the LevelDB private-state store both hang off it. State therefore
|
|
14
|
+
* belongs to the project rather than to whichever directory the user
|
|
15
|
+
* happened to run `compact-deploy` from.
|
|
16
|
+
*/
|
|
17
|
+
readonly rootDir: string;
|
|
18
|
+
private constructor();
|
|
19
|
+
/** Walks up from `cwd` Foundry-style when `explicitPath` is omitted. */
|
|
20
|
+
static load(explicitPath?: string, cwd?: string): Promise<CompactConfig>;
|
|
21
|
+
get defaultNetwork(): string | undefined;
|
|
22
|
+
get artifactsDir(): string;
|
|
23
|
+
get deploymentsDir(): string;
|
|
24
|
+
get wallet(): WalletConfig | undefined;
|
|
25
|
+
hasNetwork(name: string): boolean;
|
|
26
|
+
hasContract(name: string): boolean;
|
|
27
|
+
listNetworks(): string[];
|
|
28
|
+
listContracts(): string[];
|
|
29
|
+
network(name: string): NetworkConfig;
|
|
30
|
+
contract(name: string): ContractConfig;
|
|
31
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { dirname, isAbsolute, resolve } from 'node:path';
|
|
4
|
+
import { parse as parseToml } from 'smol-toml';
|
|
5
|
+
import { ConfigError } from "../errors.js";
|
|
6
|
+
import { configSchema, } from "./schema.js";
|
|
7
|
+
/**
|
|
8
|
+
* Parsed + validated `compact.toml` with the resolved project root.
|
|
9
|
+
* Single source of truth for the pipeline; `network` / `contract`
|
|
10
|
+
* lookups throw {@link ConfigError} with the available set on miss.
|
|
11
|
+
*/
|
|
12
|
+
export class CompactConfig {
|
|
13
|
+
configPath;
|
|
14
|
+
/**
|
|
15
|
+
* Directory `compact.toml` was loaded from, and the anchor for every
|
|
16
|
+
* path the deployer writes: the `.states/` wallet-cache snapshots and
|
|
17
|
+
* the LevelDB private-state store both hang off it. State therefore
|
|
18
|
+
* belongs to the project rather than to whichever directory the user
|
|
19
|
+
* happened to run `compact-deploy` from.
|
|
20
|
+
*/
|
|
21
|
+
rootDir;
|
|
22
|
+
#data;
|
|
23
|
+
constructor(data, configPath) {
|
|
24
|
+
this.#data = data;
|
|
25
|
+
this.configPath = configPath;
|
|
26
|
+
this.rootDir = dirname(configPath);
|
|
27
|
+
}
|
|
28
|
+
/** Walks up from `cwd` Foundry-style when `explicitPath` is omitted. */
|
|
29
|
+
static async load(explicitPath, cwd = process.cwd()) {
|
|
30
|
+
const configPath = explicitPath
|
|
31
|
+
? resolveExplicit(explicitPath, cwd)
|
|
32
|
+
: findUpward(cwd);
|
|
33
|
+
if (!configPath) {
|
|
34
|
+
throw new ConfigError(`compact.toml not found (searched upward from ${cwd}). Pass --config <path> or create one at the repo root.`);
|
|
35
|
+
}
|
|
36
|
+
let raw;
|
|
37
|
+
try {
|
|
38
|
+
raw = await readFile(configPath, 'utf8');
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
throw new ConfigError(`Failed to read ${configPath}: ${e.message}`);
|
|
42
|
+
}
|
|
43
|
+
let parsed;
|
|
44
|
+
try {
|
|
45
|
+
parsed = parseToml(raw);
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
throw new ConfigError(`Invalid TOML in ${configPath}: ${e.message}`);
|
|
49
|
+
}
|
|
50
|
+
const result = configSchema.safeParse(parsed);
|
|
51
|
+
if (!result.success) {
|
|
52
|
+
const issues = result.error.issues
|
|
53
|
+
.map((i) => {
|
|
54
|
+
// A TOML document always parses to a table, so an issue can
|
|
55
|
+
// never land at the empty root path.
|
|
56
|
+
/* v8 ignore next */
|
|
57
|
+
const at = i.path.join('.') || '(root)';
|
|
58
|
+
return ` - ${at}: ${i.message}`;
|
|
59
|
+
})
|
|
60
|
+
.join('\n');
|
|
61
|
+
throw new ConfigError(`compact.toml validation failed:\n${issues}`);
|
|
62
|
+
}
|
|
63
|
+
return new CompactConfig(result.data, configPath);
|
|
64
|
+
}
|
|
65
|
+
get defaultNetwork() {
|
|
66
|
+
return this.#data.profile.default_network;
|
|
67
|
+
}
|
|
68
|
+
get artifactsDir() {
|
|
69
|
+
return this.#data.profile.artifacts_dir;
|
|
70
|
+
}
|
|
71
|
+
get deploymentsDir() {
|
|
72
|
+
return this.#data.profile.deployments_dir;
|
|
73
|
+
}
|
|
74
|
+
get wallet() {
|
|
75
|
+
return this.#data.wallet;
|
|
76
|
+
}
|
|
77
|
+
hasNetwork(name) {
|
|
78
|
+
return Object.hasOwn(this.#data.networks, name);
|
|
79
|
+
}
|
|
80
|
+
hasContract(name) {
|
|
81
|
+
return Object.hasOwn(this.#data.contracts, name);
|
|
82
|
+
}
|
|
83
|
+
listNetworks() {
|
|
84
|
+
return Object.keys(this.#data.networks);
|
|
85
|
+
}
|
|
86
|
+
listContracts() {
|
|
87
|
+
return Object.keys(this.#data.contracts);
|
|
88
|
+
}
|
|
89
|
+
network(name) {
|
|
90
|
+
const n = this.#data.networks[name];
|
|
91
|
+
if (!n) {
|
|
92
|
+
throw new ConfigError(`Network "${name}" not defined. Available: ${this.listNetworks().join(', ')}`);
|
|
93
|
+
}
|
|
94
|
+
return n;
|
|
95
|
+
}
|
|
96
|
+
contract(name) {
|
|
97
|
+
const c = this.#data.contracts[name];
|
|
98
|
+
if (!c) {
|
|
99
|
+
throw new ConfigError(`Contract "${name}" not defined. Available: ${this.listContracts().join(', ')}`);
|
|
100
|
+
}
|
|
101
|
+
return c;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function resolveExplicit(p, cwd) {
|
|
105
|
+
const abs = isAbsolute(p) ? p : resolve(cwd, p);
|
|
106
|
+
if (!existsSync(abs)) {
|
|
107
|
+
throw new ConfigError(`--config path does not exist: ${abs}`);
|
|
108
|
+
}
|
|
109
|
+
return abs;
|
|
110
|
+
}
|
|
111
|
+
function findUpward(start) {
|
|
112
|
+
let dir = resolve(start);
|
|
113
|
+
while (true) {
|
|
114
|
+
const candidate = resolve(dir, 'compact.toml');
|
|
115
|
+
if (existsSync(candidate))
|
|
116
|
+
return candidate;
|
|
117
|
+
const parent = dirname(dir);
|
|
118
|
+
if (parent === dir)
|
|
119
|
+
return undefined;
|
|
120
|
+
dir = parent;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=compact-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compact-config.js","sourceRoot":"","sources":["../../src/config/compact-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAGL,YAAY,GAGb,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACf,UAAU,CAAS;IAC5B;;;;;;OAMG;IACM,OAAO,CAAS;IAChB,KAAK,CAAoB;IAElC,YAAoB,IAAuB,EAAE,UAAkB;QAC7D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,wEAAwE;IACxE,MAAM,CAAC,KAAK,CAAC,IAAI,CACf,YAAqB,EACrB,MAAc,OAAO,CAAC,GAAG,EAAE;QAE3B,MAAM,UAAU,GAAG,YAAY;YAC7B,CAAC,CAAC,eAAe,CAAC,YAAY,EAAE,GAAG,CAAC;YACpC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,WAAW,CACnB,gD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