diff --git a/substrate/client/service/src/client/call_executor.rs b/substrate/client/service/src/client/call_executor.rs index bcedcf92da72..cba736767011 100644 --- a/substrate/client/service/src/client/call_executor.rs +++ b/substrate/client/service/src/client/call_executor.rs @@ -27,7 +27,7 @@ use sp_externalities::Extensions; use sp_runtime::{ generic::BlockId, traits::{Block as BlockT, HashingFor}, -; +}; use sp_state_machine::{ backend::{AsTrieBackend, TryPendingCode}, OverlayedChanges, StateMachine, StorageProof, diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index fdb9529155c6..9695ee855eeb 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -703,7 +703,6 @@ where sp_io::init_tracing(); sp_tracing::enter_span!(sp_tracing::Level::TRACE, "finalize_block"); - >::maybe_apply_pending_code_upgrade(); // In this case there were no transactions to trigger this state transition: if !>::inherents_applied() { Self::inherents_applied(); @@ -766,6 +765,7 @@ where /// Run the `on_finalize` hook of all pallet. fn on_finalize_hook(block_number: NumberFor) { >>::on_finalize(block_number); + >::maybe_apply_pending_code_upgrade(); } /// Apply extrinsic outside of the block execution function. diff --git a/substrate/frame/support/src/traits/hooks.rs b/substrate/frame/support/src/traits/hooks.rs index 012a74d0ae92..c6806005bc36 100644 --- a/substrate/frame/support/src/traits/hooks.rs +++ b/substrate/frame/support/src/traits/hooks.rs @@ -61,7 +61,7 @@ impl PostInherents for Tuple { } } -/// Provides a callback to execute logic before the all transactions. +/// Provides a callback to execute logic after the all transactions. pub trait PostTransactions { /// Called after all transactions were applied but before `on_finalize`. fn post_transactions() {}