Skip to content

Commit

Permalink
fix migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
re-gius committed Dec 18, 2024
1 parent 2da736a commit 831f1b0
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions substrate/frame/staking/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,36 @@ pub mod v17 {
let mut migration_errors = false;

v16::MaxValidatorsCount::<T>::kill();
v16::ErasStakers::<T>::remove_all(None);
v16::ErasStakersClipped::<T>::remove_all(None);

let mut eras_stakers_keys =
v16::ErasStakers::<T>::iter_keys().map(|(k1, k2)| k1).collect::<Vec<_>>();

Check failure on line 76 in substrate/frame/staking/src/migrations.rs

View workflow job for this annotation

GitHub Actions / cargo-check-all-crate-macos

unused variable: `k2`
eras_stakers_keys.dedup();
for k in eras_stakers_keys {
let mut removal_result =
v16::ErasStakers::<T>::clear_prefix(k, u32::max_value(), None);
while let Some(next_cursor) = removal_result.maybe_cursor {
removal_result = v16::ErasStakers::<T>::clear_prefix(
k,
u32::max_value(),
Some(&next_cursor[..]),
);
}
}

let mut eras_stakers_clipped_keys =
v16::ErasStakersClipped::<T>::iter_keys().map(|(k1, k2)| k1).collect::<Vec<_>>();

Check failure on line 91 in substrate/frame/staking/src/migrations.rs

View workflow job for this annotation

GitHub Actions / cargo-check-all-crate-macos

unused variable: `k2`
eras_stakers_clipped_keys.dedup();
for k in eras_stakers_clipped_keys {
let mut removal_result =
v16::ErasStakersClipped::<T>::clear_prefix(k, u32::max_value(), None);
while let Some(next_cursor) = removal_result.maybe_cursor {
removal_result = v16::ErasStakersClipped::<T>::clear_prefix(
k,
u32::max_value(),
Some(&next_cursor[..]),
);
}
}

let old_disabled_validators = v16::DisabledValidators::<T>::get();
// BoundedVec with MaxDisabledValidators limit, this should always work
Expand Down

0 comments on commit 831f1b0

Please sign in to comment.