Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Consume the rest of the block and add test verification after the ben…
Browse files Browse the repository at this point in the history
…chmark
  • Loading branch information
hirschenberger committed Feb 14, 2023
1 parent 37d21f9 commit 3530e1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
9 changes: 1 addition & 8 deletions frame/system/benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@ benchmarks! {
let runtime_blob = include_bytes!("../res/kitchensink_runtime.compact.compressed.wasm");
}: _(RawOrigin::Root, runtime_blob.to_vec())
verify {
assert_eq!(
System::<T>::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: frame_system::Event::<T>::CodeUpdated.into(),
topics: vec![],
}],
);
System::<T>::assert_last_event(frame_system::Event::<T>::CodeUpdated.into());
}

#[extra]
Expand Down
3 changes: 2 additions & 1 deletion frame/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ pub mod pallet {
ensure_root(origin)?;
Self::can_set_code(&code)?;
T::OnSetCode::set_code(code)?;
Ok(().into())
// consume the rest of the block to prevent further transactions
Ok(Some(T::BlockWeights::get().max_block).into())
}

/// Set the new runtime code without doing any checks of the given `code`.
Expand Down

0 comments on commit 3530e1e

Please sign in to comment.