diff --git a/frame/system/benchmarking/src/lib.rs b/frame/system/benchmarking/src/lib.rs index 60fc2737a4596..a2e3f7e2241ae 100644 --- a/frame/system/benchmarking/src/lib.rs +++ b/frame/system/benchmarking/src/lib.rs @@ -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::::events(), - vec![EventRecord { - phase: Phase::Initialization, - event: frame_system::Event::::CodeUpdated.into(), - topics: vec![], - }], - ); + System::::assert_last_event(frame_system::Event::::CodeUpdated.into()); } #[extra] diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 2894b5a237ee1..4ec3918ea8507 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -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`.