Skip to content
Snippets Groups Projects
Commit 00dbc79e authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Two-stage upgrade for parachains (#392)

* Authorised upgrade doesn't pay fee

* Origin not needed

* Fixes
parent 0831f74f
Branches
No related merge requests found
......@@ -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() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment