git.delta.rocks / unique-network / refs/commits / 0caf783d73c3

difftreelog

fix use plain node names instead of test account names

Daniel Shiposha2023-09-08parent: #0e9500c.patch.diff
in: master

2 files changed

modified.baedeker/collator-selection.jsonnetdiffbeforeafterboth
31 bin: $.bin,31 bin: $.bin,
32 wantedKeys: 'para',32 wantedKeys: 'para',
33 },33 },
34 for name in ['alice', 'bob', 'charlie', 'dave']34 for name in ['alpha', 'beta', 'gamma', 'delta']
35 },35 },
36};36};
3737
modifiedtests/src/collator-selection/collatorSelection.seqtest.tsdiffbeforeafterboth
3333
34async function getInitialInvulnerables() {34async function getInitialInvulnerables() {
35 return await Promise.all([35 return await Promise.all([
36 nodeAddress('Alice'),36 nodeAddress('alpha'),
37 nodeAddress('Bob'),37 nodeAddress('beta'),
38 nodeAddress('Charlie'),38 nodeAddress('gamma'),
39 nodeAddress('Dave'),39 nodeAddress('delta'),
40 ]);40 ]);
41}41}
4242
8484
85 describe('Dynamic shuffling of collators', () => {85 describe('Dynamic shuffling of collators', () => {
86 // These two are the default invulnerables, and should return to be invulnerables after this suite.86 // These two are the default invulnerables, and should return to be invulnerables after this suite.
87 let aliceNode: string;87 let alphaNode: string;
88 let bobNode: string;88 let betaNode: string;
8989
90 let charlieNode: string;90 let gammaNode: string;
91 let daveNode: string;91 let deltaNode: string;
9292
93 before(async function() {93 before(async function() {
94 await usingPlaygrounds(async (helper, privateKey) => {94 await usingPlaygrounds(async (helper, privateKey) => {
95 // todo:collator see again if blocks start to be finalized in dev mode95 // todo:collator see again if blocks start to be finalized in dev mode
96 // Skip the collator block production in dev mode, since the blocks are sealed automatically.96 // Skip the collator block production in dev mode, since the blocks are sealed automatically.
97 if(await helper.arrange.isDevNode()) this.skip();97 if(await helper.arrange.isDevNode()) this.skip();
9898
99 [aliceNode, bobNode, charlieNode, daveNode] = await getInitialInvulnerables();99 [alphaNode, betaNode, gammaNode, deltaNode] = await getInitialInvulnerables();
100100
101 const invulnerables = await helper.collatorSelection.getInvulnerables();101 const invulnerables = await helper.collatorSelection.getInvulnerables();
102 expect(invulnerables.length, 'Invalid initial invulnerables number').to.be.equal(4);102 expect(invulnerables.length, 'Invalid initial invulnerables number').to.be.equal(4);
103 expect(invulnerables, 'Invalid initial invulnerables').containSubset([aliceNode, bobNode, charlieNode, daveNode]);103 expect(invulnerables, 'Invalid initial invulnerables').containSubset([alphaNode, betaNode, gammaNode, deltaNode]);
104 });104 });
105 });105 });
106106
109109
110 nonce = await helper.chain.getNonce(superuser.address);110 nonce = await helper.chain.getNonce(superuser.address);
111 await expect(Promise.all([111 await expect(Promise.all([
112 helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [aliceNode], true, {nonce: nonce++}),112 helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [alphaNode], true, {nonce: nonce++}),
113 helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [bobNode], true, {nonce: nonce++}),113 helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [betaNode], true, {nonce: nonce++}),
114 ])).to.be.fulfilled;114 ])).to.be.fulfilled;
115115
116 const newInvulnerables = await helper.collatorSelection.getInvulnerables();116 const newInvulnerables = await helper.collatorSelection.getInvulnerables();
117 expect(newInvulnerables).to.contain(charlieNode).and.contain(daveNode).and.be.length(2);117 expect(newInvulnerables).to.contain(gammaNode).and.contain(deltaNode).and.be.length(2);
118118
119 await helper.wait.newSessions(2);119 await helper.wait.newSessions(2);
120120
121 const newValidators = await helper.callRpc('api.query.session.validators');121 const newValidators = await helper.callRpc('api.query.session.validators');
122 expect(newValidators).to.contain(charlieNode).and.contain(daveNode).and.be.length(2);122 expect(newValidators).to.contain(gammaNode).and.contain(deltaNode).and.be.length(2);
123123
124 const lastBlockNumber = await helper.chain.getLatestBlockNumber();124 const lastBlockNumber = await helper.chain.getLatestBlockNumber();
125 await helper.wait.newBlocks(1);125 await helper.wait.newBlocks(1);
126 const lastCharlieBlock = (await helper.callRpc('api.query.collatorSelection.lastAuthoredBlock', [charlieNode])).toNumber();126 const lastGammaBlock = (await helper.callRpc('api.query.collatorSelection.lastAuthoredBlock', [gammaNode])).toNumber();
127 const lastDaveBlock = (await helper.callRpc('api.query.collatorSelection.lastAuthoredBlock', [daveNode])).toNumber();127 const lastDeltaBlock = (await helper.callRpc('api.query.collatorSelection.lastAuthoredBlock', [deltaNode])).toNumber();
128 expect(lastCharlieBlock >= lastBlockNumber || lastDaveBlock >= lastBlockNumber).to.be.true;128 expect(lastGammaBlock >= lastBlockNumber || lastDeltaBlock >= lastBlockNumber).to.be.true;
129 });129 });
130130
131 after(async () => {131 after(async () => {