Skip to content

pallet-whitelist: E2E Test Deferred Dispatch#595

Open
runcomet wants to merge 4 commits into
open-web3-stack:masterfrom
runcomet:WE2E
Open

pallet-whitelist: E2E Test Deferred Dispatch#595
runcomet wants to merge 4 commits into
open-web3-stack:masterfrom
runcomet:WE2E

Conversation

@runcomet
Copy link
Copy Markdown

@runcomet runcomet commented Apr 22, 2026

Summary

Closes #594

Adds E2E test coverage for the pallet-whitelist deferred dispatch feature on Kusama Asset Hub (and by extension Polkadot Asset Hub). Deferred dispatch allows whitelisted calls to be executed later with a signed origin after an initial Root dispatch creates a deferred entry.

Test Coverage

Success Path (5 tests)

Test What it verifies
happy path Full flow: defer → whitelist → signed execution
direct dispatch Already-whitelisted call executes immediately without deferral
root semantics Signed execution runs the inner call with Root origin
hash-only dispatch dispatchWhitelistedCall (without preimage) variant works
permissionless removal Anyone can remove an expired deferred entry

Failure Path (5 tests)

Test What it verifies
already deferred Duplicate deferral is rejected
invalid weight witness Wrong call weight is rejected
origin gating Non-Root whitelist/dispatch is rejected
call already whitelisted Duplicate whitelist is rejected
remove whitelisted call BadOrigin / double-remove is rejected

Runtime Prerequisites

The deferred dispatch feature requires pallet-whitelist with the deferred-dispatch feature enabled in the target runtime. To enable it:

1. Add pallet-whitelist to your runtime with this feature

In your runtime's Cargo.toml:

[dependencies]
pallet-whitelist = { path = "pallets/whitelist", default-features = false }

2. Configure existing runtime configs to include BlockNumberProvider and DeferredDispatchExpiration

impl pallet_whitelist::Config for Runtime {
    ...
    type DeferredDispatchExpiration = ConstU32<{ 15 * RC_MINUTES }>;
    type BlockNumberProvider = RelaychainDataProvider<Runtime>;
}

3. Build the WASM

cargo build --release -p asset-hub-kusama-runtime &&
cargo build --release -p asset-hub-polkadot-runtime

4. Test

ASSETHUBKUSAMA_WASM=.../asset_hub_kusama_runtime.compact.wasm \
bun run test packages/kusama/src/assetHubKusama.whitelist.deferred.e2e.test.ts -- --run

@rockbmb rockbmb added the e2e tests Related to end-to-end tests label Apr 22, 2026
@rockbmb rockbmb added this to the Essential E2E test coverage milestone Apr 22, 2026
@runcomet runcomet marked this pull request as ready for review April 29, 2026 14:06
@runcomet
Copy link
Copy Markdown
Author

please review @rockbmb @dhirajs0

@rockbmb rockbmb added the enhancement New feature or request label Apr 30, 2026
@rockbmb
Copy link
Copy Markdown
Collaborator

rockbmb commented May 2, 2026

@runcomet will take a look next week!

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good and the tests are comprehensive. I've found a couple of opportunities to improve type safety in the new shared test file by replacing any with more specific types from Polkadot.js.

Comment thread packages/shared/src/whitelist-deferred.ts Outdated
Comment thread packages/shared/src/whitelist-deferred.ts Outdated
@rockbmb
Copy link
Copy Markdown
Collaborator

rockbmb commented May 12, 2026

@runcomet apologies for the delay; could you merge master into this, and refactor this suite to use the new pattern of client-sharing across test suites introduced in #609 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e tests Related to end-to-end tests enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add E2E test for deferred dispatch of whitelisted calls

2 participants