Two-stage upgrade for parachains (#392)

* Authorised upgrade doesn't pay fee

* Origin not needed

* Fixes
This commit is contained in:
Gavin Wood
2021-04-16 12:45:55 +02:00
committed by GitHub
parent 0831f74fe3
commit 00dbc79ebf
+2 -1
View File
@@ -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() {