mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +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:
@@ -343,9 +343,6 @@ cfg_if! {
|
||||
fn get_block_number() -> u64;
|
||||
/// Takes and returns the initialized block number.
|
||||
fn take_block_number() -> Option<u64>;
|
||||
/// Returns if no block was initialized.
|
||||
#[skip_initialize_block]
|
||||
fn without_initialize_block() -> bool;
|
||||
/// Test that `ed25519` crypto works in the runtime.
|
||||
///
|
||||
/// Returns the signature generated for the message `ed25519` and the public key.
|
||||
@@ -396,9 +393,6 @@ cfg_if! {
|
||||
fn get_block_number() -> u64;
|
||||
/// Takes and returns the initialized block number.
|
||||
fn take_block_number() -> Option<u64>;
|
||||
/// Returns if no block was initialized.
|
||||
#[skip_initialize_block]
|
||||
fn without_initialize_block() -> bool;
|
||||
/// Test that `ed25519` crypto works in the runtime.
|
||||
///
|
||||
/// Returns the signature generated for the message `ed25519` and the public key.
|
||||
@@ -635,6 +629,7 @@ cfg_if! {
|
||||
fn validate_transaction(
|
||||
_source: TransactionSource,
|
||||
utx: <Block as BlockT>::Extrinsic,
|
||||
_: <Block as BlockT>::Hash,
|
||||
) -> TransactionValidity {
|
||||
if let Extrinsic::IncludeData(data) = utx {
|
||||
return Ok(ValidTransaction {
|
||||
@@ -720,10 +715,6 @@ cfg_if! {
|
||||
system::get_block_number().expect("Block number is initialized")
|
||||
}
|
||||
|
||||
fn without_initialize_block() -> bool {
|
||||
system::get_block_number().is_none()
|
||||
}
|
||||
|
||||
fn take_block_number() -> Option<u64> {
|
||||
system::take_block_number()
|
||||
}
|
||||
@@ -888,6 +879,7 @@ cfg_if! {
|
||||
fn validate_transaction(
|
||||
_source: TransactionSource,
|
||||
utx: <Block as BlockT>::Extrinsic,
|
||||
_: <Block as BlockT>::Hash,
|
||||
) -> TransactionValidity {
|
||||
if let Extrinsic::IncludeData(data) = utx {
|
||||
return Ok(ValidTransaction{
|
||||
@@ -977,10 +969,6 @@ cfg_if! {
|
||||
system::get_block_number().expect("Block number is initialized")
|
||||
}
|
||||
|
||||
fn without_initialize_block() -> bool {
|
||||
system::get_block_number().is_none()
|
||||
}
|
||||
|
||||
fn take_block_number() -> Option<u64> {
|
||||
system::take_block_number()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user