This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[WIP] Enable validators to find and connect to other validators #3247
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instead of building the network future via an independent function `build_network_future`, follow the convention introduced through `components.rs/OffchainWorker` and have `build_network_future` implement a trait.
The runtime SessionApi enables users to retrieve the ids of the current set of validators from the srml session module.
For a node to be able to learn its own authority id (public key) and to be able to sign payloads for the DHT, the node needs to retrieve its authority key. This is done via AuthorityKeyProvider.
The goal of the commit is to be able to retrieve the current set of authorities without needing to know the concrete consensus mechanism in place. In order to achieve the above this commit introduces the `core/consensus/common/primitives` crate, declaring the `ConsensusApi` runtime API. In addition it implements the above mentioned trait definition in `node/runtime` by returning the current authorities of the BABE consensus mechanism.
When retrieving addresses of other validators via the DHT, make sure they are within the current validator set and the payload is properly signed with the authority key.
mxinden
added
A3-in_progress
Pull request is in progress. No review needed at this stage.
I9-optimisation
An enhancement to provide better overall performance in terms of time-to-completion for a task.
M4-core
labels
Jul 30, 2019
This should use |
This was referenced Aug 1, 2019
Status: Waiting for #3296 as this pull request requires retrieving the current authority key. |
gavofyork
removed
the
I9-optimisation
An enhancement to provide better overall performance in terms of time-to-completion for a task.
label
Aug 8, 2019
andresilva
suggested changes
Aug 9, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick review.
status_sinks.lock().retain(|sink| sink.unbounded_send((status.clone(), state.clone())).is_ok()); | ||
} | ||
|
||
let authorities = client.runtime_api().authorities(&BlockId::hash(client.info().chain.best_hash)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For GRANDPA we need to check the active authority set from the node state and not the runtime, it is tracked here. Maybe we can just pass a Fn() -> Vec<Authority>
into this function and then build up the authorities externally (babe authorities + grandpa authorities).
Replaced by #3452. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal of this pull request is to enable Substrate validators to directly connect to other validators. With this pull request a validator does two things:
Making itself discoverable
Discovering other validators
reservedpriority nodes to the peersetThe first point Making itself discoverable fixes #3247.
Pull request status:
Work in progress
To do: