Skip to content

[Staking] Remove try_state(false) escape hatch from pallet-staking-async tests #12204

@Ank4n

Description

@Ank4n

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions