Skip to content

Commit

Permalink
fix: test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dandanlen committed Oct 30, 2023
1 parent dfc2142 commit fe8a21e
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions state-chain/pallets/cf-vaults/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ fn test_key_handover_timeout_period() {
#[cfg(test)]
mod vault_key_rotation {
use cf_chains::mocks::{MockEthereum, BAD_AGG_KEY_POST_HANDOVER};
use cf_runtime_utilities::StorageDecodeVariant;
use cf_traits::mocks::block_height_provider::BlockHeightProvider;

use super::*;
Expand Down Expand Up @@ -855,16 +856,6 @@ mod vault_key_rotation {

fn final_checks(ext: TestRunner<()>, expected_activation_block: u64) {
ext.execute_with(|| {
// Can't repeat.
assert_noop!(
VaultsPallet::vault_key_rotated(
RuntimeOrigin::root(),
expected_activation_block,
TX_HASH,
),
Error::<Test, _>::InvalidRotationStatus
);

let current_epoch = <Test as Chainflip>::EpochInfo::epoch_index();

let Vault { public_key, active_from_block } =
Expand Down Expand Up @@ -936,15 +927,12 @@ mod vault_key_rotation {
MockOptimisticActivation::set(true);
VaultsPallet::activate();

// No need to call vault_key_rotated.
assert_noop!(
VaultsPallet::vault_key_rotated(
RuntimeOrigin::root(),
ACTIVATION_BLOCK_NUMBER,
TX_HASH,
),
Error::<Test, _>::InvalidRotationStatus
);
// No need to call vault_key_rotated, but it's ok if we do.
assert_ok!(VaultsPallet::vault_key_rotated(
RuntimeOrigin::root(),
ACTIVATION_BLOCK_NUMBER,
TX_HASH,
),);

assert!(matches!(
PendingVaultRotation::<Test, _>::get().unwrap(),
Expand Down

0 comments on commit fe8a21e

Please sign in to comment.