Relax Send/Sync/Clone requirements for Pair (#14647)

* Relax Send/Sync requirements for not instanced generic Pair

* Remove leftover

* Apply review suggestion

Co-authored-by: Sebastian Kunert <skunert49@gmail.com>

* Further cleanup

* Trigger CI

---------

Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
This commit is contained in:
Davide Galassi
2023-07-27 12:28:56 +02:00
committed by GitHub
parent 99fc51ce3e
commit 91ba40380a
4 changed files with 30 additions and 32 deletions
@@ -22,7 +22,7 @@ use crate::{
authorities, standalone::SealVerificationError, AuthorityId, CompatibilityMode, Error,
LOG_TARGET,
};
use codec::{Codec, Decode, Encode};
use codec::Codec;
use log::{debug, info, trace};
use prometheus_endpoint::Registry;
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
@@ -44,7 +44,7 @@ use sp_runtime::{
traits::{Block as BlockT, Header, NumberFor},
DigestItem,
};
use std::{fmt::Debug, hash::Hash, marker::PhantomData, sync::Arc};
use std::{fmt::Debug, marker::PhantomData, sync::Arc};
/// check a header has been signed by the right key. If the slot is too far in the future, an error
/// will be returned. If it's successful, returns the pre-header and the digest item
@@ -60,9 +60,9 @@ fn check_header<C, B: BlockT, P: Pair>(
check_for_equivocation: CheckForEquivocation,
) -> Result<CheckedHeader<B::Header, (Slot, DigestItem)>, Error<B>>
where
P::Public: Codec,
P::Signature: Codec,
C: sc_client_api::backend::AuxStore,
P::Public: Encode + Decode + PartialEq + Clone,
{
let check_result =
crate::standalone::check_header_slot_and_seal::<B, P>(slot_now, header, authorities);
@@ -101,11 +101,11 @@ where
/// A verifier for Aura blocks.
pub struct AuraVerifier<C, P, CIDP, N> {
client: Arc<C>,
phantom: PhantomData<P>,
create_inherent_data_providers: CIDP,
check_for_equivocation: CheckForEquivocation,
telemetry: Option<TelemetryHandle>,
compatibility_mode: CompatibilityMode<N>,
_phantom: PhantomData<fn() -> P>,
}
impl<C, P, CIDP, N> AuraVerifier<C, P, CIDP, N> {
@@ -122,14 +122,13 @@ impl<C, P, CIDP, N> AuraVerifier<C, P, CIDP, N> {
check_for_equivocation,
telemetry,
compatibility_mode,
phantom: PhantomData,
_phantom: PhantomData,
}
}
}
impl<C, P, CIDP, N> AuraVerifier<C, P, CIDP, N>
where
P: Send + Sync + 'static,
CIDP: Send,
{
async fn check_inherents<B: BlockT>(
@@ -168,9 +167,9 @@ impl<B: BlockT, C, P, CIDP> Verifier<B> for AuraVerifier<C, P, CIDP, NumberFor<B
where
C: ProvideRuntimeApi<B> + Send + Sync + sc_client_api::backend::AuxStore,
C::Api: BlockBuilderApi<B> + AuraApi<B, AuthorityId<P>> + ApiExt<B>,
P: Pair + Send + Sync + 'static,
P::Public: Send + Sync + Hash + Eq + Clone + Decode + Encode + Debug + 'static,
P::Signature: Encode + Decode,
P: Pair,
P::Public: Codec + Debug,
P::Signature: Codec,
CIDP: CreateInherentDataProviders<B, ()> + Send + Sync,
CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync,
{
@@ -365,9 +364,9 @@ where
+ Send
+ Sync
+ 'static,
P: Pair + Send + Sync + 'static,
P::Public: Clone + Eq + Send + Sync + Hash + Debug + Encode + Decode,
P::Signature: Encode + Decode,
P: Pair + 'static,
P::Public: Codec + Debug,
P::Signature: Codec,
S: sp_core::traits::SpawnEssentialNamed,
CIDP: CreateInherentDataProviders<Block, ()> + Sync + Send + 'static,
CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync,