@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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for `compact.toml`. Cross-field rules: `profile.default_network`
|
|
3
|
+
* must name a defined `[networks.X]`; `private_state_id` and
|
|
4
|
+
* `init_private_state` are both-or-neither.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
const url = z.string().url();
|
|
8
|
+
const profileSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
default_network: z.string().optional(),
|
|
11
|
+
artifacts_dir: z.string().default('src/artifacts'),
|
|
12
|
+
deployments_dir: z.string().default('deployments/compact'),
|
|
13
|
+
})
|
|
14
|
+
.default({});
|
|
15
|
+
const localWalletSchema = z.object({
|
|
16
|
+
source: z.literal('local'),
|
|
17
|
+
// Upper bound matches LOCAL_PREFUNDED_SEEDS' five slots.
|
|
18
|
+
index: z.number().int().min(0).max(4).default(0),
|
|
19
|
+
});
|
|
20
|
+
const networkSchema = z.object({
|
|
21
|
+
network_id: z.string().min(1),
|
|
22
|
+
indexer: url,
|
|
23
|
+
indexer_ws: url,
|
|
24
|
+
node: url,
|
|
25
|
+
node_ws: url,
|
|
26
|
+
proof_server: z.union([url, z.literal('auto')]).optional(),
|
|
27
|
+
wallet: localWalletSchema.optional(),
|
|
28
|
+
// Optional block-explorer base URL (e.g. `https://preview.midnightexplorer.com`).
|
|
29
|
+
// When set, the CLI prints `<explorer>/contracts/0x<address>` on a successful
|
|
30
|
+
// deploy. Trailing slash is stripped at print time.
|
|
31
|
+
explorer: url.optional(),
|
|
32
|
+
// Optional sync tuning, per network. `sync_timeout` is the max seconds to
|
|
33
|
+
// wait for the wallet to reach chain tip; `sync_batch_size` is the
|
|
34
|
+
// dust/shielded sync batch size (raise for long-history networks like
|
|
35
|
+
// preprod, default 5000). The matching CLI flags (`--sync-timeout`,
|
|
36
|
+
// `--sync-batch-size`) override these when set.
|
|
37
|
+
sync_timeout: z.number().int().positive().optional(),
|
|
38
|
+
sync_batch_size: z.number().int().positive().optional(),
|
|
39
|
+
});
|
|
40
|
+
const walletObjectSchema = z.object({
|
|
41
|
+
keystore: z.string().optional(),
|
|
42
|
+
});
|
|
43
|
+
const walletSchema = walletObjectSchema.optional();
|
|
44
|
+
const fileRefSchema = z.object({ file: z.string().min(1) }).strict();
|
|
45
|
+
const moduleRefSchema = z
|
|
46
|
+
.object({
|
|
47
|
+
module: z.string().min(1),
|
|
48
|
+
export: z.string().default('default'),
|
|
49
|
+
})
|
|
50
|
+
.strict();
|
|
51
|
+
const fileOrModuleRefSchema = z.union([fileRefSchema, moduleRefSchema]);
|
|
52
|
+
const argsSchema = z.union([z.array(z.unknown()), fileOrModuleRefSchema]);
|
|
53
|
+
const contractSchema = z
|
|
54
|
+
.object({
|
|
55
|
+
artifact: z.string().min(1),
|
|
56
|
+
private_state_id: z.string().optional(),
|
|
57
|
+
init_private_state: fileOrModuleRefSchema.optional(),
|
|
58
|
+
private_state_store_name: z.string().optional(),
|
|
59
|
+
args: argsSchema.optional(),
|
|
60
|
+
witnesses: fileOrModuleRefSchema.optional(),
|
|
61
|
+
signing_key_file: z.string().min(1),
|
|
62
|
+
// Verifier keys per transaction. Set it for a contract too large to deploy
|
|
63
|
+
// in one tx: fragment 0 rides the deploy and the rest arrive as batched
|
|
64
|
+
// maintenance updates within the same `deploy()` call. `--circuits-per-tx`
|
|
65
|
+
// overrides it.
|
|
66
|
+
circuits_per_tx: z.number().int().positive().optional(),
|
|
67
|
+
})
|
|
68
|
+
.refine((c) => (c.private_state_id === undefined) ===
|
|
69
|
+
(c.init_private_state === undefined), {
|
|
70
|
+
message: 'private_state_id and init_private_state must be set together (or both omitted)',
|
|
71
|
+
});
|
|
72
|
+
export const configSchema = z
|
|
73
|
+
.object({
|
|
74
|
+
profile: profileSchema,
|
|
75
|
+
networks: z.record(z.string(), networkSchema),
|
|
76
|
+
wallet: walletSchema,
|
|
77
|
+
contracts: z.record(z.string(), contractSchema),
|
|
78
|
+
})
|
|
79
|
+
.refine((c) => c.profile.default_network === undefined ||
|
|
80
|
+
Object.hasOwn(c.networks, c.profile.default_network), {
|
|
81
|
+
message: 'profile.default_network must reference a defined [networks.X] block',
|
|
82
|
+
path: ['profile', 'default_network'],
|
|
83
|
+
});
|
|
84
|
+
export function isFileRef(v) {
|
|
85
|
+
return typeof v === 'object' && v !== null && 'file' in v;
|
|
86
|
+
}
|
|
87
|
+
export function isModuleRef(v) {
|
|
88
|
+
return typeof v === 'object' && v !== null && 'module' in v;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;AAE7B,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,CAAC;IACN,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACtC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC;IAClD,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC;CAC3D,CAAC;KACD,OAAO,CAAC,EAAE,CAAC,CAAC;AAEf,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AC,QAAQ,EAAE;CACxD,CAAC;KACD,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,CAAC,gBAAgB,KAAK,SAAS,CAAC;IAClC,CAAC,CAAC,CAAC,kBAAkB,KAAK,SAAS,CAAC,EACtC;IACE,OAAO,EACL,gFAAgF;CACnF,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,aAAa,CAAC;IAC7C,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC;CAChD,CAAC;KACD,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,OAAO,CAAC,eAAe,KAAK,SAAS;IACvC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EACtD;IACE,OAAO,EACL,qEAAqE;IACvE,IAAI,EAAE,CAAC,SAAS,EAAE,iBAAiB,CAAC;CACrC,CACF,CAAC;AAWJ,MAAM,UAAU,SAAS,CAAC,CAAU;IAClC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,IAAI,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,QAAQ,IAAI,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { PrivateStateProvider } from '@midnight-ntwrk/midnight-js-types';
|
|
2
|
+
import type { MidnightWalletProvider } from '@midnight-ntwrk/testkit-js';
|
|
3
|
+
import type { Logger } from 'pino';
|
|
4
|
+
import { Artifact } from './loaders/artifact.ts';
|
|
5
|
+
import { SigningKey } from './loaders/signing-key.ts';
|
|
6
|
+
/** Inputs to {@link Deployer.prepare}. */
|
|
7
|
+
export interface DeployerOptions {
|
|
8
|
+
contract: string;
|
|
9
|
+
network?: string;
|
|
10
|
+
configPath?: string;
|
|
11
|
+
seedFile?: string;
|
|
12
|
+
proofServer?: string;
|
|
13
|
+
argsOverride?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Programmatic constructor args. Highest precedence — overrides
|
|
16
|
+
* `argsOverride`, the TOML `args` field, and any file/module ref.
|
|
17
|
+
* Either a positional array (`[a, b, c]`) or a named object
|
|
18
|
+
* (`{ foo: a, bar: b }`); named objects are reordered to match the
|
|
19
|
+
* artifact's constructor signature.
|
|
20
|
+
*/
|
|
21
|
+
args?: readonly unknown[] | Record<string, unknown>;
|
|
22
|
+
initPrivateStateOverride?: string;
|
|
23
|
+
logger: Logger;
|
|
24
|
+
promptPassphrase?: (path: string) => Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Inject a shared wallet so back-to-back deploys reuse one UTXO view.
|
|
27
|
+
* When set, prepare skips seed resolution + lifecycle management.
|
|
28
|
+
* The caller owns `start()`/`stop()`. Avoids `DustDoubleSpend` from
|
|
29
|
+
* indexer lag between rapid deploys.
|
|
30
|
+
*/
|
|
31
|
+
walletProvider?: MidnightWalletProvider;
|
|
32
|
+
/**
|
|
33
|
+
* Pass `inMemoryPrivateStateProvider()` in tests; otherwise multiple
|
|
34
|
+
* deployers in one process hit fcntl LOCK contention on the default
|
|
35
|
+
* LevelDB directory.
|
|
36
|
+
*/
|
|
37
|
+
privateStateProvider?: PrivateStateProvider;
|
|
38
|
+
/**
|
|
39
|
+
* Sync ceiling (ms). Precedence: this value > `[networks.X].sync_timeout`
|
|
40
|
+
* (seconds, from TOML) > {@link DEFAULT_SYNC_TIMEOUT_MS}. Ignored when
|
|
41
|
+
* {@link walletProvider} is injected.
|
|
42
|
+
*/
|
|
43
|
+
syncTimeoutMs?: number;
|
|
44
|
+
/** Force a fresh sync from genesis. Default `false` (cache reuse saves the 30–60 min first-preprod sync). */
|
|
45
|
+
skipWalletCache?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Import a pre-warmed dust wallet state file into `.states/` before
|
|
48
|
+
* the wallet builds. Use this to skip the first-run preprod cold
|
|
49
|
+
* sync when you already have a `serializeState()` output from a
|
|
50
|
+
* prior session. Argv: `--seed-cache-from-dust`.
|
|
51
|
+
*/
|
|
52
|
+
seedCacheDust?: string;
|
|
53
|
+
/** Like {@link seedCacheDust} but for the shielded sub-wallet. Argv: `--seed-cache-from-shielded`. */
|
|
54
|
+
seedCacheShielded?: string;
|
|
55
|
+
/** Like {@link seedCacheDust} but for the unshielded sub-wallet. Argv: `--seed-cache-from-unshielded`. */
|
|
56
|
+
seedCacheUnshielded?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Sync batch size for the shielded + dust sub-wallets. Precedence: this
|
|
59
|
+
* value > `[networks.X].sync_batch_size` (TOML) > 5000. Raise it to replay
|
|
60
|
+
* a long dust history faster (more memory per batch); lower it on a
|
|
61
|
+
* memory-constrained host. Ignored when {@link walletProvider} is injected.
|
|
62
|
+
* Argv: `--sync-batch-size`.
|
|
63
|
+
*/
|
|
64
|
+
syncBatchSize?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Ceiling on the wait for deploy-tx finalization. Default
|
|
67
|
+
* {@link DEFAULT_TX_TIMEOUT_MS}. On timeout the pending ledger record
|
|
68
|
+
* survives so the tx can be reconciled by hand. Argv: `--tx-timeout`
|
|
69
|
+
* (seconds).
|
|
70
|
+
*/
|
|
71
|
+
txTimeoutMs?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Replace a pending ledger record for this contract instead of refusing to
|
|
74
|
+
* deploy over it. On a `partial` head this abandons the unfinished deploy and
|
|
75
|
+
* starts a new contract at a new address. Argv: `--force`.
|
|
76
|
+
*/
|
|
77
|
+
force?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Verifier keys per transaction. Set it when a contract is too large for one
|
|
80
|
+
* deploy tx: fragment 0 rides the deploy and the rest arrive as batched
|
|
81
|
+
* maintenance updates, all within this one `deploy()` call. Left unset, the
|
|
82
|
+
* deployer tries a single tx and halves on a block-limit refusal.
|
|
83
|
+
* Argv: `--circuits-per-tx`, TOML: `[contracts.X].circuits_per_tx`.
|
|
84
|
+
*/
|
|
85
|
+
circuitsPerTx?: number;
|
|
86
|
+
}
|
|
87
|
+
/** Result of {@link Deployer.deploy} / {@link Deployer.dryRun}. On-chain fields are empty when `dryRun: true`. */
|
|
88
|
+
export interface DeployResult {
|
|
89
|
+
contractName: string;
|
|
90
|
+
network: string;
|
|
91
|
+
address: string;
|
|
92
|
+
txHash: string;
|
|
93
|
+
txId: string;
|
|
94
|
+
blockHeight: number;
|
|
95
|
+
deployer: string;
|
|
96
|
+
artifact: string;
|
|
97
|
+
deploymentsFile: string;
|
|
98
|
+
dryRun: boolean;
|
|
99
|
+
/** `[networks.X].explorer` + `/contracts/0x<address>`, or empty when no explorer is configured / in dry-run. */
|
|
100
|
+
explorerUrl: string;
|
|
101
|
+
/**
|
|
102
|
+
* `1` for a single-tx deploy. For a split, the deploy tx plus every
|
|
103
|
+
* maintenance update the address has ever taken, read off the on-chain CMA
|
|
104
|
+
* counter, so it includes inserts from an interrupted run and any made out
|
|
105
|
+
* of band. `0` on a dry-run, which submits nothing.
|
|
106
|
+
*/
|
|
107
|
+
fragments: number;
|
|
108
|
+
/** Artifact circuit count on a single-tx deploy; chain-verified on a split. */
|
|
109
|
+
circuits: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Stateful handle for one contract's deploy lifecycle. Always acquire
|
|
113
|
+
* with `await using`: `[Symbol.asyncDispose]` releases the proof-server
|
|
114
|
+
* container (if `"auto"`) and the wallet (if built here, not injected).
|
|
115
|
+
*/
|
|
116
|
+
export declare class Deployer implements AsyncDisposable {
|
|
117
|
+
#private;
|
|
118
|
+
/** Contract name as specified in opts. */
|
|
119
|
+
readonly contractName: string;
|
|
120
|
+
/** Resolved network name (`opts.network` or `[profile].default_network`). */
|
|
121
|
+
readonly networkName: string;
|
|
122
|
+
/** Hex of the deployer's coin public key. */
|
|
123
|
+
readonly deployer: string;
|
|
124
|
+
/** Loaded artifact: zk config path + compiled-contract handle. */
|
|
125
|
+
readonly artifact: Artifact;
|
|
126
|
+
/** Per-contract signing key loaded from disk. */
|
|
127
|
+
readonly signingKey: SigningKey;
|
|
128
|
+
private constructor();
|
|
129
|
+
/**
|
|
130
|
+
* Load config + artifact + signing key, start proof server, build or
|
|
131
|
+
* adopt a wallet. Throws typed errors that map to CLI exit codes via
|
|
132
|
+
* {@link DeployError.exitCode}.
|
|
133
|
+
*/
|
|
134
|
+
static prepare(opts: DeployerOptions): Promise<Deployer>;
|
|
135
|
+
/**
|
|
136
|
+
* Deploy the contract and leave a `confirmed` record under
|
|
137
|
+
* `deployments/<network>.json`.
|
|
138
|
+
*
|
|
139
|
+
* A contract that fits one tx takes the single-tx path unchanged. A larger
|
|
140
|
+
* one is split: fragment 0's verifier keys ride the deploy tx and the rest
|
|
141
|
+
* arrive as batched maintenance updates, all inside this call. The record
|
|
142
|
+
* written after submission is what makes either path recoverable: every
|
|
143
|
+
* later failure leaves the address on disk and names it in the error.
|
|
144
|
+
*
|
|
145
|
+
* A `partial` head record resumes from chain state unless `--force`
|
|
146
|
+
* is set, in which case it is rotated into history and a new contract is
|
|
147
|
+
* deployed. Resuming is idempotent: only the circuits still missing on chain
|
|
148
|
+
* are inserted.
|
|
149
|
+
*/
|
|
150
|
+
deploy(): Promise<DeployResult>;
|
|
151
|
+
/** Log a "would deploy" event and return a synthetic result. No tx, no file. */
|
|
152
|
+
dryRun(): Promise<DeployResult>;
|
|
153
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
154
|
+
}
|