Skip to content

Commit b25762e

Browse files
kianenigmamuharemggwpez
authored
Don't migrate staking era forcing info to AH (#939)
Doing it quick and dirty way here, just ignoring it on the recipient, to minimize code change. --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: muharem <ismailov.m.h@gmail.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
1 parent 0d8df10 commit b25762e

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Changelog for the runtimes governed by the Polkadot Fellowship.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7+
## [Unreleased]
8+
9+
### Fixed
10+
11+
- Do not migrate staking era forcing info to AH ([polkadot-fellows/runtimes/pull/939](https://github.com/polkadot-fellows/runtimes/pull/939))
12+
713
## [1.9.1] 30.09.2025
814

915
### Fixed

pallets/ah-migrator/src/staking/checks.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ impl<T: crate::Config> crate::types::AhMigrationCheck
5555
rc.active_era.map(translate_active_era),
5656
pallet_staking_async::ActiveEra::<T>::get()
5757
);
58-
assert_eq!(translate_forcing(rc.force_era), pallet_staking_async::ForceEra::<T>::get());
5958
assert_eq!(rc.max_staked_rewards, pallet_staking_async::MaxStakedRewards::<T>::get());
6059
assert_eq!(rc.slash_reward_fraction, pallet_staking_async::SlashRewardFraction::<T>::get());
6160
assert_eq!(rc.canceled_slash_payout, pallet_staking_async::CanceledSlashPayout::<T>::get());
@@ -148,16 +147,6 @@ fn translate_active_era(era: pallet_staking::ActiveEraInfo) -> pallet_staking_as
148147
pallet_staking_async::ActiveEraInfo { index: era.index, start: era.start }
149148
}
150149

151-
fn translate_forcing(forcing: pallet_staking::Forcing) -> pallet_staking_async::Forcing {
152-
use pallet_staking_async::Forcing;
153-
match forcing {
154-
pallet_staking::Forcing::NotForcing => Forcing::NotForcing,
155-
pallet_staking::Forcing::ForceNew => Forcing::ForceNew,
156-
pallet_staking::Forcing::ForceNone => Forcing::ForceNone,
157-
pallet_staking::Forcing::ForceAlways => Forcing::ForceAlways,
158-
}
159-
}
160-
161150
fn translate_validator_prefs(
162151
prefs: pallet_staking::ValidatorPrefs,
163152
) -> pallet_staking_async::ValidatorPrefs {

pallets/rc-migrator/src/staking/checks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl<T: crate::Config> crate::types::RcMigrationCheck for StakingMigratedCorrect
138138
assert!(!MaxNominatorsCount::<T>::exists());
139139
assert!(!CurrentEra::<T>::exists());
140140
assert!(!ActiveEra::<T>::exists());
141-
assert!(!ForceEra::<T>::exists());
141+
// assert!(!ForceEra::<T>::exists());
142142
assert!(!MaxStakedRewards::<T>::exists());
143143
assert!(!SlashRewardFraction::<T>::exists());
144144
assert!(!CanceledSlashPayout::<T>::exists());

pallets/rc-migrator/src/staking/message.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,8 @@ impl<T: pallet_staking::Config> StakingMigrator<T> {
200200
max_nominators_count: MaxNominatorsCount::<T>::take(),
201201
current_era: CurrentEra::<T>::take(),
202202
active_era: ActiveEra::<T>::take().map(IntoPortable::into_portable),
203-
force_era: ForceEra::<T>::exists()
204-
.then(ForceEra::<T>::take)
205-
.map(IntoPortable::into_portable),
203+
// always send `Forcing::NotForcing`, as we want the value to stay put in RC.
204+
force_era: Forcing::NotForcing.into_portable().into(),
206205
max_staked_rewards: MaxStakedRewards::<T>::take(),
207206
slash_reward_fraction: SlashRewardFraction::<T>::exists()
208207
.then(SlashRewardFraction::<T>::take),
@@ -234,6 +233,7 @@ impl<T: pallet_staking_async::Config> StakingMigrator<T> {
234233
ActiveEra::<T>::put(&active_era);
235234
CurrentEra::<T>::put(active_era.index);
236235
});
236+
// this will always be Forcing::NotForcing, so it will be a no-op
237237
values.force_era.map(|force_era| {
238238
let force_era: pallet_staking_async::Forcing = force_era.into();
239239
ForceEra::<T>::put(force_era);

0 commit comments

Comments
 (0)