@parity/ppn 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/README.md +84 -0
- package/config/ports.env +128 -0
- package/config/versions.env +120 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +30 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +471 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/bite.d.ts +27 -0
- package/dist/commands/bite.js +556 -0
- package/dist/commands/bite.js.map +1 -0
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.js +503 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/dist.d.ts +7 -0
- package/dist/commands/dist.js +121 -0
- package/dist/commands/dist.js.map +1 -0
- package/dist/commands/fetch.d.ts +11 -0
- package/dist/commands/fetch.js +550 -0
- package/dist/commands/fetch.js.map +1 -0
- package/dist/commands/fork.d.ts +1 -0
- package/dist/commands/fork.js +164 -0
- package/dist/commands/fork.js.map +1 -0
- package/dist/commands/generate.d.ts +7 -0
- package/dist/commands/generate.js +201 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/genesis-toml.d.ts +1 -0
- package/dist/commands/genesis-toml.js +26 -0
- package/dist/commands/genesis-toml.js.map +1 -0
- package/dist/commands/nginx-conf.d.ts +1 -0
- package/dist/commands/nginx-conf.js +32 -0
- package/dist/commands/nginx-conf.js.map +1 -0
- package/dist/commands/service-context.d.ts +13 -0
- package/dist/commands/service-context.js +5 -0
- package/dist/commands/service-context.js.map +1 -0
- package/dist/commands/service.d.ts +28 -0
- package/dist/commands/service.js +807 -0
- package/dist/commands/service.js.map +1 -0
- package/dist/commands/stamp-spawn.d.ts +7 -0
- package/dist/commands/stamp-spawn.js +43 -0
- package/dist/commands/stamp-spawn.js.map +1 -0
- package/dist/commands/start.d.ts +33 -0
- package/dist/commands/start.js +462 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/upgrade.d.ts +15 -0
- package/dist/commands/upgrade.js +101 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/fork/chains.d.ts +25 -0
- package/dist/fork/chains.js +36 -0
- package/dist/fork/chains.js.map +1 -0
- package/dist/fork/codec.d.ts +36 -0
- package/dist/fork/codec.js +122 -0
- package/dist/fork/codec.js.map +1 -0
- package/dist/fork/manifest.d.ts +13 -0
- package/dist/fork/manifest.js +77 -0
- package/dist/fork/manifest.js.map +1 -0
- package/dist/fork/overrides.d.ts +45 -0
- package/dist/fork/overrides.js +255 -0
- package/dist/fork/overrides.js.map +1 -0
- package/dist/fork/products.d.ts +68 -0
- package/dist/fork/products.js +265 -0
- package/dist/fork/products.js.map +1 -0
- package/dist/fork/rpc.d.ts +25 -0
- package/dist/fork/rpc.js +51 -0
- package/dist/fork/rpc.js.map +1 -0
- package/dist/fork/shared-relay.d.ts +99 -0
- package/dist/fork/shared-relay.js +162 -0
- package/dist/fork/shared-relay.js.map +1 -0
- package/dist/fork/sleep.d.ts +3 -0
- package/dist/fork/sleep.js +2 -0
- package/dist/fork/sleep.js.map +1 -0
- package/dist/fork/validators.d.ts +81 -0
- package/dist/fork/validators.js +170 -0
- package/dist/fork/validators.js.map +1 -0
- package/dist/fork/verify.d.ts +79 -0
- package/dist/fork/verify.js +192 -0
- package/dist/fork/verify.js.map +1 -0
- package/dist/lib/archive.d.ts +8 -0
- package/dist/lib/archive.js +40 -0
- package/dist/lib/archive.js.map +1 -0
- package/dist/lib/fork-bundle-name.d.ts +4 -0
- package/dist/lib/fork-bundle-name.js +20 -0
- package/dist/lib/fork-bundle-name.js.map +1 -0
- package/dist/lib/github.d.ts +48 -0
- package/dist/lib/github.js +192 -0
- package/dist/lib/github.js.map +1 -0
- package/dist/lib/provenance.d.ts +67 -0
- package/dist/lib/provenance.js +98 -0
- package/dist/lib/provenance.js.map +1 -0
- package/dist/lib/spawn-env.d.ts +33 -0
- package/dist/lib/spawn-env.js +71 -0
- package/dist/lib/spawn-env.js.map +1 -0
- package/dist/lib/spawn-stamp.d.ts +34 -0
- package/dist/lib/spawn-stamp.js +63 -0
- package/dist/lib/spawn-stamp.js.map +1 -0
- package/dist/upgrade/chains.d.ts +4 -0
- package/dist/upgrade/chains.js +17 -0
- package/dist/upgrade/chains.js.map +1 -0
- package/dist/upgrade/fund.d.ts +38 -0
- package/dist/upgrade/fund.js +119 -0
- package/dist/upgrade/fund.js.map +1 -0
- package/dist/upgrade/provider-node.d.ts +2 -0
- package/dist/upgrade/provider-node.js +7 -0
- package/dist/upgrade/provider-node.js.map +1 -0
- package/dist/upgrade/signer.d.ts +21 -0
- package/dist/upgrade/signer.js +48 -0
- package/dist/upgrade/signer.js.map +1 -0
- package/dist/upgrade/sudo.d.ts +2 -0
- package/dist/upgrade/sudo.js +26 -0
- package/dist/upgrade/sudo.js.map +1 -0
- package/dist/upgrade/upgrade.d.ts +128 -0
- package/dist/upgrade/upgrade.js +539 -0
- package/dist/upgrade/upgrade.js.map +1 -0
- package/networks/README.md +120 -0
- package/networks/devnet.json +113 -0
- package/networks/kusama.json +56 -0
- package/networks/paseo-next-v2.json +87 -0
- package/networks/polkadot.json +57 -0
- package/networks/previewnet.json +186 -0
- package/package.json +54 -0
- package/scripts/assign-cores.sh +12 -0
- package/scripts/dashboard.sh +11 -0
- package/scripts/docker-entrypoint.sh +52 -0
- package/scripts/dub/postgres.sh +116 -0
- package/scripts/dub/service.sh +202 -0
- package/scripts/ensure-dot-cli.sh +23 -0
- package/scripts/eth-rpc.sh +45 -0
- package/scripts/force-open-hrmp.sh +11 -0
- package/scripts/grant-invites.sh +11 -0
- package/scripts/increase-people-lite-attestation-allowance.sh +11 -0
- package/scripts/install.sh +12 -0
- package/scripts/ipfs-daemon.sh +48 -0
- package/scripts/ipfs-swarm.sh +48 -0
- package/scripts/kill-port.sh +11 -0
- package/scripts/lib/workspace.sh +47 -0
- package/scripts/omni-node.sh +112 -0
- package/scripts/patch-bootnodes.sh +11 -0
- package/scripts/pin-bulletin-products.sh +11 -0
- package/scripts/pin-design-families.sh +144 -0
- package/scripts/set-dispatcher-address.sh +11 -0
- package/scripts/storage-provider-node.sh +11 -0
- package/web/assets/index-BW4b1s2y.js +7 -0
- package/web/assets/index-X3pZpnYk.css +1 -0
- package/web/index.html +13 -0
- package/zombienet-configs/local-dev.toml +253 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
// Write the doppelganger storage-override files for a previewnet bite.
|
|
2
|
+
//
|
|
3
|
+
// The values themselves are built in ./validators.ts. What happens here is the part that
|
|
4
|
+
// needs a live chain: every value is decode-verified against the LIVE metadata of the chain
|
|
5
|
+
// being bitten before it is written. That is not belt-and-braces — it is what caught a
|
|
6
|
+
// `ParaScheduler::ValidatorGroups` missing its inner compact length, which decoded as
|
|
7
|
+
// `[[], …]` and would have silently mis-assigned cores.
|
|
8
|
+
import fs from 'node:fs';
|
|
9
|
+
import { rpc, storageIndex } from './rpc.js';
|
|
10
|
+
import { keyOf } from './codec.js';
|
|
11
|
+
import { coreDescriptorsValue, messagingWipes, paraMessagingWipes, planCores, transactionStorageWipes, validatorGroups, } from './shared-relay.js';
|
|
12
|
+
import { collatorKey, paraCandidates, paraInjects, relayCandidates, relayInjects, sudoEndowInjects, authorizedUpgradeCandidate, } from './validators.js';
|
|
13
|
+
/**
|
|
14
|
+
* Keep only values that round-trip through their real on-chain type.
|
|
15
|
+
*
|
|
16
|
+
* A key the runtime does not have is skipped, not an error: the five chains do not all have
|
|
17
|
+
* the same pallets. A key that exists but does not round-trip is always an error.
|
|
18
|
+
*/
|
|
19
|
+
export function verify({ reg, byKey }, candidates) {
|
|
20
|
+
const kept = {};
|
|
21
|
+
const skipped = [];
|
|
22
|
+
const failures = [];
|
|
23
|
+
for (const [key, value] of Object.entries(candidates)) {
|
|
24
|
+
const info = byKey.get(key);
|
|
25
|
+
if (!info) {
|
|
26
|
+
skipped.push(`${key.slice(0, 12)}… (absent from this runtime)`);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (info.plain === null) {
|
|
30
|
+
skipped.push(`${info.label} (map, not a plain value)`);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const decoded = reg.createType(reg.createLookupType(info.plain), '0x' + value);
|
|
35
|
+
if (decoded.toHex().slice(2) !== value)
|
|
36
|
+
throw new Error('round-trip mismatch');
|
|
37
|
+
kept[key] = value;
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
failures.push(`${info.label}: ${e.message}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return { kept, skipped, failures };
|
|
44
|
+
}
|
|
45
|
+
function report(label, result, candidates) {
|
|
46
|
+
for (const s of result.skipped)
|
|
47
|
+
console.log(` skip ${s}`);
|
|
48
|
+
for (const k of Object.keys(result.kept))
|
|
49
|
+
console.log(` ok ${k.slice(0, 12)}…`);
|
|
50
|
+
if (result.failures.length) {
|
|
51
|
+
throw new Error(`${label} failed verification:\n ${result.failures.join('\n ')}`);
|
|
52
|
+
}
|
|
53
|
+
if (Object.keys(result.kept).length === 0) {
|
|
54
|
+
throw new Error(`${label}: nothing verified out of ${Object.keys(candidates).length} candidates`);
|
|
55
|
+
}
|
|
56
|
+
return result.kept;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check every inject against the value type of the map it is written into.
|
|
60
|
+
*
|
|
61
|
+
* Injects are the one class of write a bite makes with nothing checking the shape: `verify()`
|
|
62
|
+
* skips them, because a map has no single plain value to decode against. But the values are
|
|
63
|
+
* hand-assembled — an AccountInfo built field by field, a DMQ head assumed to be one 32-byte
|
|
64
|
+
* hash — and if the runtime disagrees about a width, the bite writes a malformed value, the
|
|
65
|
+
* bundle carries it, and the fork fails later with nothing pointing back here.
|
|
66
|
+
*
|
|
67
|
+
* The key is `<map prefix><hashed key>`, so the entry is found by prefix: the prefix is the
|
|
68
|
+
* first 32 hex characters, exactly as `keyOf` produces it.
|
|
69
|
+
*/
|
|
70
|
+
export function verifyInjects({ reg, byKey }, injects) {
|
|
71
|
+
const kept = {};
|
|
72
|
+
const skipped = [];
|
|
73
|
+
const failures = [];
|
|
74
|
+
for (const [key, value] of Object.entries(injects)) {
|
|
75
|
+
const info = byKey.get(key.slice(0, 32));
|
|
76
|
+
if (!info) {
|
|
77
|
+
skipped.push(`${key.slice(0, 12)}… (no such map in this runtime)`);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (info.mapValue === null) {
|
|
81
|
+
skipped.push(`${info.label} (not a map here)`);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const decoded = reg.createType(reg.createLookupType(info.mapValue), '0x' + value);
|
|
86
|
+
if (decoded.toHex().slice(2) !== value)
|
|
87
|
+
throw new Error('round-trip mismatch');
|
|
88
|
+
kept[key] = value;
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
failures.push(`${info.label}: ${e.message}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { kept, skipped, failures };
|
|
95
|
+
}
|
|
96
|
+
function write(outFile, file, index) {
|
|
97
|
+
const { overrides, injects } = file;
|
|
98
|
+
// Injects go through the same round-trip as overrides, against the map's value type. Checked
|
|
99
|
+
// here rather than at each call site so no future caller can add a map write that nothing
|
|
100
|
+
// decodes. A failure is fatal for the same reason a bad override is: the alternative is a
|
|
101
|
+
// bundle that looks fine and produces a chain that will not run.
|
|
102
|
+
if (index) {
|
|
103
|
+
const result = verifyInjects(index, injects);
|
|
104
|
+
for (const s of result.skipped)
|
|
105
|
+
console.log(` skipped inject ${s}`);
|
|
106
|
+
if (result.failures.length) {
|
|
107
|
+
throw new Error(`${outFile.split('/').pop()}: ${result.failures.length} inject(s) do not match this ` +
|
|
108
|
+
`runtime's storage:\n ${result.failures.join('\n ')}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
fs.writeFileSync(outFile, JSON.stringify(file, null, 2) + '\n');
|
|
112
|
+
console.log(` -> ${outFile.split('/').pop()} (${Object.keys(overrides).length} overrides, ` +
|
|
113
|
+
`${Object.keys(injects).length} injects)\n`);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Encode a value through the chain's own metadata.
|
|
117
|
+
*
|
|
118
|
+
* For anything whose shape is more than a list of integers. `verify()` decodes every override
|
|
119
|
+
* afterwards, so a value built this way is checked both ways by construction.
|
|
120
|
+
*/
|
|
121
|
+
function encode(index, pallet, item, value) {
|
|
122
|
+
const entry = index.byKey.get(keyOf(pallet, item));
|
|
123
|
+
if (!entry?.plain)
|
|
124
|
+
throw new Error(`${pallet}::${item} is not a plain storage value here`);
|
|
125
|
+
const type = index.reg.createLookupType(entry.plain);
|
|
126
|
+
return index.reg.createType(type, value).toHex().slice(2);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Set `scheduler_params.num_cores` in production's own HostConfiguration.
|
|
130
|
+
*
|
|
131
|
+
* Rebuilt from the decoded value's own fields — Codec instances, not JSON. Going through
|
|
132
|
+
* `toJSON()` and back produces bytes that mean the same thing but are not the ones the chain
|
|
133
|
+
* wrote, and `verify()` rightly refuses them: it requires a value to survive decode → encode
|
|
134
|
+
* unchanged. Passing the untouched fields through as codecs keeps them byte-for-byte, so the
|
|
135
|
+
* only bytes that move are the ones for the number being changed.
|
|
136
|
+
*
|
|
137
|
+
* That matters beyond tidiness. This struct also carries `executor_params`, whose
|
|
138
|
+
* `EnabledHostFunction(EccRfc163)` the relay's validators need to accept People's PVFs, plus
|
|
139
|
+
* the async-backing values production tuned. Replacing the whole value would cost all of it to
|
|
140
|
+
* fix one number, which is why the bite leaves this key alone on previewnet entirely.
|
|
141
|
+
*/
|
|
142
|
+
function patchNumCores(index, liveHex, numCores) {
|
|
143
|
+
const entry = index.byKey.get(keyOf('Configuration', 'ActiveConfig'));
|
|
144
|
+
if (!entry?.plain)
|
|
145
|
+
throw new Error('Configuration::ActiveConfig is not a plain value here');
|
|
146
|
+
const type = index.reg.createLookupType(entry.plain);
|
|
147
|
+
const decoded = index.reg.createType(type, liveHex);
|
|
148
|
+
const fields = Object.fromEntries([...decoded.entries()]);
|
|
149
|
+
const params = fields.schedulerParams;
|
|
150
|
+
if (!params?.entries) {
|
|
151
|
+
throw new Error('HostConfiguration has no schedulerParams — this relay runtime is not what the bite expects');
|
|
152
|
+
}
|
|
153
|
+
const paramFields = Object.fromEntries([...params.entries()]);
|
|
154
|
+
const before = Number(paramFields.numCores?.toString());
|
|
155
|
+
if (!Number.isFinite(before)) {
|
|
156
|
+
throw new Error('schedulerParams has no numCores — this relay runtime is not what the bite expects');
|
|
157
|
+
}
|
|
158
|
+
const patchedParams = new params.constructor(index.reg, {
|
|
159
|
+
...paramFields,
|
|
160
|
+
numCores: index.reg.createType('u32', numCores),
|
|
161
|
+
});
|
|
162
|
+
const value = index.reg
|
|
163
|
+
.createType(type, { ...fields, schedulerParams: patchedParams })
|
|
164
|
+
.toHex()
|
|
165
|
+
.slice(2);
|
|
166
|
+
// Guards, because this rebuilds a struct whose layout is the runtime's, not ours: the result
|
|
167
|
+
// must differ from production only inside that one u32, and must read back as asked.
|
|
168
|
+
const bytes = (hex) => hex.match(/../g) ?? [];
|
|
169
|
+
const changed = bytes(value).filter((b, i) => b !== bytes(liveHex.slice(2))[i]).length;
|
|
170
|
+
if (changed === 0 || changed > 4) {
|
|
171
|
+
throw new Error(`patching num_cores changed ${changed} bytes of HostConfiguration; expected 1-4`);
|
|
172
|
+
}
|
|
173
|
+
const readBack = index.reg.createType(type, '0x' + value).toJSON().schedulerParams?.numCores;
|
|
174
|
+
if (readBack !== numCores) {
|
|
175
|
+
throw new Error(`num_cores read back as ${readBack}, not ${numCores}`);
|
|
176
|
+
}
|
|
177
|
+
return { value, before };
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The extra overrides a shared relay needs: our parachains registered alone, laid out on cores
|
|
181
|
+
* from 0 with validator groups to match, `num_cores` cut to fit, and the inherited messaging
|
|
182
|
+
* state cleared. See ./shared-relay.ts for why each one is here.
|
|
183
|
+
*/
|
|
184
|
+
async function sharedRelayCandidates(index, relayUrl, paras, validators) {
|
|
185
|
+
const plan = planCores(paras);
|
|
186
|
+
const paraIds = paras.map((p) => p.paraId);
|
|
187
|
+
// Read production's own HostConfiguration and change exactly one field in it.
|
|
188
|
+
const liveConfig = await rpc(relayUrl, 'state_getStorage', [
|
|
189
|
+
'0x' + keyOf('Configuration', 'ActiveConfig'),
|
|
190
|
+
]);
|
|
191
|
+
if (!liveConfig)
|
|
192
|
+
throw new Error('the relay has no Configuration::ActiveConfig to patch');
|
|
193
|
+
const config = patchNumCores(index, liveConfig, plan.length);
|
|
194
|
+
console.log(` shared relay: ${paraIds.join(', ')} on cores 0-${plan.length - 1}, ` +
|
|
195
|
+
`num_cores ${config.before} -> ${plan.length}`);
|
|
196
|
+
return {
|
|
197
|
+
overrides: {
|
|
198
|
+
[keyOf('ParaScheduler', 'ValidatorGroups')]: validatorGroups(plan.length, validators),
|
|
199
|
+
[keyOf('ParaScheduler', 'CoreDescriptors')]: encode(index, 'ParaScheduler', 'CoreDescriptors', coreDescriptorsValue(plan)),
|
|
200
|
+
[keyOf('Configuration', 'ActiveConfig')]: config.value,
|
|
201
|
+
},
|
|
202
|
+
// Storage map entries, so injects: one per parachain.
|
|
203
|
+
injects: messagingWipes(paraIds),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
export async function relayOverrides(relayUrl, outFile, shared, upgrade) {
|
|
207
|
+
const index = await storageIndex(relayUrl);
|
|
208
|
+
console.log('relay:');
|
|
209
|
+
// Order matters: the shared-relay values replace the ones relayCandidates() sets for a relay
|
|
210
|
+
// that is ours (ValidatorGroups above all), so they come second.
|
|
211
|
+
const extra = shared
|
|
212
|
+
? await sharedRelayCandidates(index, relayUrl, shared.paras, shared.validators)
|
|
213
|
+
: { overrides: {}, injects: {} };
|
|
214
|
+
const candidates = {
|
|
215
|
+
...relayCandidates(),
|
|
216
|
+
...extra.overrides,
|
|
217
|
+
...(upgrade ? authorizedUpgradeCandidate(upgrade.codeHash, upgrade.checkVersion) : {}),
|
|
218
|
+
};
|
|
219
|
+
const overrides = report('relay overrides', verify(index, candidates), candidates);
|
|
220
|
+
write(outFile, {
|
|
221
|
+
overrides,
|
|
222
|
+
// On a shared relay the dev accounts hold nothing — endow sudo at import so its
|
|
223
|
+
// first transaction (a runtime upgrade's fees) is payable.
|
|
224
|
+
injects: { ...relayInjects(), ...(shared ? sudoEndowInjects() : {}), ...extra.injects },
|
|
225
|
+
}, index);
|
|
226
|
+
}
|
|
227
|
+
export async function paraOverrides(paraId, paraUrl, outFile, sharedRelay = false, upgrade, scheme = 'sr25519') {
|
|
228
|
+
const index = await storageIndex(paraUrl);
|
|
229
|
+
const collator = await collatorKey(paraId, scheme);
|
|
230
|
+
// On a shared relay the inherited messaging state is cleared on both sides at once — see
|
|
231
|
+
// ./shared-relay.ts. On our own relay it is preserved on both sides, which is what keeps
|
|
232
|
+
// previewnet's HRMP channels and its XCM tests working.
|
|
233
|
+
// The transaction-storage wipe applies on EVERY bite of a chain with that pallet, not
|
|
234
|
+
// just shared relays: no bite carries the stored data blocks, so once the source chain
|
|
235
|
+
// has an active proof schedule (previewnet's bulletin since v0.0.24), the fork's next
|
|
236
|
+
// proof check panics "Storage proof must be checked once in the block" and the chain
|
|
237
|
+
// wedges one block in — reproduced on the published previewnet bundle 2026-08-19.
|
|
238
|
+
const candidates = {
|
|
239
|
+
...paraCandidates(collator),
|
|
240
|
+
...(sharedRelay ? paraMessagingWipes() : {}),
|
|
241
|
+
...(index.pallets.has('TransactionStorage') ? transactionStorageWipes() : {}),
|
|
242
|
+
...(upgrade ? authorizedUpgradeCandidate(upgrade.codeHash, upgrade.checkVersion) : {}),
|
|
243
|
+
};
|
|
244
|
+
console.log(`para ${paraId} (collator //Collator-${paraId} ${scheme} = ${collator.slice(0, 16)}…):`);
|
|
245
|
+
const overrides = report(`para ${paraId} overrides`, verify(index, candidates), candidates);
|
|
246
|
+
// A parachain without a Session pallet manages authorities through Aura alone.
|
|
247
|
+
const injects = {
|
|
248
|
+
...(index.pallets.has('Session') ? paraInjects(collator) : {}),
|
|
249
|
+
// Parachains of a shared relay are live public chains: no dev account holds
|
|
250
|
+
// funds there, so sudo is endowed at import (see sudoEndowInjects).
|
|
251
|
+
...(sharedRelay ? sudoEndowInjects() : {}),
|
|
252
|
+
};
|
|
253
|
+
write(outFile, { overrides, injects }, index);
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=overrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/fork/overrides.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,yFAAyF;AACzF,4FAA4F;AAC5F,uFAAuF;AACvF,sFAAsF;AACtF,wDAAwD;AAExD,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,uBAAuB,EACvB,eAAe,GAEhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,WAAW,EACX,cAAc,EACd,WAAW,EACX,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AAezB;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CACpB,EAAE,GAAG,EAAE,KAAK,EAAuC,EACnD,UAAkC;IAElC,MAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,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E,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACvF,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,QAAQ,MAAM,yBAAyB,MAAM,IAAI,MAAM,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IACrG,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,MAAM,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;IAE5F,+EAA+E;IAC/E,MAAM,OAAO,GAAG;QACd,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,4EAA4E;QAC5E,oEAAoE;QACpE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3C,CAAC;IACF,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface BulletinEntry {
|
|
2
|
+
contentHash: string;
|
|
3
|
+
cidCodec: number;
|
|
4
|
+
hashing: string;
|
|
5
|
+
size: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The digest prefix each contenthash record exposes.
|
|
9
|
+
*
|
|
10
|
+
* A contenthash is Solidity `bytes`, 38 bytes for a CIDv1, so it spans two storage
|
|
11
|
+
* words. Revive hashes storage keys, so the second word cannot be located by
|
|
12
|
+
* incrementing the first one's key — only the leading 26 digest bytes are readable
|
|
13
|
+
* here. That is enough to identify the entry against bulletin, which holds the full
|
|
14
|
+
* hash; `matchProducts` does the join.
|
|
15
|
+
*/
|
|
16
|
+
export declare function contenthashPrefixes(words: readonly string[]): string[];
|
|
17
|
+
/**
|
|
18
|
+
* The readable digest prefix of one contenthash word, or null if it is not one.
|
|
19
|
+
*
|
|
20
|
+
* The header is `e3 01 01 | codec | multihash code | length`, and the multihash code is an
|
|
21
|
+
* LEB128 varint — one byte for sha2-256 (0x12), but three for blake2b-256 (0xb220 encodes as
|
|
22
|
+
* a0 e4 02). Assuming one byte reads a blake2b record two bytes early, so its "digest" is the
|
|
23
|
+
* tail of the code plus the length byte, matches nothing in bulletin, and the product is
|
|
24
|
+
* dropped from the fork with no error — silently, and only for blake2b. So the code is
|
|
25
|
+
* decoded rather than assumed. The codec is likewise a varint, though both codecs bulletin
|
|
26
|
+
* uses (85 raw, 112 dag-pb) are single-byte.
|
|
27
|
+
*/
|
|
28
|
+
export declare function digestPrefixOf(word: string): string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Join contenthash records to the bulletin entries that still hold their bytes.
|
|
31
|
+
*
|
|
32
|
+
* Returns one CID per distinct product. A record with no match points at content
|
|
33
|
+
* outside bulletin's retention window — nothing can serve it, so it is dropped.
|
|
34
|
+
*/
|
|
35
|
+
export declare function matchProducts(prefixes: readonly string[], entries: readonly BulletinEntry[]): {
|
|
36
|
+
cids: string[];
|
|
37
|
+
matched: number;
|
|
38
|
+
unmatched: number;
|
|
39
|
+
};
|
|
40
|
+
/** Addresses of every revive contract on the chain. */
|
|
41
|
+
export declare function contractAddresses(url: string): Promise<string[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Find the content resolver by what it holds rather than by its address.
|
|
44
|
+
*
|
|
45
|
+
* DotNS is redeployed on every release, so a configured address goes stale the moment
|
|
46
|
+
* the network is wiped — and the previous deployment is usually still on chain, holding
|
|
47
|
+
* nothing, which makes the failure look like "this network has no products". A fork is
|
|
48
|
+
* worse again: its state is from whenever it was bitten, so it agrees with neither the
|
|
49
|
+
* current release nor the previous one.
|
|
50
|
+
*
|
|
51
|
+
* The resolver is identifiable without any of that: it is the contract holding ENS
|
|
52
|
+
* contenthash records. Returns the address with the most, or null if none has any.
|
|
53
|
+
*/
|
|
54
|
+
export declare function discoverResolver(url: string): Promise<string | null>;
|
|
55
|
+
/** Every storage word owned by a revive contract, via its child trie. */
|
|
56
|
+
export declare function contractWords(url: string, address: string): Promise<string[]>;
|
|
57
|
+
/** Every transaction bulletin currently retains. */
|
|
58
|
+
export declare function bulletinEntries(url: string): Promise<BulletinEntry[]>;
|
|
59
|
+
export interface ProductScan {
|
|
60
|
+
/** The resolver actually used — may differ from the one asked for. */
|
|
61
|
+
resolver: string;
|
|
62
|
+
cids: string[];
|
|
63
|
+
records: number;
|
|
64
|
+
matched: number;
|
|
65
|
+
unmatched: number;
|
|
66
|
+
bulletinEntries: number;
|
|
67
|
+
}
|
|
68
|
+
export declare function scanProducts(assetHubUrl: string, bulletinUrl: string, resolverAddress: string): Promise<ProductScan>;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
// Finding the DotNS products a forked network can still serve.
|
|
2
|
+
//
|
|
3
|
+
// A fork carries chain state but not bulletin's stored bytes: those live in block
|
|
4
|
+
// bodies, and the bite is a warp sync. So a forked bulletin lists content it does
|
|
5
|
+
// not hold. Copying all of it is not an option — measured on paseo-next-v2 that is
|
|
6
|
+
// 35 GiB across 33k entries.
|
|
7
|
+
//
|
|
8
|
+
// Almost none of it is wanted, though. What a user actually loads is the current
|
|
9
|
+
// version of a registered product, and DotNS says exactly which those are:
|
|
10
|
+
//
|
|
11
|
+
// Revive::AccountInfoOf[resolver] -> the contract's trie id
|
|
12
|
+
// its child trie -> every storage word it owns
|
|
13
|
+
// words beginning e3 01 01 -> ENS EIP-1577 contenthash records
|
|
14
|
+
// intersect with bulletin's own entries -> the ones still in retention
|
|
15
|
+
//
|
|
16
|
+
// On paseo-next-v2 that reduces 35 GiB to 797 products totalling 3.0 GiB, because
|
|
17
|
+
// most registered contenthashes point at content already pruned past the retention
|
|
18
|
+
// period, and every superseded publish is skipped.
|
|
19
|
+
//
|
|
20
|
+
// Each product resolves to a single UnixFS file whose bytes are a CAR archive of the
|
|
21
|
+
// whole site, so there are no child objects to chase — fetching the root is the
|
|
22
|
+
// whole product.
|
|
23
|
+
import { cidV1, keyOf } from './codec.js';
|
|
24
|
+
import { rpc, storageIndex } from './rpc.js';
|
|
25
|
+
/** ENS EIP-1577 ipfs-ns prefix, followed by the CID bytes. */
|
|
26
|
+
const CONTENTHASH_PREFIX = 'e30101';
|
|
27
|
+
/**
|
|
28
|
+
* Bytes of the digest that survive in the first 32-byte word, for a sha2-256 record.
|
|
29
|
+
*
|
|
30
|
+
* This is the *most* a word can expose: 32 bytes less a 6-byte header. A blake2b-256 record
|
|
31
|
+
* has a wider header (its multihash code is a three-byte varint) and so exposes 24. Rather
|
|
32
|
+
* than truncate everything to the shorter of the two, each record keeps whatever it has and
|
|
33
|
+
* `matchProducts` joins on the shorter of the two sides — see `digestPrefixOf`.
|
|
34
|
+
*/
|
|
35
|
+
const DIGEST_PREFIX_BYTES = 26;
|
|
36
|
+
/** What the widest header (blake2b-256's) leaves readable — the shortest join key we accept. */
|
|
37
|
+
const MIN_DIGEST_PREFIX_BYTES = 24;
|
|
38
|
+
/**
|
|
39
|
+
* The digest prefix each contenthash record exposes.
|
|
40
|
+
*
|
|
41
|
+
* A contenthash is Solidity `bytes`, 38 bytes for a CIDv1, so it spans two storage
|
|
42
|
+
* words. Revive hashes storage keys, so the second word cannot be located by
|
|
43
|
+
* incrementing the first one's key — only the leading 26 digest bytes are readable
|
|
44
|
+
* here. That is enough to identify the entry against bulletin, which holds the full
|
|
45
|
+
* hash; `matchProducts` does the join.
|
|
46
|
+
*/
|
|
47
|
+
export function contenthashPrefixes(words) {
|
|
48
|
+
const out = [];
|
|
49
|
+
for (const word of words) {
|
|
50
|
+
const digest = digestPrefixOf(word);
|
|
51
|
+
if (digest)
|
|
52
|
+
out.push(digest);
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The readable digest prefix of one contenthash word, or null if it is not one.
|
|
58
|
+
*
|
|
59
|
+
* The header is `e3 01 01 | codec | multihash code | length`, and the multihash code is an
|
|
60
|
+
* LEB128 varint — one byte for sha2-256 (0x12), but three for blake2b-256 (0xb220 encodes as
|
|
61
|
+
* a0 e4 02). Assuming one byte reads a blake2b record two bytes early, so its "digest" is the
|
|
62
|
+
* tail of the code plus the length byte, matches nothing in bulletin, and the product is
|
|
63
|
+
* dropped from the fork with no error — silently, and only for blake2b. So the code is
|
|
64
|
+
* decoded rather than assumed. The codec is likewise a varint, though both codecs bulletin
|
|
65
|
+
* uses (85 raw, 112 dag-pb) are single-byte.
|
|
66
|
+
*/
|
|
67
|
+
export function digestPrefixOf(word) {
|
|
68
|
+
const hex = word.replace(/^0x/, '').toLowerCase();
|
|
69
|
+
if (!hex.startsWith(CONTENTHASH_PREFIX))
|
|
70
|
+
return null;
|
|
71
|
+
let at = CONTENTHASH_PREFIX.length / 2; // bytes consumed so far
|
|
72
|
+
const byteAt = (i) => parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
73
|
+
const skipVarint = () => {
|
|
74
|
+
while (at < hex.length / 2 && (byteAt(at) & 0x80) !== 0)
|
|
75
|
+
at++;
|
|
76
|
+
at++; // the final byte, which has the continuation bit clear
|
|
77
|
+
};
|
|
78
|
+
skipVarint(); // codec
|
|
79
|
+
skipVarint(); // multihash code
|
|
80
|
+
at++; // digest length
|
|
81
|
+
// Up to DIGEST_PREFIX_BYTES, and whatever the word actually holds after its header: 26 for
|
|
82
|
+
// sha2-256, 24 for blake2b-256. A word carrying fewer than 24 is not a CIDv1 contenthash.
|
|
83
|
+
const digest = hex.slice(at * 2, at * 2 + DIGEST_PREFIX_BYTES * 2);
|
|
84
|
+
return digest.length >= MIN_DIGEST_PREFIX_BYTES * 2 ? digest : null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Join contenthash records to the bulletin entries that still hold their bytes.
|
|
88
|
+
*
|
|
89
|
+
* Returns one CID per distinct product. A record with no match points at content
|
|
90
|
+
* outside bulletin's retention window — nothing can serve it, so it is dropped.
|
|
91
|
+
*/
|
|
92
|
+
export function matchProducts(prefixes, entries) {
|
|
93
|
+
// Keyed at the shortest prefix any record can offer, because how much of the digest is
|
|
94
|
+
// readable depends on the hash function's multihash width. A longer prefix is truncated to
|
|
95
|
+
// the same key below, so sha2 and blake2b records join through one map.
|
|
96
|
+
const byPrefix = new Map();
|
|
97
|
+
for (const e of entries) {
|
|
98
|
+
byPrefix.set(e.contentHash.replace(/^0x/, '').toLowerCase().slice(0, MIN_DIGEST_PREFIX_BYTES * 2), e);
|
|
99
|
+
}
|
|
100
|
+
const cids = new Set();
|
|
101
|
+
let matched = 0;
|
|
102
|
+
let unmatched = 0;
|
|
103
|
+
for (const p of prefixes) {
|
|
104
|
+
const entry = byPrefix.get(p.slice(0, MIN_DIGEST_PREFIX_BYTES * 2));
|
|
105
|
+
if (!entry) {
|
|
106
|
+
unmatched++;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
matched++;
|
|
110
|
+
cids.add(cidV1(entry.cidCodec, entry.hashing, entry.contentHash));
|
|
111
|
+
}
|
|
112
|
+
return { cids: [...cids], matched, unmatched };
|
|
113
|
+
}
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
// Reading the two chains
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
/** Addresses of every revive contract on the chain. */
|
|
118
|
+
export async function contractAddresses(url) {
|
|
119
|
+
const prefix = '0x' + keyOf('Revive', 'AccountInfoOf');
|
|
120
|
+
const keys = [];
|
|
121
|
+
let start = prefix;
|
|
122
|
+
for (;;) {
|
|
123
|
+
const page = await rpc(url, 'state_getKeysPaged', [prefix, 1000, start]);
|
|
124
|
+
keys.push(...page);
|
|
125
|
+
if (page.length < 1000)
|
|
126
|
+
break;
|
|
127
|
+
start = page[page.length - 1];
|
|
128
|
+
}
|
|
129
|
+
// Identity-hashed map: the last 20 bytes of the key are the address.
|
|
130
|
+
return keys.map((k) => '0x' + k.slice(-40));
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Find the content resolver by what it holds rather than by its address.
|
|
134
|
+
*
|
|
135
|
+
* DotNS is redeployed on every release, so a configured address goes stale the moment
|
|
136
|
+
* the network is wiped — and the previous deployment is usually still on chain, holding
|
|
137
|
+
* nothing, which makes the failure look like "this network has no products". A fork is
|
|
138
|
+
* worse again: its state is from whenever it was bitten, so it agrees with neither the
|
|
139
|
+
* current release nor the previous one.
|
|
140
|
+
*
|
|
141
|
+
* The resolver is identifiable without any of that: it is the contract holding ENS
|
|
142
|
+
* contenthash records. Returns the address with the most, or null if none has any.
|
|
143
|
+
*/
|
|
144
|
+
export async function discoverResolver(url) {
|
|
145
|
+
let best = null;
|
|
146
|
+
for (const address of await contractAddresses(url)) {
|
|
147
|
+
let words;
|
|
148
|
+
try {
|
|
149
|
+
words = await contractWords(url, address);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
continue; // not a contract, or storage unreadable
|
|
153
|
+
}
|
|
154
|
+
const records = contenthashPrefixes(words).length;
|
|
155
|
+
if (records > 0 && (!best || records > best.records))
|
|
156
|
+
best = { address, records };
|
|
157
|
+
}
|
|
158
|
+
return best?.address ?? null;
|
|
159
|
+
}
|
|
160
|
+
/** Every storage word owned by a revive contract, via its child trie. */
|
|
161
|
+
export async function contractWords(url, address) {
|
|
162
|
+
const ix = await storageIndex(url);
|
|
163
|
+
const item = ix.meta.asLatest.pallets
|
|
164
|
+
.find((p) => p.name.toString() === 'Revive')
|
|
165
|
+
?.storage.unwrap()
|
|
166
|
+
.items.find((i) => i.name.toString() === 'AccountInfoOf');
|
|
167
|
+
if (!item)
|
|
168
|
+
throw new Error('no Revive::AccountInfoOf — is this Asset Hub?');
|
|
169
|
+
// The map is Identity-hashed, so the key is the address itself.
|
|
170
|
+
const key = '0x' + keyOf('Revive', 'AccountInfoOf') + address.toLowerCase().replace(/^0x/, '');
|
|
171
|
+
const raw = await rpc(url, 'state_getStorage', [key]);
|
|
172
|
+
if (!raw)
|
|
173
|
+
throw new Error(`no contract at ${address}`);
|
|
174
|
+
const valueType = ix.reg.createLookupType(item.type.asMap.value.toNumber());
|
|
175
|
+
const info = ix.reg.createType(valueType, raw).toJSON();
|
|
176
|
+
const trieId = info.accountType?.contract?.trieId;
|
|
177
|
+
if (!trieId)
|
|
178
|
+
throw new Error(`${address} is not a contract`);
|
|
179
|
+
const childKey = '0x' + Buffer.from(':child_storage:default:').toString('hex') + trieId.replace(/^0x/, '');
|
|
180
|
+
const keys = await pageChildKeys(url, childKey);
|
|
181
|
+
const words = [];
|
|
182
|
+
for (let i = 0; i < keys.length; i += 200) {
|
|
183
|
+
const batch = keys.slice(i, i + 200);
|
|
184
|
+
const values = await rpc(url, 'childstate_getStorageEntries', [childKey, batch]);
|
|
185
|
+
for (const v of values)
|
|
186
|
+
if (v)
|
|
187
|
+
words.push(v);
|
|
188
|
+
}
|
|
189
|
+
return words;
|
|
190
|
+
}
|
|
191
|
+
async function pageChildKeys(url, childKey) {
|
|
192
|
+
const keys = [];
|
|
193
|
+
let start = null;
|
|
194
|
+
for (;;) {
|
|
195
|
+
const page = await rpc(url, 'childstate_getKeysPaged', [
|
|
196
|
+
childKey, '0x', 1000, start,
|
|
197
|
+
]);
|
|
198
|
+
keys.push(...page);
|
|
199
|
+
if (page.length < 1000)
|
|
200
|
+
return keys;
|
|
201
|
+
start = page[page.length - 1];
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/** Every transaction bulletin currently retains. */
|
|
205
|
+
export async function bulletinEntries(url) {
|
|
206
|
+
const ix = await storageIndex(url);
|
|
207
|
+
const item = ix.meta.asLatest.pallets
|
|
208
|
+
.find((p) => p.name.toString() === 'TransactionStorage')
|
|
209
|
+
?.storage.unwrap()
|
|
210
|
+
.items.find((i) => i.name.toString() === 'Transactions');
|
|
211
|
+
if (!item)
|
|
212
|
+
throw new Error('no TransactionStorage::Transactions — is this the bulletin chain?');
|
|
213
|
+
const valueType = ix.reg.createLookupType(item.type.asMap.value.toNumber());
|
|
214
|
+
const prefix = '0x' + keyOf('TransactionStorage', 'Transactions');
|
|
215
|
+
const keys = [];
|
|
216
|
+
let start = prefix;
|
|
217
|
+
for (;;) {
|
|
218
|
+
const page = await rpc(url, 'state_getKeysPaged', [prefix, 1000, start]);
|
|
219
|
+
keys.push(...page);
|
|
220
|
+
if (page.length < 1000)
|
|
221
|
+
break;
|
|
222
|
+
start = page[page.length - 1];
|
|
223
|
+
}
|
|
224
|
+
const entries = [];
|
|
225
|
+
for (let i = 0; i < keys.length; i += 250) {
|
|
226
|
+
const res = await rpc(url, 'state_queryStorageAt', [
|
|
227
|
+
keys.slice(i, i + 250),
|
|
228
|
+
]);
|
|
229
|
+
for (const block of res) {
|
|
230
|
+
for (const [, value] of block.changes) {
|
|
231
|
+
if (!value)
|
|
232
|
+
continue;
|
|
233
|
+
const list = ix.reg.createType(valueType, value).toJSON();
|
|
234
|
+
for (const t of list) {
|
|
235
|
+
entries.push(t);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return entries;
|
|
241
|
+
}
|
|
242
|
+
export async function scanProducts(assetHubUrl, bulletinUrl, resolverAddress) {
|
|
243
|
+
// The configured address is a fast path, not a source of truth: fall back to finding
|
|
244
|
+
// the resolver by its contents whenever it is absent or holds nothing.
|
|
245
|
+
let resolver = resolverAddress;
|
|
246
|
+
let words = [];
|
|
247
|
+
try {
|
|
248
|
+
words = await contractWords(assetHubUrl, resolver);
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
words = [];
|
|
252
|
+
}
|
|
253
|
+
if (contenthashPrefixes(words).length === 0) {
|
|
254
|
+
const found = await discoverResolver(assetHubUrl);
|
|
255
|
+
if (found && found.toLowerCase() !== resolver.toLowerCase()) {
|
|
256
|
+
resolver = found;
|
|
257
|
+
words = await contractWords(assetHubUrl, resolver);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const entries = await bulletinEntries(bulletinUrl);
|
|
261
|
+
const prefixes = contenthashPrefixes(words);
|
|
262
|
+
const { cids, matched, unmatched } = matchProducts(prefixes, entries);
|
|
263
|
+
return { resolver, cids, records: prefixes.length, matched, unmatched, bulletinEntries: entries.length };
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/fork/products.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,kFAAkF;AAClF,kFAAkF;AAClF,mFAAmF;AACnF,6BAA6B;AAC7B,EAAE;AACF,iFAAiF;AACjF,2EAA2E;AAC3E,EAAE;AACF,qEAAqE;AACrE,yEAAyE;AACzE,+EAA+E;AAC/E,0EAA0E;AAC1E,EAAE;AACF,kFAAkF;AAClF,mFAAmF;AACnF,mDAAmD;AACnD,EAAE;AACF,qFAAqF;AACrF,gFAAgF;AAChF,iBAAiB;AAEjB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,8DAA8D;AAC9D,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,gGAAgG;AAChG,MAAM,uBAAuB,GAAG,EAAE,CAAC;AASnC;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAwB;IAC1D,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,MAAM;YAAE,GAAG,CAAC,IAAI,CAAC,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,CAAC,WAAW,EAAE,EAAE,CAAC;YAC5D,QAAQ,GAAG,KAAK,CAAC;YACjB,KAAK,GAAG,MAAM,aAAa,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AAC3G,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Metadata, TypeRegistry } from '@polkadot/types';
|
|
2
|
+
export declare function rpc<T = any>(url: string, method: string, params?: unknown[]): Promise<T>;
|
|
3
|
+
export interface StorageEntry {
|
|
4
|
+
label: string;
|
|
5
|
+
/** Lookup id of the stored type, or null for maps (which have no single plain value). */
|
|
6
|
+
plain: number | null;
|
|
7
|
+
/**
|
|
8
|
+
* Lookup id of a map's *value* type, or null for plain entries.
|
|
9
|
+
*
|
|
10
|
+
* Injects write into maps, so `plain` is null for every one of them and they would otherwise
|
|
11
|
+
* be written with nothing checking the shape. The value type is the thing to check them
|
|
12
|
+
* against — a hand-encoded AccountInfo or DMQ head that the runtime disagrees with is
|
|
13
|
+
* exactly the failure a bite must not carry silently into a bundle.
|
|
14
|
+
*/
|
|
15
|
+
mapValue: number | null;
|
|
16
|
+
}
|
|
17
|
+
export interface StorageIndex {
|
|
18
|
+
reg: TypeRegistry;
|
|
19
|
+
meta: Metadata;
|
|
20
|
+
byKey: Map<string, StorageEntry>;
|
|
21
|
+
pallets: Set<string>;
|
|
22
|
+
}
|
|
23
|
+
export declare function storageIndex(url: string): Promise<StorageIndex>;
|
|
24
|
+
/** Read a runtime constant, e.g. constantOf(index, 'Babe', 'EpochDuration'). */
|
|
25
|
+
export declare function constantOf({ meta, reg }: StorageIndex, pallet: string, name: string): string | null;
|