mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 06:27:58 +00:00
BlockId removal: BlockBuilderProvider::new_block_at (#13401)
* `BlockId` removal: `BlockBuilderProvider::new_block_at` It changes the arguments of `BlockBuilderProvider::new_block_at` from: `BlockId<Block>` to: `Block::Hash` * fmt * fix * more fixes
This commit is contained in:
committed by
GitHub
parent
cd299d2b45
commit
5ef88dd398
@@ -32,7 +32,7 @@ use sc_client_api::{
|
||||
blockchain::{Backend as BlockChainBackendT, HeaderBackend},
|
||||
};
|
||||
use sp_consensus::BlockOrigin;
|
||||
use sp_runtime::{generic::BlockId, traits::Block as BlockT};
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
use substrate_test_runtime::{self, Transfer};
|
||||
|
||||
/// helper to test the `leaves` implementation for various backends
|
||||
@@ -60,7 +60,7 @@ where
|
||||
|
||||
// A1 -> A2
|
||||
let a2 = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
.new_block_at(a1.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -71,7 +71,7 @@ where
|
||||
|
||||
// A2 -> A3
|
||||
let a3 = client
|
||||
.new_block_at(&BlockId::Hash(a2.hash()), Default::default(), false)
|
||||
.new_block_at(a2.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -82,7 +82,7 @@ where
|
||||
|
||||
// A3 -> A4
|
||||
let a4 = client
|
||||
.new_block_at(&BlockId::Hash(a3.hash()), Default::default(), false)
|
||||
.new_block_at(a3.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -92,7 +92,7 @@ where
|
||||
|
||||
// A4 -> A5
|
||||
let a5 = client
|
||||
.new_block_at(&BlockId::Hash(a4.hash()), Default::default(), false)
|
||||
.new_block_at(a4.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -102,9 +102,7 @@ where
|
||||
assert_eq!(blockchain.leaves().unwrap(), vec![a5.hash()]);
|
||||
|
||||
// A1 -> B2
|
||||
let mut builder = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
.unwrap();
|
||||
let mut builder = client.new_block_at(a1.hash(), Default::default(), false).unwrap();
|
||||
|
||||
// this push is required as otherwise B2 has the same hash as A2 and won't get imported
|
||||
builder
|
||||
@@ -121,7 +119,7 @@ where
|
||||
|
||||
// B2 -> B3
|
||||
let b3 = client
|
||||
.new_block_at(&BlockId::Hash(b2.hash()), Default::default(), false)
|
||||
.new_block_at(b2.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -132,7 +130,7 @@ where
|
||||
|
||||
// B3 -> B4
|
||||
let b4 = client
|
||||
.new_block_at(&BlockId::Hash(b3.hash()), Default::default(), false)
|
||||
.new_block_at(b3.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -141,9 +139,7 @@ where
|
||||
assert_eq!(blockchain.leaves().unwrap(), vec![a5.hash(), b4.hash()]);
|
||||
|
||||
// // B2 -> C3
|
||||
let mut builder = client
|
||||
.new_block_at(&BlockId::Hash(b2.hash()), Default::default(), false)
|
||||
.unwrap();
|
||||
let mut builder = client.new_block_at(b2.hash(), Default::default(), false).unwrap();
|
||||
// this push is required as otherwise C3 has the same hash as B3 and won't get imported
|
||||
builder
|
||||
.push_transfer(Transfer {
|
||||
@@ -158,9 +154,7 @@ where
|
||||
assert_eq!(blockchain.leaves().unwrap(), vec![a5.hash(), b4.hash(), c3.hash()]);
|
||||
|
||||
// A1 -> D2
|
||||
let mut builder = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
.unwrap();
|
||||
let mut builder = client.new_block_at(a1.hash(), Default::default(), false).unwrap();
|
||||
// this push is required as otherwise D2 has the same hash as B2 and won't get imported
|
||||
builder
|
||||
.push_transfer(Transfer {
|
||||
@@ -195,7 +189,7 @@ where
|
||||
|
||||
// A1 -> A2
|
||||
let a2 = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
.new_block_at(a1.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -204,7 +198,7 @@ where
|
||||
|
||||
// A2 -> A3
|
||||
let a3 = client
|
||||
.new_block_at(&BlockId::Hash(a2.hash()), Default::default(), false)
|
||||
.new_block_at(a2.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -213,7 +207,7 @@ where
|
||||
|
||||
// A3 -> A4
|
||||
let a4 = client
|
||||
.new_block_at(&BlockId::Hash(a3.hash()), Default::default(), false)
|
||||
.new_block_at(a3.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -222,7 +216,7 @@ where
|
||||
|
||||
// A4 -> A5
|
||||
let a5 = client
|
||||
.new_block_at(&BlockId::Hash(a4.hash()), Default::default(), false)
|
||||
.new_block_at(a4.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -230,9 +224,7 @@ where
|
||||
block_on(client.import(BlockOrigin::Own, a5.clone())).unwrap();
|
||||
|
||||
// A1 -> B2
|
||||
let mut builder = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
.unwrap();
|
||||
let mut builder = client.new_block_at(a1.hash(), Default::default(), false).unwrap();
|
||||
// this push is required as otherwise B2 has the same hash as A2 and won't get imported
|
||||
builder
|
||||
.push_transfer(Transfer {
|
||||
@@ -247,7 +239,7 @@ where
|
||||
|
||||
// B2 -> B3
|
||||
let b3 = client
|
||||
.new_block_at(&BlockId::Hash(b2.hash()), Default::default(), false)
|
||||
.new_block_at(b2.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -256,7 +248,7 @@ where
|
||||
|
||||
// B3 -> B4
|
||||
let b4 = client
|
||||
.new_block_at(&BlockId::Hash(b3.hash()), Default::default(), false)
|
||||
.new_block_at(b3.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -264,9 +256,7 @@ where
|
||||
block_on(client.import(BlockOrigin::Own, b4)).unwrap();
|
||||
|
||||
// // B2 -> C3
|
||||
let mut builder = client
|
||||
.new_block_at(&BlockId::Hash(b2.hash()), Default::default(), false)
|
||||
.unwrap();
|
||||
let mut builder = client.new_block_at(b2.hash(), Default::default(), false).unwrap();
|
||||
// this push is required as otherwise C3 has the same hash as B3 and won't get imported
|
||||
builder
|
||||
.push_transfer(Transfer {
|
||||
@@ -280,9 +270,7 @@ where
|
||||
block_on(client.import(BlockOrigin::Own, c3.clone())).unwrap();
|
||||
|
||||
// A1 -> D2
|
||||
let mut builder = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
.unwrap();
|
||||
let mut builder = client.new_block_at(a1.hash(), Default::default(), false).unwrap();
|
||||
// this push is required as otherwise D2 has the same hash as B2 and won't get imported
|
||||
builder
|
||||
.push_transfer(Transfer {
|
||||
@@ -328,7 +316,7 @@ where
|
||||
|
||||
// A1 -> A2
|
||||
let a2 = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
.new_block_at(a1.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -337,7 +325,7 @@ where
|
||||
|
||||
// A2 -> A3
|
||||
let a3 = client
|
||||
.new_block_at(&BlockId::Hash(a2.hash()), Default::default(), false)
|
||||
.new_block_at(a2.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -346,7 +334,7 @@ where
|
||||
|
||||
// A3 -> A4
|
||||
let a4 = client
|
||||
.new_block_at(&BlockId::Hash(a3.hash()), Default::default(), false)
|
||||
.new_block_at(a3.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -355,7 +343,7 @@ where
|
||||
|
||||
// A4 -> A5
|
||||
let a5 = client
|
||||
.new_block_at(&BlockId::Hash(a4.hash()), Default::default(), false)
|
||||
.new_block_at(a4.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -363,9 +351,7 @@ where
|
||||
block_on(client.import(BlockOrigin::Own, a5.clone())).unwrap();
|
||||
|
||||
// A1 -> B2
|
||||
let mut builder = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
.unwrap();
|
||||
let mut builder = client.new_block_at(a1.hash(), Default::default(), false).unwrap();
|
||||
// this push is required as otherwise B2 has the same hash as A2 and won't get imported
|
||||
builder
|
||||
.push_transfer(Transfer {
|
||||
@@ -380,7 +366,7 @@ where
|
||||
|
||||
// B2 -> B3
|
||||
let b3 = client
|
||||
.new_block_at(&BlockId::Hash(b2.hash()), Default::default(), false)
|
||||
.new_block_at(b2.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -389,7 +375,7 @@ where
|
||||
|
||||
// B3 -> B4
|
||||
let b4 = client
|
||||
.new_block_at(&BlockId::Hash(b3.hash()), Default::default(), false)
|
||||
.new_block_at(b3.hash(), Default::default(), false)
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap()
|
||||
@@ -397,9 +383,7 @@ where
|
||||
block_on(client.import(BlockOrigin::Own, b4)).unwrap();
|
||||
|
||||
// // B2 -> C3
|
||||
let mut builder = client
|
||||
.new_block_at(&BlockId::Hash(b2.hash()), Default::default(), false)
|
||||
.unwrap();
|
||||
let mut builder = client.new_block_at(b2.hash(), Default::default(), false).unwrap();
|
||||
// this push is required as otherwise C3 has the same hash as B3 and won't get imported
|
||||
builder
|
||||
.push_transfer(Transfer {
|
||||
@@ -413,9 +397,7 @@ where
|
||||
block_on(client.import(BlockOrigin::Own, c3)).unwrap();
|
||||
|
||||
// A1 -> D2
|
||||
let mut builder = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
.unwrap();
|
||||
let mut builder = client.new_block_at(a1.hash(), Default::default(), false).unwrap();
|
||||
// this push is required as otherwise D2 has the same hash as B2 and won't get imported
|
||||
builder
|
||||
.push_transfer(Transfer {
|
||||
|
||||
Reference in New Issue
Block a user