Skip to content

Add E2E test for deferred dispatch of whitelisted calls #594

Description

@dhirajs0

Summary

Add end-to-end test coverage for the new deferred dispatch flow in pallet-whitelist,
once paritytech/polkadot-sdk#11336 is merged.

Background

RFC #11199 proposes extending pallet-whitelist so that a whitelisted call can be
scheduled to dispatch after a delay, rather than executed immediately by
DispatchWhitelistedOrigin. The implementation in #11336 adds:

  • A deferred-dispatch storage entry keyed by call_hash.
  • A permissionless executor path: any account may trigger the deferred call once
    its delay has elapsed (event: DeferredDispatchExecuted { call_hash, who }).
  • Permissionless removal of expired/cancelled deferred dispatches.
  • Runtime wiring in asset-hub-westend (governance/mod.rs) as the first integration target.
  • Benchmarks for the new extrinsics.

Unit tests exist in the pallet, but we need runtime-level e2e tests.

Scope

E2E tests should cover, at minimum:

  • Happy pathDispatchWhitelistedOrigin schedules a deferred dispatch;
    after the delay, a permissionless account executes it; assert
    DeferredDispatchExecuted { call_hash, who } is emitted with the executor's account.
  • Early execution rejected — attempting to dispatch before the delay elapses fails.
  • Root-origin dispatch semantics — confirm the deferred call is dispatched as
    Root (matches lib.rs:228); a whitelisted call requiring Signed origin should
    surface BadOrigin end-to-end, and the test should pin this behavior so any future
    change is intentional.
  • Permissionless removal — anyone can clean up a deferred entry once it is eligible
    for removal; storage is cleared and weight is refunded as expected.
  • Origin gating on scheduling — only DispatchWhitelistedOrigin can create a
    deferred dispatch; other origins fail.
  • Preimage interaction — missing/unavailable preimage at execution time yields
    UnavailablePreImage; restoring the preimage allows execution.

Blocked by

Metadata

Metadata

Assignees

Labels

e2e testsRelated to end-to-end testsenhancementNew feature or request

Type

Fields

No fields configured for Task.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions