difftreelog
fix use plain node names instead of test account names
in: master
2 files changed
.baedeker/collator-selection.jsonnetdiffbeforeafterboth31 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};3737tests/src/collator-selection/collatorSelection.seqtest.tsdiffbeforeafterboth333334async 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}4242848485 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;898990 let charlieNode: string;90 let gammaNode: string;91 let daveNode: string;91 let deltaNode: string;929293 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 mode96 // 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();989899 [aliceNode, bobNode, charlieNode, daveNode] = await getInitialInvulnerables();99 [alphaNode, betaNode, gammaNode, deltaNode] = await getInitialInvulnerables();100100101 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 });106106109109110 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;115115116 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);118118119 await helper.wait.newSessions(2);119 await helper.wait.newSessions(2);120120121 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);123123124 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 });130130131 after(async () => {131 after(async () => {