Closed sainoe closed 3 months ago
The recent changes introduce a new test function, TestTooManyLastValidators
, across multiple files in the codebase. This function simulates scenarios where validators are jailed and unjailed, validator set changes are applied, and validator set updates are verified, ultimately leading to a panic due to inconsistent state in the staking module. Additionally, new methods have been added to the TestStakingKeeper
interface and its mock implementation to support these test scenarios.
File Path | Change Summary |
---|---|
tests/integration/unbonding.go |
Added TestTooManyLastValidators to CCVTestSuite to simulate and test panic scenarios. |
testutil/integration/debug_test.go |
Added TestTooManyLastValidators to test last validator scenarios. |
testutil/integration/interfaces.go |
Added GetParams , SetParams , and ApplyAndReturnValidatorSetUpdates to TestStakingKeeper . |
testutil/keeper/mocks.go |
Added GetParams and SetParams methods to MockStakingKeeper and its mock recorder. |
sequenceDiagram
participant Tester
participant CCVTestSuite
participant StakingKeeper
participant ValidatorSet
Tester->>CCVTestSuite: Call TestTooManyLastValidators()
CCVTestSuite->>StakingKeeper: Jail validators
CCVTestSuite->>ValidatorSet: Apply validator set changes
ValidatorSet-->>CCVTestSuite: Return updated validator set
CCVTestSuite->>StakingKeeper: Unjail validators
CCVTestSuite->>ValidatorSet: Verify validator set updates
ValidatorSet-->>CCVTestSuite: Return final validator set
CCVTestSuite-->>Tester: Panic due to inconsistent state
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
TestTooManyLastValidators
to simulate scenarios causing a panic due to inconsistent state in the staking module.