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

difftreelog

test(CollatorSelection) added restoration of invulnerables

Fahrrader2022-03-30parent: #5489e8c.patch.diff
in: master

1 file changed

modifiedtests/src/shuffleCollators.test.tsdiffbeforeafterboth
14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import {ApiPromise} from '@polkadot/api';
18import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';
19import privateKey from './substrate/privateKey';18import privateKey from './substrate/privateKey';
20import usingApi, { submitTransactionAsync } from './substrate/substrate-api';19import usingApi, { submitTransactionAsync } from './substrate/substrate-api';
21import waitNewBlocks from './substrate/wait-new-blocks';20import waitNewBlocks from './substrate/wait-new-blocks';
22import {expect} from 'chai';21import {expect} from 'chai';
23import { getGenericResult } from './util/helpers';22import { getGenericResult } from './util/helpers';
24//import find from 'find-process';
2523
26let alice: IKeyringPair;24let alice: IKeyringPair;
27let bob: IKeyringPair;25let bob: IKeyringPair;
28let charlie: IKeyringPair;26let charlie: IKeyringPair;
29let dave: IKeyringPair;27let dave: IKeyringPair;
30let eve: IKeyringPair;28let eve: IKeyringPair;
31
32const alice_port = 31200;
33const bob_port = 31201;
3429
35describe('Integration Test: Dynamic shuffling of collators', () => {30describe('Integration Test: Dynamic shuffling of collators', () => {
36 before(async () => { 31 before(async () => {
86 expect(newValidators).to.contain(charlie.address).and.contain(dave.address);81 expect(newValidators).to.contain(charlie.address).and.contain(dave.address);
87 expect(newValidators).to.be.length(2);82 expect(newValidators).to.be.length(2);
83
84 // todo add delay to check that new blocks are authored by these
88 });85 });
89 });86 });
87
88 after(async () => {
89 await usingApi(async (api) => {
90 const tx = api.tx.collatorSelection.setInvulnerables([
91 alice.address,
92 bob.address
93 ]);
94 const sudoTx = api.tx.sudo.sudo(tx as any);
95 const events = await submitTransactionAsync(alice, sudoTx);
96 const result = getGenericResult(events);
97 expect(result.success).to.be.true;
98 });
99 });
90});100});
101