git.delta.rocks / unique-network / refs/commits / 3b5468eb6759

difftreelog

fix fork.jsonnet key moving

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

1 file changed

modified.docker/forkless-config/fork.jsonnetdiffbeforeafterboth
before · .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	// AuraExt.Authorities, we don't have aura pallet enabled for some reason, to refer using cql api16	'0x3c311d57d4daf52904616cf69648081e5e0621c4869aa60c02be9adcc98a0d1d',17	// Aura.Authorities18	'0x57f8dc2f5ab09467896f47300f0424385e0621c4869aa60c02be9adcc98a0d1d',19],2021// Keys, which should be migrated from passed spec, rather than from forked chain22wantedKeys = [23	sourceChain.ParachainInfo._key.ParachainId,24	sourceChain.Sudo._key.Key,25	sourceChain.System.BlockHash._key['0'],26	sourceChain.System._key.ParentHash,27] + auraKeys,2829// Keys to remove from original chain30unwantedPrefixes = [31	// Aura.CurrentSlot32	'0x57f8dc2f5ab09467896f47300f04243806155b3cd9a8c9e5e9a23fd5dc13a5ed',33	// Ensure there will be no panics caused by unexpected kept state34	sourceChain.ParachainSystem._key.ValidationData,35	sourceChain.ParachainSystem._key.RelayStateProof,36	sourceChain.ParachainSystem._key.HostConfiguration,37	sourceChain.ParachainSystem._key.LastDmqMqcHead,38	// Part of head39	sourceChain.System._key.BlockHash,40	sourceChain.System._key.Number,41	sourceChain.System._key.Digest,42] + auraKeys,4344cleanupRaw(raw) = {45	[key]: raw[key]46	for key in std.objectFields(raw)47	if std.all(std.map(function(prefix) !std.startsWith(key, prefix), unwantedPrefixes))48};495051local originalRaw = rawSpec.genesis.raw.top;52local outSpec = rawSpec {53	genesis+: {54		raw+: {55			top: cleanupRaw(raw) {56				[key]: originalRaw[key]57				for key in wantedKeys58				if std.objectHas(originalRaw, key)59			},60		},61	},62};6364local65	aliceAccount = sourceChain.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),66	totalIssuance = sourceChain.Balances._encodeKey.TotalIssuance([]),67 	unique = cql.calc(["10", "18", "**"]),68 	Munique = cql.calc([unique, "10", "6", "**", "*"]),69;7071outSpec {72	genesis+: {73		raw+: {74			top+: {75				[totalIssuance]: cql.calc([76					Munique,77					if std.objectHas(super, totalIssuance) then sourceChain._decode(typeNames.u128, super[totalIssuance]) else '0',78					if std.objectHas(super, aliceAccount) then sourceChain._decode(typeNames.AccountInfo, super[aliceAccount]).data.free else '0',79					'-', '+',80				]),81				[aliceAccount]: sourceChain._encode(typeNames.AccountInfo, {82					nonce: 0,83					consumers: 3,84					providers: 1,85					sufficients: 0,86					data: {87						free: Munique,88						reserved: "0",89						misc_frozen: "0",90						fee_frozen: "0",91					},92				},)93			},94		},95	},96}
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	sourceChain.CollatorSelection._key.Candidates,18	sourceChain.CollatorSelection._key.Invulnerables,19],2021// Keys, which should be migrated from passed spec, rather than from forked chain22wantedKeys = [23	sourceChain.ParachainInfo._key.ParachainId,24	sourceChain.Sudo._key.Key,25	sourceChain.System.BlockHash._key['0'],26	// Always [69, 69, 69, ..., 69, 69, 69]27	sourceChain.System._key.ParentHash,28] + auraKeys,2930// Keys to remove from original chain31unwantedPrefixes = [32	sourceChain.Aura._key.CurrentSlot,33	// Ensure there will be no panics caused by unexpected kept state34	sourceChain.ParachainSystem._key.ValidationData,35	sourceChain.ParachainSystem._key.RelayStateProof,36	sourceChain.ParachainSystem._key.HostConfiguration,37	sourceChain.ParachainSystem._key.LastRelayChainBlockNumber,38	sourceChain.ParachainSystem._key.LastDmqMqcHead,39	// Part of head40	sourceChain.System._key.BlockHash,41	sourceChain.System._key.Number,42	sourceChain.System._key.Digest,43] + auraKeys,4445cleanupRaw(raw) = {46	[key]: raw[key]47	for key in std.objectFields(raw)48	if std.all(std.map(function(prefix) !std.startsWith(key, prefix), unwantedPrefixes))49};505152local originalRaw = rawSpec.genesis.raw.top;53local outSpec = rawSpec {54	genesis+: {55		raw+: {56			top: cleanupRaw(raw) {57				[key]: originalRaw[key]58				for key in wantedKeys59				if std.objectHas(originalRaw, key)60			},61		},62	},63};6465local66	aliceAccount = sourceChain.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),67	totalIssuance = sourceChain.Balances._encodeKey.TotalIssuance([]),68 	unique = cql.calc(["10", "18", "**"]),69 	Munique = cql.calc([unique, "10", "6", "**", "*"]),70;7172outSpec {73	genesis+: {74		raw+: {75			top+: {76				[totalIssuance]: sourceChain._encode(typeNames.u128, cql.calc([77					Munique,78					if std.objectHas(super, totalIssuance) then sourceChain._decode(typeNames.u128, super[totalIssuance]) else '0',79					if std.objectHas(super, aliceAccount) then sourceChain._decode(typeNames.AccountInfo, super[aliceAccount]).data.free else '0',80					'-', '+',81				])),82				[aliceAccount]: sourceChain._encode(typeNames.AccountInfo, {83					nonce: 0,84					consumers: 3,85					providers: 1,86					sufficients: 0,87					data: {88						free: Munique,89						reserved: "0",90						misc_frozen: "0",91						fee_frozen: "0",92					},93				},)94			},95		},96	},97}