Skip to content

Commit

Permalink
Merge branch 'paritytech:master' into olanod-referenda-owned-tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
olanod authored Oct 31, 2023
2 parents 4bc9edc + 9faea38 commit 5c3ab3b
Show file tree
Hide file tree
Showing 62 changed files with 1,776 additions and 1,010 deletions.
2 changes: 1 addition & 1 deletion .gitlab/pipeline/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ check-rust-feature-propagation:
echo "---------- Building ${PACKAGE} runtime ----------"
time cargo build --release --locked -p "$PACKAGE" --features try-runtime
echo "---------- Executing `on-runtime-upgrade` for ${NETWORK} ----------"
echo "---------- Executing on-runtime-upgrade for ${NETWORK} ----------"
time ./try-runtime \
--runtime ./target/release/wbuild/"$PACKAGE"/"$WASM" \
on-runtime-upgrade --checks=pre-and-post ${EXTRA_ARGS} live --uri ${URI}
Expand Down
112 changes: 69 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions cumulus/pallets/parachain-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ use frame_support::{
dispatch::{DispatchResult, Pays, PostDispatchInfo},
ensure,
inherent::{InherentData, InherentIdentifier, ProvideInherent},
storage,
traits::Get,
weights::Weight,
};
Expand Down Expand Up @@ -598,7 +597,7 @@ pub mod pallet {
);
let validation_code = <PendingValidationCode<T>>::take();

Self::put_parachain_code(&validation_code);
frame_system::Pallet::<T>::update_code_in_storage(&validation_code);
<T::OnSystemEvent as OnSystemEvent>::on_validation_code_applied();
Self::deposit_event(Event::ValidationFunctionApplied {
relay_chain_block_num: vfp.relay_parent_number,
Expand Down Expand Up @@ -1399,12 +1398,6 @@ impl<T: Config> Pallet<T> {
<DidSetValidationCode<T>>::put(true);
}

/// Put a new validation function into a particular location where this
/// parachain will execute it on subsequent blocks.
fn put_parachain_code(code: &[u8]) {
storage::unhashed::put_raw(sp_core::storage::well_known_keys::CODE, code);
}

/// The maximum code size permitted, in bytes.
///
/// Returns `None` if the relay chain parachain host configuration hasn't been submitted yet.
Expand Down
12 changes: 10 additions & 2 deletions cumulus/pallets/parachain-system/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ fn hrmp_outbound_respects_used_bandwidth() {
}

#[test]
fn events() {
fn runtime_upgrade_events() {
BlockTests::new()
.with_relay_sproof_builder(|_, block_number, builder| {
if block_number > 123 {
Expand All @@ -894,12 +894,20 @@ fn events() {
|| {},
|| {
let events = System::events();

assert_eq!(events[0].event, RuntimeEvent::System(frame_system::Event::CodeUpdated));

assert_eq!(
events[0].event,
events[1].event,
RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionApplied {
relay_chain_block_num: 1234
})
);

assert!(System::digest()
.logs()
.iter()
.any(|d| *d == sp_runtime::generic::DigestItem::RuntimeEnvironmentUpdated));
},
);
}
Expand Down
Loading

0 comments on commit 5c3ab3b

Please sign in to comment.