difftreelog
Fix vesting test: increase periods for full node
in: master
1 file changed
tests/src/vesting.test.tsdiffbeforeafterboth28 });28 });29 });29 });303031 itSub('can perform vestedTransfer and claim tokens', async ({helper}) => {31 itSub.only('can perform vestedTransfer and claim tokens', async ({helper}) => {32 // arrange32 // arrange33 const [sender, recepient] = await helper.arrange.createAccounts([1000n, 1n], donor);33 const [sender, recepient] = await helper.arrange.createAccounts([1000n, 1n], donor);34 const currentRelayBlock = await helper.chain.getRelayBlockNumber();34 const currentRelayBlock = await helper.chain.getRelayBlockNumber();35 const SCHEDULE_1_PERIOD = 4n; // 6 blocks one period36 const SCHEDULE_1_START = currentRelayBlock + 6n; // Block when 1 schedule starts37 const SCHEDULE_2_PERIOD = 8n; // 12 blocks one period38 const SCHEDULE_2_START = currentRelayBlock + 12n; // Block when 2 schedule starts35 const schedule1 = {start: currentRelayBlock + 4n, period: 4n, periodCount: 2n, perPeriod: 50n * nominal};39 const schedule1 = {start: SCHEDULE_1_START, period: SCHEDULE_1_PERIOD, periodCount: 2n, perPeriod: 50n * nominal};36 const schedule2 = {start: currentRelayBlock + 8n, period: 8n, periodCount: 2n, perPeriod: 100n * nominal};40 const schedule2 = {start: SCHEDULE_2_START, period: SCHEDULE_2_PERIOD, periodCount: 2n, perPeriod: 100n * nominal};374138 // act42 // act39 await helper.balance.vestedTransfer(sender, recepient.address, schedule1);43 await helper.balance.vestedTransfer(sender, recepient.address, schedule1);59 expect(schedule[0]).to.deep.eq(schedule1);63 expect(schedule[0]).to.deep.eq(schedule1);60 expect(schedule[1]).to.deep.eq(schedule2);64 expect(schedule[1]).to.deep.eq(schedule2);616566 // Wait first part available:62 await helper.wait.forRelayBlockNumber(currentRelayBlock + 8n);67 await helper.wait.forRelayBlockNumber(SCHEDULE_1_START + SCHEDULE_1_PERIOD);63 await helper.balance.claim(recepient);68 await helper.balance.claim(recepient);646965 // check recepient balance after claim (50 tokens claimed):70 // check recepient balance after claim (50 tokens claimed, 250 left):66 balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);71 balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);67 expect(balanceRecepient.free / nominal).to.eq(300n);72 expect(balanceRecepient.free / nominal).to.eq(300n);68 expect(balanceRecepient.feeFrozen).to.eq(250n * nominal);73 expect(balanceRecepient.feeFrozen).to.eq(250n * nominal);69 expect(balanceRecepient.miscFrozen).to.eq(250n * nominal);74 expect(balanceRecepient.miscFrozen).to.eq(250n * nominal);70 expect(balanceRecepient.reserved).to.eq(0n);75 expect(balanceRecepient.reserved).to.eq(0n);71 76 77 // Wait first schedule ends and first part od second schedule:72 await helper.wait.forRelayBlockNumber(currentRelayBlock + 16n);78 await helper.wait.forRelayBlockNumber(SCHEDULE_2_START + SCHEDULE_2_PERIOD);73 await helper.balance.claim(recepient);79 await helper.balance.claim(recepient);748075 // check recepient balance after second claim (150 tokens claimed):81 // check recepient balance after second claim (150 tokens claimed, 100 left):76 balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);82 balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);77 expect(balanceRecepient.free / nominal).to.eq(300n);83 expect(balanceRecepient.free / nominal).to.eq(300n);78 expect(balanceRecepient.feeFrozen).to.eq(100n * nominal);84 expect(balanceRecepient.feeFrozen).to.eq(100n * nominal);84 expect(schedule).to.has.length(1);90 expect(schedule).to.has.length(1);85 expect(schedule[0]).to.deep.eq(schedule2);91 expect(schedule[0]).to.deep.eq(schedule2);869293 // Wait 2 schedule ends:87 await helper.wait.forRelayBlockNumber(currentRelayBlock + 24n);94 await helper.wait.forRelayBlockNumber(SCHEDULE_2_START + SCHEDULE_2_PERIOD * 2n);88 await helper.balance.claim(recepient);95 await helper.balance.claim(recepient);899690 // check recepient balance after second claim (100 tokens claimed):97 // check recepient balance after second claim (100 tokens claimed, 0 left):91 balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);98 balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);92 expect(balanceRecepient.free / nominal).to.eq(300n);99 expect(balanceRecepient.free / nominal).to.eq(300n);93 expect(balanceRecepient.feeFrozen).to.eq(0n);100 expect(balanceRecepient.feeFrozen).to.eq(0n);