Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Prev Previous commit
Next Next commit
fix interface
  • Loading branch information
ruseinov committed Sep 28, 2022
commit 53779781b6240c98b0c86f2bc68f42a5827b4716
6 changes: 3 additions & 3 deletions frame/multisig/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ pub mod v1 {
pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>);
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
let onchain = Pallet::<T>::on_chain_storage_version();

ensure!(onchain < 1, "this migration can be deleted");

log!(info, "Number of calls to refund and delete: {}", Calls::<T>::iter().count());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be pedantic, we could add some math here that: if the number of calls is so much that this exhausts block weight, abort or log a warning.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just have a limit configurable limit (eg 100) which can then be tested with try-runtime in advance to respect the limits.


Ok(())
Ok(Vec::new())
}

fn on_runtime_upgrade() -> Weight {
Expand All @@ -72,7 +72,7 @@ pub mod v1 {
}

#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> {
let onchain = Pallet::<T>::on_chain_storage_version();
ensure!(onchain < 2, "this migration needs to be removed");
ensure!(onchain == 1, "this migration needs to be run");
Expand Down