mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 05:17:58 +00:00
Do not call initialize_block before any runtime api (#8953)
* Do not call `initialize_block` before any runtime api Before this change we always called `initialize_block` before calling into the runtime. There was already support with `skip_initialize` to skip the initialization. Almost no runtime_api requires that `initialize_block` is called before. Actually this only leads to higher execution times most of the time, because all runtime modules are initialized and this is especially expensive when the block contained a runtime upgrade. TLDR: Do not call `initialize_block` before calling a runtime api. * Change `validate_transaction` interface * Fix rpc test * Fixes and comments * Some docs
This commit is contained in:
@@ -28,12 +28,10 @@ sp_api::decl_runtime_apis! {
|
||||
#[api_version(2)]
|
||||
pub trait OffchainWorkerApi {
|
||||
/// Starts the off-chain task for given block number.
|
||||
#[skip_initialize_block]
|
||||
#[changed_in(2)]
|
||||
fn offchain_worker(number: sp_runtime::traits::NumberFor<Block>);
|
||||
|
||||
/// Starts the off-chain task for given block header.
|
||||
#[skip_initialize_block]
|
||||
fn offchain_worker(header: &Block::Header);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user