mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 06:21:02 +00:00
Update Substrate & Polkadot (#557)
* Update Substrate & Polkadot * Format * Update again
This commit is contained in:
@@ -15,6 +15,7 @@ sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "mas
|
||||
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
# Polkadot dependencies
|
||||
|
||||
@@ -16,19 +16,18 @@
|
||||
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
|
||||
use sc_consensus::{
|
||||
import_queue::{BasicQueue, Verifier as VerifierT},
|
||||
BlockImport, BlockImportParams,
|
||||
};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_block_builder::BlockBuilder as BlockBuilderApi;
|
||||
use sp_blockchain::Result as ClientResult;
|
||||
use sp_consensus::{
|
||||
error::Error as ConsensusError,
|
||||
import_queue::{BasicQueue, CacheKeyId, Verifier as VerifierT},
|
||||
BlockImport, BlockImportParams, BlockOrigin,
|
||||
};
|
||||
use sp_consensus::{error::Error as ConsensusError, CacheKeyId};
|
||||
use sp_inherents::{CreateInherentDataProviders, InherentDataProvider};
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Header as HeaderT},
|
||||
Justifications,
|
||||
};
|
||||
|
||||
/// A verifier that just checks the inherents.
|
||||
@@ -59,10 +58,7 @@ where
|
||||
{
|
||||
async fn verify(
|
||||
&mut self,
|
||||
origin: BlockOrigin,
|
||||
header: Block::Header,
|
||||
justifications: Option<Justifications>,
|
||||
mut body: Option<Vec<Block::Extrinsic>>,
|
||||
mut block_params: BlockImportParams<Block, ()>,
|
||||
) -> Result<
|
||||
(
|
||||
BlockImportParams<Block, ()>,
|
||||
@@ -70,10 +66,10 @@ where
|
||||
),
|
||||
String,
|
||||
> {
|
||||
if let Some(inner_body) = body.take() {
|
||||
if let Some(inner_body) = block_params.body.take() {
|
||||
let inherent_data_providers = self
|
||||
.create_inherent_data_providers
|
||||
.create_inherent_data_providers(*header.parent_hash(), ())
|
||||
.create_inherent_data_providers(*block_params.header.parent_hash(), ())
|
||||
.await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
@@ -81,13 +77,13 @@ where
|
||||
.create_inherent_data()
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
|
||||
let block = Block::new(header.clone(), inner_body);
|
||||
let block = Block::new(block_params.header.clone(), inner_body);
|
||||
|
||||
let inherent_res = self
|
||||
.client
|
||||
.runtime_api()
|
||||
.check_inherents(
|
||||
&BlockId::Hash(*header.parent_hash()),
|
||||
&BlockId::Hash(*block.header().parent_hash()),
|
||||
block.clone(),
|
||||
inherent_data,
|
||||
)
|
||||
@@ -106,17 +102,12 @@ where
|
||||
}
|
||||
|
||||
let (_, inner_body) = block.deconstruct();
|
||||
body = Some(inner_body);
|
||||
block_params.body = Some(inner_body);
|
||||
}
|
||||
|
||||
let post_hash = Some(header.hash());
|
||||
let mut block_import_params = BlockImportParams::new(origin, header);
|
||||
block_import_params.body = body;
|
||||
block_import_params.justifications = justifications;
|
||||
block_params.post_hash = Some(block_params.header.hash());
|
||||
|
||||
block_import_params.post_hash = post_hash;
|
||||
|
||||
Ok((block_import_params, None))
|
||||
Ok((block_params, None))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ use cumulus_primitives_core::{
|
||||
use parking_lot::Mutex;
|
||||
use polkadot_client::ClientHandle;
|
||||
use sc_client_api::Backend;
|
||||
use sc_consensus::{BlockImport, BlockImportParams};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_consensus::{
|
||||
BlockImport, BlockImportParams, BlockOrigin, EnableProofRecording, Environment, ProofRecording,
|
||||
Proposal, Proposer,
|
||||
BlockOrigin, EnableProofRecording, Environment, ProofRecording, Proposal, Proposer,
|
||||
};
|
||||
use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvider};
|
||||
use sp_runtime::traits::{Block as BlockT, HashFor, Header as HeaderT};
|
||||
@@ -208,8 +208,8 @@ where
|
||||
|
||||
let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header);
|
||||
block_import_params.body = Some(extrinsics);
|
||||
block_import_params.state_action = sp_consensus::StateAction::ApplyChanges(
|
||||
sp_consensus::StorageChanges::Changes(storage_changes)
|
||||
block_import_params.state_action = sc_consensus::StateAction::ApplyChanges(
|
||||
sc_consensus::StorageChanges::Changes(storage_changes),
|
||||
);
|
||||
|
||||
if let Err(err) = self
|
||||
|
||||
Reference in New Issue
Block a user