mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 14:17:56 +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:
Generated
+281
-318
File diff suppressed because it is too large
Load Diff
@@ -208,7 +208,9 @@ where
|
||||
|
||||
let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header);
|
||||
block_import_params.body = Some(extrinsics);
|
||||
block_import_params.storage_changes = Some(storage_changes);
|
||||
block_import_params.state_action = sp_consensus::StateAction::ApplyChanges(
|
||||
sp_consensus::StorageChanges::Changes(storage_changes)
|
||||
);
|
||||
|
||||
if let Err(err) = self
|
||||
.block_import
|
||||
|
||||
@@ -352,6 +352,8 @@ where
|
||||
allow_missing_state: false,
|
||||
justifications: None,
|
||||
origin: None,
|
||||
skip_execution: false,
|
||||
state: None,
|
||||
});
|
||||
|
||||
if let Some(waiting) = self.waiting_for_parent.remove(&block_hash) {
|
||||
|
||||
@@ -44,7 +44,6 @@ lazy_static = "1.4"
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
# Cumulus dependencies
|
||||
|
||||
@@ -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