mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-07 02:38:02 +00:00
Companion for substrate 14647 (#2941)
* Companion for substrate 14647 * Futher cleanup * Apply review suggestion Co-authored-by: Sebastian Kunert <skunert49@gmail.com> * Apply suggestions from code review Co-authored-by: Sebastian Kunert <skunert49@gmail.com> * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: Sebastian Kunert <skunert49@gmail.com> Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+196
-196
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,7 @@
|
||||
//! This module also exposes some standalone functions for common operations when building
|
||||
//! aura-based collators.
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use codec::{Codec, Encode};
|
||||
use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface;
|
||||
use cumulus_client_consensus_common::{
|
||||
self as consensus_common, ParachainBlockImportMarker, ParachainCandidate,
|
||||
@@ -55,7 +55,7 @@ use sp_runtime::{
|
||||
};
|
||||
use sp_state_machine::StorageChanges;
|
||||
use sp_timestamp::Timestamp;
|
||||
use std::{convert::TryFrom, error::Error, hash::Hash, sync::Arc, time::Duration};
|
||||
use std::{convert::TryFrom, error::Error, sync::Arc, time::Duration};
|
||||
|
||||
/// Parameters for instantiating a [`Collator`].
|
||||
pub struct Params<BI, CIDP, RClient, Proposer, CS> {
|
||||
@@ -98,9 +98,9 @@ where
|
||||
Proposer: ProposerInterface<Block, Transaction = BI::Transaction>,
|
||||
Proposer::Transaction: Sync,
|
||||
CS: CollatorServiceInterface<Block>,
|
||||
P: Pair + Send + Sync,
|
||||
P::Public: AppPublic + Hash + Member + Encode + Decode,
|
||||
P::Signature: TryFrom<Vec<u8>> + Hash + Member + Encode + Decode,
|
||||
P: Pair,
|
||||
P::Public: AppPublic + Member,
|
||||
P::Signature: TryFrom<Vec<u8>> + Member + Codec,
|
||||
{
|
||||
/// Instantiate a new instance of the `Aura` manager.
|
||||
pub fn new(params: Params<BI, CIDP, RClient, Proposer, CS>) -> Self {
|
||||
@@ -257,8 +257,8 @@ impl<Pub> SlotClaim<Pub> {
|
||||
pub fn unchecked<P>(author_pub: Pub, slot: Slot, timestamp: Timestamp) -> Self
|
||||
where
|
||||
P: Pair<Public = Pub>,
|
||||
P::Public: Encode + Decode,
|
||||
P::Signature: Encode + Decode,
|
||||
P::Public: Codec,
|
||||
P::Signature: Codec,
|
||||
{
|
||||
SlotClaim { author_pub, timestamp, pre_digest: aura_internal::pre_digest::<P>(slot) }
|
||||
}
|
||||
@@ -294,8 +294,8 @@ where
|
||||
C: ProvideRuntimeApi<B> + Send + Sync + 'static,
|
||||
C::Api: AuraApi<B, P::Public>,
|
||||
P: Pair,
|
||||
P::Public: Encode + Decode,
|
||||
P::Signature: Encode + Decode,
|
||||
P::Public: Codec,
|
||||
P::Signature: Codec,
|
||||
{
|
||||
// load authorities
|
||||
let authorities = client.runtime_api().authorities(parent_hash).map_err(Box::new)?;
|
||||
@@ -330,7 +330,7 @@ pub fn seal<B: BlockT, T, P>(
|
||||
) -> Result<BlockImportParams<B, T>, Box<dyn Error>>
|
||||
where
|
||||
P: Pair,
|
||||
P::Signature: Encode + Decode + TryFrom<Vec<u8>>,
|
||||
P::Signature: Codec + TryFrom<Vec<u8>>,
|
||||
P::Public: AppPublic,
|
||||
{
|
||||
let (pre_header, body) = pre_sealed.deconstruct();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//!
|
||||
//! For more information about AuRa, the Substrate crate should be checked.
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use codec::{Codec, Decode};
|
||||
use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface;
|
||||
use cumulus_client_consensus_common::ParachainBlockImportMarker;
|
||||
use cumulus_client_consensus_proposer::ProposerInterface;
|
||||
@@ -45,7 +45,7 @@ use sp_core::crypto::Pair;
|
||||
use sp_inherents::CreateInherentDataProviders;
|
||||
use sp_keystore::KeystorePtr;
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member};
|
||||
use std::{convert::TryFrom, hash::Hash, sync::Arc, time::Duration};
|
||||
use std::{convert::TryFrom, sync::Arc, time::Duration};
|
||||
|
||||
use crate::collator as collator_util;
|
||||
|
||||
@@ -87,9 +87,9 @@ pub async fn run<Block, P, BI, CIDP, Client, RClient, SO, Proposer, CS>(
|
||||
Proposer: ProposerInterface<Block, Transaction = BI::Transaction>,
|
||||
Proposer::Transaction: Sync,
|
||||
CS: CollatorServiceInterface<Block>,
|
||||
P: Pair + Send + Sync,
|
||||
P::Public: AppPublic + Hash + Member + Encode + Decode,
|
||||
P::Signature: TryFrom<Vec<u8>> + Hash + Member + Encode + Decode,
|
||||
P: Pair,
|
||||
P::Public: AppPublic + Member,
|
||||
P::Signature: TryFrom<Vec<u8>> + Member + Codec,
|
||||
{
|
||||
let mut collation_requests = cumulus_client_collator::relay_chain_driven::init(
|
||||
params.key,
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
//! The main limitation is block propagation time - i.e. the new blocks created by an author
|
||||
//! must be propagated to the next author before their turn.
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use codec::{Codec, Encode};
|
||||
use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface;
|
||||
use cumulus_client_consensus_common::{
|
||||
self as consensus_common, ParachainBlockImportMarker, ParentSearchParams,
|
||||
@@ -60,7 +60,7 @@ use sp_inherents::CreateInherentDataProviders;
|
||||
use sp_keystore::KeystorePtr;
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member};
|
||||
use sp_timestamp::Timestamp;
|
||||
use std::{convert::TryFrom, hash::Hash, sync::Arc, time::Duration};
|
||||
use std::{convert::TryFrom, sync::Arc, time::Duration};
|
||||
|
||||
use crate::collator::{self as collator_util, SlotClaim};
|
||||
|
||||
@@ -106,9 +106,9 @@ pub async fn run<Block, P, BI, CIDP, Client, Backend, RClient, SO, Proposer, CS>
|
||||
Proposer: ProposerInterface<Block, Transaction = BI::Transaction>,
|
||||
Proposer::Transaction: Sync,
|
||||
CS: CollatorServiceInterface<Block>,
|
||||
P: Pair + Send + Sync,
|
||||
P::Public: AppPublic + Hash + Member + Encode + Decode,
|
||||
P::Signature: TryFrom<Vec<u8>> + Hash + Member + Encode + Decode,
|
||||
P: Pair,
|
||||
P::Public: AppPublic + Member,
|
||||
P::Signature: TryFrom<Vec<u8>> + Member + Codec,
|
||||
{
|
||||
// This is an arbitrary value which is likely guaranteed to exceed any reasonable
|
||||
// limit, as it would correspond to 10 non-included blocks.
|
||||
@@ -314,8 +314,8 @@ where
|
||||
Client: ProvideRuntimeApi<Block>,
|
||||
Client::Api: AuraApi<Block, P::Public> + AuraUnincludedSegmentApi<Block>,
|
||||
P: Pair,
|
||||
P::Public: Encode + Decode,
|
||||
P::Signature: Encode + Decode,
|
||||
P::Public: Codec,
|
||||
P::Signature: Codec,
|
||||
{
|
||||
let runtime_api = client.runtime_api();
|
||||
let authorities = runtime_api.authorities(parent_hash).ok()?;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
/// Equivocation resistance in general is a hard problem, as different nodes in the network
|
||||
/// may see equivocations in a different order, and therefore may not agree on which blocks
|
||||
/// should be thrown out and which ones should be kept.
|
||||
use codec::{Decode, Encode};
|
||||
use codec::Codec;
|
||||
use cumulus_client_consensus_common::ParachainBlockImportMarker;
|
||||
use lru::LruCache;
|
||||
|
||||
@@ -72,15 +72,15 @@ struct Verifier<P, Client, Block, CIDP> {
|
||||
slot_duration: SlotDuration,
|
||||
defender: NaiveEquivocationDefender,
|
||||
telemetry: Option<TelemetryHandle>,
|
||||
_marker: std::marker::PhantomData<(Block, P)>,
|
||||
_phantom: std::marker::PhantomData<fn() -> (Block, P)>,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl<P, Client, Block, CIDP> VerifierT<Block> for Verifier<P, Client, Block, CIDP>
|
||||
where
|
||||
P: Pair,
|
||||
P::Signature: Encode + Decode,
|
||||
P::Public: Encode + Decode + PartialEq + Clone + Debug,
|
||||
P::Signature: Codec,
|
||||
P::Public: Codec + Debug,
|
||||
Block: BlockT,
|
||||
Client: ProvideRuntimeApi<Block> + Send + Sync,
|
||||
<Client as ProvideRuntimeApi<Block>>::Api: BlockBuilderApi<Block> + AuraApi<Block, P::Public>,
|
||||
@@ -223,9 +223,9 @@ pub fn fully_verifying_import_queue<P, Client, Block: BlockT, I, CIDP>(
|
||||
telemetry: Option<TelemetryHandle>,
|
||||
) -> BasicQueue<Block, I::Transaction>
|
||||
where
|
||||
P: Pair,
|
||||
P::Signature: Encode + Decode,
|
||||
P::Public: Encode + Decode + PartialEq + Clone + Debug,
|
||||
P: Pair + 'static,
|
||||
P::Signature: Codec,
|
||||
P::Public: Codec + Debug,
|
||||
I: BlockImport<Block, Error = ConsensusError>
|
||||
+ ParachainBlockImportMarker
|
||||
+ Send
|
||||
@@ -242,7 +242,7 @@ where
|
||||
defender: NaiveEquivocationDefender::default(),
|
||||
slot_duration,
|
||||
telemetry,
|
||||
_marker: std::marker::PhantomData,
|
||||
_phantom: std::marker::PhantomData,
|
||||
};
|
||||
|
||||
BasicQueue::new(verifier, Box::new(block_import), None, spawner, registry)
|
||||
|
||||
@@ -31,7 +31,7 @@ use sp_consensus_aura::AuraApi;
|
||||
use sp_core::crypto::Pair;
|
||||
use sp_inherents::CreateInherentDataProviders;
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
use std::{fmt::Debug, hash::Hash, sync::Arc};
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
use substrate_prometheus_endpoint::Registry;
|
||||
|
||||
/// Parameters for [`import_queue`].
|
||||
@@ -77,8 +77,8 @@ where
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
P: Pair + Send + Sync + 'static,
|
||||
P::Public: Clone + Eq + Send + Sync + Hash + Debug + Codec,
|
||||
P: Pair + 'static,
|
||||
P::Public: Debug + Codec,
|
||||
P::Signature: Codec,
|
||||
S: sp_core::traits::SpawnEssentialNamed,
|
||||
CIDP: CreateInherentDataProviders<Block, ()> + Sync + Send + 'static,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//!
|
||||
//! For more information about AuRa, the Substrate crate should be checked.
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use codec::Codec;
|
||||
use cumulus_client_consensus_common::{
|
||||
ParachainBlockImportMarker, ParachainCandidate, ParachainConsensus,
|
||||
};
|
||||
@@ -42,7 +42,7 @@ use sp_core::crypto::Pair;
|
||||
use sp_inherents::CreateInherentDataProviders;
|
||||
use sp_keystore::KeystorePtr;
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member, NumberFor};
|
||||
use std::{convert::TryFrom, hash::Hash, marker::PhantomData, sync::Arc};
|
||||
use std::{convert::TryFrom, marker::PhantomData, sync::Arc};
|
||||
|
||||
mod import_queue;
|
||||
|
||||
@@ -134,9 +134,9 @@ where
|
||||
Proof = <EnableProofRecording as ProofRecording>::Proof,
|
||||
>,
|
||||
Error: std::error::Error + Send + From<sp_consensus::Error> + 'static,
|
||||
P: Pair + Send + Sync,
|
||||
P::Public: AppPublic + Hash + Member + Encode + Decode,
|
||||
P::Signature: TryFrom<Vec<u8>> + Hash + Member + Encode + Decode,
|
||||
P: Pair + 'static,
|
||||
P::Public: AppPublic + Member + Codec,
|
||||
P::Signature: TryFrom<Vec<u8>> + Member + Codec,
|
||||
{
|
||||
let worker = sc_consensus_aura::build_aura_worker::<P, _, _, _, _, _, _, _, _>(
|
||||
BuildAuraWorkerParams {
|
||||
|
||||
Reference in New Issue
Block a user