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

*: Disable authority discovery module #3914

Merged
merged 3 commits into from
Oct 28, 2019

Conversation

mxinden
Copy link
Contributor

@mxinden mxinden commented Oct 25, 2019

The authority discovery module enables authorities to be discoverable
and discover other authorities to improve interconnection among them. In
order to achieve this the module needs to know when the authority set
changes, thus when a session changes.

One has to register a module as a session handler in order for it to
be notified of changing sessions. The order and number of these session
handlers
MUST correspond to the order and number of the session
keys
.

Commit 7fc21ce added the authority discovery to the SessionHandlers.
Given that the authority discovery module piggybacks on the Babe session
keys the commit violated the above constraint.

This commit reverts most of 7fc21ce, leaving core/authority-discovery
and srml/authority-discovery untouched. I am currently refactoring the
authority discovery module, so eventually we can re-enable it.

Relates to #3452.

The authority discovery module enables authorities to be discoverable
and discover other authorities to improve interconnection among them. In
order to achieve this the module needs to know when the authority set
changes, thus when a session changes.

One has to register a module as a *session handler* in order for it to
be notified of changing sessions. The order and number of these *session
handlers* **MUST** correspond to the order and number of the *session
keys*.

Commit 7fc21ce added the authority discovery to the `SessionHandlers`.
Given that the authority discovery module piggybacks on the Babe session
keys the commit violated the above constraint.

This commit reverts most of 7fc21ce, leaving `core/authority-discovery`
and `srml/authority-discovery` untouched.
@mxinden mxinden added A0-please_review Pull request needs code review. A6-revertrevert labels Oct 25, 2019
Copy link
Contributor

@marcio-diaz marcio-diaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

let (dht_event_tx, dht_event_rx) =
mpsc::channel::<DhtEvent>(10000);
let (dht_event_tx, _dht_event_rx) =
mpsc::channel::<DhtEvent>(10_000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this unused now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is unused now @marcio-diaz. I kept it here with the following reasoning:

  • This commit is only temporary and will be reverted once the authority discovery refactoring is done.

  • As of my knowledge no one other than the authority discovery module is using Kademlia, thus no events are being produced. (Will check back with @montekki)

  • Given that no other module depends on the receiving side, this only affects the authority discovery module.

  • The receiver goes out of scope, thus the channel will be closed. Even if not the channel is bounded, thus we don't have a memory leak.

  • Even if events are produced, the network will drop them here: https://github.com/paritytech/substrate/blob/master/core/service/src/lib.rs#L449

@@ -211,7 +209,10 @@ impl authorship::Trait for Runtime {
type EventHandler = Staking;
}

type SessionHandlers = (Grandpa, Babe, ImOnline, AuthorityDiscovery);
// !!!!!!!!!!!!!
// WARNING!!!!!! SEE NOTE BELOW BEFORE TOUCHING THIS CODE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants