From 00dbc79ebfddff92eca5a736105bcc3cf5c83644 Mon Sep 17 00:00:00 2001 From: Gavin Wood <gavin@parity.io> Date: Fri, 16 Apr 2021 12:45:55 +0200 Subject: [PATCH] Two-stage upgrade for parachains (#392) * Authorised upgrade doesn't pay fee * Origin not needed * Fixes --- cumulus/pallets/parachain-system/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cumulus/pallets/parachain-system/src/lib.rs b/cumulus/pallets/parachain-system/src/lib.rs index 79b8815b3b5..90c832eb0c6 100644 --- a/cumulus/pallets/parachain-system/src/lib.rs +++ b/cumulus/pallets/parachain-system/src/lib.rs @@ -258,7 +258,7 @@ decl_module! { } #[weight = 1_000_000] - fn enact_authorized_upgrade(origin, code: Vec<u8>) { + fn enact_authorized_upgrade(_origin, code: Vec<u8>) -> DispatchResultWithPostInfo { // No ensure origin on purpose. We validate by checking the code vs hash in storage. let required_hash = AuthorizedUpgrade::<T>::get() .ok_or(Error::<T>::NothingAuthorized)?; @@ -266,6 +266,7 @@ decl_module! { ensure!(actual_hash == required_hash, Error::<T>::Unauthorized); Self::set_code_impl(code)?; AuthorizedUpgrade::<T>::kill(); + Ok(Pays::No.into()) } fn on_finalize() { -- GitLab