1

I have integrated scheduller pallet into my node, trying to test it running the node and using polkadot js. All compiles. The scheduled task event is printed to the explorer, but when the block used as execution time arrives nothing happens. What is the better way to check what part is failing?

The following is the code that schedule the task in the pallet code and the config in runtime lib:

if T::Scheduler::schedule_named(
            (POLLS_ID, poll.currency, poll_id).encode(),
            DispatchTime::At(end),
            None,
            63,
            frame_system::RawOrigin::Root.into(),
            Call::enact_poll_end { poll_currency: poll.currency, poll_id }.into(),
        )
        .is_err()

impl pallet_scheduler::Config for Runtime {
    type RuntimeEvent = RuntimeEvent;
    type RuntimeOrigin = RuntimeOrigin;
    type PalletsOrigin = OriginCaller;
    type RuntimeCall = RuntimeCall;
    type MaximumWeight = (); // No weight limit. Modify this to set a limit.
    type ScheduleOrigin = EnsureRoot<AccountId>;
    type MaxScheduledPerBlock = ConstU32<100>;
    type WeightInfo = ();
    type OriginPrivilegeCmp = EqualPrivilegeOnly;
    type Preimages = ();
}
2
  • 1
    Try setting MaximumWeight to Weight::max_value() by adding a new parameter_type! for it like MaxSchedulerWeight. Feb 27, 2023 at 23:19
  • 1
    @OliverTale-Yazdi It worked. Thanks a lot. Do you know what was happening? type MaximumWeight = () means to give no weight to the execution or something like that?
    – Xavier
    Feb 27, 2023 at 23:38

1 Answer 1

1

The scheduler has MaximumWeight weight available each block to process tasks. Setting it to () means that it has zero weight available and therefore does nothing.
You can take a look at the Polkadot runtime on how to configure it with a better value. For example 80% of the total block limit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.