difftreelog
ci zombienet config + updated chainql files
in: master
3 files changed
.docker/forkless-config/fork.jsonnetdiffbeforeafterboth12function(rawSpec, forkFrom)3local sourceChain = cql.chain(forkFrom).latest;45local raw = local sourceRaw = sourceChain._raw._preloadKeys; {6 [key]: cql.toHex(sourceRaw[key])7 for key in std.objectFields(sourceRaw)8 if sourceRaw[key] != null9};1011local typeNames = (import './typeNames.jsonnet')(sourceChain);1213local14auraKeys = [15 sourceChain.AuraExt._key.Authorities,16 sourceChain.Aura._key.Authorities,17] + (if 'CollatorSelection' in sourceChain then [18 sourceChain.CollatorSelection._key.Candidates,19 sourceChain.CollatorSelection._key.Invulnerables,20] else []),2122// Keys, which should be migrated from passed spec, rather than from forked chain23wantedKeys = [24 sourceChain.ParachainInfo._key.ParachainId,25 sourceChain.Sudo._key.Key,26 sourceChain.System.BlockHash._key['0'],27 // Always [69, 69, 69, ..., 69, 69, 69]28 sourceChain.System._key.ParentHash,29] + auraKeys,3031// Keys to remove from original chain32unwantedPrefixes = [33 sourceChain.Aura._key.CurrentSlot,34 // Ensure there will be no panics caused by unexpected kept state35 sourceChain.ParachainSystem._key.ValidationData,36 sourceChain.ParachainSystem._key.RelayStateProof,37 sourceChain.ParachainSystem._key.HostConfiguration,38 sourceChain.ParachainSystem._key.LastRelayChainBlockNumber,39 sourceChain.ParachainSystem._key.LastDmqMqcHead,40 // Part of head41 sourceChain.System._key.BlockHash,42 sourceChain.System._key.Number,43 sourceChain.System._key.Digest,44] + auraKeys,4546cleanupRaw(raw) = {47 [key]: raw[key]48 for key in std.objectFields(raw)49 if std.all(std.map(function(prefix) !std.startsWith(key, prefix), unwantedPrefixes))50};515253local originalRaw = rawSpec.genesis.raw.top;54local outSpec = rawSpec {55 genesis+: {56 raw+: {57 top: cleanupRaw(raw) {58 [key]: originalRaw[key]59 for key in wantedKeys60 if std.objectHas(originalRaw, key)61 },62 },63 },64};6566local67 aliceAccount = sourceChain.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),68 totalIssuance = sourceChain.Balances._encodeKey.TotalIssuance([]),69 unique = cql.calc(["10", "18", "**"]),70 Munique = cql.calc([unique, "10", "6", "**", "*"]),71;7273outSpec {74 genesis+: {75 raw+: {76 top+: {77 [totalIssuance]: sourceChain._encode(typeNames.u128, cql.calc([78 Munique,79 if std.objectHas(super, totalIssuance) then sourceChain._decode(typeNames.u128, super[totalIssuance]) else '0',80 if std.objectHas(super, aliceAccount) then sourceChain._decode(typeNames.AccountInfo, super[aliceAccount]).data.free else '0',81 '-', '+',82 ])),83 [aliceAccount]: sourceChain._encode(typeNames.AccountInfo, {84 nonce: 0,85 consumers: 3,86 providers: 1,87 sufficients: 0,88 data: {89 free: Munique,90 reserved: "0",91 misc_frozen: "0",92 fee_frozen: "0",93 },94 },)95 },96 },97 },98}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// ### Arguments5// - `rawSpec`: Path to the raw chain spec to modify6// - `forkFrom`: URL of the chain's WS port to get the data from7// 8// ### Usage9// `chainql --tla-code=rawSpec="import 'parachain-spec-raw.json'" --tla-str=forkFrom="wss://some-parachain.node:443" fork.jsonnet`1011function(rawSpec, forkFrom)12local sourceChainState = cql.chain(forkFrom).latest;1314local raw = local sourceRaw = sourceChainState._raw._preloadKeys; {15 [key]: cql.toHex(sourceRaw[key])16 for key in std.objectFields(sourceRaw)17 if sourceRaw[key] != null18};1920local21auraKeys = [22 sourceChainState.AuraExt._key.Authorities,23 sourceChainState.Aura._key.Authorities,24] + (if 'CollatorSelection' in sourceChainState then [25 sourceChainState.CollatorSelection._key.Candidates,26 sourceChainState.CollatorSelection._key.Invulnerables,27] else []),2829// Keys, which should be migrated from passed spec, rather than from forked chain30wantedKeys = [31 sourceChainState.ParachainInfo._key.ParachainId,32 sourceChainState.Sudo._key.Key,33 sourceChainState.System.BlockHash._key['0'],34 // Always [69, 69, 69, ..., 69, 69, 69]35 sourceChainState.System._key.ParentHash,36] + auraKeys,37// Keys to remove from original chain38unwantedPrefixes = [39 sourceChainState.Aura._key.CurrentSlot,40 // Ensure there will be no panics caused by unexpected kept state41 sourceChainState.ParachainSystem._key.ValidationData,42 sourceChainState.ParachainSystem._key.RelayStateProof,43 sourceChainState.ParachainSystem._key.HostConfiguration,44 sourceChainState.ParachainSystem._key.LastRelayChainBlockNumber,45 sourceChainState.ParachainSystem._key.LastDmqMqcHead,46 // Part of head47 sourceChainState.System._key.BlockHash,48 sourceChainState.System._key.Number,49 sourceChainState.System._key.Digest,50] + auraKeys,5152cleanupRaw(raw) = {53 [key]: raw[key]54 for key in std.objectFields(raw)55 if std.all(std.map(function(prefix) !std.startsWith(key, prefix), unwantedPrefixes))56};575859local originalRaw = rawSpec.genesis.raw.top;60local outSpec = rawSpec {61 genesis+: {62 raw+: {63 top: cleanupRaw(raw) {64 [key]: originalRaw[key]65 for key in wantedKeys66 if std.objectHas(originalRaw, key)67 },68 },69 },70};7172local pow10(n) = std.foldl(function(a, _) a * std.bigint('10'), std.range(0, n), std.bigint('1'));7374local75 aliceAccount = sourceChainState.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),76 totalIssuance = sourceChainState.Balances._encodeKey.TotalIssuance([]),77 Munique = pow10(6 + 18),78;7980outSpec {81 genesis+: {82 raw+: {83 top+: {84 [totalIssuance]: sourceChainState.Balances._encodeValue.TotalIssuance(85 if std.objectHas(super, totalIssuance)86 then sourceChainState.Balances._decodeValue.TotalIssuance(super[totalIssuance])87 else std.bigint(0)88 - if std.objectHas(super, aliceAccount)89 then sourceChainState.System._decodeValue.Account(super[aliceAccount]).data.free90 else std.bigint(0)91 + Munique92 ),93 [aliceAccount]: sourceChainState.System._encodeValue.Account({94 nonce: 0,95 consumers: 3,96 providers: 1,97 sufficients: 0,98 data: {99 free: Munique,100 reserved: std.bigint('0'),101 misc_frozen: std.bigint('0'),102 fee_frozen: std.bigint('0'),103 },104 },)105 },106 },107 },108}.docker/forkless-config/typeNames.jsonnetdiffbeforeafterboth--- a/.docker/forkless-config/typeNames.jsonnet
+++ /dev/null
@@ -1,52 +0,0 @@
-function(chain)
-local
- typeName(id) = local
- ty = chain._meta.types.types[id],
- name = if std.objectHas(ty.type, "path") then
- std.join('::', ty.type.path)
- else if std.objectHas(ty.type.def, "primitive") then ty.type.def.primitive
- else if std.objectHas(ty.type.def, "tuple") then "(" + std.join(', ', std.map(typeName, ty.type.def.tuple)) + ")"
- else if std.objectHas(ty.type.def, "sequence") then "Vec<" + typeName(ty.type.def.sequence.type) + ">"
- else if std.objectHas(ty.type.def, "array") then "[" + typeName(ty.type.def.array.type) + "; " + ty.type.def.array.len + "]"
- else if std.objectHas(ty.type.def, "compact") then "Compact<" + typeName(ty.type.def.compact.type) + ">"
- else error "Can't generate useable name for " + ty.type,
- generics = if std.objectHas(ty.type, "params") then
- '<' + std.join(', ', std.map(function(p) if p.type == null then 'Spec#'+id else typeName(p.type), ty.type.params)) + '>'
- else ''
- ; name + generics,
- shortenPrefix(obj, prefix, short) = {
- [short]: obj[field]
- for field in std.objectFields(obj)
- // There should be at most one element with this prefix
- if std.startsWith(field, prefix)
- },
- makeObject(keyValues) = std.foldl(function(o, kv) if kv[0] in o then o else o + {[kv[0]]: kv[1]}, keyValues, {}),
-;
-
-local typesRaw = makeObject([
- [typeName(id), id]
- for id in std.range(0, std.length(chain._meta.types.types)-1)
-]);
-
-local types = typesRaw + shortenPrefix(typesRaw, 'frame_system::AccountInfo<', 'AccountInfo');
-
-types
-// local
-// ;
-
-// local encoded = chain._encode(types['AccountInfo'], {
-// nonce: 0,
-// consumers: 3,
-// providers: 1,
-// sufficients: 0,
-// data: {
-// free: Munique,
-// reserved: "0",
-// misc_frozen: "0",
-// fee_frozen: "0",
-// },
-// });
-
-// local systemAccount = chain._decode(types['AccountInfo'], encoded);
-
-// chain.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'])
.docker/forkless-config/zombienet-forkless-data.tomldiffbeforeafterboth--- /dev/null
+++ b/.docker/forkless-config/zombienet-forkless-data.toml
@@ -0,0 +1,46 @@
+[settings]
+provider = "native"
+
+[relaychain]
+default_command = "/polkadot/target/release/polkadot"
+default_args = [ "-lparachain::candidate_validation=debug", "-lxcm=trace", ]
+chain = "{{ RELAY_CHAIN_TYPE }}-local"
+
+ [[relaychain.nodes]]
+ name = "relay-alice"
+ ws_port = 9844
+ rpc_port = 9843
+ p2p_port = 30444
+
+ [[relaychain.node_groups]]
+ name = "relay"
+ count = 4
+
+[[parachains]]
+id = 1000
+chain_spec_modifier_commands = [[
+ "chainql",
+ "--tla-code=rawSpec=import '{{'raw'|chainSpec}}'",
+ "--tla-str=forkFrom={{ REPLICA_FROM }}",
+ "fork.jsonnet",
+]]
+
+ [[parachains.collators]]
+ name = "alice"
+ command = "/unique-chain/current/release/unique-collator"
+ ws_port = 9944
+ rpc_port = 9933
+ p2p_port = 31200
+ args = [
+ "-lxcm=trace,parity_ws::handler=debug,jsonrpsee_core=trace,jsonrpsee-core=trace,jsonrpsee_ws_server=debug",
+ ]
+
+ [[parachains.collators]]
+ name = "bob"
+ command = "/unique-chain/current/release/unique-collator"
+ ws_port = 9945
+ rpc_port = 9934
+ p2p_port = 31201
+ args = [
+ "-lxcm=trace,parity_ws::handler=debug,jsonrpsee_core=trace,jsonrpsee-core=trace,jsonrpsee_ws_server=debug",
+ ]