parachain-system: Send same event & digest as a standalone chain (#2064)

This ensures that upgrading a parachain code sends the same event &
digest as when using `set_code` on a standalone chain.

Close: https://github.com/paritytech/polkadot-sdk/issues/2049
This commit is contained in:
Bastian Köcher
2023-10-30 17:37:10 +01:00
committed by GitHub
parent 40ff09b8fb
commit 2d9426f1cc
3 changed files with 13 additions and 13 deletions
+2 -3
View File
@@ -163,7 +163,7 @@ pub trait SetCode<T: Config> {
impl<T: Config> SetCode<T> for () {
fn set_code(code: Vec<u8>) -> DispatchResult {
<Pallet<T>>::update_code_in_storage(&code)?;
<Pallet<T>>::update_code_in_storage(&code);
Ok(())
}
}
@@ -1106,11 +1106,10 @@ impl<T: Config> Pallet<T> {
/// Note this function almost never should be used directly. It is exposed
/// for `OnSetCode` implementations that defer actual code being written to
/// the storage (for instance in case of parachains).
pub fn update_code_in_storage(code: &[u8]) -> DispatchResult {
pub fn update_code_in_storage(code: &[u8]) {
storage::unhashed::put_raw(well_known_keys::CODE, code);
Self::deposit_log(generic::DigestItem::RuntimeEnvironmentUpdated);
Self::deposit_event(Event::CodeUpdated);
Ok(())
}
/// Increment the reference counter on an account.