Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions KNOWN_GOOD_BLOCK_NUMBERS_KUSAMA.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ASSETHUBKUSAMA_BLOCK_NUMBER=11717903
BASILISK_BLOCK_NUMBER=12067946
BRIDGEHUBKUSAMA_BLOCK_NUMBER=7001619
CORETIMEKUSAMA_BLOCK_NUMBER=3935500
ENCOINTERKUSAMA_BLOCK_NUMBER=11532648
ASSETHUBKUSAMA_BLOCK_NUMBER=11736841
BASILISK_BLOCK_NUMBER=12088116
BRIDGEHUBKUSAMA_BLOCK_NUMBER=7011114
CORETIMEKUSAMA_BLOCK_NUMBER=3944850
ENCOINTERKUSAMA_BLOCK_NUMBER=11548820
INTEGRITEEKUSAMA_BLOCK_NUMBER=8897648
KARURA_BLOCK_NUMBER=10397192
KUSAMA_BLOCK_NUMBER=31048242
MOONRIVER_BLOCK_NUMBER=14012622
PEOPLEKUSAMA_BLOCK_NUMBER=6640275
SHIDEN_BLOCK_NUMBER=12681396
KARURA_BLOCK_NUMBER=10405230
KUSAMA_BLOCK_NUMBER=31068597
MOONRIVER_BLOCK_NUMBER=14031305
PEOPLEKUSAMA_BLOCK_NUMBER=6659709
SHIDEN_BLOCK_NUMBER=12698491
20 changes: 10 additions & 10 deletions KNOWN_GOOD_BLOCK_NUMBERS_POLKADOT.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ACALA_BLOCK_NUMBER=9906281
ASSETHUBPOLKADOT_BLOCK_NUMBER=10474894
ASTAR_BLOCK_NUMBER=11146077
BRIDGEHUBPOLKADOT_BLOCK_NUMBER=6433488
COLLECTIVESPOLKADOT_BLOCK_NUMBER=7630786
CORETIMEPOLKADOT_BLOCK_NUMBER=3037810
HYDRATION_BLOCK_NUMBER=10166009
ACALA_BLOCK_NUMBER=9916130
ASSETHUBPOLKADOT_BLOCK_NUMBER=10494116
ASTAR_BLOCK_NUMBER=11165523
BRIDGEHUBPOLKADOT_BLOCK_NUMBER=6443323
COLLECTIVESPOLKADOT_BLOCK_NUMBER=7640559
CORETIMEPOLKADOT_BLOCK_NUMBER=3047120
HYDRATION_BLOCK_NUMBER=10186316
INTEGRITEEPOLKADOT_BLOCK_NUMBER=5670011
MOONBEAM_BLOCK_NUMBER=13415030
PEOPLEPOLKADOT_BLOCK_NUMBER=3366615
POLKADOT_BLOCK_NUMBER=28722897
MOONBEAM_BLOCK_NUMBER=13432146
PEOPLEPOLKADOT_BLOCK_NUMBER=3375979
POLKADOT_BLOCK_NUMBER=28743434
37 changes: 34 additions & 3 deletions packages/shared/src/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,41 @@ export async function cancelScheduledTaskBadOriginTest<

await client.dev.newBlock()

// Add a bogus task to the agenda to test robustness
const currentAgenda = await client.api.query.scheduler.agenda(targetBlockNumber!)
const bogusCall = client.api.tx.system.remarkWithEvent('bogus task').method.toHex()
const modifiedAgenda = [...currentAgenda]

modifiedAgenda.push(
client.api.createType('Option<PalletSchedulerScheduled>', {
call: { Inline: bogusCall },
maybeId: null,
priority: 1,
maybePeriodic: null,
origin: { system: 'Root' },
}),
)

await client.dev.setStorage({
Scheduler: {
agenda: [[[targetBlockNumber!], modifiedAgenda]],
},
})

const scheduled = await client.api.query.scheduler.agenda(targetBlockNumber!)
expect(scheduled.length).toBe(1)
expect(scheduled[0].isSome).toBeTruthy()
await check(scheduled[0].unwrap()).toMatchObject({
expect(scheduled.length).toBeGreaterThan(0)
// Find our scheduled task (unnamed, priority 0, with our specific call)
const ourTask = scheduled.find((item) => {
if (!item.isSome) return false
const task = item.unwrap()
return (
task.maybeId.isNone && task.priority.toNumber() === 0 && task.call.isInline && task.call.asInline.toHex() === call
)
})

expect(ourTask).toBeDefined()
expect(ourTask!.isSome).toBeTruthy()
await check(ourTask!.unwrap()).toMatchObject({
maybeId: null,
priority: 0,
call: { inline: call },
Expand Down
Loading