BlockId removal: BlockBuilderProvider::new_block_at (#2219)

* `BlockId` removal: `BlockBuilderProvider::new_block_at`

It changes the arguments of `BlockBuilderProvider::new_block_at` from:
`BlockId<Block>` to: `Block::Hash`

* update lockfile for {"polkadot", "substrate"}

* fix

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2023-02-21 21:28:52 +01:00
committed by GitHub
parent 046ef29ece
commit 749b078bac
2 changed files with 271 additions and 261 deletions
+267 -254
View File
File diff suppressed because it is too large Load Diff
+4 -7
View File
@@ -22,10 +22,7 @@ use cumulus_test_runtime::{Block, GetLastTimestamp, Hash, Header};
use polkadot_primitives::{BlockNumber as PBlockNumber, Hash as PHash}; use polkadot_primitives::{BlockNumber as PBlockNumber, Hash as PHash};
use sc_block_builder::{BlockBuilder, BlockBuilderProvider}; use sc_block_builder::{BlockBuilder, BlockBuilderProvider};
use sp_api::ProvideRuntimeApi; use sp_api::ProvideRuntimeApi;
use sp_runtime::{ use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
generic::BlockId,
traits::{Block as BlockT, Header as HeaderT},
};
/// An extension for the Cumulus test client to init a block builder. /// An extension for the Cumulus test client to init a block builder.
pub trait InitBlockBuilder { pub trait InitBlockBuilder {
@@ -45,7 +42,7 @@ pub trait InitBlockBuilder {
/// Init a specific block builder at a specific block that works for the test runtime. /// Init a specific block builder at a specific block that works for the test runtime.
/// ///
/// Same as [`InitBlockBuilder::init_block_builder`] besides that it takes a /// Same as [`InitBlockBuilder::init_block_builder`] besides that it takes a
/// [`BlockId`] to say which should be the parent block of the block that is being build. /// [`type@Hash`] to say which should be the parent block of the block that is being build.
fn init_block_builder_at( fn init_block_builder_at(
&self, &self,
at: Hash, at: Hash,
@@ -56,7 +53,7 @@ pub trait InitBlockBuilder {
/// Init a specific block builder that works for the test runtime. /// Init a specific block builder that works for the test runtime.
/// ///
/// Same as [`InitBlockBuilder::init_block_builder`] besides that it takes a /// Same as [`InitBlockBuilder::init_block_builder`] besides that it takes a
/// [`BlockId`] to say which should be the parent block of the block that is being build and /// [`type@Hash`] to say which should be the parent block of the block that is being build and
/// it will use the given `timestamp` as input for the timestamp inherent. /// it will use the given `timestamp` as input for the timestamp inherent.
fn init_block_builder_with_timestamp( fn init_block_builder_with_timestamp(
&self, &self,
@@ -75,7 +72,7 @@ fn init_block_builder<'a>(
timestamp: u64, timestamp: u64,
) -> BlockBuilder<'a, Block, Client, Backend> { ) -> BlockBuilder<'a, Block, Client, Backend> {
let mut block_builder = client let mut block_builder = client
.new_block_at(&BlockId::Hash(at), Default::default(), true) .new_block_at(at, Default::default(), true)
.expect("Creates new block builder for test runtime"); .expect("Creates new block builder for test runtime");
let mut inherent_data = sp_inherents::InherentData::new(); let mut inherent_data = sp_inherents::InherentData::new();