Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

client/authority-discovery: Add option to specify relevant authority set #6595

Closed
Tracked by #989
mxinden opened this issue Jul 7, 2020 · 2 comments · Fixed by #6760
Closed
Tracked by #989

client/authority-discovery: Add option to specify relevant authority set #6595

mxinden opened this issue Jul 7, 2020 · 2 comments · Fixed by #6760
Assignees
Labels
J0-enhancement An additional feature request. U2-some_time_soon Issue is worth doing soon. Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase.

Comments

@mxinden
Copy link
Contributor

mxinden commented Jul 7, 2020

Today the Substrate authority discovery module retrieves the AuthorityIds of all validators of the current validator set from the authorities() runtime API.

Polkadot Collators don't want to connect to all nodes within the current validator set, but instead only to those nodes that are currently assigned as validators of their parachain.

This issue suggests to make AuthorityDiscovery listen on a channel for incoming Commands where the only enum variant would be Command::SetAuthorities(Vec<AuthorityId>) (for now). Instead of considering all validator nodes for the peer set priority group it would then only consider the subset.

The channel can be an implementation detail by wrapping it in a AuthorityDiscoveryClient:

struct AuthorityDiscoveryClient(Sender<Command>)

impl AuthorityDiscoveryClient {
  async fn set_authorities(authorities: Vec<AuthorityId>) {
    self.0.send(Command::SetAuthorities(authorities)).await;
  }
}

FAQ

  • Why not introduce a new method set_authorities on the AuthorityDiscovery struct?

    The AuthorityDiscovery struct is spawned as a Future onto an executor. Thus there is no way to call such method after spawning.

@mxinden mxinden added J0-enhancement An additional feature request. U2-some_time_soon Issue is worth doing soon. Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. labels Jul 7, 2020
@mxinden mxinden self-assigned this Jul 7, 2020
@tomaka
Copy link
Contributor

tomaka commented Jul 27, 2020

Instead of doing this, what do you think of:

  • Continue to let the authority-discovery discover all validators, as it does today.
  • The authority-discovery would no longer automatically update the peerset. It would just be a passive service running in the background.
  • Add some method somewhere to query the list of peerids/addresses of a given validator from the authority-discovery.

This way, when Polkadot knows the list of validator IDs we need to be connected to, it would ask the authority-discovery for the corresponding PeerIds/addresses, and do the peerset update itself.

This generally seems to me like a better way to design the system.

@mxinden
Copy link
Contributor Author

mxinden commented Jul 29, 2020

#6760 is a first proof of concept for the suggestion above allowing to retrieve the cached addresses for a given AuthorityId.

Next steps:

@ghost ghost closed this as completed in #6760 Aug 12, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request. U2-some_time_soon Issue is worth doing soon. Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants