Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate domain tx range on runtime upgrade #1921

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions crates/pallet-domains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1097,12 +1097,9 @@ mod pallet {

// TODO: remove once the migration is done
fn on_runtime_upgrade() -> Weight {
for (domain_id, stake_summary) in DomainStakingSummary::<T>::iter() {
if stake_summary.current_epoch_index.is_zero() {
if let Err(err) = do_finalize_domain_current_epoch::<T>(domain_id, One::one()) {
log::error!(target: "runtime::domains", "Failed to do epoch transition for {domain_id:?}: {err:?}");
}
}
for (domain_id, mut tx_range_state) in DomainTxRangeState::<T>::iter() {
tx_range_state.tx_range = Self::initial_tx_range();
DomainTxRangeState::<T>::set(domain_id, Some(tx_range_state));
}
Weight::zero()
}
Expand Down