@parity/ppn-network-config 0.2.0-rc.1

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.
Files changed (59) hide show
  1. package/LICENSE +202 -0
  2. package/config/ports.env +128 -0
  3. package/dist/bundle.d.ts +36 -0
  4. package/dist/bundle.d.ts.map +1 -0
  5. package/dist/bundle.js +7 -0
  6. package/dist/bundle.js.map +1 -0
  7. package/dist/dashboard-model.d.ts +63 -0
  8. package/dist/dashboard-model.d.ts.map +1 -0
  9. package/dist/dashboard-model.js +126 -0
  10. package/dist/dashboard-model.js.map +1 -0
  11. package/dist/dub.d.ts +98 -0
  12. package/dist/dub.d.ts.map +1 -0
  13. package/dist/dub.js +202 -0
  14. package/dist/dub.js.map +1 -0
  15. package/dist/env-file.d.ts +6 -0
  16. package/dist/env-file.d.ts.map +1 -0
  17. package/dist/env-file.js +30 -0
  18. package/dist/env-file.js.map +1 -0
  19. package/dist/fork-toml.d.ts +35 -0
  20. package/dist/fork-toml.d.ts.map +1 -0
  21. package/dist/fork-toml.js +276 -0
  22. package/dist/fork-toml.js.map +1 -0
  23. package/dist/genesis-patch.d.ts +54 -0
  24. package/dist/genesis-patch.d.ts.map +1 -0
  25. package/dist/genesis-patch.js +223 -0
  26. package/dist/genesis-patch.js.map +1 -0
  27. package/dist/index.d.ts +19 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +19 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/load.d.ts +12 -0
  32. package/dist/load.d.ts.map +1 -0
  33. package/dist/load.js +23 -0
  34. package/dist/load.js.map +1 -0
  35. package/dist/networks.d.ts +214 -0
  36. package/dist/networks.d.ts.map +1 -0
  37. package/dist/networks.js +329 -0
  38. package/dist/networks.js.map +1 -0
  39. package/dist/nginx-routes.d.ts +10 -0
  40. package/dist/nginx-routes.d.ts.map +1 -0
  41. package/dist/nginx-routes.js +37 -0
  42. package/dist/nginx-routes.js.map +1 -0
  43. package/dist/overrides.d.ts +50 -0
  44. package/dist/overrides.d.ts.map +1 -0
  45. package/dist/overrides.js +169 -0
  46. package/dist/overrides.js.map +1 -0
  47. package/dist/repo-root.d.ts +42 -0
  48. package/dist/repo-root.d.ts.map +1 -0
  49. package/dist/repo-root.js +129 -0
  50. package/dist/repo-root.js.map +1 -0
  51. package/dist/toml-generator.d.ts +30 -0
  52. package/dist/toml-generator.d.ts.map +1 -0
  53. package/dist/toml-generator.js +469 -0
  54. package/dist/toml-generator.js.map +1 -0
  55. package/dist/types.d.ts +14 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +2 -0
  58. package/dist/types.js.map +1 -0
  59. package/package.json +37 -0
@@ -0,0 +1,276 @@
1
+ // Generates the zombienet TOML that spawns a fork bundle — a network resumed from a live
2
+ // network's state rather than from genesis. The bundle's manifest names which network it
3
+ // is a bite of (networks/<name>.json); old bundles without the field are previewnet's.
4
+ // See docs/FORK.md.
5
+ //
6
+ // Ports, para ids and per-chain flags are imported from toml-generator.ts rather than
7
+ // restated here. A forked collator has to run with the same arguments as a genesis one,
8
+ // and when the two lists were maintained separately they drifted immediately — a
9
+ // hand-copied table dropped `--listen-addr=…/webrtc-direct`, which pairs with
10
+ // `--experimental-webrtc`. Only what is genuinely different about a fork is expressed
11
+ // below, and there are four such things:
12
+ //
13
+ // 1. Node names. zombienet maps the well-known names (alice, bob, …) to the well-known
14
+ // dev keys, which is exactly the authority set the bite installs over production's
15
+ // generated keys. PPN's genesis-mode names (`alice-paseo-validator`,
16
+ // `bulletin-collator1`) get generated keys instead, and the network cannot author.
17
+ // Collators must be `Collator-<paraId>` to match the `//Collator-<paraId>` Aura key.
18
+ //
19
+ // 2. Collators use --relay-chain-rpc-urls rather than an embedded relay node. The relay
20
+ // database came from warp sync: it holds state at the bite block but no bodies before
21
+ // it, so it cannot serve a peer syncing from genesis. An embedded relay sits at #0.
22
+ //
23
+ // 3. Every relay node needs ZOMBIE_DISPUTE_CANDIDATE_LIFETIME_AFTER_FINALIZATION=1.
24
+ // Without it the dispute scrape reaches for ancestry a warp-synced DB does not have,
25
+ // DetermineUndisputedChain fails, and relay chain-selection pins the finality target
26
+ // to the bite block — blocks are produced but nothing finalizes. zombienet does not
27
+ // forward the parent environment, so it has to be declared per node.
28
+ //
29
+ // 4. Genesis-time bootstrap processes are omitted. The forked state already carries the
30
+ // HRMP channels, core assignments and dispatcher address, so re-running them is at
31
+ // best a no-op and at worst writes stale values.
32
+ //
33
+ // The attestation allowance is the exception, and runs in both modes. It is not
34
+ // bootstrap: it grants allowance to whichever account the identity backend attests
35
+ // with, and a fork carries production's grants — which say nothing about that account
36
+ // once it is not Alice. The grant is additive, so re-running it is safe.
37
+ //
38
+ // Paths are absolute rather than zombienet's {{BIN}}/{{SCRIPTS}} placeholders: this file
39
+ // is generated per machine into a gitignored bundle directory, and the bundle path is not
40
+ // an environment variable, so there is nothing to gain by making half of it relocatable.
41
+ import fs from 'node:fs';
42
+ import { VALIDATORS, PORTS, P2P_PORTS, RELAY_BASE_PORT, buildArgs, addMissing, tomlArgs, requiredPort, } from './toml-generator.js';
43
+ import { DEFAULT_NETWORK } from './networks.js';
44
+ import { loadNetwork } from './load.js';
45
+ import { dubCustomProcesses } from './dub.js';
46
+ // Services, data loading, and spec publishing — see note 4 above.
47
+ //
48
+ // patch-bootnodes belongs here even though it sounds like genesis bootstrap: zombienet
49
+ // regenerates bootNodes from the running nodes, so the specs it publishes advertise
50
+ // /ip4/127.0.0.1/. Without this the chainspecs a spawned instance serves are unusable to
51
+ // anything off the box. It rewrites addresses only; it touches no chain state.
52
+ // Each process runs only when the parachain it serves is part of the fork (null = always),
53
+ // and can be switched off per network via the descriptor's `services` map. Genesis-bootstrap
54
+ // processes (HRMP channels, core assignment, the POP controller address) are deliberately
55
+ // absent: a fork already carries all of that in state. The attestation allowance is the
56
+ // exception — it is not bootstrap but a grant to *our* attester, and the forked state
57
+ // carries production's grants, not one for the account IBv2 signs with here.
58
+ const PROCESS_GATES = {
59
+ dashboard: null,
60
+ 'eth-rpc': 'asset-hub',
61
+ 'ipfs-daemon': 'bulletin',
62
+ 'ipfs-swarm': 'bulletin',
63
+ 'storage-provider-node': 'web3-storage',
64
+ 'pin-design-families': 'people',
65
+ 'patch-bootnodes': null,
66
+ // Imports the DotNS products whose bytes a warp-synced bulletin cannot have. Best
67
+ // effort: without it the fork runs, but content published before the bite 404s.
68
+ 'pin-bulletin-products': 'bulletin',
69
+ 'increase-people-lite-attestation-allowance': 'people',
70
+ // Same reason as the allowance grant: a fork inherits the source network's invites, which
71
+ // say nothing about the account signing here, and without invites the ticket pool fails
72
+ // every batch it submits.
73
+ 'grant-invites': 'people',
74
+ };
75
+ const FORK_PROCESSES = Object.keys(PROCESS_GATES);
76
+ // A warp-synced node keeps only recent state, and skipping the hardware benchmark keeps
77
+ // the spawn quiet on machines that would otherwise warn on every start.
78
+ const FORK_COMMON = ['--state-pruning=256', '--no-hardware-benchmarks'];
79
+ // --discover-local/--allow-private-ip on the *validators*, not just the collators. A validator
80
+ // only enters an address into the DHT if it passes the non-global filter, and on a local network
81
+ // every address is 127.0.0.1 — so without these it publishes nothing resolvable. The collator
82
+ // then asks authority discovery for its backing group, resolves no addresses, opens no collation
83
+ // substream, and every collation expires unadvertised:
84
+ //
85
+ // TRACE collator-protocol: Sending connection request to validators: [Public(d43593c7…)]
86
+ // TRACE collator-protocol: Peer-set updated due to a timeout timeout=4s
87
+ // WARN collator-protocol: Collation wasn't advertised to any validator
88
+ //
89
+ // PeerSet::Collation is configured out_peers: 0 with an empty reserved set, and validators never
90
+ // dial collators — set_reserved_peers() from a resolved address is the only way that substream
91
+ // ever opens. So this is not a nicety; nothing is backed without it.
92
+ const FORK_RELAY_ARGS = ['--force-authoring', '--discover-local', '--allow-private-ip', ...FORK_COMMON];
93
+ const FORK_COLLATOR_ARGS = ['--discover-local', '--allow-private-ip', ...FORK_COMMON];
94
+ // Quieter than the genesis default (runtime=debug); babe and grandpa are what you actually
95
+ // want to read when a fork fails to author or finalize.
96
+ const FORK_RELAY_LOGS = { runtime: 'info', babe: 'info', grandpa: 'info' };
97
+ // ---------------------------------------------------------------------------
98
+ // Helpers
99
+ // ---------------------------------------------------------------------------
100
+ function readManifest(bundleDir) {
101
+ const file = `${bundleDir}/manifest.json`;
102
+ if (!fs.existsSync(file)) {
103
+ throw new Error(`no manifest at ${file} — run \`make bite\` or delete the bundle and retry`);
104
+ }
105
+ const manifest = JSON.parse(fs.readFileSync(file, 'utf-8'));
106
+ if (!manifest.biteBlocks || !manifest.chains?.relay?.spec) {
107
+ throw new Error(`${file} predates the current bundle format.\n` +
108
+ 'Re-bite with `make bite` (or `make clean-fork` and let FORK=1 fetch a current one).');
109
+ }
110
+ return manifest;
111
+ }
112
+ // A bundle names the network it was bitten from; bundles from before the network registry
113
+ // are previewnet's. The descriptor is what the bundle is validated against.
114
+ function networkOf(manifest) {
115
+ return loadNetwork(manifest.network ?? DEFAULT_NETWORK);
116
+ }
117
+ // The bundle and the network descriptor must agree on which parachains exist. Nothing else
118
+ // enforces that, and the failure it prevents is quiet: a five-chain network would simply
119
+ // fork as four.
120
+ function forkParachains(manifest, net) {
121
+ const bundled = Object.keys(manifest.chains)
122
+ .filter((k) => k !== 'relay')
123
+ .sort();
124
+ const known = net.parachains.map((p) => p.key).sort();
125
+ if (bundled.join(',') !== known.join(',')) {
126
+ throw new Error(`parachain set mismatch — bundle has [${bundled}], ${net.name} declares [${known}].\n` +
127
+ `Re-bite with \`make bite\`, or update networks/${net.name}.json.`);
128
+ }
129
+ for (const p of net.parachains) {
130
+ const bundledId = manifest.chains[p.key].paraId;
131
+ if (bundledId !== p.paraId) {
132
+ throw new Error(`para id mismatch for ${p.key} — bundle says ${bundledId}, networks/${net.name}.json says ${p.paraId}`);
133
+ }
134
+ }
135
+ return net.parachains.map((p) => p.key);
136
+ }
137
+ // Read the chain id out of the spec rather than restating the name->id mapping. `chain` is
138
+ // mandatory alongside chain_spec_path: without it zombienet applies a single spec to every
139
+ // parachain (last one wins) and all collators silently run the same chain, which shows up
140
+ // only as the parachains converging on identical block numbers.
141
+ function chainIdOf(specPath) {
142
+ return JSON.parse(fs.readFileSync(specPath, 'utf-8')).id;
143
+ }
144
+ function relayNodes(count) {
145
+ return VALIDATORS.slice(0, count).map((name, i) => `
146
+ [[relaychain.nodes]]
147
+ name = "${name}"
148
+ validator = true
149
+ rpc_port = ${RELAY_BASE_PORT + i}${i === 0 ? `\np2p_port = ${P2P_PORTS.relay}` : ''}
150
+ env = [{ name = "ZOMBIE_DISPUTE_CANDIDATE_LIFETIME_AFTER_FINALIZATION", value = "1" }]`).join('\n');
151
+ }
152
+ function parachainSection(key, manifest, bundleDir, scriptsDir, enableHop, net, binDirOverride) {
153
+ const chain = manifest.chains[key];
154
+ const desc = net.parachains.find((p) => p.key === key);
155
+ const paraId = chain.paraId;
156
+ const specPath = `${bundleDir}/specs/${chain.spec}.json`;
157
+ const args = addMissing(addMissing([
158
+ `--relay-chain-rpc-urls=ws://127.0.0.1:${RELAY_BASE_PORT}`,
159
+ ...buildArgs(key, undefined, key === 'bulletin' && enableHop),
160
+ ], desc.extraArgs), FORK_COLLATOR_ARGS);
161
+ // The collator runs through scripts/omni-node.sh either way (it carries the libp2p
162
+ // fix any cumulus collator needs — see that file). Which binary it execs, and from
163
+ // which bin directory, is the wrapper's PPN_* environment: non-previewnet networks
164
+ // keep their node binaries in bin/<network>, and the descriptor binds each chain's
165
+ // binary explicitly (binary: { name, release }).
166
+ const env = [];
167
+ if (binDirOverride)
168
+ env.push(`{ name = "PPN_BIN_DIR", value = "${binDirOverride}" }`);
169
+ if (desc.binary.name !== 'polkadot-omni-node') {
170
+ env.push(`{ name = "PPN_COLLATOR_BINARY", value = "${desc.binary.name}" }`);
171
+ }
172
+ // zombienet files the collator's ed25519 key under `gran`, and its `aura` key is always
173
+ // sr25519 — so on a chain whose Aura is ed25519 the node finds no key it can author with.
174
+ // The wrapper inserts one; see scripts/omni-node.sh.
175
+ if (desc.aura === 'ed25519') {
176
+ env.push(`{ name = "PPN_COLLATOR_AURA", value = "ed25519" }`);
177
+ }
178
+ const envLine = env.length ? `\nenv = [${env.join(', ')}]` : '';
179
+ return `
180
+ ## ${chain.specName} (${paraId}) — bitten at block ${manifest.biteBlocks[paraId]}
181
+ [[parachains]]
182
+ id = ${paraId}
183
+ cumulus_based = true
184
+ chain = "${chainIdOf(specPath)}"
185
+ chain_spec_path = "${specPath}"
186
+
187
+ [[parachains.collators]]
188
+ name = "Collator-${paraId}"
189
+ rpc_port = ${PORTS[key]}
190
+ p2p_port = ${P2P_PORTS[key]}
191
+ command = "${scriptsDir}/omni-node.sh"
192
+ db_snapshot = "${bundleDir}/snapshots/${paraId}.tgz"${envLine}
193
+ args = ${tomlArgs(args)}
194
+ `;
195
+ }
196
+ /**
197
+ * Whether this spawn imports the network's DotNS products.
198
+ *
199
+ * The descriptor decides and PRODUCT_SYNC overrides it, in both directions: whether the content
200
+ * is wanted belongs to the run, not to the network. Forking paseo-next-v2 to test a runtime does
201
+ * not need its products; the same fork opened to browse them does. Unasked, the import walks
202
+ * every product the resolver knows and pulls each one's bytes from the source gateway, which was
203
+ * 659 products and over half an hour the last time it ran on a network that never checked them.
204
+ *
205
+ * PRODUCT_SYNC=0 already meant "skip" inside the service itself; deciding here as well means the
206
+ * process is not spawned at all rather than started and told to do nothing.
207
+ */
208
+ export function pinsProducts(net) {
209
+ const sync = process.env.PRODUCT_SYNC;
210
+ if (sync === '0')
211
+ return false;
212
+ if (sync === '1')
213
+ return true;
214
+ return net.dotns?.pinProducts === true;
215
+ }
216
+ function customProcesses(scriptsDir, net, present) {
217
+ return FORK_PROCESSES.filter((name) => {
218
+ const gate = PROCESS_GATES[name];
219
+ if (gate !== null && !present.has(gate))
220
+ return false;
221
+ if (name === 'pin-bulletin-products' && !pinsProducts(net))
222
+ return false;
223
+ return net.services[name] !== false;
224
+ })
225
+ .map((name) => `
226
+ [[custom_processes]]
227
+ name = "${name}"
228
+ command = "${scriptsDir}/${name}.sh"
229
+ `)
230
+ .join('');
231
+ }
232
+ export function generateForkToml(options) {
233
+ const { repoDir, bundleDir, enableHop = true } = options;
234
+ const binDir = options.binDir ?? `${repoDir}/bin`;
235
+ const scriptsDir = options.scriptsDir ?? `${repoDir}/scripts`;
236
+ const manifest = readManifest(bundleDir);
237
+ const net = networkOf(manifest);
238
+ const parachains = forkParachains(manifest, net);
239
+ const present = new Set(parachains);
240
+ const relaySpecPath = `${bundleDir}/specs/${manifest.chains.relay.spec}.json`;
241
+ const relayArgs = addMissing(addMissing(buildArgs('relay', FORK_RELAY_LOGS), net.relay.extraArgs), FORK_RELAY_ARGS);
242
+ // The identity backend rides the people chain, like its attestation-allowance grant.
243
+ const identity = present.has('people') && net.services['dub'] !== false
244
+ ? dubCustomProcesses({
245
+ postgres: requiredPort('DUB_POSTGRES_PORT'),
246
+ people: PORTS.people,
247
+ assetHub: PORTS['asset-hub'],
248
+ gateway: requiredPort('DUB_PORT'),
249
+ }, undefined, scriptsDir)
250
+ : '';
251
+ const toml = `\
252
+ # DO NOT EDIT — regenerate with: ppn fork toml <bundle> <out>
253
+ # Forked ${net.name}, bitten ${manifest.bittenAt} from ${manifest.source}
254
+ # Production node version at bite time: ${manifest.nodeVersion}
255
+ # Bite blocks: ${JSON.stringify(manifest.biteBlocks)}
256
+
257
+ [settings]
258
+ timeout = 1200
259
+ node_spawn_timeout = 400
260
+
261
+ [relaychain]
262
+ chain = "${chainIdOf(relaySpecPath)}"
263
+ chain_spec_path = "${relaySpecPath}"
264
+ default_command = "${binDir}/${net.relay.binary.name}"
265
+ default_db_snapshot = "${bundleDir}/snapshots/relay.tgz"
266
+ default_args = ${tomlArgs(relayArgs)}
267
+ ${relayNodes(net.relay.validators)}
268
+ ${parachains
269
+ .map((p) => parachainSection(p, manifest, bundleDir, scriptsDir, enableHop, net, options.binDir))
270
+ .join('')}
271
+ ${customProcesses(scriptsDir, net, present)}${identity}`;
272
+ // Collapse 3+ consecutive blank lines into 2
273
+ return toml.replace(/\n{3,}/g, '\n\n').trim() + '\n';
274
+ }
275
+ export { FORK_PROCESSES };
276
+ //# sourceMappingURL=fork-toml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fork-toml.js","sourceRoot":"","sources":["../src/fork-toml.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,yFAAyF;AACzF,uFAAuF;AACvF,oBAAoB;AACpB,EAAE;AACF,sFAAsF;AACtF,wFAAwF;AACxF,iFAAiF;AACjF,8EAA8E;AAC9E,sFAAsF;AACtF,yCAAyC;AACzC,EAAE;AACF,wFAAwF;AACxF,uFAAuF;AACvF,yEAAyE;AACzE,uFAAuF;AACvF,yFAAyF;AACzF,EAAE;AACF,yFAAyF;AACzF,0FAA0F;AAC1F,wFAAwF;AACxF,EAAE;AACF,qFAAqF;AACrF,yFAAyF;AACzF,yFAAyF;AACzF,wFAAwF;AACxF,yEAAyE;AACzE,EAAE;AACF,yFAAyF;AACzF,uFAAuF;AACvF,qDAAqD;AACrD,EAAE;AACF,oFAAoF;AACpF,uFAAuF;AACvF,0FAA0F;AAC1F,6EAA6E;AAC7E,EAAE;AACF,yFAAyF;AACzF,0FAA0F;AAC1F,yFAAyF;AAEzF,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EACL,UAAU,EACV,KAAK,EACL,SAAS,EACT,eAAe,EACf,SAAS,EACT,UAAU,EACV,QAAQ,EACR,YAAY,GACb,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,eAAe,EAAmB,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAQ9C,kEAAkE;AAClE,EAAE;AACF,uFAAuF;AACvF,oFAAoF;AACpF,yFAAyF;AACzF,+EAA+E;AAC/E,2FAA2F;AAC3F,6FAA6F;AAC7F,0FAA0F;AAC1F,wFAAwF;AACxF,sFAAsF;AACtF,6EAA6E;AAC7E,MAAM,aAAa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;qBACb,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI;yBAC3B,SAAS;iBACjB,QAAQ,CAAC,SAAS,CAAC;EAClC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC;EAChC,UAAU;SACP,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;SAChG,IAAI,CAAC,EAAE,CAAC;EACX,eAAe,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,QAAQ,EAAE,CAAC;IAEvD,6CAA6C;IAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;AACvD,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,54 @@
1
+ export declare const PROFILES: string[];
2
+ /** Read a chain spec without losing precision on u128 genesis values. */
3
+ export declare function readSpec(path: string): any;
4
+ export declare function writeSpec(path: string, spec: unknown): void;
5
+ /** Enable the RFC-163 ECC host functions the People runtime needs during PVF validation. */
6
+ export declare function enableEccRfc163(spec: any): boolean;
7
+ /**
8
+ * Point this network's product contexts at its own namespace.
9
+ *
10
+ * The suffix used to be a runtime constant — `paseo`, baked into the WASM — so a network
11
+ * that wanted its own namespace had to rebuild the runtime. individuality-community#20
12
+ * moved it into a pallet whose value genesis sets, and this writes ours over the `paseo`
13
+ * the People and Asset Hub presets ship.
14
+ *
15
+ * Only those two runtimes carry the pallet. The relay, Bulletin and Web3 Storage emit no
16
+ * such section, and neither does an individuality runtime built before that PR — injecting
17
+ * a key their `RuntimeGenesisConfig` does not know would fail genesis validation outright,
18
+ * so those are reported back as `absent` rather than patched.
19
+ */
20
+ export declare function setNetworkSuffix(spec: any, suffix: string): 'set' | 'unchanged' | 'absent';
21
+ /**
22
+ * Create the People collections at genesis.
23
+ *
24
+ * Both people pallets create their collection in a migration, and a migration only runs on
25
+ * a runtime upgrade — a chain starting from genesis never runs one, so the collections
26
+ * never come into existence. Nothing fails loudly when they are missing: registrations are
27
+ * accepted and then land nowhere, which is what `tests/09-dub-registration.zndsl` sees when
28
+ * a username never reaches search.
29
+ *
30
+ * The preset emits both sections as `false`, and this flips them. A runtime built before
31
+ * the flag existed emits neither, and creating one there is fatal rather than harmless —
32
+ * `chain-spec-builder verify` rejects the whole spec with "unknown field `people`" — so
33
+ * those are left alone. Returns the sections it changed.
34
+ */
35
+ export declare function createPeopleCollections(spec: any): string[];
36
+ /** Put the pre-deployed DotNS contracts into Asset Hub's genesis. */
37
+ export declare function injectDotns(spec: any, dotnsGenesis: unknown, expectedTld?: string): boolean;
38
+ /**
39
+ * Apply the profile's account rules. Returns false when there is nothing to do, so the
40
+ * caller can leave the file untouched.
41
+ *
42
+ * local fund the EVM-mapped dev accounts (Asset Hub only, via fundEvmDev).
43
+ * Substrate dev accounts are already funded by the runtime preset.
44
+ * deployable strip the well-known dev accounts, fund sudo + faucet (+ attester when
45
+ * configured), and set sudo.key. Missing env vars are a hard failure.
46
+ */
47
+ export declare function applyProfile(spec: any, { profile, fundEvmDev, log }: {
48
+ profile: string;
49
+ fundEvmDev?: boolean;
50
+ log?: (msg: string) => void;
51
+ }): boolean;
52
+ /** Read a spec, run the mutators, and write it back only if one of them changed it. */
53
+ export declare function patchSpec(path: string, mutators: ((spec: any) => boolean)[]): boolean;
54
+ //# sourceMappingURL=genesis-patch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-patch.d.ts","sourceRoot":"","sources":["../src/genesis-patch.ts"],"names":[],"mappings":"AAkDA,eAAO,MAAM,QAAQ,UAA0B,CAAC;AAEhD,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAW1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAE3D;AAED,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAQlD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,CAY1F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,EAAE,CAU3D;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAc3F;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,GAAG,EACT,EAAE,OAAO,EAAE,UAAkB,EAAE,GAAc,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GACtH,OAAO,CAkET;AAED,uFAAuF;AACvF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,EAAE,GAAG,OAAO,CAMrF"}
@@ -0,0 +1,223 @@
1
+ // Reading, patching and writing a chain spec.
2
+ //
3
+ // Two things here are easy to get wrong and expensive to notice:
4
+ //
5
+ // 1. Chain specs carry u128 genesis values above Number.MAX_SAFE_INTEGER (25-digit
6
+ // balances on the web3-storage spec). A plain JSON round-trip loses precision and
7
+ // re-emits values >= 1e21 in exponent notation, which the serde-based consumers
8
+ // (zombie-cli, the nodes) reject as "invalid number". Every read below preserves the
9
+ // original source text of unsafe numbers via JSON.rawJSON.
10
+ //
11
+ // 2. Re-serializing a large spec can alter formatting in ways downstream tools
12
+ // (polkadot-omni-node build-spec) trip on, so a spec that needs no change is never
13
+ // rewritten. `patchSpec` writes only when a mutator reports one.
14
+ import fs from 'node:fs';
15
+ // Same balance as the substrate dev accounts (1,000,000 PAS at 10 decimals).
16
+ const BALANCE = 10000000000000000;
17
+ // EVM-mapped SS58 addresses for dev accounts (pallet-revive convention). Computed from:
18
+ // DEV_PHRASE → sr25519 derive → keccak256(pubkey) → H160 → [h160 ++ 0xEE*12] → SS58.
19
+ // Applied to Asset Hub only; the other chains have no pallet-revive, so these would be
20
+ // inert pre-funded AccountId32s polluting their genesis state.
21
+ const EVM_DEV_ACCOUNTS = [
22
+ '5FTZ6n1wY3GBqEZ2DWEdspbTarvRnp8DM8x2YXbWubu7JN98', // Alice 0x9621dde6…
23
+ '5DZ4ZRZVipXuQ5BtamrqwymLZggk6J1iLW6LvGVGrJjVSyFj', // Bob 0x41dccbd4…
24
+ '5HBDBSu2q6fbnDR6djKKJ2WbJQt3orNanKe8QEnou8FSYopF', // Charlie 0xe2235a2f…
25
+ '5FrTVzyowexWhZ4hbomCbKvciky17fneKbY7Krt9yLNtJsLg', // Dave 0xa799a942…
26
+ '5Cnxtrz86WmZfXByZTS4HrAAvU7SKbs3uDQgKdKeF2TPu8Tt', // Eve 0x203aedc6…
27
+ '5CpqYNJLHzaYFttQtp3u3aUKM2dW5JXmJxTiuZvPMymbMzgX', // Ferdie 0x21a8aa80…
28
+ '5Ha8yXQgvWcvpFya1BmjtJX386xUskafNTzU4Zmb6B3UwYd9', // Hardhat 0xf39Fd6e5…
29
+ ];
30
+ // Well-known //Alice…//Ferdie SS58 accounts (+ stash variants) baked into the
31
+ // `development` / `local_testnet` runtime presets.
32
+ const DEV_SS58 = new Set([
33
+ '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
34
+ '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
35
+ '5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y',
36
+ '5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy',
37
+ '5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw',
38
+ '5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL',
39
+ '5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY',
40
+ '5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc',
41
+ '5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT',
42
+ '5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8',
43
+ '5FCfAonRZgTFrTd9HREEyeJjDpT397KMzizE6T3DvebLFE7n',
44
+ '5CRmqmsiNFExV6VbdmPJViVxrWmkaXXvBrSX8oqBT8R9vmWk',
45
+ ]);
46
+ export const PROFILES = ['local', 'deployable'];
47
+ /** Read a chain spec without losing precision on u128 genesis values. */
48
+ export function readSpec(path) {
49
+ if (typeof JSON.rawJSON !== 'function') {
50
+ throw new Error('needs Node >= 21 (JSON.rawJSON) to preserve u128 genesis values');
51
+ }
52
+ // The three-argument reviver (with `context.source`) is Node >= 21; the lib types this
53
+ // project builds against still declare the two-argument form, hence the cast.
54
+ const reviver = (key, value, ctx) => typeof value === 'number' && !Number.isSafeInteger(value)
55
+ ? JSON.rawJSON(ctx.source)
56
+ : value;
57
+ return JSON.parse(fs.readFileSync(path, 'utf8'), reviver);
58
+ }
59
+ export function writeSpec(path, spec) {
60
+ fs.writeFileSync(path, JSON.stringify(spec, null, 2) + '\n');
61
+ }
62
+ /** Enable the RFC-163 ECC host functions the People runtime needs during PVF validation. */
63
+ export function enableEccRfc163(spec) {
64
+ const params = spec.genesis?.runtimeGenesis?.patch?.configuration?.config;
65
+ if (!params)
66
+ throw new Error('no genesis.runtimeGenesis.patch.configuration.config');
67
+ const existing = (params.executor_params ?? []).filter((p) => p.EnabledHostFunction !== 'EccRfc163');
68
+ params.executor_params = [...existing, { EnabledHostFunction: 'EccRfc163' }];
69
+ return true;
70
+ }
71
+ /**
72
+ * Point this network's product contexts at its own namespace.
73
+ *
74
+ * The suffix used to be a runtime constant — `paseo`, baked into the WASM — so a network
75
+ * that wanted its own namespace had to rebuild the runtime. individuality-community#20
76
+ * moved it into a pallet whose value genesis sets, and this writes ours over the `paseo`
77
+ * the People and Asset Hub presets ship.
78
+ *
79
+ * Only those two runtimes carry the pallet. The relay, Bulletin and Web3 Storage emit no
80
+ * such section, and neither does an individuality runtime built before that PR — injecting
81
+ * a key their `RuntimeGenesisConfig` does not know would fail genesis validation outright,
82
+ * so those are reported back as `absent` rather than patched.
83
+ */
84
+ export function setNetworkSuffix(spec, suffix) {
85
+ const patch = spec.genesis?.runtimeGenesis?.patch;
86
+ if (!patch)
87
+ throw new Error('no genesis.runtimeGenesis.patch');
88
+ if (!patch.networkSuffix)
89
+ return 'absent';
90
+ const bytes = [...Buffer.from(suffix, 'utf8')];
91
+ const current = patch.networkSuffix.networkSuffix;
92
+ if (Array.isArray(current) && current.length === bytes.length && current.every((b, i) => b === bytes[i])) {
93
+ return 'unchanged';
94
+ }
95
+ patch.networkSuffix.networkSuffix = bytes;
96
+ return 'set';
97
+ }
98
+ /**
99
+ * Create the People collections at genesis.
100
+ *
101
+ * Both people pallets create their collection in a migration, and a migration only runs on
102
+ * a runtime upgrade — a chain starting from genesis never runs one, so the collections
103
+ * never come into existence. Nothing fails loudly when they are missing: registrations are
104
+ * accepted and then land nowhere, which is what `tests/09-dub-registration.zndsl` sees when
105
+ * a username never reaches search.
106
+ *
107
+ * The preset emits both sections as `false`, and this flips them. A runtime built before
108
+ * the flag existed emits neither, and creating one there is fatal rather than harmless —
109
+ * `chain-spec-builder verify` rejects the whole spec with "unknown field `people`" — so
110
+ * those are left alone. Returns the sections it changed.
111
+ */
112
+ export function createPeopleCollections(spec) {
113
+ const patch = spec.genesis?.runtimeGenesis?.patch;
114
+ if (!patch)
115
+ throw new Error('no genesis.runtimeGenesis.patch');
116
+ const changed = [];
117
+ for (const section of ['people', 'peopleLite']) {
118
+ if (!patch[section] || patch[section].createCollection === true)
119
+ continue;
120
+ patch[section].createCollection = true;
121
+ changed.push(section);
122
+ }
123
+ return changed;
124
+ }
125
+ /** Put the pre-deployed DotNS contracts into Asset Hub's genesis. */
126
+ export function injectDotns(spec, dotnsGenesis, expectedTld) {
127
+ const patch = spec.genesis?.runtimeGenesis?.patch;
128
+ if (!patch)
129
+ throw new Error('no genesis.runtimeGenesis.patch');
130
+ const g = dotnsGenesis;
131
+ if (!g || g.accounts === undefined)
132
+ throw new Error('dotns genesis has no accounts');
133
+ // dotns stamps the TLD into the artifact so a consumer can refuse a registry baked for a
134
+ // different namespace — a rename cannot defeat it. Files predating the field pass.
135
+ if (expectedTld && g.tld && g.tld !== expectedTld) {
136
+ throw new Error(`dotns genesis is for TLD .${g.tld}, this network wants .${expectedTld}`);
137
+ }
138
+ // Only accounts: the artifact carries siblings (tld) that pallet-revive's GenesisConfig
139
+ // does not know, and an unknown field fails chain-spec construction.
140
+ patch.revive = { accounts: g.accounts };
141
+ return true;
142
+ }
143
+ /**
144
+ * Apply the profile's account rules. Returns false when there is nothing to do, so the
145
+ * caller can leave the file untouched.
146
+ *
147
+ * local fund the EVM-mapped dev accounts (Asset Hub only, via fundEvmDev).
148
+ * Substrate dev accounts are already funded by the runtime preset.
149
+ * deployable strip the well-known dev accounts, fund sudo + faucet (+ attester when
150
+ * configured), and set sudo.key. Missing env vars are a hard failure.
151
+ */
152
+ export function applyProfile(spec, { profile, fundEvmDev = false, log = () => { } }) {
153
+ if (!PROFILES.includes(profile)) {
154
+ throw new Error(`unknown profile "${profile}" (expected ${PROFILES.join(' or ')})`);
155
+ }
156
+ // In local profile the only possible change is funding EVM dev accounts.
157
+ if (profile === 'local' && !fundEvmDev)
158
+ return false;
159
+ const patch = spec.genesis?.runtimeGenesis?.patch;
160
+ if (!patch)
161
+ throw new Error('no genesis.runtimeGenesis.patch');
162
+ if (profile === 'local') {
163
+ const balances = patch.balances?.balances;
164
+ if (!balances)
165
+ return false;
166
+ const existing = new Set(balances.map(([addr]) => addr));
167
+ const added = EVM_DEV_ACCOUNTS.filter((a) => !existing.has(a));
168
+ for (const addr of added)
169
+ balances.push([addr, BALANCE]);
170
+ if (added.length)
171
+ log(` [local] Funded ${added.length} EVM dev account(s)`);
172
+ return added.length > 0;
173
+ }
174
+ const sudo = process.env.PPN_SUDO_SS58;
175
+ const faucet = process.env.PPN_FAUCET_SS58;
176
+ if (!sudo || !faucet) {
177
+ throw new Error('deployable profile requires PPN_SUDO_SS58 and PPN_FAUCET_SS58');
178
+ }
179
+ // A storage provider must be able to cover its stake at genesis, so its account
180
+ // survives the dev-account strip even when it is a well-known one.
181
+ const protectedAddrs = new Set((patch.storageProvider?.providers ?? []).map((p) => p.account));
182
+ patch.balances ??= {};
183
+ if (!Array.isArray(patch.balances.balances))
184
+ patch.balances.balances = [];
185
+ const before = patch.balances.balances.length;
186
+ patch.balances.balances = patch.balances.balances.filter(([addr]) => !DEV_SS58.has(addr) || protectedAddrs.has(addr));
187
+ const removed = before - patch.balances.balances.length;
188
+ const kept = [...protectedAddrs].filter((a) => DEV_SS58.has(a)).length;
189
+ // The attestation-allowance recipient is funded too when configured: it is the account
190
+ // the identity backend signs PeopleLite.attest with, so it pays those fees. Unfunded,
191
+ // registrations are accepted and then never land. Optional — a deployment without the
192
+ // identity backend needs no such account.
193
+ const allowance = process.env.PPN_ALLOWANCE_SS58;
194
+ for (const addr of [sudo, faucet, ...(allowance ? [allowance] : [])]) {
195
+ if (!patch.balances.balances.some(([a]) => a === addr)) {
196
+ patch.balances.balances.push([addr, BALANCE]);
197
+ }
198
+ }
199
+ log(` [deployable] Removed ${removed} dev account(s)` +
200
+ (kept > 0 ? ` (kept ${kept} storage provider(s))` : '') +
201
+ `; funded sudo + faucet${allowance ? ' + attester' : ''}`);
202
+ // Only override sudo.key when the preset emits a sudo section — injecting one on a
203
+ // chain with no sudo pallet (the paseo-local relay) fails runtime genesis validation.
204
+ if (patch.sudo) {
205
+ patch.sudo.key = sudo;
206
+ log(` [deployable] Set sudo key to ${sudo}`);
207
+ }
208
+ else {
209
+ log(' [deployable] No sudo section in preset — skipping sudo key override');
210
+ }
211
+ return true;
212
+ }
213
+ /** Read a spec, run the mutators, and write it back only if one of them changed it. */
214
+ export function patchSpec(path, mutators) {
215
+ const spec = readSpec(path);
216
+ let changed = false;
217
+ for (const mutate of mutators)
218
+ changed = mutate(spec) || changed;
219
+ if (changed)
220
+ writeSpec(path, spec);
221
+ return changed;
222
+ }
223
+ //# sourceMappingURL=genesis-patch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genesis-patch.js","sourceRoot":"","sources":["../src/genesis-patch.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,iEAAiE;AACjE,EAAE;AACF,mFAAmF;AACnF,qFAAqF;AACrF,mFAAmF;AACnF,wFAAwF;AACxF,8DAA8D;AAC9D,EAAE;AACF,+EAA+E;AAC/E,sFAAsF;AACtF,oEAAoE;AAEpE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,6EAA6E;AAC7E,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAElC,wFAAwF;AACxF,qFAAqF;AACrF,uFAAuF;AACvF,+DAA+D;AAC/D,MAAM,gBAAgB,GAAG;IACvB,kDAAkD,EAAE,sBAAsB;IAC1E,kDAAkD,EAAE,sBAAsB;IAC1E,kDAAkD,EAAE,sBAAsB;IAC1E,kDAAkD,EAAE,sBAAsB;IAC1E,kDAAkD,EAAE,sBAAsB;IAC1E,kDAAkD,EAAE,sBAAsB;IAC1E,kDAAkD,EAAE,sBAAsB;CAC3E,CAAC;AAEF,8EAA8E;AAC9E,mDAAmD;AACnD,MAAM,QAAQ,GAAG,IAAI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AAE,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC;IACjE,IAAI,OAAO;QAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnC,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,19 @@
1
+ export { parseOverride, overridesFromEnv, mergeOverrides, applyOverrides, overriddenKeys, effectiveOverrides, overrideReleaseKey, type Override, type OverrideSet, } from './overrides.js';
2
+ export { repoRoot, packageRoot, workspaceRoot, networksDirs } from './repo-root.js';
3
+ export * from './networks.js';
4
+ export * from './load.js';
5
+ export { readEnvFile } from './env-file.js';
6
+ export * from './types.js';
7
+ export { pinsProducts } from './fork-toml.js';
8
+ export * from './bundle.js';
9
+ export * from './genesis-patch.js';
10
+ export { generateToml, calcValidatorCount, VALID_PARACHAINS, CHAIN_ARGS, PORTS, P2P_PORTS, paraIds, RELAY_BASE_PORT, VALIDATORS, POPULAR_LOG_TARGETS, LOG_LEVELS, buildArgs, addMissing, tomlArgs, requiredPort, } from './toml-generator.js';
11
+ export { nginxRoutes } from './nginx-routes.js';
12
+ export { dashboardModel, DASHBOARD_SCHEMA_VERSION, } from './dashboard-model.js';
13
+ export type { DashboardModel, DashboardChain, DashboardEndpoint, } from './dashboard-model.js';
14
+ export { hrmpChannels } from './toml-generator.js';
15
+ export type { HrmpChannel } from './toml-generator.js';
16
+ export { generateForkToml, FORK_PROCESSES } from './fork-toml.js';
17
+ export type { GenerateForkTomlOptions } from './fork-toml.js';
18
+ export { dubCustomProcesses, ALICE_SS58, BOB_SS58 } from './dub.js';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,QAAQ,EACb,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAKpF,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,KAAK,EACL,SAAS,EACT,OAAO,EACP,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACR,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ export { parseOverride, overridesFromEnv, mergeOverrides, applyOverrides, overriddenKeys, effectiveOverrides, overrideReleaseKey, } from './overrides.js';
2
+ export { repoRoot, packageRoot, workspaceRoot, networksDirs } from './repo-root.js';
3
+ // The public surface of @parity/ppn-network-config. Consumers import from here, never from a
4
+ // deep path — that is what keeps the internals free to move (and it is how the shell
5
+ // scripts once ended up welded to spawner/dist/fork/chains.js).
6
+ export * from './networks.js';
7
+ export * from './load.js';
8
+ export { readEnvFile } from './env-file.js';
9
+ export * from './types.js';
10
+ export { pinsProducts } from './fork-toml.js';
11
+ export * from './bundle.js';
12
+ export * from './genesis-patch.js';
13
+ export { generateToml, calcValidatorCount, VALID_PARACHAINS, CHAIN_ARGS, PORTS, P2P_PORTS, paraIds, RELAY_BASE_PORT, VALIDATORS, POPULAR_LOG_TARGETS, LOG_LEVELS, buildArgs, addMissing, tomlArgs, requiredPort, } from './toml-generator.js';
14
+ export { nginxRoutes } from './nginx-routes.js';
15
+ export { dashboardModel, DASHBOARD_SCHEMA_VERSION, } from './dashboard-model.js';
16
+ export { hrmpChannels } from './toml-generator.js';
17
+ export { generateForkToml, FORK_PROCESSES } from './fork-toml.js';
18
+ export { dubCustomProcesses, ALICE_SS58, BOB_SS58 } from './dub.js';
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GAGnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACpF,6FAA6F;AAC7F,qFAAqF;AACrF,gEAAgE;AAEhE,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,KAAK,EACL,SAAS,EACT,OAAO,EACP,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACR,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}