mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
Fix tons of warnings in newest nightly (#2784)
* Fix tons of warnings in newest nightly * Fix sr-api-macro doc tests
This commit is contained in:
@@ -657,7 +657,7 @@ impl<Block: BlockT> GossipValidator<Block> {
|
||||
}
|
||||
|
||||
impl<Block: BlockT> network_gossip::Validator<Block> for GossipValidator<Block> {
|
||||
fn new_peer(&self, context: &mut ValidatorContext<Block>, who: &PeerId, _roles: Roles) {
|
||||
fn new_peer(&self, context: &mut dyn ValidatorContext<Block>, who: &PeerId, _roles: Roles) {
|
||||
let packet_data = {
|
||||
let mut inner = self.inner.write();
|
||||
inner.peers.new_peer(who.clone());
|
||||
@@ -673,11 +673,11 @@ impl<Block: BlockT> network_gossip::Validator<Block> for GossipValidator<Block>
|
||||
context.send_message(who, packet_data);
|
||||
}
|
||||
|
||||
fn peer_disconnected(&self, _context: &mut ValidatorContext<Block>, who: &PeerId) {
|
||||
fn peer_disconnected(&self, _context: &mut dyn ValidatorContext<Block>, who: &PeerId) {
|
||||
self.inner.write().peers.peer_disconnected(who);
|
||||
}
|
||||
|
||||
fn validate(&self, context: &mut ValidatorContext<Block>, who: &PeerId, data: &[u8])
|
||||
fn validate(&self, context: &mut dyn ValidatorContext<Block>, who: &PeerId, data: &[u8])
|
||||
-> network_gossip::ValidationResult<Block::Hash>
|
||||
{
|
||||
let (action, broadcast_topics) = self.do_validate(who, data);
|
||||
@@ -705,7 +705,7 @@ impl<Block: BlockT> network_gossip::Validator<Block> for GossipValidator<Block>
|
||||
}
|
||||
|
||||
fn message_allowed<'a>(&'a self)
|
||||
-> Box<FnMut(&PeerId, MessageIntent, &Block::Hash, &[u8]) -> bool + 'a>
|
||||
-> Box<dyn FnMut(&PeerId, MessageIntent, &Block::Hash, &[u8]) -> bool + 'a>
|
||||
{
|
||||
let (inner, do_rebroadcast) = {
|
||||
use parking_lot::RwLockWriteGuard;
|
||||
@@ -763,7 +763,7 @@ impl<Block: BlockT> network_gossip::Validator<Block> for GossipValidator<Block>
|
||||
})
|
||||
}
|
||||
|
||||
fn message_expired<'a>(&'a self) -> Box<FnMut(Block::Hash, &[u8]) -> bool + 'a> {
|
||||
fn message_expired<'a>(&'a self) -> Box<dyn FnMut(Block::Hash, &[u8]) -> bool + 'a> {
|
||||
let inner = self.inner.read();
|
||||
Box::new(move |topic, mut data| {
|
||||
// if the topic is not one of the ones that we are keeping at the moment,
|
||||
|
||||
@@ -103,7 +103,7 @@ pub trait AuthoritySetForFinalityChecker<Block: BlockT>: Send + Sync {
|
||||
}
|
||||
|
||||
/// FetchChecker-based implementation of AuthoritySetForFinalityChecker.
|
||||
impl<Block: BlockT> AuthoritySetForFinalityChecker<Block> for Arc<FetchChecker<Block>> {
|
||||
impl<Block: BlockT> AuthoritySetForFinalityChecker<Block> for Arc<dyn FetchChecker<Block>> {
|
||||
fn check_authorities_proof(
|
||||
&self,
|
||||
hash: Block::Hash,
|
||||
@@ -132,7 +132,7 @@ impl<Block: BlockT> AuthoritySetForFinalityChecker<Block> for Arc<FetchChecker<B
|
||||
/// Finality proof provider for serving network requests.
|
||||
pub struct FinalityProofProvider<B, E, Block: BlockT<Hash=H256>, RA> {
|
||||
client: Arc<Client<B, E, Block, RA>>,
|
||||
authority_provider: Arc<AuthoritySetForFinalityProver<Block>>,
|
||||
authority_provider: Arc<dyn AuthoritySetForFinalityProver<Block>>,
|
||||
}
|
||||
|
||||
impl<B, E, Block: BlockT<Hash=H256>, RA> FinalityProofProvider<B, E, Block, RA>
|
||||
@@ -147,7 +147,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA> FinalityProofProvider<B, E, Block, RA>
|
||||
/// - authority_provider for calling and proving runtime methods.
|
||||
pub fn new(
|
||||
client: Arc<Client<B, E, Block, RA>>,
|
||||
authority_provider: Arc<AuthoritySetForFinalityProver<Block>>,
|
||||
authority_provider: Arc<dyn AuthoritySetForFinalityProver<Block>>,
|
||||
) -> Self {
|
||||
FinalityProofProvider { client, authority_provider }
|
||||
}
|
||||
@@ -256,7 +256,7 @@ pub(crate) fn make_finality_proof_request<H: Encode + Decode>(last_finalized: H,
|
||||
/// Returns None if there are no finalized blocks unknown to the caller.
|
||||
pub(crate) fn prove_finality<Block: BlockT<Hash=H256>, B: BlockchainBackend<Block>, J>(
|
||||
blockchain: &B,
|
||||
authorities_provider: &AuthoritySetForFinalityProver<Block>,
|
||||
authorities_provider: &dyn AuthoritySetForFinalityProver<Block>,
|
||||
authorities_set_id: u64,
|
||||
begin: Block::Hash,
|
||||
end: Block::Hash,
|
||||
@@ -416,7 +416,7 @@ pub(crate) fn check_finality_proof<Block: BlockT<Hash=H256>, B>(
|
||||
blockchain: &B,
|
||||
current_set_id: u64,
|
||||
current_authorities: Vec<(AuthorityId, u64)>,
|
||||
authorities_provider: &AuthoritySetForFinalityChecker<Block>,
|
||||
authorities_provider: &dyn AuthoritySetForFinalityChecker<Block>,
|
||||
remote_proof: Vec<u8>,
|
||||
) -> ClientResult<FinalityEffects<Block::Header>>
|
||||
where
|
||||
@@ -435,7 +435,7 @@ fn do_check_finality_proof<Block: BlockT<Hash=H256>, B, J>(
|
||||
blockchain: &B,
|
||||
current_set_id: u64,
|
||||
current_authorities: Vec<(AuthorityId, u64)>,
|
||||
authorities_provider: &AuthoritySetForFinalityChecker<Block>,
|
||||
authorities_provider: &dyn AuthoritySetForFinalityChecker<Block>,
|
||||
remote_proof: Vec<u8>,
|
||||
) -> ClientResult<FinalityEffects<Block::Header>>
|
||||
where
|
||||
@@ -489,7 +489,7 @@ fn do_check_finality_proof<Block: BlockT<Hash=H256>, B, J>(
|
||||
fn check_finality_proof_fragment<Block: BlockT<Hash=H256>, B, J>(
|
||||
blockchain: &B,
|
||||
authority_set: AuthoritiesOrEffects<Block::Header>,
|
||||
authorities_provider: &AuthoritySetForFinalityChecker<Block>,
|
||||
authorities_provider: &dyn AuthoritySetForFinalityChecker<Block>,
|
||||
proof_fragment: FinalityProofFragment<Block::Header>,
|
||||
) -> ClientResult<AuthoritiesOrEffects<Block::Header>>
|
||||
where
|
||||
|
||||
@@ -76,7 +76,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA, PRA, SC> JustificationImport<Block>
|
||||
{
|
||||
type Error = ConsensusError;
|
||||
|
||||
fn on_start(&self, link: &::consensus_common::import_queue::Link<Block>) {
|
||||
fn on_start(&self, link: &dyn consensus_common::import_queue::Link<Block>) {
|
||||
let chain_info = self.inner.info().chain;
|
||||
|
||||
// request justifications for all pending changes for which change blocks have already been imported
|
||||
@@ -183,7 +183,7 @@ where
|
||||
);
|
||||
|
||||
match maybe_change {
|
||||
Err(e) => match api.has_api_with::<GrandpaApi<Block>, _>(&at, |v| v >= 2) {
|
||||
Err(e) => match api.has_api_with::<dyn GrandpaApi<Block>, _>(&at, |v| v >= 2) {
|
||||
Err(e) => return Err(ConsensusError::ClientImport(e.to_string()).into()),
|
||||
Ok(true) => {
|
||||
// API version is high enough to support forced changes
|
||||
|
||||
@@ -53,7 +53,7 @@ const LIGHT_CONSENSUS_CHANGES_KEY: &[u8] = b"grandpa_consensus_changes";
|
||||
/// Create light block importer.
|
||||
pub fn light_block_import<B, E, Block: BlockT<Hash=H256>, RA, PRA>(
|
||||
client: Arc<Client<B, E, Block, RA>>,
|
||||
authority_set_provider: Arc<AuthoritySetForFinalityChecker<Block>>,
|
||||
authority_set_provider: Arc<dyn AuthoritySetForFinalityChecker<Block>>,
|
||||
api: Arc<PRA>,
|
||||
) -> Result<GrandpaLightBlockImport<B, E, Block, RA>, ClientError>
|
||||
where
|
||||
@@ -80,7 +80,7 @@ pub fn light_block_import<B, E, Block: BlockT<Hash=H256>, RA, PRA>(
|
||||
/// - fetching finality proofs for blocks that are enacting consensus changes.
|
||||
pub struct GrandpaLightBlockImport<B, E, Block: BlockT<Hash=H256>, RA> {
|
||||
client: Arc<Client<B, E, Block, RA>>,
|
||||
authority_set_provider: Arc<AuthoritySetForFinalityChecker<Block>>,
|
||||
authority_set_provider: Arc<dyn AuthoritySetForFinalityChecker<Block>>,
|
||||
data: Arc<RwLock<LightImportData<Block>>>,
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA> FinalityProofImport<Block>
|
||||
{
|
||||
type Error = ConsensusError;
|
||||
|
||||
fn on_start(&self, link: &::consensus_common::import_queue::Link<Block>) {
|
||||
fn on_start(&self, link: &dyn consensus_common::import_queue::Link<Block>) {
|
||||
let chain_info = self.client.info().chain;
|
||||
|
||||
let data = self.data.read();
|
||||
@@ -160,7 +160,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA> FinalityProofImport<Block>
|
||||
hash: Block::Hash,
|
||||
number: NumberFor<Block>,
|
||||
finality_proof: Vec<u8>,
|
||||
verifier: &Verifier<Block>,
|
||||
verifier: &dyn Verifier<Block>,
|
||||
) -> Result<(Block::Hash, NumberFor<Block>), Self::Error> {
|
||||
do_import_finality_proof::<_, _, _, _, GrandpaJustification<Block>>(
|
||||
&*self.client,
|
||||
@@ -271,12 +271,12 @@ fn do_import_block<B, E, Block: BlockT<Hash=H256>, RA, J>(
|
||||
/// Try to import finality proof.
|
||||
fn do_import_finality_proof<B, E, Block: BlockT<Hash=H256>, RA, J>(
|
||||
client: &Client<B, E, Block, RA>,
|
||||
authority_set_provider: &AuthoritySetForFinalityChecker<Block>,
|
||||
authority_set_provider: &dyn AuthoritySetForFinalityChecker<Block>,
|
||||
data: &mut LightImportData<Block>,
|
||||
_hash: Block::Hash,
|
||||
_number: NumberFor<Block>,
|
||||
finality_proof: Vec<u8>,
|
||||
verifier: &Verifier<Block>,
|
||||
verifier: &dyn Verifier<Block>,
|
||||
) -> Result<(Block::Hash, NumberFor<Block>), ConsensusError>
|
||||
where
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
@@ -572,7 +572,7 @@ pub mod tests {
|
||||
{
|
||||
type Error = ConsensusError;
|
||||
|
||||
fn on_start(&self, link: &::consensus_common::import_queue::Link<Block>) {
|
||||
fn on_start(&self, link: &dyn consensus_common::import_queue::Link<Block>) {
|
||||
self.0.on_start(link)
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ pub mod tests {
|
||||
hash: Block::Hash,
|
||||
number: NumberFor<Block>,
|
||||
finality_proof: Vec<u8>,
|
||||
verifier: &Verifier<Block>,
|
||||
verifier: &dyn Verifier<Block>,
|
||||
) -> Result<(Block::Hash, NumberFor<Block>), Self::Error> {
|
||||
self.0.import_finality_proof(hash, number, finality_proof, verifier)
|
||||
}
|
||||
@@ -590,7 +590,7 @@ pub mod tests {
|
||||
/// Creates light block import that ignores justifications that came outside of finality proofs.
|
||||
pub fn light_block_import_without_justifications<B, E, Block: BlockT<Hash=H256>, RA, PRA>(
|
||||
client: Arc<Client<B, E, Block, RA>>,
|
||||
authority_set_provider: Arc<AuthoritySetForFinalityChecker<Block>>,
|
||||
authority_set_provider: Arc<dyn AuthoritySetForFinalityChecker<Block>>,
|
||||
api: Arc<PRA>,
|
||||
) -> Result<NoJustificationsImport<B, E, Block, RA>, ClientError>
|
||||
where
|
||||
|
||||
@@ -150,7 +150,10 @@ impl TestNetFactory for GrandpaTestNet {
|
||||
}
|
||||
}
|
||||
|
||||
fn make_finality_proof_provider(&self, client: PeersClient) -> Option<Arc<network::FinalityProofProvider<Block>>> {
|
||||
fn make_finality_proof_provider(
|
||||
&self,
|
||||
client: PeersClient
|
||||
) -> Option<Arc<dyn network::FinalityProofProvider<Block>>> {
|
||||
match client {
|
||||
PeersClient::Full(ref client) => {
|
||||
let authorities_provider = Arc::new(self.test_config.clone());
|
||||
@@ -201,7 +204,7 @@ impl MessageRouting {
|
||||
}
|
||||
|
||||
impl Network<Block> for MessageRouting {
|
||||
type In = Box<Stream<Item=network_gossip::TopicNotification, Error=()> + Send>;
|
||||
type In = Box<dyn Stream<Item=network_gossip::TopicNotification, Error=()> + Send>;
|
||||
|
||||
/// Get a stream of messages for a specific gossip topic.
|
||||
fn messages_for(&self, topic: Hash) -> Self::In {
|
||||
@@ -463,7 +466,7 @@ fn run_to_completion_with<F>(
|
||||
peers: &[AuthorityKeyring],
|
||||
with: F,
|
||||
) -> u64 where
|
||||
F: FnOnce(current_thread::Handle) -> Option<Box<Future<Item=(),Error=()>>>
|
||||
F: FnOnce(current_thread::Handle) -> Option<Box<dyn Future<Item=(), Error=()>>>
|
||||
{
|
||||
use parking_lot::RwLock;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user