@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.
- package/LICENSE +202 -0
- package/config/ports.env +128 -0
- package/dist/bundle.d.ts +36 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +7 -0
- package/dist/bundle.js.map +1 -0
- package/dist/dashboard-model.d.ts +63 -0
- package/dist/dashboard-model.d.ts.map +1 -0
- package/dist/dashboard-model.js +126 -0
- package/dist/dashboard-model.js.map +1 -0
- package/dist/dub.d.ts +98 -0
- package/dist/dub.d.ts.map +1 -0
- package/dist/dub.js +202 -0
- package/dist/dub.js.map +1 -0
- package/dist/env-file.d.ts +6 -0
- package/dist/env-file.d.ts.map +1 -0
- package/dist/env-file.js +30 -0
- package/dist/env-file.js.map +1 -0
- package/dist/fork-toml.d.ts +35 -0
- package/dist/fork-toml.d.ts.map +1 -0
- package/dist/fork-toml.js +276 -0
- package/dist/fork-toml.js.map +1 -0
- package/dist/genesis-patch.d.ts +54 -0
- package/dist/genesis-patch.d.ts.map +1 -0
- package/dist/genesis-patch.js +223 -0
- package/dist/genesis-patch.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/load.d.ts +12 -0
- package/dist/load.d.ts.map +1 -0
- package/dist/load.js +23 -0
- package/dist/load.js.map +1 -0
- package/dist/networks.d.ts +214 -0
- package/dist/networks.d.ts.map +1 -0
- package/dist/networks.js +329 -0
- package/dist/networks.js.map +1 -0
- package/dist/nginx-routes.d.ts +10 -0
- package/dist/nginx-routes.d.ts.map +1 -0
- package/dist/nginx-routes.js +37 -0
- package/dist/nginx-routes.js.map +1 -0
- package/dist/overrides.d.ts +50 -0
- package/dist/overrides.d.ts.map +1 -0
- package/dist/overrides.js +169 -0
- package/dist/overrides.js.map +1 -0
- package/dist/repo-root.d.ts +42 -0
- package/dist/repo-root.d.ts.map +1 -0
- package/dist/repo-root.js +129 -0
- package/dist/repo-root.js.map +1 -0
- package/dist/toml-generator.d.ts +30 -0
- package/dist/toml-generator.d.ts.map +1 -0
- package/dist/toml-generator.js +469 -0
- package/dist/toml-generator.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +37 -0
package/dist/load.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type NetworkDef } from './networks.js';
|
|
2
|
+
import { type OverrideSet } from './overrides.js';
|
|
3
|
+
/**
|
|
4
|
+
* A network as it will actually run: the descriptor, with any --release/--binary overrides
|
|
5
|
+
* applied. Every command goes through here, so none of them can disagree about which binary
|
|
6
|
+
* comes from where. `extra` carries flag overrides; the environment is always consulted.
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadNetwork(name: string, extra?: OverrideSet): NetworkDef;
|
|
9
|
+
/** The descriptor exactly as checked in, overrides ignored. For drift checks and tests. */
|
|
10
|
+
export declare function loadDescriptorOnly(name: string): NetworkDef;
|
|
11
|
+
export declare function loadCurrentNetwork(): NetworkDef;
|
|
12
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,UAAU,CAEzE;AAED,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAE3D;AAED,wBAAgB,kBAAkB,IAAI,UAAU,CAE/C"}
|
package/dist/load.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Composing a network as it will actually run.
|
|
2
|
+
//
|
|
3
|
+
// Split out of networks.ts to break a cycle: the descriptor parser has no business knowing
|
|
4
|
+
// about overrides, and the override rules need the descriptor's types. This module is the only
|
|
5
|
+
// one that knows both, and it is what the package exports as `loadNetwork`.
|
|
6
|
+
import { loadDescriptor, currentNetworkName } from './networks.js';
|
|
7
|
+
import { applyOverrides, effectiveOverrides } from './overrides.js';
|
|
8
|
+
/**
|
|
9
|
+
* A network as it will actually run: the descriptor, with any --release/--binary overrides
|
|
10
|
+
* applied. Every command goes through here, so none of them can disagree about which binary
|
|
11
|
+
* comes from where. `extra` carries flag overrides; the environment is always consulted.
|
|
12
|
+
*/
|
|
13
|
+
export function loadNetwork(name, extra) {
|
|
14
|
+
return applyOverrides(loadDescriptor(name), effectiveOverrides(extra));
|
|
15
|
+
}
|
|
16
|
+
/** The descriptor exactly as checked in, overrides ignored. For drift checks and tests. */
|
|
17
|
+
export function loadDescriptorOnly(name) {
|
|
18
|
+
return loadDescriptor(name);
|
|
19
|
+
}
|
|
20
|
+
export function loadCurrentNetwork() {
|
|
21
|
+
return loadNetwork(currentNetworkName());
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=load.js.map
|
package/dist/load.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,2FAA2F;AAC3F,+FAA+F;AAC/F,4EAA4E;AAE5E,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAmB,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAoB,MAAM,gBAAgB,CAAC;AAEtF;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,KAAmB;IAC3D,OAAO,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,WAAW,CAAC,kBAAkB,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/** The parachain keys PPN knows: what its port and per-chain flag tables are keyed by. */
|
|
2
|
+
export type Parachain = 'asset-hub' | 'people' | 'bulletin' | 'web3-storage';
|
|
3
|
+
export type ChainKey = 'relay' | Parachain;
|
|
4
|
+
/**
|
|
5
|
+
* A descriptor may use any subset of these keys, in any order, with any para ids.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PARACHAIN_KEYS: Parachain[];
|
|
8
|
+
/** A GitHub release artifacts are taken from. */
|
|
9
|
+
export interface ReleasePin {
|
|
10
|
+
repo: string;
|
|
11
|
+
tag: string;
|
|
12
|
+
}
|
|
13
|
+
/** A binary a chain or service runs, and the release it comes from. */
|
|
14
|
+
export interface BinaryRef {
|
|
15
|
+
/** Bare binary name, also the release asset name (plus platform suffix). */
|
|
16
|
+
name: string;
|
|
17
|
+
/** A key of the network's `releases` table. */
|
|
18
|
+
release: string;
|
|
19
|
+
/**
|
|
20
|
+
* Set when the binary ships inside a tarball rather than as a bare asset.
|
|
21
|
+
* `{tag}` and `{triple}` are substituted at fetch time.
|
|
22
|
+
*/
|
|
23
|
+
archive?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A runtime WASM a chain runs from genesis. Genesis networks (previewnet) only. */
|
|
26
|
+
export interface RuntimeRef {
|
|
27
|
+
/** Asset name on the release. */
|
|
28
|
+
asset: string;
|
|
29
|
+
/** A key of the network's `releases` table. */
|
|
30
|
+
release: string;
|
|
31
|
+
/** Local filename under bin/, as the chain-spec builder and upgrade tooling expect it. */
|
|
32
|
+
file: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The chain spec a genesis network builds for this chain. `ppn generate` builds it and the
|
|
36
|
+
* genesis config generator points zombienet at it, both from here — `chainId` is mandatory
|
|
37
|
+
* alongside the file, or zombienet applies one spec to every parachain.
|
|
38
|
+
*/
|
|
39
|
+
export interface GenesisSpec {
|
|
40
|
+
chainId: string;
|
|
41
|
+
/** Human-readable chain name baked into the spec. */
|
|
42
|
+
name: string;
|
|
43
|
+
/** named-preset passed to chain-spec-builder. */
|
|
44
|
+
preset: string;
|
|
45
|
+
/** Local chain-spec filename under bin/. */
|
|
46
|
+
file: string;
|
|
47
|
+
}
|
|
48
|
+
/** Genesis-wide settings for a network that builds its own chain specs. */
|
|
49
|
+
export interface GenesisConfig {
|
|
50
|
+
/** chain-spec-builder -t, e.g. 'local'. */
|
|
51
|
+
chainType: string;
|
|
52
|
+
/** chain-spec-builder --properties, e.g. 'tokenSymbol=PAS,tokenDecimals=10'. */
|
|
53
|
+
properties: string;
|
|
54
|
+
/** Relay node names are `<validator>-<suffix>`; zombienet derives keys from them. */
|
|
55
|
+
validatorNameSuffix: string;
|
|
56
|
+
/**
|
|
57
|
+
* The namespace product contexts are derived in, written into genesis. Optional: a
|
|
58
|
+
* network that leaves it out keeps whatever its runtimes' presets ship with.
|
|
59
|
+
* See `setNetworkSuffix` for which chains carry it.
|
|
60
|
+
*/
|
|
61
|
+
networkSuffix?: string;
|
|
62
|
+
}
|
|
63
|
+
/** `MAX_NETWORK_SUFFIX_LENGTH` in indiv-support: the pallet's BoundedVec bound. */
|
|
64
|
+
export declare const MAX_NETWORK_SUFFIX_BYTES = 16;
|
|
65
|
+
/** Curve an Aura authority key is on. */
|
|
66
|
+
export type AuraScheme = 'sr25519' | 'ed25519';
|
|
67
|
+
export interface NetworkParachain {
|
|
68
|
+
key: Parachain;
|
|
69
|
+
/** The network's real para id — previewnet band (1500+) or system-chain band (1000+). */
|
|
70
|
+
paraId: number;
|
|
71
|
+
/** Basename of the chain spec inside a bundle: specs/<spec>.json. */
|
|
72
|
+
spec: string;
|
|
73
|
+
/** Absolute ws(s)/http(s) URL, or a path resolved against bite.source. */
|
|
74
|
+
rpc: string;
|
|
75
|
+
/** 'builtin', an absolute URL, or a path against bite.source. */
|
|
76
|
+
specSource: string;
|
|
77
|
+
/** The node binary this chain runs. Explicit — every chain declares its own. */
|
|
78
|
+
binary: BinaryRef;
|
|
79
|
+
/** The runtime this chain starts from at genesis. Genesis networks only. */
|
|
80
|
+
runtime?: RuntimeRef;
|
|
81
|
+
/** The chain spec built for this chain at genesis. Genesis networks only. */
|
|
82
|
+
genesisSpec?: GenesisSpec;
|
|
83
|
+
/** Extra node args for this chain, appended to the shared per-key flag table. */
|
|
84
|
+
extraArgs: string[];
|
|
85
|
+
/**
|
|
86
|
+
* Curve this chain's Aura keys are on. Nearly every chain is sr25519; Polkadot's Asset Hub
|
|
87
|
+
* is ed25519, and the collator authors nothing at all if the fork guesses wrong.
|
|
88
|
+
*/
|
|
89
|
+
aura?: AuraScheme;
|
|
90
|
+
}
|
|
91
|
+
export interface NetworkRelay extends Omit<NetworkParachain, 'key' | 'paraId'> {
|
|
92
|
+
/** Built-in chain name doppelganger runs with (ZOMBIE_CHAIN), e.g. 'paseo'. */
|
|
93
|
+
chain: string;
|
|
94
|
+
/** Dev-key validators the fork runs with, max 6 (alice…ferdie). */
|
|
95
|
+
validators: number;
|
|
96
|
+
}
|
|
97
|
+
/** A chain of either kind, as networkChains() yields them. */
|
|
98
|
+
export type NetworkChain = Omit<NetworkParachain, 'key' | 'paraId'> & {
|
|
99
|
+
key: ChainKey;
|
|
100
|
+
paraId: number | null;
|
|
101
|
+
};
|
|
102
|
+
/** false disables a service; an object configures it (its binary, when it has one). */
|
|
103
|
+
export type ServiceConfig = boolean | {
|
|
104
|
+
binary?: BinaryRef;
|
|
105
|
+
};
|
|
106
|
+
export interface NetworkDef {
|
|
107
|
+
name: string;
|
|
108
|
+
displayName: string;
|
|
109
|
+
/** Spawnable from genesis. Previewnet only. */
|
|
110
|
+
genesis: boolean;
|
|
111
|
+
/** The live network has sudo. Without it CI cannot pre-bite. */
|
|
112
|
+
sudo: boolean;
|
|
113
|
+
bite: {
|
|
114
|
+
prebaked: boolean;
|
|
115
|
+
source: string;
|
|
116
|
+
/** The doppelganger release that can execute this network's runtimes during a bite. */
|
|
117
|
+
doppelganger?: ReleasePin;
|
|
118
|
+
/**
|
|
119
|
+
* The live relay carries parachains this network does not run.
|
|
120
|
+
*
|
|
121
|
+
* True for anything forked off a shared relay — paseo-next-v2, kusama, polkadot — and
|
|
122
|
+
* false for previewnet, whose relay is ours end to end. It changes what a bite has to
|
|
123
|
+
* override, because two things in the inherited relay state are then wrong for us:
|
|
124
|
+
*
|
|
125
|
+
* cores every registered parachain occupies one, so the relay splits our six dev
|
|
126
|
+
* validators across all of them and most groups come out empty. Ours sit on
|
|
127
|
+
* cores no group is ever assigned to, so nothing backs their blocks.
|
|
128
|
+
* HRMP channel MQC heads move between the parachain snapshots and the relay
|
|
129
|
+
* snapshot. Messages delivered in that window are pruned from the relay, so a
|
|
130
|
+
* parachain can never reach the head the relay expects, and cumulus panics on
|
|
131
|
+
* `HRMP head mismatch` — it cannot build a block at all.
|
|
132
|
+
*
|
|
133
|
+
* See docs/FORK.md.
|
|
134
|
+
*/
|
|
135
|
+
sharedRelay?: boolean;
|
|
136
|
+
};
|
|
137
|
+
/** Named releases every binary/runtime reference points into. */
|
|
138
|
+
releases: Record<string, ReleasePin>;
|
|
139
|
+
/** Genesis-wide chain-spec settings. Present on a genesis network. */
|
|
140
|
+
genesisConfig?: GenesisConfig;
|
|
141
|
+
relay: NetworkRelay;
|
|
142
|
+
parachains: NetworkParachain[];
|
|
143
|
+
/** Per-service switches and binaries for the custom processes. */
|
|
144
|
+
services: Record<string, ServiceConfig>;
|
|
145
|
+
/** Local tools this network needs that are neither a chain nor a service. */
|
|
146
|
+
tools: Record<string, BinaryRef>;
|
|
147
|
+
/**
|
|
148
|
+
* DotNS product import (`ppn service pin-bulletin-products`), per network because every
|
|
149
|
+
* DotNS deployment has its own contracts and its own place to fetch product bytes from.
|
|
150
|
+
* `gateway` is only needed where that is not `bite.source`.
|
|
151
|
+
*/
|
|
152
|
+
dotns?: {
|
|
153
|
+
resolver?: string;
|
|
154
|
+
gateway?: string;
|
|
155
|
+
/** Known contract addresses of this network's DotNS deployment, name -> address. */
|
|
156
|
+
addresses?: Record<string, string>;
|
|
157
|
+
/**
|
|
158
|
+
* Import this network's product content into the fork's IPFS. Off unless a network asks
|
|
159
|
+
* for it: the import walks every product the resolver knows about and pulls each one's
|
|
160
|
+
* bytes from the source gateway, which is minutes of work for a network whose products
|
|
161
|
+
* are not what you are running it for. Override per spawn with PPN_PIN_PRODUCTS.
|
|
162
|
+
*/
|
|
163
|
+
pinProducts?: boolean;
|
|
164
|
+
};
|
|
165
|
+
/** Every `_todo` note found in the file — non-empty means the descriptor is a stub. */
|
|
166
|
+
todos: string[];
|
|
167
|
+
}
|
|
168
|
+
export interface ResolvedBinary extends ReleasePin {
|
|
169
|
+
name: string;
|
|
170
|
+
archive?: string;
|
|
171
|
+
}
|
|
172
|
+
export interface ResolvedRuntime extends ReleasePin {
|
|
173
|
+
chain: string;
|
|
174
|
+
asset: string;
|
|
175
|
+
file: string;
|
|
176
|
+
}
|
|
177
|
+
export declare const DEFAULT_NETWORK = "previewnet";
|
|
178
|
+
/** Every network with a descriptor, sorted. */
|
|
179
|
+
export declare function listNetworks(): string[];
|
|
180
|
+
/** Read and validate one network descriptor. */
|
|
181
|
+
/** Parse and validate one descriptor. Overrides are applied by ./load.ts. */
|
|
182
|
+
export declare function loadDescriptor(name: string): NetworkDef;
|
|
183
|
+
/** PPN_NETWORK, or previewnet. */
|
|
184
|
+
export declare function currentNetworkName(): string;
|
|
185
|
+
/**
|
|
186
|
+
* Every binary the network declares, with its release resolved — exactly what `make
|
|
187
|
+
* fetch` downloads into the network's bin directory. A service switched off with
|
|
188
|
+
* `false` contributes nothing; which of the remaining processes actually run is decided
|
|
189
|
+
* when the zombienet config is generated, not here.
|
|
190
|
+
*/
|
|
191
|
+
export declare function networkBinaries(net: NetworkDef): ResolvedBinary[];
|
|
192
|
+
/**
|
|
193
|
+
* Every runtime WASM the network's genesis needs, with its release resolved. Empty for
|
|
194
|
+
* a fork-only network, which restores every runtime from the state it carries.
|
|
195
|
+
*/
|
|
196
|
+
export declare function networkRuntimes(net: NetworkDef): ResolvedRuntime[];
|
|
197
|
+
/**
|
|
198
|
+
* The chains a bite covers, in the order it needs them: relay first, then parachains.
|
|
199
|
+
*/
|
|
200
|
+
export declare function networkChains(net: NetworkDef): NetworkChain[];
|
|
201
|
+
/**
|
|
202
|
+
* Resolve a descriptor rpc entry: absolute URLs pass through, paths join bite.source.
|
|
203
|
+
*/
|
|
204
|
+
export declare function endpointUrl(net: NetworkDef, rpc: string): string;
|
|
205
|
+
/**
|
|
206
|
+
* Where a chain spec comes from at bite time: `builtin:<chain>` for one built into the
|
|
207
|
+
* node binary, otherwise an absolute URL (a relative entry joins the base URL).
|
|
208
|
+
*/
|
|
209
|
+
export declare function specSourceUrl(net: NetworkDef, chain: NetworkChain, baseUrl?: string): string;
|
|
210
|
+
/** For JSON-RPC over fetch(): ws(s):// endpoints answer POSTs on their http(s) twin. */
|
|
211
|
+
export declare function asHttp(url: string): string;
|
|
212
|
+
/** For node flags like --relay-chain-rpc-url, which want a websocket URL. */
|
|
213
|
+
export declare function asWs(url: string): string;
|
|
214
|
+
//# sourceMappingURL=networks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":"AA2BA,0FAA0F;AAC1F,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,cAAc,CAAC;AAC7E,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,EAAw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,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,YAAY,EAAE,CAE7D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAS5F;AAED,wFAAwF;AACxF,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED,6EAA6E;AAC7E,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExC"}
|
package/dist/networks.js
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
// Network descriptors: which networks PPN can run, and what each one is made of.
|
|
2
|
+
//
|
|
3
|
+
// One JSON file per network under networks/ at the repo root — see networks/README.md
|
|
4
|
+
// for the schema. A descriptor is self-contained: it names every artifact the network
|
|
5
|
+
// needs (node binary per chain, runtime WASM per chain for genesis, service binaries,
|
|
6
|
+
// the bite tool) and the exact release each comes from. Nothing resolves against
|
|
7
|
+
// config/versions.env, which holds only the shared local toolchain (zombienet, kubo,
|
|
8
|
+
// postgres, …) that is not part of any network.
|
|
9
|
+
//
|
|
10
|
+
// Releases are declared once in the `releases` table and referred to by name, so a
|
|
11
|
+
// version is written in one place per network. Every name is the descriptor author's
|
|
12
|
+
// own — there are no reserved or special-cased names.
|
|
13
|
+
//
|
|
14
|
+
// Everything that needs to know what a network is made of reads it through this one
|
|
15
|
+
// module: the config generators, every `ppn` command, and — through those — the shell
|
|
16
|
+
// that fetches artifacts, builds chain specs and bites live networks. When the shell
|
|
17
|
+
// could not call this, it grew its own copy of these rules in jq; two sets of rules over
|
|
18
|
+
// one file is how they drift.
|
|
19
|
+
//
|
|
20
|
+
// Local ports are NOT in the descriptor. Networks run one at a time on a machine, and
|
|
21
|
+
// every descriptor's parachains use the shared keys (asset-hub, people, …), so the
|
|
22
|
+
// ports.env slot for a key applies to whichever network is running.
|
|
23
|
+
import fs from 'node:fs';
|
|
24
|
+
import path from 'node:path';
|
|
25
|
+
import { defaultHome, networksDirs } from './repo-root.js';
|
|
26
|
+
/**
|
|
27
|
+
* A descriptor may use any subset of these keys, in any order, with any para ids.
|
|
28
|
+
*/
|
|
29
|
+
export const PARACHAIN_KEYS = ['asset-hub', 'people', 'bulletin', 'web3-storage'];
|
|
30
|
+
/** `MAX_NETWORK_SUFFIX_LENGTH` in indiv-support: the pallet's BoundedVec bound. */
|
|
31
|
+
export const MAX_NETWORK_SUFFIX_BYTES = 16;
|
|
32
|
+
export const DEFAULT_NETWORK = 'previewnet';
|
|
33
|
+
function collectTodos(value, at, into) {
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
value.forEach((v, i) => collectTodos(v, `${at}[${i}]`, into));
|
|
36
|
+
}
|
|
37
|
+
else if (value && typeof value === 'object') {
|
|
38
|
+
for (const [k, v] of Object.entries(value)) {
|
|
39
|
+
if (k === '_todo')
|
|
40
|
+
into.push(`${at}: ${v}`);
|
|
41
|
+
else
|
|
42
|
+
collectTodos(v, at === '' ? k : `${at}.${k}`, into);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Every network with a descriptor, sorted. */
|
|
47
|
+
export function listNetworks() {
|
|
48
|
+
// Union, not first-wins: a workspace that adds a network must not hide the ones that
|
|
49
|
+
// shipped, and the error message for an unknown name has to list everything runnable.
|
|
50
|
+
const dirs = networksDirs();
|
|
51
|
+
if (dirs.length === 0) {
|
|
52
|
+
throw new Error('no networks/ directory found.\n' +
|
|
53
|
+
' A network is defined by a descriptor, and none shipped with this install.\n' +
|
|
54
|
+
' Point PPN_HOME at a directory containing networks/<name>.json,\n' +
|
|
55
|
+
` or put them in ${defaultHome()}/networks/, which is checked by default.`);
|
|
56
|
+
}
|
|
57
|
+
const names = new Set();
|
|
58
|
+
for (const dir of dirs) {
|
|
59
|
+
for (const f of fs.readdirSync(dir)) {
|
|
60
|
+
if (f.endsWith('.json'))
|
|
61
|
+
names.add(f.replace(/\.json$/, ''));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return [...names].sort();
|
|
65
|
+
}
|
|
66
|
+
/** Read and validate one network descriptor. */
|
|
67
|
+
/** Parse and validate one descriptor. Overrides are applied by ./load.ts. */
|
|
68
|
+
export function loadDescriptor(name) {
|
|
69
|
+
if (!/^[a-z0-9-]+$/.test(name))
|
|
70
|
+
throw new Error(`invalid network name: ${name}`);
|
|
71
|
+
const file = networksDirs()
|
|
72
|
+
.map((dir) => path.join(dir, `${name}.json`))
|
|
73
|
+
.find((f) => fs.existsSync(f));
|
|
74
|
+
if (!file) {
|
|
75
|
+
throw new Error(`unknown network "${name}" — known: ${listNetworks().join(', ')}`);
|
|
76
|
+
}
|
|
77
|
+
const raw = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
78
|
+
const bad = (why) => {
|
|
79
|
+
throw new Error(`networks/${name}.json: ${why}`);
|
|
80
|
+
};
|
|
81
|
+
if (raw.name !== name)
|
|
82
|
+
bad(`"name" is "${raw.name}", must match the filename`);
|
|
83
|
+
if (raw.dotns?.pinProducts !== undefined && typeof raw.dotns.pinProducts !== 'boolean') {
|
|
84
|
+
bad('dotns.pinProducts must be true or false');
|
|
85
|
+
}
|
|
86
|
+
if (!raw.relay?.chain || !raw.relay?.spec || !raw.relay?.rpc || !raw.relay?.specSource) {
|
|
87
|
+
bad('relay needs chain, spec, rpc and specSource');
|
|
88
|
+
}
|
|
89
|
+
if (!raw.bite?.source)
|
|
90
|
+
bad('bite.source is required');
|
|
91
|
+
if (!Array.isArray(raw.parachains) || raw.parachains.length === 0) {
|
|
92
|
+
bad('at least one parachain is required');
|
|
93
|
+
}
|
|
94
|
+
const releases = Object.fromEntries(Object.entries(raw.releases ?? {}).filter(([k]) => !k.startsWith('_')));
|
|
95
|
+
for (const [rel, pin] of Object.entries(releases)) {
|
|
96
|
+
if (!pin?.repo || !pin?.tag)
|
|
97
|
+
bad(`releases.${rel} needs repo and tag`);
|
|
98
|
+
}
|
|
99
|
+
// Every chain names its binary, and every reference resolves inside this file. One
|
|
100
|
+
// binary name must not come from two releases — the files collide in bin/.
|
|
101
|
+
const usedReleases = new Set();
|
|
102
|
+
const binaryRelease = new Map();
|
|
103
|
+
// Runtime WASMs are fetched into the same flat bin/ as the binaries, keyed by `file`, so two
|
|
104
|
+
// chains naming one file is the same collision — with a worse failure. A binary that clashes
|
|
105
|
+
// is at least the same program; two runtimes silently overwrite each other and whichever
|
|
106
|
+
// chain fetches second boots the *other* chain's WASM, with nothing to say so.
|
|
107
|
+
const runtimeFile = new Map();
|
|
108
|
+
const checkRelease = (at, rel) => {
|
|
109
|
+
if (typeof rel !== 'string' || !(rel in releases)) {
|
|
110
|
+
bad(`${at}.release "${rel}" is not declared in releases ` +
|
|
111
|
+
`(${Object.keys(releases).join(', ') || 'empty'})`);
|
|
112
|
+
}
|
|
113
|
+
usedReleases.add(rel);
|
|
114
|
+
return rel;
|
|
115
|
+
};
|
|
116
|
+
const checkBinary = (at, ref) => {
|
|
117
|
+
if (!ref?.name)
|
|
118
|
+
bad(`${at}.binary needs { name, release }`);
|
|
119
|
+
if (!/^[a-z0-9-]+$/.test(ref.name))
|
|
120
|
+
bad(`${at}.binary.name must be a bare binary name`);
|
|
121
|
+
checkRelease(`${at}.binary`, ref.release);
|
|
122
|
+
const prev = binaryRelease.get(ref.name);
|
|
123
|
+
if (prev !== undefined && prev !== ref.release) {
|
|
124
|
+
bad(`binary "${ref.name}" is bound to two releases ("${prev}" and "${ref.release}") — ` +
|
|
125
|
+
'they would collide in bin/');
|
|
126
|
+
}
|
|
127
|
+
binaryRelease.set(ref.name, ref.release);
|
|
128
|
+
return ref;
|
|
129
|
+
};
|
|
130
|
+
const checkRuntime = (at, ref) => {
|
|
131
|
+
if (ref === undefined)
|
|
132
|
+
return undefined;
|
|
133
|
+
if (!ref.asset || !ref.file)
|
|
134
|
+
bad(`${at}.runtime needs { asset, release, file }`);
|
|
135
|
+
checkRelease(`${at}.runtime`, ref.release);
|
|
136
|
+
const prev = runtimeFile.get(ref.file);
|
|
137
|
+
if (prev !== undefined && prev !== at) {
|
|
138
|
+
bad(`runtime file "${ref.file}" is claimed by two chains ("${prev}" and "${at}") — ` +
|
|
139
|
+
'they would collide in bin/');
|
|
140
|
+
}
|
|
141
|
+
runtimeFile.set(ref.file, at);
|
|
142
|
+
return ref;
|
|
143
|
+
};
|
|
144
|
+
const checkArgs = (at, args) => {
|
|
145
|
+
if (args === undefined)
|
|
146
|
+
return [];
|
|
147
|
+
if (!Array.isArray(args) || args.some((x) => typeof x !== 'string' || !x.startsWith('-'))) {
|
|
148
|
+
bad(`${at}.extraArgs must be an array of "--flag" strings`);
|
|
149
|
+
}
|
|
150
|
+
return args;
|
|
151
|
+
};
|
|
152
|
+
checkBinary('relay', raw.relay.binary);
|
|
153
|
+
checkRuntime('relay', raw.relay.runtime);
|
|
154
|
+
const seen = new Set();
|
|
155
|
+
for (const p of raw.parachains) {
|
|
156
|
+
if (!PARACHAIN_KEYS.includes(p.key)) {
|
|
157
|
+
bad(`parachain key "${p.key}" is not one of: ${PARACHAIN_KEYS.join(', ')}`);
|
|
158
|
+
}
|
|
159
|
+
if (!Number.isInteger(p.paraId) || p.paraId <= 0) {
|
|
160
|
+
bad(`parachain ${p.key} needs a positive paraId`);
|
|
161
|
+
}
|
|
162
|
+
if (!p.spec || !p.rpc || !p.specSource)
|
|
163
|
+
bad(`parachain ${p.key} needs spec, rpc and specSource`);
|
|
164
|
+
if (p.aura !== undefined && p.aura !== 'sr25519' && p.aura !== 'ed25519') {
|
|
165
|
+
bad(`parachain ${p.key}: aura must be "sr25519" or "ed25519"`);
|
|
166
|
+
}
|
|
167
|
+
checkBinary(`parachains.${p.key}`, p.binary);
|
|
168
|
+
checkRuntime(`parachains.${p.key}`, p.runtime);
|
|
169
|
+
if (seen.has(p.key))
|
|
170
|
+
bad(`parachain ${p.key} listed twice`);
|
|
171
|
+
seen.add(p.key);
|
|
172
|
+
}
|
|
173
|
+
const ids = raw.parachains.map((p) => p.paraId);
|
|
174
|
+
if (new Set(ids).size !== ids.length)
|
|
175
|
+
bad('duplicate para ids');
|
|
176
|
+
// A genesis network builds its chain specs locally, so every chain needs a runtime to
|
|
177
|
+
// build from and a spec to build into, and the network needs the settings they share.
|
|
178
|
+
if (raw.genesis === true) {
|
|
179
|
+
const gc = raw.genesisConfig;
|
|
180
|
+
if (!gc?.chainType || !gc?.properties || !gc?.validatorNameSuffix) {
|
|
181
|
+
bad('a genesis network needs genesisConfig { chainType, properties, validatorNameSuffix }');
|
|
182
|
+
}
|
|
183
|
+
// The suffix goes into a BoundedVec<u8, 16>, so an over-long one is rejected here
|
|
184
|
+
// rather than by genesis validation with a much less helpful message.
|
|
185
|
+
if (gc?.networkSuffix !== undefined) {
|
|
186
|
+
const bytes = Buffer.byteLength(gc.networkSuffix, 'utf8');
|
|
187
|
+
if (bytes === 0)
|
|
188
|
+
bad('genesisConfig.networkSuffix cannot be empty');
|
|
189
|
+
if (bytes > MAX_NETWORK_SUFFIX_BYTES) {
|
|
190
|
+
bad(`genesisConfig.networkSuffix is ${bytes} bytes, over the ${MAX_NETWORK_SUFFIX_BYTES}-byte bound`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const chains = [
|
|
194
|
+
['relay', raw.relay],
|
|
195
|
+
...raw.parachains.map((p) => [`parachains.${p.key}`, p]),
|
|
196
|
+
];
|
|
197
|
+
for (const [at, chain] of chains) {
|
|
198
|
+
if (!chain.runtime)
|
|
199
|
+
bad(`a genesis network needs ${at}.runtime`);
|
|
200
|
+
const g = chain.genesisSpec;
|
|
201
|
+
if (!g?.chainId || !g?.name || !g?.preset || !g?.file) {
|
|
202
|
+
bad(`a genesis network needs ${at}.genesisSpec { chainId, name, preset, file }`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const validators = raw.relay.validators ?? 6;
|
|
207
|
+
if (!Number.isInteger(validators) || validators < 1 || validators > 6) {
|
|
208
|
+
bad('relay.validators must be 1..6 (alice…ferdie)');
|
|
209
|
+
}
|
|
210
|
+
const services = raw.services ?? {};
|
|
211
|
+
for (const [svc, cfg] of Object.entries(services)) {
|
|
212
|
+
if (cfg && typeof cfg === 'object' && cfg.binary)
|
|
213
|
+
checkBinary(`services."${svc}"`, cfg.binary);
|
|
214
|
+
}
|
|
215
|
+
const tools = Object.fromEntries(Object.entries(raw.tools ?? {}).filter(([k]) => !k.startsWith('_')));
|
|
216
|
+
for (const [tool, ref] of Object.entries(tools))
|
|
217
|
+
checkBinary(`tools."${tool}"`, ref);
|
|
218
|
+
const dg = raw.bite.doppelganger;
|
|
219
|
+
if (dg && (!dg.repo || !dg.tag))
|
|
220
|
+
bad('bite.doppelganger needs repo and tag');
|
|
221
|
+
const unused = Object.keys(releases).filter((r) => !usedReleases.has(r));
|
|
222
|
+
if (unused.length)
|
|
223
|
+
bad(`releases declared but never used: ${unused.join(', ')}`);
|
|
224
|
+
const todos = [];
|
|
225
|
+
collectTodos(raw, '', todos);
|
|
226
|
+
return {
|
|
227
|
+
name: raw.name,
|
|
228
|
+
displayName: raw.displayName ?? raw.name,
|
|
229
|
+
genesis: raw.genesis === true,
|
|
230
|
+
sudo: raw.sudo === true,
|
|
231
|
+
bite: {
|
|
232
|
+
prebaked: raw.bite.prebaked === true,
|
|
233
|
+
source: raw.bite.source,
|
|
234
|
+
doppelganger: dg,
|
|
235
|
+
sharedRelay: raw.bite.sharedRelay === true,
|
|
236
|
+
},
|
|
237
|
+
releases,
|
|
238
|
+
genesisConfig: raw.genesisConfig,
|
|
239
|
+
relay: { ...raw.relay, validators, extraArgs: checkArgs('relay', raw.relay.extraArgs) },
|
|
240
|
+
parachains: raw.parachains.map((p) => ({
|
|
241
|
+
...p,
|
|
242
|
+
extraArgs: checkArgs(`parachains.${p.key}`, p.extraArgs),
|
|
243
|
+
})),
|
|
244
|
+
services,
|
|
245
|
+
tools,
|
|
246
|
+
dotns: raw.dotns,
|
|
247
|
+
todos,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
/** PPN_NETWORK, or previewnet. */
|
|
251
|
+
export function currentNetworkName() {
|
|
252
|
+
return process.env.PPN_NETWORK || DEFAULT_NETWORK;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Every binary the network declares, with its release resolved — exactly what `make
|
|
256
|
+
* fetch` downloads into the network's bin directory. A service switched off with
|
|
257
|
+
* `false` contributes nothing; which of the remaining processes actually run is decided
|
|
258
|
+
* when the zombienet config is generated, not here.
|
|
259
|
+
*/
|
|
260
|
+
export function networkBinaries(net) {
|
|
261
|
+
const refs = [net.relay.binary, ...net.parachains.map((p) => p.binary)];
|
|
262
|
+
for (const cfg of Object.values(net.services)) {
|
|
263
|
+
if (cfg !== false && typeof cfg === 'object' && cfg.binary)
|
|
264
|
+
refs.push(cfg.binary);
|
|
265
|
+
}
|
|
266
|
+
refs.push(...Object.values(net.tools));
|
|
267
|
+
const out = new Map();
|
|
268
|
+
for (const ref of refs) {
|
|
269
|
+
const pin = net.releases[ref.release];
|
|
270
|
+
out.set(ref.name, { name: ref.name, archive: ref.archive, ...pin });
|
|
271
|
+
}
|
|
272
|
+
return [...out.values()];
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Every runtime WASM the network's genesis needs, with its release resolved. Empty for
|
|
276
|
+
* a fork-only network, which restores every runtime from the state it carries.
|
|
277
|
+
*/
|
|
278
|
+
export function networkRuntimes(net) {
|
|
279
|
+
const entries = [
|
|
280
|
+
['relay', net.relay.runtime],
|
|
281
|
+
...net.parachains.map((p) => [p.key, p.runtime]),
|
|
282
|
+
];
|
|
283
|
+
return entries
|
|
284
|
+
.filter((e) => e[1] !== undefined)
|
|
285
|
+
.map(([chain, r]) => ({
|
|
286
|
+
chain,
|
|
287
|
+
asset: r.asset,
|
|
288
|
+
file: r.file,
|
|
289
|
+
...net.releases[r.release],
|
|
290
|
+
}));
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* The chains a bite covers, in the order it needs them: relay first, then parachains.
|
|
294
|
+
*/
|
|
295
|
+
export function networkChains(net) {
|
|
296
|
+
return [{ key: 'relay', paraId: null, ...net.relay }, ...net.parachains];
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Resolve a descriptor rpc entry: absolute URLs pass through, paths join bite.source.
|
|
300
|
+
*/
|
|
301
|
+
export function endpointUrl(net, rpc) {
|
|
302
|
+
return /^(wss?|https?):\/\//.test(rpc) ? rpc : `${net.bite.source}/${rpc}`;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Where a chain spec comes from at bite time: `builtin:<chain>` for one built into the
|
|
306
|
+
* node binary, otherwise an absolute URL (a relative entry joins the base URL).
|
|
307
|
+
*/
|
|
308
|
+
export function specSourceUrl(net, chain, baseUrl) {
|
|
309
|
+
const src = chain.specSource;
|
|
310
|
+
// Bare `builtin` is the relay's own spec. A parachain names its chain explicitly
|
|
311
|
+
// (`builtin:asset-hub-kusama`): a public system chain carries a spec its binary can build,
|
|
312
|
+
// so unlike Paseo's Asset Hub it needs no host to publish one.
|
|
313
|
+
if (src === 'builtin')
|
|
314
|
+
return `builtin:${net.relay.chain}`;
|
|
315
|
+
if (src.startsWith('builtin:'))
|
|
316
|
+
return src;
|
|
317
|
+
if (/^https?:\/\//.test(src))
|
|
318
|
+
return src;
|
|
319
|
+
return `${baseUrl ?? net.bite.source}/${src}`;
|
|
320
|
+
}
|
|
321
|
+
/** For JSON-RPC over fetch(): ws(s):// endpoints answer POSTs on their http(s) twin. */
|
|
322
|
+
export function asHttp(url) {
|
|
323
|
+
return url.replace(/^ws(s?):\/\//, 'http$1://');
|
|
324
|
+
}
|
|
325
|
+
/** For node flags like --relay-chain-rpc-url, which want a websocket URL. */
|
|
326
|
+
export function asWs(url) {
|
|
327
|
+
return url.replace(/^http(s?):\/\//, 'ws$1://');
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=networks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,sFAAsF;AACtF,sFAAsF;AACtF,sFAAsF;AACtF,iFAAiF;AACjF,qFAAqF;AACrF,gDAAgD;AAChD,EAAE;AACF,mFAAmF;AACnF,qFAAqF;AACrF,sDAAsD;AACtD,EAAE;AACF,oFAAoF;AACpF,sFAAsF;AACtF,qFAAqF;AACrF,yFAAyF;AACzF,8BAA8B;AAC9B,EAAE;AACF,sFAAsF;AACtF,mFAAmF;AACnF,oEAAoE;AAEpE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMxE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgB,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;AA8D/F,mFAAmF;AACnF,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAwH3C,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAI5C,SAAS,YAAY,CAAC,KAAc,EAAE,EAAU,EAAE,IAAc;IAC9D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;SAAM,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9C,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC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AAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IACzC,OAAO,GAAG,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;AAChD,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AAClD,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,IAAI,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DashboardModel } from './dashboard-model.js';
|
|
2
|
+
/**
|
|
3
|
+
* The `upstream` blocks (http context) and `location` blocks (server context), as two
|
|
4
|
+
* strings, so the caller can splice each into the right place in the template.
|
|
5
|
+
*/
|
|
6
|
+
export declare function nginxRoutes(model: DashboardModel): {
|
|
7
|
+
upstreams: string;
|
|
8
|
+
locations: string;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=nginx-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nginx-routes.d.ts","sourceRoot":"","sources":["../src/nginx-routes.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAI3D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAuB3F"}
|