mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Substrate companion: Authority discovery multiple peer ids (#4295)
* Substrate companion: Authority discovery multiple peer ids Authority discovery before had a fixed mapping from `PeerId` to `AuthorityId`. This wasn't correct, as a `PeerId` can actually map to multiple `AuthorityId`s. The linked Substrate pr fixes this. https://github.com/paritytech/substrate/pull/10259 * Update node/network/availability-distribution/src/requester/mod.rs * Update node/network/collator-protocol/src/validator_side/mod.rs * Update node/network/statement-distribution/src/tests.rs * Update guide * Adapt to Substrate pr * Update Substrate
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Authority discovery service interfacing.
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::{collections::HashSet, fmt::Debug};
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
@@ -34,12 +34,12 @@ pub trait AuthorityDiscovery: Send + Debug + 'static {
|
||||
async fn get_addresses_by_authority_id(
|
||||
&mut self,
|
||||
authority: AuthorityDiscoveryId,
|
||||
) -> Option<Vec<Multiaddr>>;
|
||||
) -> Option<HashSet<Multiaddr>>;
|
||||
/// Get the [`AuthorityId`] for the given [`PeerId`] from the local address cache.
|
||||
async fn get_authority_id_by_peer_id(
|
||||
async fn get_authority_ids_by_peer_id(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
) -> Option<AuthorityDiscoveryId>;
|
||||
) -> Option<HashSet<AuthorityDiscoveryId>>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -47,14 +47,14 @@ impl AuthorityDiscovery for AuthorityDiscoveryService {
|
||||
async fn get_addresses_by_authority_id(
|
||||
&mut self,
|
||||
authority: AuthorityDiscoveryId,
|
||||
) -> Option<Vec<Multiaddr>> {
|
||||
) -> Option<HashSet<Multiaddr>> {
|
||||
AuthorityDiscoveryService::get_addresses_by_authority_id(self, authority).await
|
||||
}
|
||||
|
||||
async fn get_authority_id_by_peer_id(
|
||||
async fn get_authority_ids_by_peer_id(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
) -> Option<AuthorityDiscoveryId> {
|
||||
AuthorityDiscoveryService::get_authority_id_by_peer_id(self, peer_id).await
|
||||
) -> Option<HashSet<AuthorityDiscoveryId>> {
|
||||
AuthorityDiscoveryService::get_authority_ids_by_peer_id(self, peer_id).await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user