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

difftreelog

fix test both scheduling variants - anon and named

Daniel Shiposha2022-11-10parent: #786ff7e.patch.diff
in: master

8 files changed

modifiedtests/src/eth/scheduling.test.tsdiffbeforeafterboth
--- a/tests/src/eth/scheduling.test.ts
+++ b/tests/src/eth/scheduling.test.ts
@@ -15,7 +15,7 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 import {expect} from 'chai';
-import {EthUniqueHelper, itEth} from './util';
+import {EthUniqueHelper, itSchedEth} from './util';
 import {Pallets, usingPlaygrounds} from '../util';
 
 describe('Scheduing EVM smart contracts', () => {
@@ -26,11 +26,11 @@
     });
   });
 
-  itEth.ifWithPallets('Successfully schedules and periodically executes an EVM contract', [Pallets.Scheduler], async ({helper, privateKey}) => {
+  itSchedEth.ifWithPallets('Successfully schedules and periodically executes an EVM contract', [Pallets.Scheduler], async (scheduleKind, {helper, privateKey}) => {
     const donor = await privateKey({filename: __filename});
     const [alice] = await helper.arrange.createAccounts([1000n], donor);
 
-    const scheduledId = await helper.arrange.makeScheduledId();
+    const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;
 
     const deployer = await helper.eth.createAccountWithBalance(alice);
     const flipper = await helper.eth.deployFlipper(deployer);
@@ -44,7 +44,7 @@
       repetitions: 2,
     };
 
-    await helper.scheduler.scheduleAfter<EthUniqueHelper>(scheduledId, waitForBlocks, {periodic})
+    await helper.scheduler.scheduleAfter<EthUniqueHelper>(waitForBlocks, {scheduledId, periodic})
       .eth.sendEVM(
         alice,
         flipper.options.address,
modifiedtests/src/eth/util/index.tsdiffbeforeafterboth
--- a/tests/src/eth/util/index.ts
+++ b/tests/src/eth/util/index.ts
@@ -8,6 +8,7 @@
 
 import {EthUniqueHelper} from './playgrounds/unique.dev';
 import {SilentLogger, SilentConsole} from '../../util/playgrounds/unique.dev';
+import {SchedKind} from '../../util';
 
 export {EthUniqueHelper} from './playgrounds/unique.dev';
 
@@ -81,3 +82,19 @@
 itEthIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itEthIfWithPallet(name, required, cb, {only: true});
 itEthIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itEthIfWithPallet(name, required, cb, {skip: true});
 itEth.ifWithPallets = itEthIfWithPallet;
+
+export function itSchedEth(
+  name: string,
+  cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any,
+  opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {},
+) {
+  itEth(name + ' (anonymous scheduling)', (apis) => cb('anon', apis), opts);
+  itEth(name + ' (named scheduling)', (apis) => cb('named', apis), opts);
+}
+itSchedEth.only = (name: string, cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itSchedEth(name, cb, {only: true});
+itSchedEth.skip = (name: string, cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itSchedEth(name, cb, {skip: true});
+itSchedEth.ifWithPallets = itSchedIfWithPallets;
+
+function itSchedIfWithPallets(name: string, required: string[], cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+  return itSchedEth(name, cb, {requiredPallets: required, ...opts});
+}
modifiedtests/src/maintenanceMode.seqtest.tsdiffbeforeafterboth
--- a/tests/src/maintenanceMode.seqtest.ts
+++ b/tests/src/maintenanceMode.seqtest.ts
@@ -16,7 +16,7 @@
 
 import {IKeyringPair} from '@polkadot/types/types';
 import {ApiPromise} from '@polkadot/api';
-import {expect, itSub, Pallets, usingPlaygrounds} from './util';
+import {expect, itSched, itSub, Pallets, usingPlaygrounds} from './util';
 import {itEth} from './eth/util';
 
 async function maintenanceEnabled(api: ApiPromise): Promise<boolean> {
@@ -162,7 +162,7 @@
     await expect(helper.balance.transferToSubstrate(bob, superuser.address, 1n)).to.be.fulfilled;
   });
 
-  itSub.ifWithPallets('MM blocks scheduled calls and the scheduler itself', [Pallets.Scheduler], async ({helper}) => {
+  itSched.ifWithPallets('MM blocks scheduled calls and the scheduler itself', [Pallets.Scheduler], async (scheduleKind, {helper}) => {
     const collection = await helper.nft.mintCollection(bob);
 
     const nftBeforeMM = await collection.mintToken(bob);
@@ -175,23 +175,25 @@
       scheduledIdBunkerThroughMM,
       scheduledIdAttemptDuringMM,
       scheduledIdAfterMM,
-    ] = await helper.arrange.makeScheduledIds(5);
+    ] = scheduleKind == 'named'
+      ? helper.arrange.makeScheduledIds(5)
+      : new Array(5);
 
     const blocksToWait = 6;
 
     // Scheduling works before the maintenance
-    await nftBeforeMM.scheduleAfter(scheduledIdBeforeMM, blocksToWait)
+    await nftBeforeMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdBeforeMM})
       .transfer(bob, {Substrate: superuser.address});
 
     await helper.wait.newBlocks(blocksToWait + 1);
     expect(await nftBeforeMM.getOwner()).to.be.deep.equal({Substrate: superuser.address});
 
     // Schedule a transaction that should occur *during* the maintenance
-    await nftDuringMM.scheduleAfter(scheduledIdDuringMM, blocksToWait)
+    await nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdDuringMM})
       .transfer(bob, {Substrate: superuser.address});
     
     // Schedule a transaction that should occur *after* the maintenance
-    await nftDuringMM.scheduleAfter(scheduledIdBunkerThroughMM, blocksToWait * 2)
+    await nftDuringMM.scheduleAfter(blocksToWait * 2, {scheduledId: scheduledIdBunkerThroughMM})
       .transfer(bob, {Substrate: superuser.address});
 
     await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
@@ -202,7 +204,7 @@
     expect(await nftDuringMM.getOwner()).to.be.deep.equal({Substrate: bob.address});
 
     // Any attempts to schedule a tx during the MM should be rejected
-    await expect(nftDuringMM.scheduleAfter(scheduledIdAttemptDuringMM, blocksToWait)
+    await expect(nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAttemptDuringMM})
       .transfer(bob, {Substrate: superuser.address}))
       .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
 
@@ -210,7 +212,7 @@
     expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
 
     // Scheduling works after the maintenance
-    await nftAfterMM.scheduleAfter(scheduledIdAfterMM, blocksToWait)
+    await nftAfterMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAfterMM})
       .transfer(bob, {Substrate: superuser.address});
     
     await helper.wait.newBlocks(blocksToWait + 1);
modifiedtests/src/scheduler.seqtest.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 {expect, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util';17import {expect, itSched, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util';
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {DevUniqueHelper} from './util/playgrounds/unique.dev';19import {DevUniqueHelper} from './util/playgrounds/unique.dev';
2020
36 });36 });
37 });37 });
38
39 beforeEach(async () => {
40 await usingPlaygrounds(async (helper) => {
41 await helper.wait.noScheduledTasks();
42 });
43 });
3844
39 itSub('Can delay a transfer of an owned token', async ({helper}) => {45 itSched('Can delay a transfer of an owned token', async (scheduleKind, {helper}) => {
40 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});46 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
41 const token = await collection.mintToken(alice);47 const token = await collection.mintToken(alice);
42 const schedulerId = await helper.arrange.makeScheduledId();48 const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;
43 const blocksBeforeExecution = 4;49 const blocksBeforeExecution = 4;
44 50
45 await token.scheduleAfter(schedulerId, blocksBeforeExecution)51 await token.scheduleAfter(blocksBeforeExecution, {scheduledId})
46 .transfer(alice, {Substrate: bob.address});52 .transfer(alice, {Substrate: bob.address});
47 const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;53 const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;
4854
53 expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});59 expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
54 });60 });
5561
56 itSub('Can transfer funds periodically', async ({helper}) => {62 itSched('Can transfer funds periodically', async (scheduleKind, {helper}) => {
57 const scheduledId = await helper.arrange.makeScheduledId();63 const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;
58 const waitForBlocks = 1;64 const waitForBlocks = 1;
5965
60 const amount = 1n * helper.balance.getOneTokenNominal();66 const amount = 1n * helper.balance.getOneTokenNominal();
6571
66 const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);72 const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);
6773
68 await helper.scheduler.scheduleAfter(scheduledId, waitForBlocks, {periodic})74 await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId, periodic})
69 .balance.transferToSubstrate(alice, bob.address, amount);75 .balance.transferToSubstrate(alice, bob.address, amount);
70 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;76 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
7177
92 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});98 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
93 const token = await collection.mintToken(alice);99 const token = await collection.mintToken(alice);
94100
95 const scheduledId = await helper.arrange.makeScheduledId();101 const scheduledId = helper.arrange.makeScheduledId();
96 const waitForBlocks = 4;102 const waitForBlocks = 4;
97103
98 expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});104 expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});
99105
100 await token.scheduleAfter(scheduledId, waitForBlocks)106 await token.scheduleAfter(waitForBlocks, {scheduledId})
101 .transfer(alice, {Substrate: bob.address});107 .transfer(alice, {Substrate: bob.address});
102 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;108 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
103109
115 repetitions: 2,121 repetitions: 2,
116 };122 };
117123
118 const scheduledId = await helper.arrange.makeScheduledId();124 const scheduledId = helper.arrange.makeScheduledId();
119125
120 const amount = 1n * helper.balance.getOneTokenNominal();126 const amount = 1n * helper.balance.getOneTokenNominal();
121127
122 const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);128 const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);
123129
124 await helper.scheduler.scheduleAfter(scheduledId, waitForBlocks, {periodic})130 await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId, periodic})
125 .balance.transferToSubstrate(alice, bob.address, amount);131 .balance.transferToSubstrate(alice, bob.address, amount);
126 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;132 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
127133
146 );152 );
147 });153 });
148154
149 itSub('scheduler will not insert more tasks than allowed', async ({helper}) => {155 itSched('scheduler will not insert more tasks than allowed', async (scheduleKind, {helper}) => {
150 const maxScheduledPerBlock = 50;156 const maxScheduledPerBlock = 50;
157 let fillScheduledIds = new Array(maxScheduledPerBlock);
158 let extraScheduledId = undefined;
159
160 if (scheduleKind == 'named') {
151 const scheduledIds = await helper.arrange.makeScheduledIds(maxScheduledPerBlock + 1);161 const scheduledIds = helper.arrange.makeScheduledIds(maxScheduledPerBlock + 1);
152 const fillScheduledIds = scheduledIds.slice(0, maxScheduledPerBlock);162 fillScheduledIds = scheduledIds.slice(0, maxScheduledPerBlock);
153 const extraScheduledId = scheduledIds[maxScheduledPerBlock];163 extraScheduledId = scheduledIds[maxScheduledPerBlock];
164 }
154165
155 // Since the dev node has Instant Seal,166 // Since the dev node has Instant Seal,
156 // we need a larger gap between the current block and the target one.167 // we need a larger gap between the current block and the target one.
168179
169 // Fill the target block180 // Fill the target block
170 for (let i = 0; i < maxScheduledPerBlock; i++) {181 for (let i = 0; i < maxScheduledPerBlock; i++) {
171 await helper.scheduler.scheduleAt(fillScheduledIds[i], executionBlock)182 await helper.scheduler.scheduleAt(executionBlock, {scheduledId: fillScheduledIds[i]})
172 .balance.transferToSubstrate(superuser, bob.address, amount);183 .balance.transferToSubstrate(superuser, bob.address, amount);
173 }184 }
174185
175 // Try to schedule a task into a full block186 // Try to schedule a task into a full block
176 await expect(helper.scheduler.scheduleAt(extraScheduledId, executionBlock)187 await expect(helper.scheduler.scheduleAt(executionBlock, {scheduledId: extraScheduledId})
177 .balance.transferToSubstrate(superuser, bob.address, amount))188 .balance.transferToSubstrate(superuser, bob.address, amount))
178 .to.be.rejectedWith(/scheduler\.AgendaIsExhausted/);189 .to.be.rejectedWith(/scheduler\.AgendaIsExhausted/);
179190
187 expect(diff).to.be.equal(amount * BigInt(maxScheduledPerBlock));198 expect(diff).to.be.equal(amount * BigInt(maxScheduledPerBlock));
188 });199 });
189200
190 itSub.ifWithPallets('Scheduled tasks are transactional', [Pallets.TestUtils], async ({helper}) => {201 itSched.ifWithPallets('Scheduled tasks are transactional', [Pallets.TestUtils], async (scheduleKind, {helper}) => {
191 const scheduledId = await helper.arrange.makeScheduledId();202 const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;
192 const waitForBlocks = 4;203 const waitForBlocks = 4;
193204
194 const initTestVal = 42;205 const initTestVal = 42;
195 const changedTestVal = 111;206 const changedTestVal = 111;
196207
197 await helper.testUtils.setTestValue(alice, initTestVal);208 await helper.testUtils.setTestValue(alice, initTestVal);
198209
199 await helper.scheduler.scheduleAfter<DevUniqueHelper>(scheduledId, waitForBlocks)210 await helper.scheduler.scheduleAfter<DevUniqueHelper>(waitForBlocks, {scheduledId})
200 .testUtils.setTestValueAndRollback(alice, changedTestVal);211 .testUtils.setTestValueAndRollback(alice, changedTestVal);
201 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;212 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
202213
207 .to.be.equal(initTestVal);218 .to.be.equal(initTestVal);
208 });219 });
209220
210 itSub.ifWithPallets('Scheduled tasks should take correct fees', [Pallets.TestUtils], async function({helper}) {221 itSched.ifWithPallets('Scheduled tasks should take correct fees', [Pallets.TestUtils], async function(scheduleKind, {helper}) {
211 const scheduledId = await helper.arrange.makeScheduledId();222 const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;
212 const waitForBlocks = 4;223 const waitForBlocks = 4;
213 const periodic = {224 const periodic = {
214 period: 2,225 period: 2,
221 const expectedScheduledFee = (await helper.getPaymentInfo(alice, dummyTx, scheduledLen))232 const expectedScheduledFee = (await helper.getPaymentInfo(alice, dummyTx, scheduledLen))
222 .partialFee.toBigInt();233 .partialFee.toBigInt();
223234
224 await helper.scheduler.scheduleAfter<DevUniqueHelper>(scheduledId, waitForBlocks, {periodic})235 await helper.scheduler.scheduleAfter<DevUniqueHelper>(waitForBlocks, {scheduledId, periodic})
225 .testUtils.justTakeFee(alice);236 .testUtils.justTakeFee(alice);
226 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;237 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
227238
267 const [278 const [
268 scheduledId,279 scheduledId,
269 scheduledCancelId,280 scheduledCancelId,
270 ] = await helper.arrange.makeScheduledIds(2);281 ] = helper.arrange.makeScheduledIds(2);
271282
272 const periodic = {283 const periodic = {
273 period: 5,284 period: 5,
280291
281 await helper.testUtils.setTestValue(alice, initTestVal);292 await helper.testUtils.setTestValue(alice, initTestVal);
282293
283 await helper.scheduler.scheduleAt<DevUniqueHelper>(scheduledId, firstExecutionBlockNumber, {periodic})294 await helper.scheduler.scheduleAt<DevUniqueHelper>(firstExecutionBlockNumber, {scheduledId, periodic})
284 .testUtils.incTestValue(alice);295 .testUtils.incTestValue(alice);
285296
286 // Cancel the inc tx after 2 executions297 // Cancel the inc tx after 2 executions
287 // *in the same block* in which the second execution is scheduled298 // *in the same block* in which the second execution is scheduled
288 await helper.scheduler.scheduleAt(299 await helper.scheduler.scheduleAt(
289 scheduledCancelId,
290 firstExecutionBlockNumber + periodic.period,300 firstExecutionBlockNumber + periodic.period,
301 {scheduledId: scheduledCancelId},
291 ).scheduler.cancelScheduled(alice, scheduledId);302 ).scheduler.cancelScheduled(alice, scheduledId);
292303
293 await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);304 await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);
310 });321 });
311322
312 itSub.ifWithPallets('A scheduled operation can cancel itself', [Pallets.TestUtils], async ({helper}) => {323 itSub.ifWithPallets('A scheduled operation can cancel itself', [Pallets.TestUtils], async ({helper}) => {
313 const scheduledId = await helper.arrange.makeScheduledId();324 const scheduledId = helper.arrange.makeScheduledId();
314 const waitForBlocks = 4;325 const waitForBlocks = 4;
315 const periodic = {326 const periodic = {
316 period: 2,327 period: 2,
322333
323 await helper.testUtils.setTestValue(alice, initTestVal);334 await helper.testUtils.setTestValue(alice, initTestVal);
324335
325 await helper.scheduler.scheduleAfter<DevUniqueHelper>(scheduledId, waitForBlocks, {periodic})336 await helper.scheduler.scheduleAfter<DevUniqueHelper>(waitForBlocks, {scheduledId, periodic})
326 .testUtils.selfCancelingInc(alice, scheduledId, maxTestVal);337 .testUtils.selfCancelingInc(alice, scheduledId, maxTestVal);
327 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;338 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
328339
349 const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});360 const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});
350 const token = await collection.mintToken(bob);361 const token = await collection.mintToken(bob);
351362
352 const scheduledId = await helper.arrange.makeScheduledId();363 const scheduledId = helper.arrange.makeScheduledId();
353 const waitForBlocks = 4;364 const waitForBlocks = 4;
354365
355 await token.scheduleAfter(scheduledId, waitForBlocks)366 await token.scheduleAfter(waitForBlocks, {scheduledId})
356 .transfer(bob, {Substrate: alice.address});367 .transfer(bob, {Substrate: alice.address});
357 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;368 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
358369
363 expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});374 expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
364 });375 });
365376
366 itSub('Root can set prioritized scheduled operation', async ({helper}) => {377 itSched('Root can set prioritized scheduled operation', async (scheduleKind, {helper}) => {
367 const scheduledId = await helper.arrange.makeScheduledId();378 const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;
368 const waitForBlocks = 4;379 const waitForBlocks = 4;
369380
370 const amount = 42n * helper.balance.getOneTokenNominal();381 const amount = 42n * helper.balance.getOneTokenNominal();
371382
372 const balanceBefore = await helper.balance.getSubstrate(charlie.address);383 const balanceBefore = await helper.balance.getSubstrate(charlie.address);
373384
374 await helper.getSudo()385 await helper.getSudo()
375 .scheduler.scheduleAfter(scheduledId, waitForBlocks, {priority: 42})386 .scheduler.scheduleAfter(waitForBlocks, {scheduledId, priority: 42})
376 .balance.forceTransferToSubstrate(superuser, bob.address, charlie.address, amount);387 .balance.forceTransferToSubstrate(superuser, bob.address, charlie.address, amount);
377 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;388 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
378389
390 const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});401 const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});
391 const token = await collection.mintToken(bob);402 const token = await collection.mintToken(bob);
392403
393 const scheduledId = await helper.arrange.makeScheduledId();404 const scheduledId = helper.arrange.makeScheduledId();
394 const waitForBlocks = 6;405 const waitForBlocks = 6;
395406
396 await token.scheduleAfter(scheduledId, waitForBlocks)407 await token.scheduleAfter(waitForBlocks, {scheduledId})
397 .transfer(bob, {Substrate: alice.address});408 .transfer(bob, {Substrate: alice.address});
398 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;409 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
399410
419 const [430 const [
420 scheduledFirstId,431 scheduledFirstId,
421 scheduledSecondId,432 scheduledSecondId,
422 ] = await helper.arrange.makeScheduledIds(2);433 ] = helper.arrange.makeScheduledIds(2);
423434
424 const currentBlockNumber = await helper.chain.getLatestBlockNumber();435 const currentBlockNumber = await helper.chain.getLatestBlockNumber();
425 const blocksBeforeExecution = 6;436 const blocksBeforeExecution = 6;
436 const amount = 1n * helper.balance.getOneTokenNominal();447 const amount = 1n * helper.balance.getOneTokenNominal();
437448
438 // Scheduler a task with a lower priority first, then with a higher priority449 // Scheduler a task with a lower priority first, then with a higher priority
439 await helper.getSudo().scheduler.scheduleAt(scheduledFirstId, firstExecutionBlockNumber, {priority: prioLow, periodic})450 await helper.getSudo().scheduler.scheduleAt(firstExecutionBlockNumber, {
451 scheduledId: scheduledFirstId,
452 priority: prioLow,
453 periodic,
440 .balance.forceTransferToSubstrate(superuser, alice.address, bob.address, amount);454 }).balance.forceTransferToSubstrate(superuser, alice.address, bob.address, amount);
441455
442 await helper.getSudo().scheduler.scheduleAt(scheduledSecondId, firstExecutionBlockNumber, {priority: prioHigh, periodic})456 await helper.getSudo().scheduler.scheduleAt(firstExecutionBlockNumber, {
457 scheduledId: scheduledSecondId,
458 priority: prioHigh,
459 periodic,
443 .balance.forceTransferToSubstrate(superuser, alice.address, bob.address, amount);460 }).balance.forceTransferToSubstrate(superuser, alice.address, bob.address, amount);
444461
445 const capture = await helper.arrange.captureEvents('scheduler', 'Dispatched');462 const capture = await helper.arrange.captureEvents('scheduler', 'Dispatched');
467 expect(secondExecuctionIds[1]).to.be.equal(scheduledSecondId);484 expect(secondExecuctionIds[1]).to.be.equal(scheduledSecondId);
468 });485 });
469486
470 itSub('Periodic operations always can be rescheduled', async ({helper}) => {487 itSched('Periodic operations always can be rescheduled', async (scheduleKind, {helper}) => {
471 const maxScheduledPerBlock = 50;488 const maxScheduledPerBlock = 50;
472 const numFilledBlocks = 3;489 const numFilledBlocks = 3;
473 const ids = await helper.arrange.makeScheduledIds(numFilledBlocks * maxScheduledPerBlock + 1);490 const ids = helper.arrange.makeScheduledIds(numFilledBlocks * maxScheduledPerBlock + 1);
474 const periodicId = ids[0];491 const periodicId = scheduleKind == 'named' ? ids[0] : undefined;
475 const fillIds = ids.slice(1);492 const fillIds = ids.slice(1);
493
494 const fillScheduleFn = scheduleKind == 'named' ? 'scheduleNamed' : 'schedule';
476495
477 const initTestVal = 0;496 const initTestVal = 0;
478 const firstExecTestVal = 1;497 const firstExecTestVal = 1;
498 const scheduledTx = helper.constructApiCall('api.tx.balances.transfer', [bob.address, 1n]);517 const scheduledTx = helper.constructApiCall('api.tx.balances.transfer', [bob.address, 1n]);
499518
500 const when = firstExecutionBlockNumber + period + offset;519 const when = firstExecutionBlockNumber + period + offset;
520 const mandatoryArgs = [when, null, null, scheduledTx];
501 const tx = helper.constructApiCall('api.tx.scheduler.scheduleNamed', [fillIds[i + offset * maxScheduledPerBlock], when, null, null, scheduledTx]);521 const scheduleArgs = scheduleKind == 'named'
522 ? [fillIds[i + offset * maxScheduledPerBlock], ...mandatoryArgs]
523 : mandatoryArgs;
524
525 const tx = helper.constructApiCall(`api.tx.scheduler.${fillScheduleFn}`, scheduleArgs);
502526
503 txs.push(tx);527 txs.push(tx);
504 }528 }
505 }529 }
506 await helper.executeExtrinsic(alice, 'api.tx.testUtils.batchAll', [txs], true);530 await helper.executeExtrinsic(alice, 'api.tx.testUtils.batchAll', [txs], true);
507531
508 await helper.scheduler.scheduleAt<DevUniqueHelper>(periodicId, firstExecutionBlockNumber, {periodic})532 await helper.scheduler.scheduleAt<DevUniqueHelper>(firstExecutionBlockNumber, {
533 scheduledId: periodicId,
534 periodic,
509 .testUtils.incTestValue(alice);535 }).testUtils.incTestValue(alice);
510536
511 await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);537 await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);
522 expect(await helper.testUtils.testValue()).to.be.equal(secondExecTestVal);548 expect(await helper.testUtils.testValue()).to.be.equal(secondExecTestVal);
523 });549 });
524550
525 itSub('scheduled operations does not change nonce', async ({helper}) => {551 itSched('scheduled operations does not change nonce', async (scheduleKind, {helper}) => {
526 const scheduledId = await helper.arrange.makeScheduledId();552 const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;
527 const blocksBeforeExecution = 4;553 const blocksBeforeExecution = 4;
528554
529 await helper.scheduler555 await helper.scheduler
530 .scheduleAfter<DevUniqueHelper>(scheduledId, blocksBeforeExecution)556 .scheduleAfter<DevUniqueHelper>(blocksBeforeExecution, {scheduledId})
531 .balance.transferToSubstrate(alice, bob.address, 1n);557 .balance.transferToSubstrate(alice, bob.address, 1n);
532 const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;558 const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;
533559
560 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});586 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
561 const token = await collection.mintToken(alice);587 const token = await collection.mintToken(alice);
562588
563 const scheduledId = await helper.arrange.makeScheduledId();589 const scheduledId = helper.arrange.makeScheduledId();
564 const waitForBlocks = 4;590 const waitForBlocks = 4;
565591
566 await token.scheduleAfter(scheduledId, waitForBlocks)592 await token.scheduleAfter(waitForBlocks, {scheduledId})
567 .transfer(alice, {Substrate: bob.address});593 .transfer(alice, {Substrate: bob.address});
568 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;594 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
569595
570 const scheduled = helper.scheduler.scheduleAfter(scheduledId, waitForBlocks);596 const scheduled = helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId});
571 await expect(scheduled.balance.transferToSubstrate(alice, bob.address, 1n * helper.balance.getOneTokenNominal()))597 await expect(scheduled.balance.transferToSubstrate(alice, bob.address, 1n * helper.balance.getOneTokenNominal()))
572 .to.be.rejectedWith(/scheduler\.FailedToSchedule/);598 .to.be.rejectedWith(/scheduler\.FailedToSchedule/);
573599
582 });608 });
583609
584 itSub("Can't cancel an operation which is not scheduled", async ({helper}) => {610 itSub("Can't cancel an operation which is not scheduled", async ({helper}) => {
585 const scheduledId = await helper.arrange.makeScheduledId();611 const scheduledId = helper.arrange.makeScheduledId();
586 await expect(helper.scheduler.cancelScheduled(alice, scheduledId))612 await expect(helper.scheduler.cancelScheduled(alice, scheduledId))
587 .to.be.rejectedWith(/scheduler\.NotFound/);613 .to.be.rejectedWith(/scheduler\.NotFound/);
588 });614 });
591 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});617 const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
592 const token = await collection.mintToken(alice);618 const token = await collection.mintToken(alice);
593619
594 const scheduledId = await helper.arrange.makeScheduledId();620 const scheduledId = helper.arrange.makeScheduledId();
595 const waitForBlocks = 4;621 const waitForBlocks = 4;
596622
597 await token.scheduleAfter(scheduledId, waitForBlocks)623 await token.scheduleAfter(waitForBlocks, {scheduledId})
598 .transfer(alice, {Substrate: bob.address});624 .transfer(alice, {Substrate: bob.address});
599 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;625 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
600626
606 expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});632 expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
607 });633 });
608634
609 itSub("Regular user can't set prioritized scheduled operation", async ({helper}) => {635 itSched("Regular user can't set prioritized scheduled operation", async (scheduleKind, {helper}) => {
610 const scheduledId = await helper.arrange.makeScheduledId();636 const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;
611 const waitForBlocks = 4;637 const waitForBlocks = 4;
612638
613 const amount = 42n * helper.balance.getOneTokenNominal();639 const amount = 42n * helper.balance.getOneTokenNominal();
614640
615 const balanceBefore = await helper.balance.getSubstrate(bob.address);641 const balanceBefore = await helper.balance.getSubstrate(bob.address);
616642
617 const scheduled = helper.scheduler.scheduleAfter(scheduledId, waitForBlocks, {priority: 42});643 const scheduled = helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId, priority: 42});
618 644
619 await expect(scheduled.balance.transferToSubstrate(alice, bob.address, amount))645 await expect(scheduled.balance.transferToSubstrate(alice, bob.address, amount))
620 .to.be.rejectedWith(/BadOrigin/);646 .to.be.rejectedWith(/BadOrigin/);
632 const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});658 const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});
633 const token = await collection.mintToken(bob);659 const token = await collection.mintToken(bob);
634660
635 const scheduledId = await helper.arrange.makeScheduledId();661 const scheduledId = helper.arrange.makeScheduledId();
636 const waitForBlocks = 4;662 const waitForBlocks = 4;
637663
638 await token.scheduleAfter(scheduledId, waitForBlocks)664 await token.scheduleAfter(waitForBlocks, {scheduledId})
639 .transfer(bob, {Substrate: alice.address});665 .transfer(bob, {Substrate: alice.address});
640666
641 const priority = 112;667 const priority = 112;
modifiedtests/src/util/index.tsdiffbeforeafterboth
--- a/tests/src/util/index.ts
+++ b/tests/src/util/index.ts
@@ -130,6 +130,24 @@
 itSubIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSubIfWithPallet(name, required, cb, {skip: true});
 itSub.ifWithPallets = itSubIfWithPallet;
 
+export type SchedKind = 'anon' | 'named';
+
+export function itSched(
+  name: string,
+  cb: (schedKind: SchedKind, apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any,
+  opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {},
+) {
+  itSub(name + ' (anonymous scheduling)', (apis) => cb('anon', apis), opts);
+  itSub(name + ' (named scheduling)', (apis) => cb('named', apis), opts);
+}
+itSched.only = (name: string, cb: (schedKind: SchedKind, apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSched(name, cb, {only: true});
+itSched.skip = (name: string, cb: (schedKind: SchedKind, apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSched(name, cb, {skip: true});
+itSched.ifWithPallets = itSchedIfWithPallets;
+
+function itSchedIfWithPallets(name: string, required: string[], cb: (schedKind: SchedKind, apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+  return itSched(name, cb, {requiredPallets: required, ...opts});
+}
+
 export function describeXCM(title: string, fn: (this: Mocha.Suite) => void, opts: {skip?: boolean} = {}) {
   (process.env.RUN_XCM_TESTS && !opts.skip
     ? describe
modifiedtests/src/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -172,6 +172,7 @@
 }
 
 export interface ISchedulerOptions {
+  scheduledId?: string,
   priority?: number,
   periodic?: {
     period: number,
modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -308,9 +308,7 @@
     return encodeAddress(address);
   }
 
-  async makeScheduledIds(num: number): Promise<string[]> {
-    await this.helper.wait.noScheduledTasks();
-
+  makeScheduledIds(num: number): string[] {
     function makeId(slider: number) {
       const scheduledIdSize = 64;
       const hexId = slider.toString(16);
@@ -330,8 +328,8 @@
     return ids;
   }
 
-  async makeScheduledId(): Promise<string> {
-    return (await this.makeScheduledIds(1))[0];
+  makeScheduledId(): string {
+    return (this.makeScheduledIds(1))[0];
   }
 
   async captureEvents(eventSection: string, eventMethod: string): Promise<EventCapture> {
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -2560,24 +2560,21 @@
   }
 
   scheduleAt<T extends UniqueHelper>(
-    scheduledId: string,
     executionBlockNumber: number,
     options: ISchedulerOptions = {},
   ) {
-    return this.schedule<T>('scheduleNamed', scheduledId, executionBlockNumber, options);
+    return this.schedule<T>('schedule', executionBlockNumber, options);
   }
 
   scheduleAfter<T extends UniqueHelper>(
-    scheduledId: string,
     blocksBeforeExecution: number,
     options: ISchedulerOptions = {},
   ) {
-    return this.schedule<T>('scheduleNamedAfter', scheduledId, blocksBeforeExecution, options);
+    return this.schedule<T>('scheduleAfter', blocksBeforeExecution, options);
   }
 
   schedule<T extends UniqueHelper>(
-    scheduleFn: 'scheduleNamed' | 'scheduleNamedAfter',
-    scheduledId: string,
+    scheduleFn: 'schedule' | 'scheduleAfter',
     blocksNum: number,
     options: ISchedulerOptions = {},
   ) {
@@ -2585,7 +2582,6 @@
     const ScheduledHelperType = ScheduledUniqueHelper(this.helper.helperBase);
     return this.helper.clone(ScheduledHelperType, {
       scheduleFn,
-      scheduledId,
       blocksNum,
       options,
     }) as T;
@@ -2874,16 +2870,14 @@
 // eslint-disable-next-line @typescript-eslint/naming-convention
 function ScheduledUniqueHelper<T extends UniqueHelperConstructor>(Base: T) {
   return class extends Base {
-    scheduleFn: 'scheduleNamed' | 'scheduleNamedAfter';
-    scheduledId: string;
+    scheduleFn: 'schedule' | 'scheduleAfter';
     blocksNum: number;
     options: ISchedulerOptions;
 
     constructor(...args: any[]) {
       const logger = args[0] as ILogger;
       const options = args[1] as {
-        scheduleFn: 'scheduleNamed' | 'scheduleNamedAfter',
-        scheduledId: string,
+        scheduleFn: 'schedule' | 'scheduleAfter',
         blocksNum: number,
         options: ISchedulerOptions
       };
@@ -2891,25 +2885,42 @@
       super(logger);
 
       this.scheduleFn = options.scheduleFn;
-      this.scheduledId = options.scheduledId;
       this.blocksNum = options.blocksNum;
       this.options = options.options;
     }
 
     executeExtrinsic(sender: IKeyringPair, scheduledExtrinsic: string, scheduledParams: any[], expectSuccess?: boolean): Promise<ITransactionResult> {
       const scheduledTx = this.constructApiCall(scheduledExtrinsic, scheduledParams);
-      const extrinsic = 'api.tx.scheduler.' +  this.scheduleFn;
+      
+      const mandatorySchedArgs = [
+        this.blocksNum,
+        this.options.periodic ? [this.options.periodic.period, this.options.periodic.repetitions] : null,
+        this.options.priority ?? null,
+        scheduledTx,
+      ];
+      
+      let schedArgs;
+      let scheduleFn;
+
+      if (this.options.scheduledId) {
+        schedArgs = [this.options.scheduledId!, ...mandatorySchedArgs];
 
+        if (this.scheduleFn == 'schedule') {
+          scheduleFn = 'scheduleNamed';
+        } else if (this.scheduleFn == 'scheduleAfter') {
+          scheduleFn = 'scheduleNamedAfter';
+        }
+      } else {
+        schedArgs = mandatorySchedArgs;
+        scheduleFn = this.scheduleFn;
+      }
+
+      const extrinsic = 'api.tx.scheduler.' +  scheduleFn;
+
       return super.executeExtrinsic(
         sender,
         extrinsic,
-        [
-          this.scheduledId,
-          this.blocksNum,
-          this.options.periodic ? [this.options.periodic.period, this.options.periodic.repetitions] : null,
-          this.options.priority ?? null,
-          scheduledTx,
-        ],
+        schedArgs,
         expectSuccess,
       );
     }
@@ -3046,20 +3057,18 @@
   }
 
   scheduleAt<T extends UniqueHelper>(
-    scheduledId: string,
     executionBlockNumber: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);
+    const scheduledHelper = this.helper.scheduler.scheduleAt<T>(executionBlockNumber, options);
     return new UniqueBaseCollection(this.collectionId, scheduledHelper);
   }
 
   scheduleAfter<T extends UniqueHelper>(
-    scheduledId: string,
     blocksBeforeExecution: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);
+    const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(blocksBeforeExecution, options);
     return new UniqueBaseCollection(this.collectionId, scheduledHelper);
   }
 
@@ -3155,20 +3164,18 @@
   }
 
   scheduleAt<T extends UniqueHelper>(
-    scheduledId: string,
     executionBlockNumber: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);
+    const scheduledHelper = this.helper.scheduler.scheduleAt<T>(executionBlockNumber, options);
     return new UniqueNFTCollection(this.collectionId, scheduledHelper);
   }
 
   scheduleAfter<T extends UniqueHelper>(
-    scheduledId: string,
     blocksBeforeExecution: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);
+    const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(blocksBeforeExecution, options);
     return new UniqueNFTCollection(this.collectionId, scheduledHelper);
   }
 
@@ -3260,20 +3267,18 @@
   }
 
   scheduleAt<T extends UniqueHelper>(
-    scheduledId: string,
     executionBlockNumber: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);
+    const scheduledHelper = this.helper.scheduler.scheduleAt<T>(executionBlockNumber, options);
     return new UniqueRFTCollection(this.collectionId, scheduledHelper);
   }
 
   scheduleAfter<T extends UniqueHelper>(
-    scheduledId: string,
     blocksBeforeExecution: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);
+    const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(blocksBeforeExecution, options);
     return new UniqueRFTCollection(this.collectionId, scheduledHelper);
   }
 
@@ -3329,20 +3334,18 @@
   }
 
   scheduleAt<T extends UniqueHelper>(
-    scheduledId: string,
     executionBlockNumber: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledHelper = this.helper.scheduler.scheduleAt<T>(scheduledId, executionBlockNumber, options);
+    const scheduledHelper = this.helper.scheduler.scheduleAt<T>(executionBlockNumber, options);
     return new UniqueFTCollection(this.collectionId, scheduledHelper);
   }
 
   scheduleAfter<T extends UniqueHelper>(
-    scheduledId: string,
     blocksBeforeExecution: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);
+    const scheduledHelper = this.helper.scheduler.scheduleAfter<T>(blocksBeforeExecution, options);
     return new UniqueFTCollection(this.collectionId, scheduledHelper);
   }
 
@@ -3388,20 +3391,18 @@
   }
 
   scheduleAt<T extends UniqueHelper>(
-    scheduledId: string,
     executionBlockNumber: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledCollection = this.collection.scheduleAt<T>(scheduledId, executionBlockNumber, options);
+    const scheduledCollection = this.collection.scheduleAt<T>(executionBlockNumber, options);
     return new UniqueBaseToken(this.tokenId, scheduledCollection);
   }
 
   scheduleAfter<T extends UniqueHelper>(
-    scheduledId: string,
     blocksBeforeExecution: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledCollection = this.collection.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);
+    const scheduledCollection = this.collection.scheduleAfter<T>(blocksBeforeExecution, options);
     return new UniqueBaseToken(this.tokenId, scheduledCollection);
   }
 
@@ -3468,20 +3469,18 @@
   }
 
   scheduleAt<T extends UniqueHelper>(
-    scheduledId: string,
     executionBlockNumber: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledCollection = this.collection.scheduleAt<T>(scheduledId, executionBlockNumber, options);
+    const scheduledCollection = this.collection.scheduleAt<T>(executionBlockNumber, options);
     return new UniqueNFToken(this.tokenId, scheduledCollection);
   }
 
   scheduleAfter<T extends UniqueHelper>(
-    scheduledId: string,
     blocksBeforeExecution: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledCollection = this.collection.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);
+    const scheduledCollection = this.collection.scheduleAfter<T>(blocksBeforeExecution, options);
     return new UniqueNFToken(this.tokenId, scheduledCollection);
   }
 
@@ -3543,20 +3542,18 @@
   }
 
   scheduleAt<T extends UniqueHelper>(
-    scheduledId: string,
     executionBlockNumber: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledCollection = this.collection.scheduleAt<T>(scheduledId, executionBlockNumber, options);
+    const scheduledCollection = this.collection.scheduleAt<T>(executionBlockNumber, options);
     return new UniqueRFToken(this.tokenId, scheduledCollection);
   }
 
   scheduleAfter<T extends UniqueHelper>(
-    scheduledId: string,
     blocksBeforeExecution: number,
     options: ISchedulerOptions = {},
   ) {
-    const scheduledCollection = this.collection.scheduleAfter<T>(scheduledId, blocksBeforeExecution, options);
+    const scheduledCollection = this.collection.scheduleAfter<T>(blocksBeforeExecution, options);
     return new UniqueRFToken(this.tokenId, scheduledCollection);
   }