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
--- a/.docker/forkless-config/fork.jsonnet
+++ b/.docker/forkless-config/fork.jsonnet
@@ -1,46 +1,52 @@
+// Get live chain data on the URL provided with `forkFrom`, and 
+// insert the necessary data into a chain spec to launch a new chain with.
+// 
+// ### Arguments
+// - `rawSpec`: Path to the raw chain spec to modify
+// - `forkFrom`: URL of the chain's WS port to get the data from
+// 
+// ### Usage
+// `chainql --tla-code=rawSpec="import 'parachain-spec-raw.json'" --tla-str=forkFrom="wss://some-parachain.node:443" fork.jsonnet`
 
 function(rawSpec, forkFrom)
-local sourceChain = cql.chain(forkFrom).latest;
+local sourceChainState = cql.chain(forkFrom).latest;
 
-local raw = local sourceRaw = sourceChain._raw._preloadKeys; {
+local raw = local sourceRaw = sourceChainState._raw._preloadKeys; {
   [key]: cql.toHex(sourceRaw[key])
   for key in std.objectFields(sourceRaw)
   if sourceRaw[key] != null
 };
 
-local typeNames = (import './typeNames.jsonnet')(sourceChain);
-
 local
 auraKeys = [
-	sourceChain.AuraExt._key.Authorities,
-	sourceChain.Aura._key.Authorities,
-] + (if 'CollatorSelection' in sourceChain then [
-	sourceChain.CollatorSelection._key.Candidates,
-	sourceChain.CollatorSelection._key.Invulnerables,
+	sourceChainState.AuraExt._key.Authorities,
+	sourceChainState.Aura._key.Authorities,
+] + (if 'CollatorSelection' in sourceChainState then [
+	sourceChainState.CollatorSelection._key.Candidates,
+	sourceChainState.CollatorSelection._key.Invulnerables,
 ] else []),
 
 // Keys, which should be migrated from passed spec, rather than from forked chain
 wantedKeys = [
-	sourceChain.ParachainInfo._key.ParachainId,
-	sourceChain.Sudo._key.Key,
-	sourceChain.System.BlockHash._key['0'],
+	sourceChainState.ParachainInfo._key.ParachainId,
+	sourceChainState.Sudo._key.Key,
+	sourceChainState.System.BlockHash._key['0'],
 	// Always [69, 69, 69, ..., 69, 69, 69]
-	sourceChain.System._key.ParentHash,
+	sourceChainState.System._key.ParentHash,
 ] + auraKeys,
-
 // Keys to remove from original chain
 unwantedPrefixes = [
-	sourceChain.Aura._key.CurrentSlot,
+	sourceChainState.Aura._key.CurrentSlot,
 	// Ensure there will be no panics caused by unexpected kept state
-	sourceChain.ParachainSystem._key.ValidationData,
-	sourceChain.ParachainSystem._key.RelayStateProof,
-	sourceChain.ParachainSystem._key.HostConfiguration,
-	sourceChain.ParachainSystem._key.LastRelayChainBlockNumber,
-	sourceChain.ParachainSystem._key.LastDmqMqcHead,
+	sourceChainState.ParachainSystem._key.ValidationData,
+	sourceChainState.ParachainSystem._key.RelayStateProof,
+	sourceChainState.ParachainSystem._key.HostConfiguration,
+	sourceChainState.ParachainSystem._key.LastRelayChainBlockNumber,
+	sourceChainState.ParachainSystem._key.LastDmqMqcHead,
 	// Part of head
-	sourceChain.System._key.BlockHash,
-	sourceChain.System._key.Number,
-	sourceChain.System._key.Digest,
+	sourceChainState.System._key.BlockHash,
+	sourceChainState.System._key.Number,
+	sourceChainState.System._key.Digest,
 ] + auraKeys,
 
 cleanupRaw(raw) = {
@@ -63,33 +69,37 @@
 	},
 };
 
+local pow10(n) = std.foldl(function(a, _) a * std.bigint('10'), std.range(0, n), std.bigint('1'));
+
 local
-	aliceAccount = sourceChain.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),
-	totalIssuance = sourceChain.Balances._encodeKey.TotalIssuance([]),
- 	unique = cql.calc(["10", "18", "**"]),
- 	Munique = cql.calc([unique, "10", "6", "**", "*"]),
+	aliceAccount = sourceChainState.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),
+	totalIssuance = sourceChainState.Balances._encodeKey.TotalIssuance([]),
+	Munique = pow10(6 + 18),
 ;
 
 outSpec {
 	genesis+: {
 		raw+: {
 			top+: {
-				[totalIssuance]: sourceChain._encode(typeNames.u128, cql.calc([
-					Munique,
-					if std.objectHas(super, totalIssuance) then sourceChain._decode(typeNames.u128, super[totalIssuance]) else '0',
-					if std.objectHas(super, aliceAccount) then sourceChain._decode(typeNames.AccountInfo, super[aliceAccount]).data.free else '0',
-					'-', '+',
-				])),
-				[aliceAccount]: sourceChain._encode(typeNames.AccountInfo, {
+				[totalIssuance]: sourceChainState.Balances._encodeValue.TotalIssuance(
+					if std.objectHas(super, totalIssuance)
+						then sourceChainState.Balances._decodeValue.TotalIssuance(super[totalIssuance])
+						else std.bigint(0)
+					- if std.objectHas(super, aliceAccount)
+						then sourceChainState.System._decodeValue.Account(super[aliceAccount]).data.free
+						else std.bigint(0)
+					+ Munique
+				),
+				[aliceAccount]: sourceChainState.System._encodeValue.Account({
 					nonce: 0,
 					consumers: 3,
 					providers: 1,
 					sufficients: 0,
 					data: {
 						free: Munique,
-						reserved: "0",
-						misc_frozen: "0",
-						fee_frozen: "0",
+						reserved: std.bigint('0'),
+						misc_frozen: std.bigint('0'),
+						fee_frozen: std.bigint('0'),
 					},
 				},)
 			},
deleted.docker/forkless-config/typeNames.jsonnetdiffbeforeafterboth

no changes

added.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",
+  ]