git.delta.rocks / unique-network / refs/commits / d1e86e8165d5

difftreelog

ci fix collatorSelection requirement

Yaroslav Bolyukin2023-06-05parent: #fc74051.patch.diff
in: master

1 file changed

modified.docker/forkless-config/fork.jsonnetdiffbeforeafterboth
after · .docker/forkless-config/fork.jsonnet
12function(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}