-
Notifications
You must be signed in to change notification settings - Fork 2.6k
*: Disable authority discovery module #3914
*: Disable authority discovery module #3914
Conversation
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.
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.
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); |
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.
Is this unused now?
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.
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 |
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.
Nice ;)
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 theauthority discovery module, so eventually we can re-enable it.
Relates to #3452.