@parity/ppn 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/ports.env +9 -0
- package/config/versions.env +3 -0
- package/dist/cli.js +34 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/bite.d.ts +4 -0
- package/dist/commands/bite.js +6 -0
- package/dist/commands/bite.js.map +1 -1
- package/dist/commands/dashboard.js +45 -2
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/fetch.js +44 -1
- package/dist/commands/fetch.js.map +1 -1
- package/dist/commands/fork.js +16 -12
- package/dist/commands/fork.js.map +1 -1
- package/dist/commands/nginx-conf.js +13 -7
- package/dist/commands/nginx-conf.js.map +1 -1
- package/dist/commands/service.js +2 -0
- package/dist/commands/service.js.map +1 -1
- package/dist/commands/start.d.ts +14 -0
- package/dist/commands/start.js +27 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/turn.d.ts +4 -0
- package/dist/commands/turn.js +91 -0
- package/dist/commands/turn.js.map +1 -0
- package/dist/fork/overrides.d.ts +11 -5
- package/dist/fork/overrides.js +46 -36
- package/dist/fork/overrides.js.map +1 -1
- package/dist/fork/shared-relay.d.ts +7 -5
- package/dist/fork/shared-relay.js +17 -12
- package/dist/fork/shared-relay.js.map +1 -1
- package/dist/fork/topology.d.ts +16 -0
- package/dist/fork/topology.js +60 -0
- package/dist/fork/topology.js.map +1 -0
- package/dist/fork/validators.d.ts +25 -14
- package/dist/fork/validators.js +82 -43
- package/dist/fork/validators.js.map +1 -1
- package/dist/lib/eturnal.d.ts +11 -0
- package/dist/lib/eturnal.js +35 -0
- package/dist/lib/eturnal.js.map +1 -0
- package/dist/lib/spawn-stamp.js +2 -12
- package/dist/lib/spawn-stamp.js.map +1 -1
- package/dist/lib/version.d.ts +52 -0
- package/dist/lib/version.js +119 -0
- package/dist/lib/version.js.map +1 -0
- package/networks/README.md +1 -1
- package/package.json +2 -2
- package/scripts/dub/service.sh +8 -3
- package/scripts/turn.sh +17 -0
- package/web/assets/index-D3cDtNic.js +8 -0
- package/web/assets/index-DlPqTbMO.css +1 -0
- package/web/index.html +2 -2
- package/zombienet-configs/local-dev.toml +4 -0
- package/web/assets/index-BW4b1s2y.js +0 -7
- package/web/assets/index-X3pZpnYk.css +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// What `ppn bite --cores <chain=n> --collators <chain=n>` asks for, checked against the network
|
|
2
|
+
// and settled into the ForkTopology the bundle records.
|
|
3
|
+
//
|
|
4
|
+
// Settled at bite time, not at spawn: the collator authority sets and the relay's core layout
|
|
5
|
+
// are state inside the snapshots (fork/validators.ts, fork/shared-relay.ts), so the fork TOML
|
|
6
|
+
// can only follow what the bundle says. A bundle bitten with the defaults carries no topology.
|
|
7
|
+
import { planCores } from './shared-relay.js';
|
|
8
|
+
import { MAX_VALIDATORS } from './validators.js';
|
|
9
|
+
function parseCounts(flag, specs, net) {
|
|
10
|
+
const counts = {};
|
|
11
|
+
const known = net.parachains.map((p) => p.key);
|
|
12
|
+
for (const spec of specs ?? []) {
|
|
13
|
+
const at = spec.indexOf('=');
|
|
14
|
+
if (at < 1)
|
|
15
|
+
throw new Error(`${flag} wants <chain>=<count>, got "${spec}"`);
|
|
16
|
+
const key = spec.slice(0, at);
|
|
17
|
+
const count = Number(spec.slice(at + 1));
|
|
18
|
+
if (!known.includes(key)) {
|
|
19
|
+
throw new Error(`${flag} names "${key}", which ${net.name} does not run (${known.join(', ')})`);
|
|
20
|
+
}
|
|
21
|
+
if (!Number.isInteger(count) || count < 1) {
|
|
22
|
+
throw new Error(`${flag} ${key}: a count is a whole number of at least 1, not "${spec.slice(at + 1)}"`);
|
|
23
|
+
}
|
|
24
|
+
counts[key] = count;
|
|
25
|
+
}
|
|
26
|
+
return counts;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The topology a bite was asked for, or undefined when it was asked for nothing.
|
|
30
|
+
*
|
|
31
|
+
* The validator count is not asked for: every core needs a validator group of its own or nothing
|
|
32
|
+
* backs the blocks on it, so it is the descriptor's count or the number of cores, whichever is
|
|
33
|
+
* larger. That is capped where the relay ports run out (MAX_VALIDATORS).
|
|
34
|
+
*/
|
|
35
|
+
export function resolveTopology(opts, net) {
|
|
36
|
+
const cores = parseCounts('--cores', opts.cores, net);
|
|
37
|
+
const collators = parseCounts('--collators', opts.collators, net);
|
|
38
|
+
if (!Object.keys(cores).length && !Object.keys(collators).length)
|
|
39
|
+
return undefined;
|
|
40
|
+
const totalCores = planCores(net.parachains, cores).length;
|
|
41
|
+
const validators = Math.max(net.relay.validators, totalCores);
|
|
42
|
+
if (validators > MAX_VALIDATORS) {
|
|
43
|
+
throw new Error(`--cores adds up to ${totalCores} cores, which need ${totalCores} validators; a fork runs at most ${MAX_VALIDATORS}`);
|
|
44
|
+
}
|
|
45
|
+
return { validators, cores, collators };
|
|
46
|
+
}
|
|
47
|
+
/** Whether a bundle was bitten with this topology — both absent counts as the same. */
|
|
48
|
+
export function sameTopology(a, b) {
|
|
49
|
+
const norm = (t) => JSON.stringify(t ? { v: t.validators, c: sorted(t.cores), k: sorted(t.collators) } : null);
|
|
50
|
+
const sorted = (r) => Object.fromEntries(Object.entries(r).sort());
|
|
51
|
+
return norm(a) === norm(b);
|
|
52
|
+
}
|
|
53
|
+
/** The flags that ask for a topology, for an error message that says how to re-bite. */
|
|
54
|
+
export function topologyFlags(t) {
|
|
55
|
+
return [
|
|
56
|
+
...Object.entries(t.cores).map(([k, n]) => `--cores ${k}=${n}`),
|
|
57
|
+
...Object.entries(t.collators).map(([k, n]) => `--collators ${k}=${n}`),
|
|
58
|
+
].join(' ');
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=topology.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topology.js","sourceRoot":"","sources":["../../src/fork/topology.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,wDAAwD;AACxD,EAAE;AACF,8FAA8F;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AC,CAAC;IAC7F,MAAM,MAAM,GAAG,CAAC,CAAyB,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3F,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAAC,CAAe;IAC3C,OAAO;QACL,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/D,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;KACxE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AuraScheme } from '@parity/ppn-network-config';
|
|
2
2
|
export declare const ALICE_SR = "d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d";
|
|
3
3
|
export interface DevValidator {
|
|
4
4
|
stash: string;
|
|
@@ -9,14 +9,17 @@ export interface DevValidator {
|
|
|
9
9
|
paraAssignment: string;
|
|
10
10
|
authorityDiscovery: string;
|
|
11
11
|
}
|
|
12
|
+
/** Relay RPC ports are `RELAY_BASE_PORT + i`, and the eleventh would land on People's. */
|
|
13
|
+
export declare const MAX_VALIDATORS = 10;
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* The dev keys for `count` relay validators, derived the way zombienet writes them into a
|
|
16
|
+
* node's keystore: stash `//<Name>//stash`, BABE and the parachain keys sr25519 `//<Name>`,
|
|
17
|
+
* GRANDPA the ed25519 key of that seed and BEEFY its ecdsa key. For the first six this is
|
|
18
|
+
* byte-identical to the keys zombie-bite hard-codes in src/utils.rs (pinned by test), except
|
|
19
|
+
* Charlie's and Dave's BEEFY keys, which zombie-bite has as bytes no seed derives to; the
|
|
20
|
+
* keystore holds the derived ones, so those are what the session keys name here.
|
|
18
21
|
*/
|
|
19
|
-
export declare
|
|
22
|
+
export declare function devValidators(count: number): Promise<DevValidator[]>;
|
|
20
23
|
export declare const sessionKeys: (v: DevValidator) => string;
|
|
21
24
|
/**
|
|
22
25
|
* Relay storage values that install the dev authority set.
|
|
@@ -32,9 +35,9 @@ export declare const sessionKeys: (v: DevValidator) => string;
|
|
|
32
35
|
* Hrmp::* / Dmp::* keeps the four HRMP channels
|
|
33
36
|
* Paras::Parachains keeps all four parachains registered
|
|
34
37
|
*/
|
|
35
|
-
export declare function relayCandidates(): Record<string, string>;
|
|
38
|
+
export declare function relayCandidates(validators: DevValidator[]): Record<string, string>;
|
|
36
39
|
/** Session::NextKeys is a map, so our validators' entries are injects, not overrides. */
|
|
37
|
-
export declare function relayInjects(): Record<string, string>;
|
|
40
|
+
export declare function relayInjects(validators: DevValidator[]): Record<string, string>;
|
|
38
41
|
/**
|
|
39
42
|
* Endow the fork's sudo (//Alice) by writing its System::Account entry at import.
|
|
40
43
|
*
|
|
@@ -47,15 +50,18 @@ export declare function relayInjects(): Record<string, string>;
|
|
|
47
50
|
*/
|
|
48
51
|
export declare function sudoEndowInjects(): Record<string, string>;
|
|
49
52
|
/**
|
|
50
|
-
* The collator
|
|
53
|
+
* The collator keys for a parachain, one per collator node.
|
|
51
54
|
*
|
|
52
|
-
* zombie-bite derives
|
|
55
|
+
* zombie-bite derives the first from the seed "//Collator-<paraId>" and names the collator
|
|
53
56
|
* Collator-<paraId>; zombienet derives non-well-known node keys the same way, so the two
|
|
54
|
-
* agree. Verified byte-identical against a real `bite -r paseo` run.
|
|
57
|
+
* agree. Verified byte-identical against a real `bite -r paseo` run. Further collators follow
|
|
58
|
+
* the node names collatorNodeName() gives them, for the same reason.
|
|
55
59
|
*
|
|
56
60
|
* The curve is the chain's, not ours: see auraScheme(). The same seed on the other curve
|
|
57
61
|
* is a different key, and zombienet already writes it — under `gran`, not `aura`.
|
|
58
62
|
*/
|
|
63
|
+
export declare function collatorKeys(paraId: number, count: number, scheme?: AuraScheme): Promise<string[]>;
|
|
64
|
+
/** The one collator every bite before collator counts installed. */
|
|
59
65
|
export declare function collatorKey(paraId: number, scheme?: AuraScheme): Promise<string>;
|
|
60
66
|
/**
|
|
61
67
|
* Authorize a runtime upgrade in storage, so a fork with no sudo can still enact one.
|
|
@@ -77,5 +83,10 @@ export declare function collatorKey(paraId: number, scheme?: AuraScheme): Promis
|
|
|
77
83
|
* where this belongs once PPN calls zombie-bite instead of driving doppelganger itself.
|
|
78
84
|
*/
|
|
79
85
|
export declare function authorizedUpgradeCandidate(codeHash: string, checkVersion: boolean): Record<string, string>;
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Parachain storage values that install the collators as its authority set. One key serves as
|
|
88
|
+
* both the account and the Aura key: the seed is the same and the account is the sr25519 public
|
|
89
|
+
* key, which is what CollatorSelection and Session hold.
|
|
90
|
+
*/
|
|
91
|
+
export declare function paraCandidates(collators: string[]): Record<string, string>;
|
|
92
|
+
export declare function paraInjects(collators: string[]): Record<string, string>;
|
package/dist/fork/validators.js
CHANGED
|
@@ -10,26 +10,50 @@
|
|
|
10
10
|
import { Keyring } from '@polkadot/keyring';
|
|
11
11
|
import { cryptoWaitReady } from '@polkadot/util-crypto';
|
|
12
12
|
import { blake2128Concat, compactLen, keyOf, twox64Concat, u128le, u32le } from './codec.js';
|
|
13
|
+
import { collatorNodeName, relayNodeName } from '@parity/ppn-network-config';
|
|
13
14
|
export const ALICE_SR = 'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
paraValidator: babe, paraAssignment: babe, authorityDiscovery: babe,
|
|
17
|
-
});
|
|
15
|
+
/** Relay RPC ports are `RELAY_BASE_PORT + i`, and the eleventh would land on People's. */
|
|
16
|
+
export const MAX_VALIDATORS = 10;
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
18
|
+
* The names the relay's dev keys derive from, in the order the authority set lists them.
|
|
20
19
|
*
|
|
21
|
-
*
|
|
22
|
-
* EVE (note FERDIE before EVE) — because ActiveValidatorIndices and ValidatorGroups
|
|
23
|
-
* into
|
|
20
|
+
* The first six are zombie-bite's get_validator_keys() order — ALICE, BOB, CHARLIE, DAVE,
|
|
21
|
+
* FERDIE, EVE (note FERDIE before EVE) — because ActiveValidatorIndices and ValidatorGroups
|
|
22
|
+
* index into the list positionally, and a bundle bitten with the old hard-coded keys had that
|
|
23
|
+
* order. The names beyond them are whatever the fork TOML calls the extra nodes: zombienet
|
|
24
|
+
* derives a non-well-known node's keys from `//<Name>`, exactly as done here.
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
function validatorNames(count) {
|
|
27
|
+
const wellKnown = ['Alice', 'Bob', 'Charlie', 'Dave', 'Ferdie', 'Eve'];
|
|
28
|
+
return Array.from({ length: count }, (_, i) => wellKnown[i] ?? relayNodeName(i));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The dev keys for `count` relay validators, derived the way zombienet writes them into a
|
|
32
|
+
* node's keystore: stash `//<Name>//stash`, BABE and the parachain keys sr25519 `//<Name>`,
|
|
33
|
+
* GRANDPA the ed25519 key of that seed and BEEFY its ecdsa key. For the first six this is
|
|
34
|
+
* byte-identical to the keys zombie-bite hard-codes in src/utils.rs (pinned by test), except
|
|
35
|
+
* Charlie's and Dave's BEEFY keys, which zombie-bite has as bytes no seed derives to; the
|
|
36
|
+
* keystore holds the derived ones, so those are what the session keys name here.
|
|
37
|
+
*/
|
|
38
|
+
export async function devValidators(count) {
|
|
39
|
+
if (!Number.isInteger(count) || count < 1 || count > MAX_VALIDATORS) {
|
|
40
|
+
throw new Error(`a fork runs 1..${MAX_VALIDATORS} relay validators, not ${count}`);
|
|
41
|
+
}
|
|
42
|
+
await cryptoWaitReady();
|
|
43
|
+
const hex = (scheme, suri) => Buffer.from(new Keyring({ type: scheme }).addFromUri(suri).publicKey).toString('hex');
|
|
44
|
+
return validatorNames(count).map((name) => {
|
|
45
|
+
const babe = hex('sr25519', `//${name}`);
|
|
46
|
+
return {
|
|
47
|
+
stash: hex('sr25519', `//${name}//stash`),
|
|
48
|
+
babe,
|
|
49
|
+
grandpa: hex('ed25519', `//${name}`),
|
|
50
|
+
beefy: hex('ecdsa', `//${name}`),
|
|
51
|
+
paraValidator: babe,
|
|
52
|
+
paraAssignment: babe,
|
|
53
|
+
authorityDiscovery: babe,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}
|
|
33
57
|
export const sessionKeys = (v) => v.grandpa + v.babe + v.paraValidator + v.paraAssignment + v.authorityDiscovery + v.beefy;
|
|
34
58
|
/**
|
|
35
59
|
* Relay storage values that install the dev authority set.
|
|
@@ -45,9 +69,9 @@ export const sessionKeys = (v) => v.grandpa + v.babe + v.paraValidator + v.paraA
|
|
|
45
69
|
* Hrmp::* / Dmp::* keeps the four HRMP channels
|
|
46
70
|
* Paras::Parachains keeps all four parachains registered
|
|
47
71
|
*/
|
|
48
|
-
export function relayCandidates() {
|
|
49
|
-
const len = compactLen(
|
|
50
|
-
const each = (f) =>
|
|
72
|
+
export function relayCandidates(validators) {
|
|
73
|
+
const len = compactLen(validators.length);
|
|
74
|
+
const each = (f) => validators.map(f).join('');
|
|
51
75
|
return {
|
|
52
76
|
[keyOf('Session', 'Validators')]: len + each((v) => v.stash),
|
|
53
77
|
[keyOf('Session', 'QueuedKeys')]: len + each((v) => v.stash + sessionKeys(v)),
|
|
@@ -55,14 +79,14 @@ export function relayCandidates() {
|
|
|
55
79
|
[keyOf('Babe', 'NextAuthorities')]: len + each((v) => v.babe + '0100000000000000'),
|
|
56
80
|
[keyOf('Grandpa', 'Authorities')]: len + each((v) => v.grandpa + '0100000000000000'),
|
|
57
81
|
[keyOf('Staking', 'Invulnerables')]: len + each((v) => v.stash),
|
|
58
|
-
[keyOf('ParasShared', 'ActiveValidatorIndices')]: len +
|
|
82
|
+
[keyOf('ParasShared', 'ActiveValidatorIndices')]: len + validators.map((_, i) => u32le(i)).join(''),
|
|
59
83
|
[keyOf('ParasShared', 'ActiveValidatorKeys')]: len + each((v) => v.paraValidator),
|
|
60
84
|
[keyOf('AuthorityDiscovery', 'Keys')]: len + each((v) => v.authorityDiscovery),
|
|
61
85
|
[keyOf('AuthorityDiscovery', 'NextKeys')]: len + each((v) => v.authorityDiscovery),
|
|
62
86
|
[keyOf('Sudo', 'Key')]: ALICE_SR,
|
|
63
87
|
// Each group carries its own compact length. Verified against production, whose real
|
|
64
88
|
// value is `18` + 6x(`04` + u32) = [[0],[1],[2],[3],[4],[5]].
|
|
65
|
-
[keyOf('ParaScheduler', 'ValidatorGroups')]: len +
|
|
89
|
+
[keyOf('ParaScheduler', 'ValidatorGroups')]: len + validators.map((_, i) => compactLen(1) + u32le(i)).join(''),
|
|
66
90
|
// Without this the relay takes the validator set Asset Hub elects. None of those accounts
|
|
67
91
|
// holds session keys on a fork, so `pallet_session` queues an empty set and announces the
|
|
68
92
|
// next BABE epoch with no authorities: nobody can claim a slot, no block enacts the next
|
|
@@ -75,11 +99,11 @@ export function relayCandidates() {
|
|
|
75
99
|
};
|
|
76
100
|
}
|
|
77
101
|
/** Session::NextKeys is a map, so our validators' entries are injects, not overrides. */
|
|
78
|
-
export function relayInjects() {
|
|
102
|
+
export function relayInjects(validators) {
|
|
79
103
|
// twox128(":UsePreviousValidators:")
|
|
80
104
|
const injects = { c57d82d01f0fc18afc048ca20ac460dd: '01' };
|
|
81
105
|
const nextKeys = keyOf('Session', 'NextKeys');
|
|
82
|
-
for (const v of
|
|
106
|
+
for (const v of validators) {
|
|
83
107
|
injects[nextKeys + twox64Concat(v.stash)] = sessionKeys(v);
|
|
84
108
|
}
|
|
85
109
|
return injects;
|
|
@@ -108,19 +132,26 @@ export function sudoEndowInjects() {
|
|
|
108
132
|
return { [keyOf('System', 'Account') + blake2128Concat(alice)]: info };
|
|
109
133
|
}
|
|
110
134
|
/**
|
|
111
|
-
* The collator
|
|
135
|
+
* The collator keys for a parachain, one per collator node.
|
|
112
136
|
*
|
|
113
|
-
* zombie-bite derives
|
|
137
|
+
* zombie-bite derives the first from the seed "//Collator-<paraId>" and names the collator
|
|
114
138
|
* Collator-<paraId>; zombienet derives non-well-known node keys the same way, so the two
|
|
115
|
-
* agree. Verified byte-identical against a real `bite -r paseo` run.
|
|
139
|
+
* agree. Verified byte-identical against a real `bite -r paseo` run. Further collators follow
|
|
140
|
+
* the node names collatorNodeName() gives them, for the same reason.
|
|
116
141
|
*
|
|
117
142
|
* The curve is the chain's, not ours: see auraScheme(). The same seed on the other curve
|
|
118
143
|
* is a different key, and zombienet already writes it — under `gran`, not `aura`.
|
|
119
144
|
*/
|
|
120
|
-
export async function
|
|
145
|
+
export async function collatorKeys(paraId, count, scheme = 'sr25519') {
|
|
146
|
+
if (!Number.isInteger(count) || count < 1)
|
|
147
|
+
throw new Error(`a parachain runs at least one collator, not ${count}`);
|
|
121
148
|
await cryptoWaitReady();
|
|
122
|
-
const
|
|
123
|
-
return Buffer.from(
|
|
149
|
+
const keyring = new Keyring({ type: scheme });
|
|
150
|
+
return Array.from({ length: count }, (_, i) => Buffer.from(keyring.addFromUri(`//${collatorNodeName(paraId, i)}`).publicKey).toString('hex'));
|
|
151
|
+
}
|
|
152
|
+
/** The one collator every bite before collator counts installed. */
|
|
153
|
+
export async function collatorKey(paraId, scheme = 'sr25519') {
|
|
154
|
+
return (await collatorKeys(paraId, 1, scheme))[0];
|
|
124
155
|
}
|
|
125
156
|
/**
|
|
126
157
|
* Authorize a runtime upgrade in storage, so a fork with no sudo can still enact one.
|
|
@@ -149,26 +180,34 @@ export function authorizedUpgradeCandidate(codeHash, checkVersion) {
|
|
|
149
180
|
throw new Error(`code hash must be 32 bytes of hex, got "${codeHash}"`);
|
|
150
181
|
return { [keyOf('System', 'AuthorizedUpgrade')]: hash + (checkVersion ? '01' : '00') };
|
|
151
182
|
}
|
|
152
|
-
|
|
153
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Parachain storage values that install the collators as its authority set. One key serves as
|
|
185
|
+
* both the account and the Aura key: the seed is the same and the account is the sr25519 public
|
|
186
|
+
* key, which is what CollatorSelection and Session hold.
|
|
187
|
+
*/
|
|
188
|
+
export function paraCandidates(collators) {
|
|
189
|
+
const len = compactLen(collators.length);
|
|
190
|
+
const all = collators.join('');
|
|
154
191
|
return {
|
|
155
|
-
[keyOf('CollatorSelection', 'DesiredCandidates')]:
|
|
156
|
-
[keyOf('CollatorSelection', 'Invulnerables')]:
|
|
157
|
-
[keyOf('AuraExt', 'Authorities')]:
|
|
158
|
-
[keyOf('Aura', 'Authorities')]:
|
|
159
|
-
[keyOf('Session', 'Validators')]:
|
|
160
|
-
[keyOf('Session', 'QueuedKeys')]:
|
|
192
|
+
[keyOf('CollatorSelection', 'DesiredCandidates')]: u32le(collators.length),
|
|
193
|
+
[keyOf('CollatorSelection', 'Invulnerables')]: len + all,
|
|
194
|
+
[keyOf('AuraExt', 'Authorities')]: len + all,
|
|
195
|
+
[keyOf('Aura', 'Authorities')]: len + all,
|
|
196
|
+
[keyOf('Session', 'Validators')]: len + all,
|
|
197
|
+
[keyOf('Session', 'QueuedKeys')]: len + collators.map((c) => c + c).join(''),
|
|
161
198
|
[keyOf('Sudo', 'Key')]: ALICE_SR,
|
|
162
199
|
// ParachainSystem::LastDmqMqcHead is left alone: zeroing it (as zombie-bite does)
|
|
163
200
|
// desyncs the parachain from the relay's preserved Dmp state.
|
|
164
201
|
};
|
|
165
202
|
}
|
|
166
|
-
export function paraInjects(
|
|
167
|
-
|
|
168
|
-
|
|
203
|
+
export function paraInjects(collators) {
|
|
204
|
+
const injects = {};
|
|
205
|
+
for (const collator of collators) {
|
|
206
|
+
injects[keyOf('Session', 'NextKeys') + twox64Concat(collator)] = collator;
|
|
169
207
|
// Session::KeyOwner(("aura", collatorKey))
|
|
170
|
-
['cec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa1950eab3d4a1675d3d746175726180' +
|
|
171
|
-
collator]
|
|
172
|
-
}
|
|
208
|
+
injects['cec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa1950eab3d4a1675d3d746175726180' +
|
|
209
|
+
collator] = collator;
|
|
210
|
+
}
|
|
211
|
+
return injects;
|
|
173
212
|
}
|
|
174
213
|
//# sourceMappingURL=validators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/fork/validators.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,4FAA4F;AAC5F,qFAAqF;AACrF,kEAAkE;AAClE,EAAE;AACF,4FAA4F;AAC5F,yFAAyF;AACzF,oFAAoF;AAEpF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/fork/validators.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,4FAA4F;AAC5F,qFAAqF;AACrF,kEAAkE;AAClE,EAAE;AACF,4FAA4F;AAC5F,yFAAyF;AACzF,oFAAoF;AAEpF,OAAO,EAAE,OAAO,EAAE,MAAM,mBA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CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5E,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ;QAChC,kFAAkF;QAClF,8DAA8D;KAC/D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,SAAmB;IAC7C,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,GAAG,QAAQ,CAAC;QAC1E,2CAA2C;QAC3C,OAAO,CACL,4FAA4F;YAC1F,QAAQ,CACX,GAAG,QAAQ,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The processone tap: eturnal.net publishes no macOS binary. */
|
|
2
|
+
export declare const ETURNAL_BREW_INSTALL = "brew tap processone/eturnal https://github.com/processone/eturnal && brew install processone/eturnal/eturnal";
|
|
3
|
+
/** Where `ppn fetch` unpacks the Linux release: a whole prefix tree, bundled ERTS included. */
|
|
4
|
+
export declare function eturnalDist(sharedBinDir: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* eturnalctl for this OS: the fetched tree on Linux, the Homebrew install on macOS. Null when
|
|
7
|
+
* it is not there; callers say how to get it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function eturnalCtl(sharedBinDir: string): string | null;
|
|
10
|
+
/** The installed Homebrew version, e.g. "1.12.3", or null. */
|
|
11
|
+
export declare function brewEturnalVersion(): string | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
/** The processone tap: eturnal.net publishes no macOS binary. */
|
|
5
|
+
export const ETURNAL_BREW_INSTALL = 'brew tap processone/eturnal https://github.com/processone/eturnal && brew install processone/eturnal/eturnal';
|
|
6
|
+
/** Where `ppn fetch` unpacks the Linux release: a whole prefix tree, bundled ERTS included. */
|
|
7
|
+
export function eturnalDist(sharedBinDir) {
|
|
8
|
+
return path.join(sharedBinDir, 'eturnal');
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* eturnalctl for this OS: the fetched tree on Linux, the Homebrew install on macOS. Null when
|
|
12
|
+
* it is not there; callers say how to get it.
|
|
13
|
+
*/
|
|
14
|
+
export function eturnalCtl(sharedBinDir) {
|
|
15
|
+
if (process.platform === 'darwin') {
|
|
16
|
+
// Not `brew --prefix`: zombienet starts custom processes without HOME, and brew refuses
|
|
17
|
+
// to run without it.
|
|
18
|
+
const prefixes = [process.env.HOMEBREW_PREFIX, '/opt/homebrew', '/usr/local'].filter(Boolean);
|
|
19
|
+
const ctl = prefixes.map((p) => path.join(p, 'opt', 'eturnal', 'bin', 'eturnalctl')).find((c) => fs.existsSync(c));
|
|
20
|
+
return ctl ?? null;
|
|
21
|
+
}
|
|
22
|
+
const ctl = path.join(eturnalDist(sharedBinDir), 'bin', 'eturnalctl');
|
|
23
|
+
return fs.existsSync(ctl) ? ctl : null;
|
|
24
|
+
}
|
|
25
|
+
/** The installed Homebrew version, e.g. "1.12.3", or null. */
|
|
26
|
+
export function brewEturnalVersion() {
|
|
27
|
+
try {
|
|
28
|
+
const out = execFileSync('brew', ['list', '--versions', 'eturnal'], { encoding: 'utf-8' }).trim();
|
|
29
|
+
return out.split(/\s+/)[1] ?? null;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=eturnal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eturnal.js","sourceRoot":"","sources":["../../src/lib/eturnal.ts"],"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,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAClG,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/lib/spawn-stamp.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// added here cannot reach one path and silently miss the other.
|
|
14
14
|
import fs from 'node:fs';
|
|
15
15
|
import path from 'node:path';
|
|
16
|
+
import { distManifest } from './version.js';
|
|
16
17
|
export const SPAWN_FILE = 'spawn.json';
|
|
17
18
|
/** The bite fields a manifest contributes, or null when there is no usable manifest. */
|
|
18
19
|
function biteFrom(manifest) {
|
|
@@ -27,17 +28,6 @@ function biteFrom(manifest) {
|
|
|
27
28
|
return null;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
function packedVersion(repoRoot) {
|
|
31
|
-
const dist = path.join(repoRoot, '.ppn-dist.json');
|
|
32
|
-
if (!fs.existsSync(dist))
|
|
33
|
-
return undefined;
|
|
34
|
-
try {
|
|
35
|
-
return JSON.parse(fs.readFileSync(dist, 'utf-8')).version;
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
31
|
/**
|
|
42
32
|
* Write `<dataDir>/spawn.json` and return what was written.
|
|
43
33
|
*
|
|
@@ -45,7 +35,7 @@ function packedVersion(repoRoot) {
|
|
|
45
35
|
* service starts, which may be the first thing to touch a freshly wiped DATA_DIR.
|
|
46
36
|
*/
|
|
47
37
|
export function writeSpawnStamp(dataDir, input) {
|
|
48
|
-
const version =
|
|
38
|
+
const version = distManifest(input.repoRoot)?.version;
|
|
49
39
|
const stamp = {
|
|
50
40
|
spawnedAt: new Date().toISOString(),
|
|
51
41
|
network: input.network,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn-stamp.js","sourceRoot":"","sources":["../../src/lib/spawn-stamp.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,2FAA2F;AAC3F,6FAA6F;AAC7F,4FAA4F;AAC5F,4FAA4F;AAC5F,wBAAwB;AACxB,EAAE;AACF,uFAAuF;AACvF,8FAA8F;AAC9F,sGAAsG;AACtG,8FAA8F;AAC9F,gEAAgE;AAEhE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"spawn-stamp.js","sourceRoot":"","sources":["../../src/lib/spawn-stamp.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,2FAA2F;AAC3F,6FAA6F;AAC7F,4FAA4F;AAC5F,4FAA4F;AAC5F,wBAAwB;AACxB,EAAE;AACF,uFAAuF;AACvF,8FAA8F;AAC9F,sGAAsG;AACtG,8FAA8F;AAC9F,gEAAgE;AAEhE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AA+BvC,wFAAwF;AACxF,SAAS,QAAQ,CAAC,QAAmC;IACnD,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IACvD,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QACzD,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,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AAI,CAAC;IACtC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QACzD,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAE,KAAoB,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7G,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** How this copy got here. */
|
|
2
|
+
export type Install = 'dist' | 'npm' | 'checkout' | 'docker';
|
|
3
|
+
/** The subset of `ppn dist`'s manifest anything reads back. */
|
|
4
|
+
export interface DistManifest {
|
|
5
|
+
version: string;
|
|
6
|
+
builtAt?: string;
|
|
7
|
+
repo?: string;
|
|
8
|
+
commit?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface VersionInfo {
|
|
11
|
+
/** The published version. In a checkout it is the unreleased placeholder — read `commit`. */
|
|
12
|
+
version: string;
|
|
13
|
+
install: Install;
|
|
14
|
+
/**
|
|
15
|
+
* The build's commit on a dist, HEAD in a checkout. An npm install and the Docker image
|
|
16
|
+
* carry none.
|
|
17
|
+
*/
|
|
18
|
+
commit?: string;
|
|
19
|
+
repo?: string;
|
|
20
|
+
builtAt?: string;
|
|
21
|
+
node: string;
|
|
22
|
+
platform: string;
|
|
23
|
+
packageRoot: string;
|
|
24
|
+
workspace: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The manifest `ppn dist` writes into a release tarball, or null when this is not one.
|
|
28
|
+
*
|
|
29
|
+
* Also the spawn stamp's source for the version a network was brought up on, so the two
|
|
30
|
+
* cannot disagree about what a deployed tree is.
|
|
31
|
+
*/
|
|
32
|
+
export declare function distManifest(root: string): DistManifest | null;
|
|
33
|
+
/**
|
|
34
|
+
* The version `@parity/ppn` declares.
|
|
35
|
+
*
|
|
36
|
+
* Two layouts, because the package root is not always the package: installed, it *is*
|
|
37
|
+
* @parity/ppn; in a checkout or an unpacked dist it is the private workspace root, with the
|
|
38
|
+
* CLI one level in. Both are checked by name rather than by position, so neither a renamed
|
|
39
|
+
* directory nor the private root's own version can be mistaken for a release.
|
|
40
|
+
*/
|
|
41
|
+
export declare function packageVersion(root: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* The bare string behind `ppn --version`.
|
|
44
|
+
*
|
|
45
|
+
* Registered on the program while it is being built, so it must not throw the way
|
|
46
|
+
* `packageRoot()` does: a layout this cannot resolve is one where `ppn --help` still has to
|
|
47
|
+
* work, which is the same reason the help's network list is deferred.
|
|
48
|
+
*/
|
|
49
|
+
export declare function shortVersion(): string;
|
|
50
|
+
export declare function versionInfo(): VersionInfo;
|
|
51
|
+
/** One line of identity, then what it is running on and against. */
|
|
52
|
+
export declare function formatVersion(info: VersionInfo): string;
|