mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
Update Substrate & Polkadot (#557)
* Update Substrate & Polkadot * Format * Update again
This commit is contained in:
@@ -21,6 +21,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
|
||||
sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-telemetry = { 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
|
||||
|
||||
@@ -18,15 +18,14 @@
|
||||
|
||||
use codec::Codec;
|
||||
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
|
||||
use sc_consensus::{import_queue::DefaultImportQueue, BlockImport};
|
||||
use sc_consensus_aura::AuraVerifier;
|
||||
use sc_consensus_slots::InherentDataProviderExt;
|
||||
use sc_telemetry::TelemetryHandle;
|
||||
use sp_api::{ApiExt, ProvideRuntimeApi};
|
||||
use sp_block_builder::BlockBuilder as BlockBuilderApi;
|
||||
use sp_blockchain::{HeaderBackend, ProvideCache};
|
||||
use sp_consensus::{
|
||||
import_queue::DefaultImportQueue, BlockImport, CanAuthorWith, Error as ConsensusError,
|
||||
};
|
||||
use sp_consensus::{CanAuthorWith, Error as ConsensusError};
|
||||
use sp_consensus_aura::{digests::CompatibleDigestItem, AuraApi};
|
||||
use sp_core::crypto::Pair;
|
||||
use sp_inherents::CreateInherentDataProviders;
|
||||
|
||||
@@ -33,13 +33,14 @@ use cumulus_primitives_core::{
|
||||
use futures::lock::Mutex;
|
||||
use polkadot_client::ClientHandle;
|
||||
use sc_client_api::{backend::AuxStore, Backend, BlockOf};
|
||||
use sc_consensus::BlockImport;
|
||||
use sc_consensus_slots::{BackoffAuthoringBlocksStrategy, SlotInfo};
|
||||
use sc_telemetry::TelemetryHandle;
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_application_crypto::AppPublic;
|
||||
use sp_blockchain::{HeaderBackend, ProvideCache};
|
||||
use sp_consensus::{
|
||||
BlockImport, EnableProofRecording, Environment, ProofRecording, Proposer, SlotData, SyncOracle,
|
||||
EnableProofRecording, Environment, ProofRecording, Proposer, SlotData, SyncOracle,
|
||||
};
|
||||
use sp_consensus_aura::AuraApi;
|
||||
use sp_core::crypto::Pair;
|
||||
@@ -52,8 +53,7 @@ mod import_queue;
|
||||
|
||||
pub use import_queue::{build_verifier, import_queue, BuildVerifierParams, ImportQueueParams};
|
||||
pub use sc_consensus_aura::{
|
||||
slot_duration, AuraVerifier, BuildAuraWorkerParams, SlotDuration,
|
||||
SlotProportion,
|
||||
slot_duration, AuraVerifier, BuildAuraWorkerParams, SlotDuration, SlotProportion,
|
||||
};
|
||||
pub use sc_consensus_slots::InherentDataProviderExt;
|
||||
|
||||
@@ -138,8 +138,8 @@ where
|
||||
P::Public: AppPublic + Hash + Member + Encode + Decode,
|
||||
P::Signature: TryFrom<Vec<u8>> + Hash + Member + Encode + Decode,
|
||||
{
|
||||
let worker =
|
||||
sc_consensus_aura::build_aura_worker::<P, _, _, _, _, _, _, _, _>(BuildAuraWorkerParams {
|
||||
let worker = sc_consensus_aura::build_aura_worker::<P, _, _, _, _, _, _, _, _>(
|
||||
BuildAuraWorkerParams {
|
||||
client: para_client,
|
||||
block_import: ParachainBlockImport::new(block_import),
|
||||
justification_sync_link: (),
|
||||
@@ -151,7 +151,8 @@ where
|
||||
telemetry,
|
||||
block_proposal_slot_portion,
|
||||
max_block_proposal_slot_portion,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Self {
|
||||
create_inherent_data_providers: Arc::new(create_inherent_data_providers),
|
||||
|
||||
@@ -7,6 +7,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
# Substrate deps
|
||||
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use polkadot_primitives::v1::{Hash as PHash, PersistedValidationData};
|
||||
use sp_consensus::BlockImport;
|
||||
use sc_consensus::BlockImport;
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
|
||||
mod parachain_consensus;
|
||||
@@ -96,19 +96,19 @@ where
|
||||
|
||||
async fn check_block(
|
||||
&mut self,
|
||||
block: sp_consensus::BlockCheckParams<Block>,
|
||||
) -> Result<sp_consensus::ImportResult, Self::Error> {
|
||||
block: sc_consensus::BlockCheckParams<Block>,
|
||||
) -> Result<sc_consensus::ImportResult, Self::Error> {
|
||||
self.0.check_block(block).await
|
||||
}
|
||||
|
||||
async fn import_block(
|
||||
&mut self,
|
||||
mut block_import_params: sp_consensus::BlockImportParams<Block, Self::Transaction>,
|
||||
cache: std::collections::HashMap<sp_consensus::import_queue::CacheKeyId, Vec<u8>>,
|
||||
) -> Result<sp_consensus::ImportResult, Self::Error> {
|
||||
mut block_import_params: sc_consensus::BlockImportParams<Block, Self::Transaction>,
|
||||
cache: std::collections::HashMap<sp_consensus::CacheKeyId, Vec<u8>>,
|
||||
) -> Result<sc_consensus::ImportResult, Self::Error> {
|
||||
// Best block is determined by the relay chain, or if we are doing the intial sync
|
||||
// we import all blocks as new best.
|
||||
block_import_params.fork_choice = Some(sp_consensus::ForkChoiceStrategy::Custom(
|
||||
block_import_params.fork_choice = Some(sc_consensus::ForkChoiceStrategy::Custom(
|
||||
block_import_params.origin == sp_consensus::BlockOrigin::NetworkInitialSync,
|
||||
));
|
||||
self.0.import_block(block_import_params, cache).await
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
use sc_client_api::{
|
||||
Backend, BlockBackend, BlockImportNotification, BlockchainEvents, Finalizer, UsageProvider,
|
||||
};
|
||||
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_blockchain::{Error as ClientError, Result as ClientResult};
|
||||
use sp_consensus::{BlockImport, BlockImportParams, BlockOrigin, BlockStatus, ForkChoiceStrategy};
|
||||
use sp_consensus::{BlockOrigin, BlockStatus};
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Header as HeaderT},
|
||||
|
||||
@@ -25,8 +25,9 @@ use futures::{channel::mpsc, executor::block_on, select, FutureExt, Stream, Stre
|
||||
use futures_timer::Delay;
|
||||
use polkadot_primitives::v1::{Block as PBlock, Id as ParaId};
|
||||
use sc_client_api::UsageProvider;
|
||||
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
|
||||
use sp_blockchain::{Error as ClientError, Result as ClientResult};
|
||||
use sp_consensus::{BlockImport, BlockImportParams, BlockOrigin, ForkChoiceStrategy};
|
||||
use sp_consensus::BlockOrigin;
|
||||
use sp_runtime::generic::BlockId;
|
||||
use std::{
|
||||
sync::{Arc, Mutex},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -13,6 +13,7 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-maybe-compressed-blob = { 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" }
|
||||
|
||||
# Polkadot deps
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
@@ -44,7 +45,6 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -43,11 +43,9 @@
|
||||
//! make sure that the blocks are imported in the correct order.
|
||||
|
||||
use sc_client_api::{BlockBackend, BlockchainEvents, UsageProvider};
|
||||
use sc_consensus::import_queue::{ImportQueue, IncomingBlock};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_consensus::{
|
||||
import_queue::{ImportQueue, IncomingBlock},
|
||||
BlockOrigin, BlockStatus,
|
||||
};
|
||||
use sp_consensus::{BlockOrigin, BlockStatus};
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Header as HeaderT, NumberFor},
|
||||
|
||||
@@ -18,6 +18,7 @@ sc-service = { git = "https://github.com/paritytech/substrate", branch = "master
|
||||
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
+15
-14
@@ -26,14 +26,15 @@ use polkadot_service::{AbstractClient, Client as PClient, ClientHandle, RuntimeA
|
||||
use sc_client_api::{
|
||||
Backend as BackendT, BlockBackend, BlockchainEvents, Finalizer, UsageProvider,
|
||||
};
|
||||
use sc_consensus::{
|
||||
import_queue::{ImportQueue, IncomingBlock, Link, Origin},
|
||||
BlockImport,
|
||||
};
|
||||
use sc_service::{Configuration, Role, TaskManager};
|
||||
use sc_telemetry::TelemetryWorkerHandle;
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sp_consensus::{
|
||||
import_queue::{ImportQueue, IncomingBlock, Link, Origin},
|
||||
BlockImport, BlockOrigin,
|
||||
};
|
||||
use sp_consensus::BlockOrigin;
|
||||
use sp_core::{traits::SpawnNamed, Pair};
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, Block as BlockT, NumberFor},
|
||||
@@ -118,18 +119,18 @@ where
|
||||
});
|
||||
|
||||
relay_chain_full_node
|
||||
.client
|
||||
.execute_with(StartPoVRecovery {
|
||||
para_id,
|
||||
client: client.clone(),
|
||||
import_queue,
|
||||
task_manager,
|
||||
overseer_handle: relay_chain_full_node
|
||||
.overseer_handle
|
||||
.client
|
||||
.execute_with(StartPoVRecovery {
|
||||
para_id,
|
||||
client: client.clone(),
|
||||
import_queue,
|
||||
task_manager,
|
||||
overseer_handle: relay_chain_full_node
|
||||
.overseer_handle
|
||||
.clone()
|
||||
.ok_or_else(|| "Polkadot full node did not provide an `OverseerHandle`!")?,
|
||||
_phantom: PhantomData,
|
||||
})?;
|
||||
_phantom: PhantomData,
|
||||
})?;
|
||||
|
||||
cumulus_client_collator::start_collator(cumulus_client_collator::StartCollatorParams {
|
||||
runtime_api: client.clone(),
|
||||
|
||||
Reference in New Issue
Block a user