mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 07:01:03 +00:00
Update Substrate & Polkadot (#519)
* Update Substrate & Polkadot * Basti improvements Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
@@ -19,12 +19,11 @@ use cumulus_primitives_core::{ParachainBlockData, PersistedValidationData};
|
||||
use cumulus_test_client::{
|
||||
runtime::{Block, Hash, Header, UncheckedExtrinsic, WASM_BINARY},
|
||||
transfer, BlockData, BuildParachainBlockData, Client, DefaultTestClientBuilderExt, HeadData,
|
||||
InitBlockBuilder, LongestChain, TestClientBuilder, TestClientBuilderExt, ValidationParams,
|
||||
InitBlockBuilder, TestClientBuilder, TestClientBuilderExt, ValidationParams,
|
||||
};
|
||||
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
|
||||
use sp_consensus::SelectChain;
|
||||
use sp_keyring::AccountKeyring::*;
|
||||
use sp_runtime::traits::Header as HeaderT;
|
||||
use sp_runtime::{generic::BlockId, traits::Header as HeaderT};
|
||||
use std::{env, process::Command};
|
||||
|
||||
fn call_validate_block(
|
||||
@@ -44,11 +43,19 @@ fn call_validate_block(
|
||||
.map(|v| Header::decode(&mut &v.head_data.0[..]).expect("Decodes `Header`."))
|
||||
}
|
||||
|
||||
fn create_test_client() -> (Client, LongestChain) {
|
||||
TestClientBuilder::new()
|
||||
fn create_test_client() -> (Client, Header) {
|
||||
let client = TestClientBuilder::new()
|
||||
// NOTE: this allows easier debugging
|
||||
.set_execution_strategy(sc_client_api::ExecutionStrategy::NativeWhenPossible)
|
||||
.build_with_longest_chain()
|
||||
.build();
|
||||
|
||||
let genesis_header = client
|
||||
.header(&BlockId::number(0))
|
||||
.ok()
|
||||
.flatten()
|
||||
.expect("Genesis header exists; qed");
|
||||
|
||||
(client, genesis_header)
|
||||
}
|
||||
|
||||
struct TestBlockData {
|
||||
@@ -88,8 +95,7 @@ fn build_block_with_witness(
|
||||
fn validate_block_no_extra_extrinsics() {
|
||||
sp_tracing::try_init_simple();
|
||||
|
||||
let (client, longest_chain) = create_test_client();
|
||||
let parent_head = longest_chain.best_chain().expect("Best block exists");
|
||||
let (client, parent_head) = create_test_client();
|
||||
let TestBlockData {
|
||||
block,
|
||||
validation_data,
|
||||
@@ -109,8 +115,7 @@ fn validate_block_no_extra_extrinsics() {
|
||||
fn validate_block_with_extra_extrinsics() {
|
||||
sp_tracing::try_init_simple();
|
||||
|
||||
let (client, longest_chain) = create_test_client();
|
||||
let parent_head = longest_chain.best_chain().expect("Best block exists");
|
||||
let (client, parent_head) = create_test_client();
|
||||
let extra_extrinsics = vec![
|
||||
transfer(&client, Alice, Bob, 69),
|
||||
transfer(&client, Bob, Charlie, 100),
|
||||
@@ -142,8 +147,7 @@ fn validate_block_invalid_parent_hash() {
|
||||
sp_tracing::try_init_simple();
|
||||
|
||||
if env::var("RUN_TEST").is_ok() {
|
||||
let (client, longest_chain) = create_test_client();
|
||||
let parent_head = longest_chain.best_chain().expect("Best block exists");
|
||||
let (client, parent_head) = create_test_client();
|
||||
let TestBlockData {
|
||||
block,
|
||||
validation_data,
|
||||
@@ -175,8 +179,7 @@ fn validate_block_fails_on_invalid_validation_data() {
|
||||
sp_tracing::try_init_simple();
|
||||
|
||||
if env::var("RUN_TEST").is_ok() {
|
||||
let (client, longest_chain) = create_test_client();
|
||||
let parent_head = longest_chain.best_chain().expect("Best block exists");
|
||||
let (client, parent_head) = create_test_client();
|
||||
let TestBlockData { block, .. } =
|
||||
build_block_with_witness(&client, vec![], parent_head.clone(), Default::default());
|
||||
|
||||
@@ -203,8 +206,7 @@ fn check_inherent_fails_on_validate_block_as_expected() {
|
||||
sp_tracing::try_init_simple();
|
||||
|
||||
if env::var("RUN_TEST").is_ok() {
|
||||
let (client, longest_chain) = create_test_client();
|
||||
let parent_head = longest_chain.best_chain().expect("Best block exists");
|
||||
let (client, parent_head) = create_test_client();
|
||||
|
||||
let TestBlockData {
|
||||
block,
|
||||
|
||||
Reference in New Issue
Block a user