mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 20:15:40 +00:00
aura: remove unused tx pool (#5046)
* aura: remove unused transaction pool parameter * node-template: remove transaction pool from aura * aura: fix tests
This commit is contained in:
@@ -37,7 +37,7 @@ macro_rules! new_full_start {
|
|||||||
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
|
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
|
||||||
Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api)))
|
Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api)))
|
||||||
})?
|
})?
|
||||||
.with_import_queue(|_config, client, mut select_chain, transaction_pool| {
|
.with_import_queue(|_config, client, mut select_chain, _transaction_pool| {
|
||||||
let select_chain = select_chain.take()
|
let select_chain = select_chain.take()
|
||||||
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
|
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
|
||||||
|
|
||||||
@@ -50,14 +50,13 @@ macro_rules! new_full_start {
|
|||||||
grandpa_block_import.clone(), client.clone(),
|
grandpa_block_import.clone(), client.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>(
|
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair>(
|
||||||
sc_consensus_aura::slot_duration(&*client)?,
|
sc_consensus_aura::slot_duration(&*client)?,
|
||||||
aura_block_import,
|
aura_block_import,
|
||||||
Some(Box::new(grandpa_block_import.clone())),
|
Some(Box::new(grandpa_block_import.clone())),
|
||||||
None,
|
None,
|
||||||
client,
|
client,
|
||||||
inherent_data_providers.clone(),
|
inherent_data_providers.clone(),
|
||||||
Some(transaction_pool),
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
import_setup = Some((grandpa_block_import, grandpa_link));
|
import_setup = Some((grandpa_block_import, grandpa_link));
|
||||||
@@ -210,14 +209,13 @@ pub fn new_light(config: Configuration<GenesisConfig>)
|
|||||||
let finality_proof_request_builder =
|
let finality_proof_request_builder =
|
||||||
finality_proof_import.create_finality_proof_request_builder();
|
finality_proof_import.create_finality_proof_request_builder();
|
||||||
|
|
||||||
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, ()>(
|
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair>(
|
||||||
sc_consensus_aura::slot_duration(&*client)?,
|
sc_consensus_aura::slot_duration(&*client)?,
|
||||||
grandpa_block_import,
|
grandpa_block_import,
|
||||||
None,
|
None,
|
||||||
Some(Box::new(finality_proof_import)),
|
Some(Box::new(finality_proof_import)),
|
||||||
client,
|
client,
|
||||||
inherent_data_providers.clone(),
|
inherent_data_providers.clone(),
|
||||||
None,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok((import_queue, finality_proof_request_builder))
|
Ok((import_queue, finality_proof_request_builder))
|
||||||
|
|||||||
@@ -405,21 +405,17 @@ fn find_pre_digest<B: BlockT, P: Pair>(header: &B::Header) -> Result<u64, Error<
|
|||||||
///
|
///
|
||||||
/// This digest item will always return `Some` when used with `as_aura_seal`.
|
/// This digest item will always return `Some` when used with `as_aura_seal`.
|
||||||
//
|
//
|
||||||
// FIXME #1018 needs misbehavior types. The `transaction_pool` parameter will be
|
fn check_header<C, B: BlockT, P: Pair>(
|
||||||
// used to submit such misbehavior reports.
|
|
||||||
fn check_header<C, B: BlockT, P: Pair, T>(
|
|
||||||
client: &C,
|
client: &C,
|
||||||
slot_now: u64,
|
slot_now: u64,
|
||||||
mut header: B::Header,
|
mut header: B::Header,
|
||||||
hash: B::Hash,
|
hash: B::Hash,
|
||||||
authorities: &[AuthorityId<P>],
|
authorities: &[AuthorityId<P>],
|
||||||
_transaction_pool: Option<&T>,
|
|
||||||
) -> Result<CheckedHeader<B::Header, (u64, DigestItemFor<B>)>, Error<B>> where
|
) -> Result<CheckedHeader<B::Header, (u64, DigestItemFor<B>)>, Error<B>> where
|
||||||
DigestItemFor<B>: CompatibleDigestItem<P>,
|
DigestItemFor<B>: CompatibleDigestItem<P>,
|
||||||
P::Signature: Decode,
|
P::Signature: Decode,
|
||||||
C: sc_client_api::backend::AuxStore,
|
C: sc_client_api::backend::AuxStore,
|
||||||
P::Public: Encode + Decode + PartialEq + Clone,
|
P::Public: Encode + Decode + PartialEq + Clone,
|
||||||
T: Send + Sync + 'static,
|
|
||||||
{
|
{
|
||||||
let seal = match header.digest_mut().pop() {
|
let seal = match header.digest_mut().pop() {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
@@ -469,14 +465,13 @@ fn check_header<C, B: BlockT, P: Pair, T>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A verifier for Aura blocks.
|
/// A verifier for Aura blocks.
|
||||||
pub struct AuraVerifier<C, P, T> {
|
pub struct AuraVerifier<C, P> {
|
||||||
client: Arc<C>,
|
client: Arc<C>,
|
||||||
phantom: PhantomData<P>,
|
phantom: PhantomData<P>,
|
||||||
inherent_data_providers: sp_inherents::InherentDataProviders,
|
inherent_data_providers: sp_inherents::InherentDataProviders,
|
||||||
transaction_pool: Option<Arc<T>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C, P, T> AuraVerifier<C, P, T>
|
impl<C, P> AuraVerifier<C, P>
|
||||||
where P: Send + Sync + 'static
|
where P: Send + Sync + 'static
|
||||||
{
|
{
|
||||||
fn check_inherents<B: BlockT>(
|
fn check_inherents<B: BlockT>(
|
||||||
@@ -531,7 +526,7 @@ impl<C, P, T> AuraVerifier<C, P, T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[forbid(deprecated)]
|
#[forbid(deprecated)]
|
||||||
impl<B: BlockT, C, P, T> Verifier<B> for AuraVerifier<C, P, T> where
|
impl<B: BlockT, C, P> Verifier<B> for AuraVerifier<C, P> where
|
||||||
C: ProvideRuntimeApi<B> +
|
C: ProvideRuntimeApi<B> +
|
||||||
Send +
|
Send +
|
||||||
Sync +
|
Sync +
|
||||||
@@ -543,7 +538,6 @@ impl<B: BlockT, C, P, T> Verifier<B> for AuraVerifier<C, P, T> where
|
|||||||
P: Pair + Send + Sync + 'static,
|
P: Pair + Send + Sync + 'static,
|
||||||
P::Public: Send + Sync + Hash + Eq + Clone + Decode + Encode + Debug + 'static,
|
P::Public: Send + Sync + Hash + Eq + Clone + Decode + Encode + Debug + 'static,
|
||||||
P::Signature: Encode + Decode,
|
P::Signature: Encode + Decode,
|
||||||
T: Send + Sync + 'static,
|
|
||||||
{
|
{
|
||||||
fn verify(
|
fn verify(
|
||||||
&mut self,
|
&mut self,
|
||||||
@@ -565,13 +559,12 @@ impl<B: BlockT, C, P, T> Verifier<B> for AuraVerifier<C, P, T> where
|
|||||||
// we add one to allow for some small drift.
|
// we add one to allow for some small drift.
|
||||||
// FIXME #1019 in the future, alter this queue to allow deferring of
|
// FIXME #1019 in the future, alter this queue to allow deferring of
|
||||||
// headers
|
// headers
|
||||||
let checked_header = check_header::<C, B, P, T>(
|
let checked_header = check_header::<C, B, P>(
|
||||||
&self.client,
|
&self.client,
|
||||||
slot_now + 1,
|
slot_now + 1,
|
||||||
header,
|
header,
|
||||||
hash,
|
hash,
|
||||||
&authorities[..],
|
&authorities[..],
|
||||||
self.transaction_pool.as_ref().map(|x| &**x),
|
|
||||||
).map_err(|e| e.to_string())?;
|
).map_err(|e| e.to_string())?;
|
||||||
match checked_header {
|
match checked_header {
|
||||||
CheckedHeader::Checked(pre_header, (slot_num, seal)) => {
|
CheckedHeader::Checked(pre_header, (slot_num, seal)) => {
|
||||||
@@ -795,14 +788,13 @@ impl<Block: BlockT, C, I, P> BlockImport<Block> for AuraBlockImport<Block, C, I,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Start an import queue for the Aura consensus algorithm.
|
/// Start an import queue for the Aura consensus algorithm.
|
||||||
pub fn import_queue<B, I, C, P, T>(
|
pub fn import_queue<B, I, C, P>(
|
||||||
slot_duration: SlotDuration,
|
slot_duration: SlotDuration,
|
||||||
block_import: I,
|
block_import: I,
|
||||||
justification_import: Option<BoxJustificationImport<B>>,
|
justification_import: Option<BoxJustificationImport<B>>,
|
||||||
finality_proof_import: Option<BoxFinalityProofImport<B>>,
|
finality_proof_import: Option<BoxFinalityProofImport<B>>,
|
||||||
client: Arc<C>,
|
client: Arc<C>,
|
||||||
inherent_data_providers: InherentDataProviders,
|
inherent_data_providers: InherentDataProviders,
|
||||||
transaction_pool: Option<Arc<T>>,
|
|
||||||
) -> Result<AuraImportQueue<B, sp_api::TransactionFor<C, B>>, sp_consensus::Error> where
|
) -> Result<AuraImportQueue<B, sp_api::TransactionFor<C, B>>, sp_consensus::Error> where
|
||||||
B: BlockT,
|
B: BlockT,
|
||||||
C::Api: BlockBuilderApi<B> + AuraApi<B, AuthorityId<P>> + ApiExt<B, Error = sp_blockchain::Error>,
|
C::Api: BlockBuilderApi<B> + AuraApi<B, AuthorityId<P>> + ApiExt<B, Error = sp_blockchain::Error>,
|
||||||
@@ -812,7 +804,6 @@ pub fn import_queue<B, I, C, P, T>(
|
|||||||
P: Pair + Send + Sync + 'static,
|
P: Pair + Send + Sync + 'static,
|
||||||
P::Public: Clone + Eq + Send + Sync + Hash + Debug + Encode + Decode,
|
P::Public: Clone + Eq + Send + Sync + Hash + Debug + Encode + Decode,
|
||||||
P::Signature: Encode + Decode,
|
P::Signature: Encode + Decode,
|
||||||
T: Send + Sync + 'static,
|
|
||||||
{
|
{
|
||||||
register_aura_inherent_data_provider(&inherent_data_providers, slot_duration.get())?;
|
register_aura_inherent_data_provider(&inherent_data_providers, slot_duration.get())?;
|
||||||
initialize_authorities_cache(&*client)?;
|
initialize_authorities_cache(&*client)?;
|
||||||
@@ -821,7 +812,6 @@ pub fn import_queue<B, I, C, P, T>(
|
|||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
inherent_data_providers,
|
inherent_data_providers,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
transaction_pool,
|
|
||||||
};
|
};
|
||||||
Ok(BasicQueue::new(
|
Ok(BasicQueue::new(
|
||||||
verifier,
|
verifier,
|
||||||
@@ -900,7 +890,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TestNetFactory for AuraTestNet {
|
impl TestNetFactory for AuraTestNet {
|
||||||
type Verifier = AuraVerifier<PeersFullClient, AuthorityPair, ()>;
|
type Verifier = AuraVerifier<PeersFullClient, AuthorityPair>;
|
||||||
type PeerData = ();
|
type PeerData = ();
|
||||||
|
|
||||||
/// Create new test network with peers and given config.
|
/// Create new test network with peers and given config.
|
||||||
@@ -926,7 +916,6 @@ mod tests {
|
|||||||
AuraVerifier {
|
AuraVerifier {
|
||||||
client,
|
client,
|
||||||
inherent_data_providers,
|
inherent_data_providers,
|
||||||
transaction_pool: Default::default(),
|
|
||||||
phantom: Default::default(),
|
phantom: Default::default(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user