Skip to content

Commit

Permalink
parachain-system: Send same event & digest as a standalone chain (par…
Browse files Browse the repository at this point in the history
…itytech#2064)

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

Close: paritytech#2049
  • Loading branch information
bkchr authored Oct 30, 2023
1 parent d329b07 commit 2372d60
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions substrate/frame/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2372d60

Please sign in to comment.