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

Split the Roles in three types #5520

Merged
merged 17 commits into from
Apr 3, 2020
Merged

Split the Roles in three types #5520

merged 17 commits into from
Apr 3, 2020

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Apr 3, 2020

Reopening #5492 so that the CI scripts works when picking the Polkadot companion.

---- Original description ----

This PR splits the Roles bitfield in three:

  • The existing Roles has been moved untouched into the sc_network::protocol::message module, where it continues to represent the data that is transferred on the wire.

  • sc_network::config now contains a new Role (note the lack of 's') enum whose variants are Full, Light, Sentry and Authority. It is more robust to misuse, as one can only pass a list of sentry nodes when using Authority, and a valiator when using Sentry.

  • The gossiping API now uses ObservedRole, which is an enum that can be one of Full, Light, OurSentry (for when you're a validator connecting to your sentry), OurGuardedValidator (for when you're a sentry connecting to your validator), or Authority (for third-party validators).

GrandPa has been adjusted to always gossip messages to nodes whose role is OurSentry or OurGuardedValidator. This fixes some issues with validators not receiving GrandPa messages from their sentries. This change is the original reason for this PR.

Additionally, the --sentry CLI option now accepts a list of multiaddress as parameter, representing the addresses of the validators we're protecting. This is a CLI breaking change.

While modifying the CLI code, I encountered some issues with how to properly build a Role::Authority when the parameter of --sentry is a String.
To fix that, I changed various Strings in the structopt structs in sc_cli to instead contain a Multiaddr or MultiaddrWithPeerId (a new type introduced in this PR).

Some other minor changes:

  • client/rpc/api/system::NodeRole now contains a Sentry variant. In other words, querying the node role from the RPC endpoint will now return "sentry" for sentries.
  • authority_discovery now accepts a Vec<MultiaddrWithPeerId> instead of a Vec<String> in accordance with the changes in the CLI.
  • The node_role Prometheus metric will now contain the value 3 for sentries, rather than 4 (4 meaning "authority").

polkadot companion: paritytech/polkadot#960

@tomaka tomaka changed the title Tka update roles Split the Roles in three types Apr 3, 2020
@gavofyork gavofyork merged commit 525cb7a into master Apr 3, 2020
@gavofyork gavofyork deleted the tka-update-roles branch April 3, 2020 17:08
@tomaka tomaka mentioned this pull request Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants