Context
pallet-staking-async tests currently allow disabling the post-test invariant check via ExtBuilder::try_state(false). This makes it possible for tests to leave broken staking state behind without noticing.
Task
Remove all usages of: ExtBuilder::default().try_state(false) from pallet-staking-async tests.
Tests that intentionally create invalid state should do one of:
- Assert that
Staking::do_try_state(...) returns an error, then restore the state before the test ends.
- Use
#[should_panic(expected = "...")] when the purpose of the test is to prove the post-test invariant check catches the bad state.
After all call sites are cleaned up, remove the try_state(false) builder API and the SkipTryStateCheck flag from the mock runtime.
Context
pallet-staking-asynctests currently allow disabling the post-test invariant check viaExtBuilder::try_state(false). This makes it possible for tests to leave broken staking state behind without noticing.Task
Remove all usages of:
ExtBuilder::default().try_state(false)frompallet-staking-asynctests.Tests that intentionally create invalid state should do one of:
Staking::do_try_state(...)returns an error, then restore the state before the test ends.#[should_panic(expected = "...")]when the purpose of the test is to prove the post-test invariant check catches the bad state.After all call sites are cleaned up, remove the try_state(false) builder API and the
SkipTryStateCheckflag from the mock runtime.