@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
package/dist/dub.d.ts ADDED
@@ -0,0 +1,98 @@
1
+ /** Well-known dev account. Also what PPN grants attestation allowance to. */
2
+ export declare const ALICE_SS58 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
3
+ /**
4
+ * The inviter, and deliberately not the attester.
5
+ *
6
+ * Upstream's rule is "one inviter key = one nonce lane; never scale it". Running the ticket
7
+ * writers on the same account as the chain writer breaks that rule across services
8
+ * instead of across replicas, and the result is not subtle: invite-tickets-pool submits a
9
+ * batch every ~30s for ever, so the writer's registration never wins a nonce. It retries
10
+ * through `Transaction is outdated`, `priority too low` and `rendered invalid by another
11
+ * extrinsic`, then gives up — and a username that was accepted with a 202 never lands.
12
+ *
13
+ * Bob gets its own lane. Kept equal to INVITER_ADDRESS so batches are signed directly rather
14
+ * than wrapped in Proxy.proxy, which would need a proxy registration on People Chain.
15
+ */
16
+ export declare const BOB_SS58 = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty";
17
+ export interface DubPorts {
18
+ postgres: number;
19
+ people: number;
20
+ /** Asset Hub, for the DotNS gateway surface. */
21
+ assetHub: number;
22
+ /**
23
+ * The one port the API is served on. Named `gateway` because that is the origin clients
24
+ * already use (8092) — all-in-one replaced the gateway process without moving the address.
25
+ */
26
+ gateway: number;
27
+ }
28
+ export interface DubService {
29
+ /** Process name in the zombienet config, and the log directory it gets. */
30
+ name: string;
31
+ /** The `--role` this process runs; one binary, eight roles plus all-in-one. */
32
+ role: string;
33
+ /** Non-secret environment, emitted into the TOML. */
34
+ env: Record<string, string>;
35
+ }
36
+ /**
37
+ * The databases the cluster must hold, one per service that owns state.
38
+ *
39
+ * v0.2.0 split a bare `DATABASE_URL` — read by eight call sites naming four different
40
+ * Postgres instances — into namespaced keys, so a misrouted value can no longer silently hit
41
+ * another service's data. v0.3.0 removed the fourth of them with the dim-tickets service.
42
+ *
43
+ * `identity` keeps its physical name while the config key that carries it becomes
44
+ * `DEVICE_ATTESTATION_DATABASE_URL`. Nothing upstream requires the database be *named*
45
+ * device_attestation — the URL is ours to build, and upstream's own runbook offers keeping the
46
+ * old names as the no-downtime path — whereas renaming it would hand every existing cluster a
47
+ * choice between an authentication failure and losing the rows already in it.
48
+ */
49
+ export declare const DUB_DATABASES: readonly ["identity", "username_indexer", "invite_tickets"];
50
+ /**
51
+ * Postgres connection string for one service's database.
52
+ *
53
+ * One cluster, a database per service. Upstream's compose file runs a separate
54
+ * cluster each so they can deploy independently, which buys nothing locally.
55
+ */
56
+ export declare function dubDatabaseUrl(database: string, postgresPort: number): string;
57
+ /**
58
+ * The People Chain endpoint every backend service must be given.
59
+ *
60
+ * Never omit this. device-attestation-api and its chain writer do not fail when
61
+ * PEOPLE_RPC_URL is unset — they silently default to the *public* Paseo endpoint
62
+ * (identity-service/src/config.rs:215, chain/writer.rs:91), which would point a
63
+ * signing writer at a network nobody intended. Only username-indexer treats it
64
+ * as required.
65
+ */
66
+ export declare function peopleRpcUrl(peoplePort: number): string;
67
+ /**
68
+ * The four processes PPN runs, with their non-secret environment.
69
+ *
70
+ * Required-variable sets were derived by booting the real binary with an empty environment and
71
+ * adding what it demanded, rather than read off the source — the crates phrase their errors
72
+ * differently and `JWT_ED25519_SECRET` is required without being reported as missing.
73
+ *
74
+ * `attesterAccount` is an SS58 — public, the same class of value the deployable profile bakes
75
+ * into genesis — so it belongs in the TOML. It stays equal to the writer's signing key on
76
+ * purpose: the writer derives proxying from whether the two differ, and equal means it attests
77
+ * directly, so People Chain needs no proxy registration.
78
+ */
79
+ export declare function dubServices(ports: DubPorts, attesterAccount?: string, inviterAccount?: string): DubService[];
80
+ /**
81
+ * The `[[custom_processes]]` blocks for Postgres and the backend services.
82
+ *
83
+ * Every service goes through service.sh rather than naming its binary directly.
84
+ * They do not crash: each one connects to Postgres and applies its migrations
85
+ * before anything else, and exits non-zero when that connection is not available
86
+ * ("pool timed out while waiting for an open connection"). Since
87
+ * custom_processes have no ordering, a service can reach that point before
88
+ * dub-postgres is accepting connections, so something has to wait for the
89
+ * database and start it again afterwards.
90
+ *
91
+ * zombienet has no restart policy to lean on here — the custom_process schema is
92
+ * name/command/image/args/env — which is why ipfs-daemon.sh hand-rolls the same
93
+ * loop. If zombienet grew one (a restart/backoff field, or a readiness gate
94
+ * between processes), the loop in service.sh could go, leaving it to do only
95
+ * what stays outside the config: read the deploy-time secrets.
96
+ */
97
+ export declare function dubCustomProcesses(ports: DubPorts, attesterAccount?: string, scriptsDir?: string): string;
98
+ //# sourceMappingURL=dub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dub.d.ts","sourceRoot":"","sources":["../src/dub.ts"],"names":[],"mappings":"AA4BA,6EAA6E;AAC7E,eAAO,MAAM,UAAU,qDAAqD,CAAC;AAE7E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,qDAAqD,CAAC;AAE3E,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,6DAA8D,CAAC;AAEzF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,EACf,eAAe,GAAE,MAAmB,EACpC,cAAc,GAAE,MAAiB,GAChC,UAAU,EAAE,CAoEd;AASD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,QAAQ,EACf,eAAe,CAAC,EAAE,MAAM,EAGxB,UAAU,GAAE,MAAsB,GACjC,MAAM,CAoBR"}
package/dist/dub.js ADDED
@@ -0,0 +1,202 @@
1
+ // Device uniqueness backend wiring for the generated zombienet config.
2
+ //
3
+ // device-uniqueness-backend v0.2.0 replaced its ten binaries with one, selected by `--role`,
4
+ // and namespaced the per-service config keys. PPN runs the topology that release added for
5
+ // exactly this case: `--role all-in-one`, which serves every HTTP surface on one port with the
6
+ // route table compiled in, plus the single-instance workers, which are never merged because
7
+ // each owns a Postgres lease and a nonce lane. Upstream calls that pairing the small topology
8
+ // and is explicit that it is all-in-one PLUS the workers, never all-in-one alone.
9
+ //
10
+ // v0.3.0 renamed the binary to `dub` and the identity service to device-attestation — role
11
+ // names, `DEVICE_ATTESTATION_DATABASE_URL`, the lot — and deleted dim-tickets outright. Its
12
+ // role gate refuses a role it does not know, so a stale name here is a boot failure rather
13
+ // than a service quietly missing; and the pre-namespacing config keys it used to accept with a
14
+ // WARN now fail at boot too.
15
+ //
16
+ // That deleted a liability: PPN used to reconstruct the edge's route table by hand in
17
+ // scripts/dub/routes.mjs, mirroring upstream's Caddyfile, and ran two of six services so
18
+ // the rest of the API simply did not exist locally. all-in-one carries the real table and the
19
+ // whole surface, including /docs and an aggregate /readyz.
20
+ //
21
+ // See docs/DEVICE-UNIQUENESS-BACKEND.md. Everything non-secret is emitted into the TOML
22
+ // as custom_process `env`, so the values a service runs with are visible in a
23
+ // diff of zombienet-configs/local-dev.toml rather than buried in a shell
24
+ // default. Secrets deliberately do NOT appear here — scripts/dub/service.sh
25
+ // reads those from /etc/ppn/secrets.env at exec time, matching the boundary the
26
+ // deployable profile already draws: public identifiers at generate time,
27
+ // private keys at runtime only.
28
+ /** Well-known dev account. Also what PPN grants attestation allowance to. */
29
+ export const ALICE_SS58 = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
30
+ /**
31
+ * The inviter, and deliberately not the attester.
32
+ *
33
+ * Upstream's rule is "one inviter key = one nonce lane; never scale it". Running the ticket
34
+ * writers on the same account as the chain writer breaks that rule across services
35
+ * instead of across replicas, and the result is not subtle: invite-tickets-pool submits a
36
+ * batch every ~30s for ever, so the writer's registration never wins a nonce. It retries
37
+ * through `Transaction is outdated`, `priority too low` and `rendered invalid by another
38
+ * extrinsic`, then gives up — and a username that was accepted with a 202 never lands.
39
+ *
40
+ * Bob gets its own lane. Kept equal to INVITER_ADDRESS so batches are signed directly rather
41
+ * than wrapped in Proxy.proxy, which would need a proxy registration on People Chain.
42
+ */
43
+ export const BOB_SS58 = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
44
+ /**
45
+ * The databases the cluster must hold, one per service that owns state.
46
+ *
47
+ * v0.2.0 split a bare `DATABASE_URL` — read by eight call sites naming four different
48
+ * Postgres instances — into namespaced keys, so a misrouted value can no longer silently hit
49
+ * another service's data. v0.3.0 removed the fourth of them with the dim-tickets service.
50
+ *
51
+ * `identity` keeps its physical name while the config key that carries it becomes
52
+ * `DEVICE_ATTESTATION_DATABASE_URL`. Nothing upstream requires the database be *named*
53
+ * device_attestation — the URL is ours to build, and upstream's own runbook offers keeping the
54
+ * old names as the no-downtime path — whereas renaming it would hand every existing cluster a
55
+ * choice between an authentication failure and losing the rows already in it.
56
+ */
57
+ export const DUB_DATABASES = ['identity', 'username_indexer', 'invite_tickets'];
58
+ /**
59
+ * Postgres connection string for one service's database.
60
+ *
61
+ * One cluster, a database per service. Upstream's compose file runs a separate
62
+ * cluster each so they can deploy independently, which buys nothing locally.
63
+ */
64
+ export function dubDatabaseUrl(database, postgresPort) {
65
+ return `postgres://identity@127.0.0.1:${postgresPort}/${database}`;
66
+ }
67
+ /**
68
+ * The People Chain endpoint every backend service must be given.
69
+ *
70
+ * Never omit this. device-attestation-api and its chain writer do not fail when
71
+ * PEOPLE_RPC_URL is unset — they silently default to the *public* Paseo endpoint
72
+ * (identity-service/src/config.rs:215, chain/writer.rs:91), which would point a
73
+ * signing writer at a network nobody intended. Only username-indexer treats it
74
+ * as required.
75
+ */
76
+ export function peopleRpcUrl(peoplePort) {
77
+ const url = `ws://127.0.0.1:${peoplePort}`;
78
+ if (!url.startsWith('ws://127.0.0.1:')) {
79
+ throw new Error(`dub: refusing non-loopback PEOPLE_RPC_URL: ${url}`);
80
+ }
81
+ return url;
82
+ }
83
+ /**
84
+ * The four processes PPN runs, with their non-secret environment.
85
+ *
86
+ * Required-variable sets were derived by booting the real binary with an empty environment and
87
+ * adding what it demanded, rather than read off the source — the crates phrase their errors
88
+ * differently and `JWT_ED25519_SECRET` is required without being reported as missing.
89
+ *
90
+ * `attesterAccount` is an SS58 — public, the same class of value the deployable profile bakes
91
+ * into genesis — so it belongs in the TOML. It stays equal to the writer's signing key on
92
+ * purpose: the writer derives proxying from whether the two differ, and equal means it attests
93
+ * directly, so People Chain needs no proxy registration.
94
+ */
95
+ export function dubServices(ports, attesterAccount = ALICE_SS58, inviterAccount = BOB_SS58) {
96
+ const rpc = peopleRpcUrl(ports.people);
97
+ const db = (name) => dubDatabaseUrl(name, ports.postgres);
98
+ // Every role reads its own database key, and all-in-one reads all of them, so the whole set
99
+ // is given to every process. Cheaper than three near-identical env blocks, and it means
100
+ // adding a role later needs no thought about which key it happens to want.
101
+ //
102
+ // `DEVICE_ATTESTATION_DATABASE_URL` was `IDENTITY_DATABASE_URL` until v0.3.0, which dropped
103
+ // the old name — along with the bare `DATABASE_URL` before it — from a deprecation WARN to a
104
+ // boot failure that names the key it wanted.
105
+ const databases = {
106
+ DEVICE_ATTESTATION_DATABASE_URL: db('identity'),
107
+ INDEXER_DATABASE_URL: db('username_indexer'),
108
+ INVITE_TICKETS_DATABASE_URL: db('invite_tickets'),
109
+ };
110
+ // The Prometheus exporter binds before config validation, so leaving it on means five
111
+ // processes fight for 9090 and a role crash-looping on bad config still holds it. Nothing
112
+ // scrapes them locally.
113
+ const common = {
114
+ ...databases,
115
+ METRICS_ENABLED: 'false',
116
+ RUST_LOG: 'info',
117
+ PEOPLE_RPC_URL: rpc,
118
+ // westend2 | paseo | polkadot. PPN's relay is paseo, and the value is required rather
119
+ // than defaulted — a wrong one would have the ticket services address another network.
120
+ PEOPLE_NETWORK: 'paseo',
121
+ ATTESTER_ACCOUNT: attesterAccount,
122
+ // Public counterpart of INVITER_SIGNER_SURI, which service.sh supplies. Equal to that
123
+ // signing key's own account on purpose: the ticket services wrap a batch in
124
+ // Proxy.proxy(real = INVITER_ADDRESS) only when the two differ. See BOB_SS58 for why it
125
+ // is not the attester.
126
+ INVITER_ADDRESS: inviterAccount,
127
+ };
128
+ return [
129
+ {
130
+ // All five HTTP surfaces on one port: device-attestation-api, username-indexer,
131
+ // invite-tickets-api, turn-api and notify-relay, plus /docs and an aggregate /readyz.
132
+ // (Six until v0.3.0 deleted dim-tickets-api.) Upstream calls this "not a deployable
133
+ // workload" because it holds every secret in one address space — which is exactly right
134
+ // for a local development network and is the case the release added it for.
135
+ name: 'dub-api',
136
+ role: 'all-in-one',
137
+ env: {
138
+ ...common,
139
+ BIND_ADDR: `127.0.0.1:${ports.gateway}`,
140
+ ASSET_HUB_RPC_URL: `ws://127.0.0.1:${ports.assetHub}`,
141
+ // turn-api requires a realm and has no default. Public, so it belongs here; the
142
+ // signing secret it pairs with comes from service.sh.
143
+ TURN_REALM: 'previewnet.local',
144
+ },
145
+ },
146
+ {
147
+ name: 'device-attestation-chain-writer',
148
+ role: 'device-attestation-chain-writer',
149
+ env: { ...common },
150
+ },
151
+ {
152
+ // Idles unless QUEUE_ENABLED=true. Run anyway so the local topology matches production
153
+ // and the flag is simply flippable.
154
+ name: 'registration-queue',
155
+ role: 'registration-queue',
156
+ env: { ...common },
157
+ },
158
+ { name: 'invite-tickets-pool', role: 'invite-tickets-pool', env: { ...common } },
159
+ ];
160
+ }
161
+ function tomlEnv(env) {
162
+ const entries = Object.entries(env).map(([name, value]) => ` { name = "${name}", value = "${value}" },`);
163
+ return `env = [\n${entries.join('\n')}\n]`;
164
+ }
165
+ /**
166
+ * The `[[custom_processes]]` blocks for Postgres and the backend services.
167
+ *
168
+ * Every service goes through service.sh rather than naming its binary directly.
169
+ * They do not crash: each one connects to Postgres and applies its migrations
170
+ * before anything else, and exits non-zero when that connection is not available
171
+ * ("pool timed out while waiting for an open connection"). Since
172
+ * custom_processes have no ordering, a service can reach that point before
173
+ * dub-postgres is accepting connections, so something has to wait for the
174
+ * database and start it again afterwards.
175
+ *
176
+ * zombienet has no restart policy to lean on here — the custom_process schema is
177
+ * name/command/image/args/env — which is why ipfs-daemon.sh hand-rolls the same
178
+ * loop. If zombienet grew one (a restart/backoff field, or a readiness gate
179
+ * between processes), the loop in service.sh could go, leaving it to do only
180
+ * what stays outside the config: read the deploy-time secrets.
181
+ */
182
+ export function dubCustomProcesses(ports, attesterAccount,
183
+ // Genesis mode emits the {{SCRIPTS}} placeholder that zombie-compat expands;
184
+ // fork mode writes a standalone TOML with absolute paths already resolved.
185
+ scriptsDir = '{{SCRIPTS}}') {
186
+ const wait = `127.0.0.1:${ports.postgres}`;
187
+ // zombienet validates custom_process args as CLI arguments — each must parse
188
+ // as a flag or --key=value, so bare positionals are rejected outright.
189
+ const blocks = dubServices(ports, attesterAccount).map((svc) => `
190
+ [[custom_processes]]
191
+ name = "${svc.name}"
192
+ command = "${scriptsDir}/dub/service.sh"
193
+ args = ["--role=${svc.role}", "--wait-for=${wait}"]
194
+ ${tomlEnv(svc.env)}
195
+ `);
196
+ return `
197
+ [[custom_processes]]
198
+ name = "dub-postgres"
199
+ command = "${scriptsDir}/dub/postgres.sh"
200
+ ${blocks.join('')}`;
201
+ }
202
+ //# sourceMappingURL=dub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dub.js","sourceRoot":"","sources":["../src/dub.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,6FAA6F;AAC7F,2FAA2F;AAC3F,+FAA+F;AAC/F,4FAA4F;AAC5F,8FAA8F;AAC9F,kFAAkF;AAClF,EAAE;AACF,2FAA2F;AAC3F,4FAA4F;AAC5F,2FAA2F;AAC3F,+FAA+F;AAC/F,6BAA6B;AAC7B,EAAE;AACF,sFAAsF;AACtF,yFAAyF;AACzF,8FAA8F;AAC9F,2DAA2D;AAC3D,EAAE;AACF,wFAAwF;AACxF,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,gFAAgF;AAChF,yEAAyE;AACzE,gCAAgC;AAEhC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,UAAU,GAAG,kDAAkD,CAAC;AAE7E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,kDAAkD,CAAC;AAuB3E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,kBAAkB,EAAE,gBAAgB,CAAU,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,YAAoB;IACnE,OAAO,iCAAiC,YAAY,IAAI,QAAQ,EAAE,CAAC;AACrE,CAAC;AAED;;;;;;;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D,CAAC,GAAG,EAAE,EAAE,CAAC;;UAEH,GAAG,CAAC,IAAI;aACL,UAAU;kBACL,GAAG,CAAC,IAAI,kBAAkB,IAAI;EAC9C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;CACjB,CACE,CAAC;IAEF,OAAO;;;aAGI,UAAU;EACrB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Parse a `KEY=value` shell file. Handles quoted values and `${VAR:-default}`, which
3
+ * `config/versions.env` uses so the environment can override a pin.
4
+ */
5
+ export declare function readEnvFile(path: string, env?: NodeJS.ProcessEnv): Record<string, string>;
6
+ //# sourceMappingURL=env-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../src/env-file.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmBtG"}
@@ -0,0 +1,30 @@
1
+ // Reading config/*.env — shell files that Make, the scripts and this code all source.
2
+ //
3
+ // They stay shell-syntax because the Makefile and the zombienet wrappers `source` them
4
+ // directly; this reads the same files rather than keeping a second copy of their values.
5
+ import fs from 'node:fs';
6
+ /**
7
+ * Parse a `KEY=value` shell file. Handles quoted values and `${VAR:-default}`, which
8
+ * `config/versions.env` uses so the environment can override a pin.
9
+ */
10
+ export function readEnvFile(path, env = process.env) {
11
+ const out = {};
12
+ for (const line of fs.readFileSync(path, 'utf-8').split('\n')) {
13
+ const trimmed = line.trim();
14
+ if (!trimmed || trimmed.startsWith('#'))
15
+ continue;
16
+ const eq = trimmed.indexOf('=');
17
+ if (eq <= 0)
18
+ continue;
19
+ const key = trimmed.slice(0, eq).replace(/^export\s+/, '').trim();
20
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key))
21
+ continue;
22
+ let value = trimmed.slice(eq + 1).trim().replace(/^["']|["']$/g, '');
23
+ // ${VAR:-default} and ${VAR}. An already-set environment variable wins, which is how
24
+ // `PPN_TAG=v1 make fetch` overrides a pin.
25
+ value = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g, (_, name, fallback) => env[name] ?? fallback ?? '');
26
+ out[key] = value;
27
+ }
28
+ return out;
29
+ }
30
+ //# sourceMappingURL=env-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-file.js","sourceRoot":"","sources":["../src/env-file.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,EAAE;AACF,uFAAuF;AACvF,yFAAyF;AAEzF,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,MAAyB,OAAO,CAAC,GAAG;IAC5E,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAClD,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,EAAE,IAAI,CAAC;YAAE,SAAS;QACtB,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAClE,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,SAAS;QAEpD,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QACrE,qFAAqF;QACrF,2CAA2C;QAC3C,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,+CAA+C,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAC3F,GAAG,CAAC,IAAI,CAAC,IAAI,QAAQ,IAAI,EAAE,CAC5B,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type NetworkDef } from './networks.js';
2
+ export type { ForkManifest, ForkManifestChain } from './bundle.js';
3
+ declare const FORK_PROCESSES: string[];
4
+ /**
5
+ * Whether this spawn imports the network's DotNS products.
6
+ *
7
+ * The descriptor decides and PRODUCT_SYNC overrides it, in both directions: whether the content
8
+ * is wanted belongs to the run, not to the network. Forking paseo-next-v2 to test a runtime does
9
+ * not need its products; the same fork opened to browse them does. Unasked, the import walks
10
+ * every product the resolver knows and pulls each one's bytes from the source gateway, which was
11
+ * 659 products and over half an hour the last time it ran on a network that never checked them.
12
+ *
13
+ * PRODUCT_SYNC=0 already meant "skip" inside the service itself; deciding here as well means the
14
+ * process is not spawned at all rather than started and told to do nothing.
15
+ */
16
+ export declare function pinsProducts(net: NetworkDef): boolean;
17
+ export interface GenerateForkTomlOptions {
18
+ /**
19
+ * Root that supplies bin/ (and scripts/, unless scriptsDir overrides it). In a checkout the
20
+ * two live together; installed from npm they do not — bin/ is the workspace's, scripts/ ship
21
+ * inside the package — which is why the launcher dir can be named separately.
22
+ */
23
+ repoDir: string;
24
+ /** Where the shell launchers live. Defaults to <repoDir>/scripts. */
25
+ scriptsDir?: string;
26
+ /** Unpacked fork bundle (manifest.json, specs/, snapshots/, overrides/). */
27
+ bundleDir: string;
28
+ /** Mirrors ENABLE_HOP in genesis mode. */
29
+ enableHop?: boolean;
30
+ /** Overrides <repoDir>/bin — non-previewnet binaries live in bin/<network>. */
31
+ binDir?: string;
32
+ }
33
+ export declare function generateForkToml(options: GenerateForkTomlOptions): string;
34
+ export { FORK_PROCESSES };
35
+ //# sourceMappingURL=fork-toml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fork-toml.d.ts","sourceRoot":"","sources":["../src/fork-toml.ts"],"names":[],"mappings":"AAsDA,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAQjE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAgCnE,QAAA,MAAM,cAAc,UAA6B,CAAC;AA0JlD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAKrD;AAuBD,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAsDzE;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}