git.delta.rocks / unique-network / refs/commits / 6964da352da9

difftreelog

ci zombienet config + updated chainql files

Fahrrader2023-04-28parent: #379a12b.patch.diff
in: master

3 files changed

modified.docker/forkless-config/fork.jsonnetdiffbeforeafterboth
1// Get live chain data on the URL provided with `forkFrom`, and
2// insert the necessary data into a chain spec to launch a new chain with.
3//
4// ### Arguments
5// - `rawSpec`: Path to the raw chain spec to modify
6// - `forkFrom`: URL of the chain's WS port to get the data from
7//
8// ### Usage
9// `chainql --tla-code=rawSpec="import 'parachain-spec-raw.json'" --tla-str=forkFrom="wss://some-parachain.node:443" fork.jsonnet`
110
2function(rawSpec, forkFrom)11function(rawSpec, forkFrom)
3local sourceChain = cql.chain(forkFrom).latest;12local sourceChainState = cql.chain(forkFrom).latest;
413
5local raw = local sourceRaw = sourceChain._raw._preloadKeys; {14local raw = local sourceRaw = sourceChainState._raw._preloadKeys; {
6 [key]: cql.toHex(sourceRaw[key])15 [key]: cql.toHex(sourceRaw[key])
7 for key in std.objectFields(sourceRaw)16 for key in std.objectFields(sourceRaw)
8 if sourceRaw[key] != null17 if sourceRaw[key] != null
9};18};
1019
11local typeNames = (import './typeNames.jsonnet')(sourceChain);
12
13local20local
14auraKeys = [21auraKeys = [
15 sourceChain.AuraExt._key.Authorities,22 sourceChainState.AuraExt._key.Authorities,
16 sourceChain.Aura._key.Authorities,23 sourceChainState.Aura._key.Authorities,
17] + (if 'CollatorSelection' in sourceChain then [24] + (if 'CollatorSelection' in sourceChainState then [
18 sourceChain.CollatorSelection._key.Candidates,25 sourceChainState.CollatorSelection._key.Candidates,
19 sourceChain.CollatorSelection._key.Invulnerables,26 sourceChainState.CollatorSelection._key.Invulnerables,
20] else []),27] else []),
2128
22// Keys, which should be migrated from passed spec, rather than from forked chain29// Keys, which should be migrated from passed spec, rather than from forked chain
23wantedKeys = [30wantedKeys = [
24 sourceChain.ParachainInfo._key.ParachainId,31 sourceChainState.ParachainInfo._key.ParachainId,
25 sourceChain.Sudo._key.Key,32 sourceChainState.Sudo._key.Key,
26 sourceChain.System.BlockHash._key['0'],33 sourceChainState.System.BlockHash._key['0'],
27 // Always [69, 69, 69, ..., 69, 69, 69]34 // Always [69, 69, 69, ..., 69, 69, 69]
28 sourceChain.System._key.ParentHash,35 sourceChainState.System._key.ParentHash,
29] + auraKeys,36] + auraKeys,
30
31// Keys to remove from original chain37// Keys to remove from original chain
32unwantedPrefixes = [38unwantedPrefixes = [
33 sourceChain.Aura._key.CurrentSlot,39 sourceChainState.Aura._key.CurrentSlot,
34 // Ensure there will be no panics caused by unexpected kept state40 // Ensure there will be no panics caused by unexpected kept state
35 sourceChain.ParachainSystem._key.ValidationData,41 sourceChainState.ParachainSystem._key.ValidationData,
36 sourceChain.ParachainSystem._key.RelayStateProof,42 sourceChainState.ParachainSystem._key.RelayStateProof,
37 sourceChain.ParachainSystem._key.HostConfiguration,43 sourceChainState.ParachainSystem._key.HostConfiguration,
38 sourceChain.ParachainSystem._key.LastRelayChainBlockNumber,44 sourceChainState.ParachainSystem._key.LastRelayChainBlockNumber,
39 sourceChain.ParachainSystem._key.LastDmqMqcHead,45 sourceChainState.ParachainSystem._key.LastDmqMqcHead,
40 // Part of head46 // Part of head
41 sourceChain.System._key.BlockHash,47 sourceChainState.System._key.BlockHash,
42 sourceChain.System._key.Number,48 sourceChainState.System._key.Number,
43 sourceChain.System._key.Digest,49 sourceChainState.System._key.Digest,
44] + auraKeys,50] + auraKeys,
4551
46cleanupRaw(raw) = {52cleanupRaw(raw) = {
62 },68 },
63 },69 },
64};70};
71
72local pow10(n) = std.foldl(function(a, _) a * std.bigint('10'), std.range(0, n), std.bigint('1'));
6573
66local74local
67 aliceAccount = sourceChain.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),75 aliceAccount = sourceChainState.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),
68 totalIssuance = sourceChain.Balances._encodeKey.TotalIssuance([]),76 totalIssuance = sourceChainState.Balances._encodeKey.TotalIssuance([]),
69 unique = cql.calc(["10", "18", "**"]),77 Munique = pow10(6 + 18),
70 Munique = cql.calc([unique, "10", "6", "**", "*"]),
71;78;
7279
73outSpec {80outSpec {
74 genesis+: {81 genesis+: {
75 raw+: {82 raw+: {
76 top+: {83 top+: {
77 [totalIssuance]: sourceChain._encode(typeNames.u128, cql.calc([84 [totalIssuance]: sourceChainState.Balances._encodeValue.TotalIssuance(
78 Munique,85 if std.objectHas(super, totalIssuance)
79 if std.objectHas(super, totalIssuance) then sourceChain._decode(typeNames.u128, super[totalIssuance]) else '0',86 then sourceChainState.Balances._decodeValue.TotalIssuance(super[totalIssuance])
87 else std.bigint(0)
80 if std.objectHas(super, aliceAccount) then sourceChain._decode(typeNames.AccountInfo, super[aliceAccount]).data.free else '0',88 - if std.objectHas(super, aliceAccount)
89 then sourceChainState.System._decodeValue.Account(super[aliceAccount]).data.free
90 else std.bigint(0)
81 '-', '+',91 + Munique
82 ])),92 ),
83 [aliceAccount]: sourceChain._encode(typeNames.AccountInfo, {93 [aliceAccount]: sourceChainState.System._encodeValue.Account({
84 nonce: 0,94 nonce: 0,
85 consumers: 3,95 consumers: 3,
86 providers: 1,96 providers: 1,
87 sufficients: 0,97 sufficients: 0,
88 data: {98 data: {
89 free: Munique,99 free: Munique,
90 reserved: "0",100 reserved: std.bigint('0'),
91 misc_frozen: "0",101 misc_frozen: std.bigint('0'),
92 fee_frozen: "0",102 fee_frozen: std.bigint('0'),
93 },103 },
94 },)104 },)
95 },105 },
deleted.docker/forkless-config/typeNames.jsonnetdiffbeforeafterboth

no changes

added.docker/forkless-config/zombienet-forkless-data.tomldiffbeforeafterboth

no changes