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

implement try_on_runtime_upgrade #13

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

girazoki
Copy link
Collaborator

Implements try_on_runtime_upgrade in pallet migrations. Otherwise after the 1.3.0 upgrade we see the error:

panicked at 'called Result::unwrap()on anErrvalue: Other("Usage ofpre_upgradewith Tuples is not expected. Please usetry_on_runtime_upgradeinstead, which internally callspre_upgrade->on_runtime_upgrade->post_upgrade for each tuple member.")

@rimbi
Copy link
Contributor

rimbi commented Nov 28, 2023

The version in the branch moonbeam-polkadot-v1.1.0 is shorter. You should take a look.

@girazoki
Copy link
Collaborator Author

what?

@rimbi
Copy link
Contributor

rimbi commented Nov 28, 2023

impl<T> OnRuntimeUpgrade for ExecutiveHooks<T>
where
	T: Config,
{
	fn on_runtime_upgrade() -> Weight {
		if Pallet::<T>::maintenance_mode() {
			T::MaintenanceExecutiveHooks::on_runtime_upgrade()
		} else {
			T::NormalExecutiveHooks::on_runtime_upgrade()
		}
	}

	#[cfg(feature = "try-runtime")]
	fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, TryRuntimeError> {
		if Pallet::<T>::maintenance_mode() {
			T::MaintenanceExecutiveHooks::try_on_runtime_upgrade(checks)
		} else {
			T::NormalExecutiveHooks::try_on_runtime_upgrade(checks)
		}
	}
}

@girazoki
Copy link
Collaborator Author

girazoki commented Nov 28, 2023

Oh I see yes we dont need the pre and post hooks now. Why isnt this merged into master if it is in moonbeam-polkadot-v1.1.0?

@rimbi
Copy link
Contributor

rimbi commented Nov 28, 2023

Because I have not been aware of this convention (merging each change to master as well). But we had a conversation about this change before.

@girazoki
Copy link
Collaborator Author

In general any change that is not moonbeam specific it should be merged to master

@girazoki girazoki merged commit 76ad8d4 into main Nov 28, 2023
8 of 10 checks passed
@girazoki girazoki deleted the girazoki-implement-try-runtime-upgrade branch November 28, 2023 13:38
girazoki added a commit to moondance-labs/moonkit that referenced this pull request Nov 28, 2023
* implement try_on_runtime_upgrade

* fmt

* remove pre and post upgrade hooks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants