mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 15:41:02 +00:00
Two-stage upgrade for parachains (#392)
* Authorised upgrade doesn't pay fee * Origin not needed * Fixes
This commit is contained in:
@@ -258,7 +258,7 @@ decl_module! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[weight = 1_000_000]
|
#[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.
|
// No ensure origin on purpose. We validate by checking the code vs hash in storage.
|
||||||
let required_hash = AuthorizedUpgrade::<T>::get()
|
let required_hash = AuthorizedUpgrade::<T>::get()
|
||||||
.ok_or(Error::<T>::NothingAuthorized)?;
|
.ok_or(Error::<T>::NothingAuthorized)?;
|
||||||
@@ -266,6 +266,7 @@ decl_module! {
|
|||||||
ensure!(actual_hash == required_hash, Error::<T>::Unauthorized);
|
ensure!(actual_hash == required_hash, Error::<T>::Unauthorized);
|
||||||
Self::set_code_impl(code)?;
|
Self::set_code_impl(code)?;
|
||||||
AuthorizedUpgrade::<T>::kill();
|
AuthorizedUpgrade::<T>::kill();
|
||||||
|
Ok(Pays::No.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_finalize() {
|
fn on_finalize() {
|
||||||
|
|||||||
Reference in New Issue
Block a user