-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into haiko/remove-ecs-gha
- Loading branch information
Showing
43 changed files
with
1,171 additions
and
104 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
layout: default | ||
title: Authority Discovery Overview | ||
permalink: /design/authority-discovery/ | ||
--- | ||
|
||
# Authority Discovery | ||
|
||
## Questions | ||
|
||
### Is the authority discovery implemented on Kademlia for a custom peer discovery? | ||
|
||
No, it uses Kademlia capabilities however it adds a custom handlers for DHT Events, like: DhtEvent::ValueFound | ||
- DhtEvent::ValueNotFound | ||
- DhtEvent::ValuePut | ||
- DhtEvent::ValuePutFailed | ||
- DhtEvent::PutRecordRequest | ||
|
||
These events are produced by the Discovery layer (Kademlia) and propagated to the `authority-discovery` that handles each of them. Specifically for `DhtEvent::PutRecordRequest` it does a validation step and then store the record. | ||
|
||
What happens is that the `authority-discovery` is the actual protocol implementation for discovery in substrate/polkadot given that it produces and store the records that are available in the DHT for other peers to query, validate and use. | ||
|
||
### What are the functionalities of the authority discovery, beyond discovery new peers based on its authority ids? | ||
|
||
- Publish the node external address, more specifically, create the authority discovery record, sign it and distributing through DHT allowing other nodes to query it. | ||
- Handle DHT events, validating incoming records and caching other authorities address. | ||
|
||
### What subsystems uses the authority discovery mechanism? Describe the usages. | ||
|
||
- Availability Distribution | ||
- Availability Recovery | ||
- Gossip Support | ||
|
||
### Check if we can currently extend the authority discovery protocol can to golang kademlia p2p library | ||
|
||
Yes, we pretty much can implement the protocol. | ||
- We are able to encode the records using the same [proto schema used by substrate/polkadot](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/client/authority-discovery/src/worker/schema/dht-v3.proto) - We can query for specific keys in DHT. | ||
- What can write a custom validator to validate incoming records. | ||
- golang-libp2p does not works in the same way rust-libp2p works by enabling us to receive those DHT events but we can achieve the same protocol implementation using what the library provide to us. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
layout: default | ||
title: Gossip Support | ||
permalink: /design/gossip-support/ | ||
--- | ||
|
||
# Gossip Support | ||
|
||
Gossip support is a short subsystem that cares about handling active leaves and network bridge update events. | ||
|
||
## Functionalities | ||
|
||
- **Check connectivity**: The subsystem contains a timer that triggers every 600 seconds (10 minutes) a connectivity check that is a simple verification on the amount of authorities connected against the actual set of authorities, if the percentage of connected authorities is bellow 90% the node will issue WARN logs. | ||
|
||
- **Handle Active Leaves**: | ||
- Given the current values in the state, **last failure** and **last connection request**, the subsystem should force new requests or re-resolve authorities | ||
- Determine if the current session index has changed, if so determine relevant validators and issue connection request. The subsystem should change the **last sesison index** value only if it is possible to retrieve the new session info. | ||
- If we notice that a new session is starting we should update our authority ids cache and send a `NetworkBridgeRxMessage::UpdatedAuthorityIds` message with informations about the new set of authorities. | ||
|
||
- **Handle Network Bridge Update**: | ||
- In the above point, when handling active leaves, we issue connection requests and whenever a new connection is stablished or a disconnection happens for some reason. The subsytems listen on any network bridge update about `NetworkBridgeEvent::PeerConnected` and `NetworkBridgeEvent::PeerDisconnected`, other updates are not important. | ||
|
||
## State | ||
|
||
The subsystem state is composed of: | ||
|
||
- Keystore | ||
- Last Session Index | ||
- **Last Failure**: last time we could not resolve a third of the authorities | ||
- **Last Connection Request**: is possible that validators change their peer IDs in during a session. If that happens we will reconnect to them in the best case after a session, so we need to try more often to resolve peers and reconnect to them. We cannot detect changes faster them Authority Discovery DHT queries. | ||
- **Failure Start**: first time the node cannot reach the connectivity threshold | ||
- **Resolved Authorities**: A map of resolved authority IDs to a set of multiaddr, basically we were able to find the addresses for authorities, not mean we are actually connected to them. | ||
- **Connected Authorities**: A map of actual authorities ID's connected to their PeerId | ||
- **Connected Peers**: A map of PeerId to authority IDs for fast lookup | ||
- **Authority Discovery**: authority discovery service, allows us to resolve authorities addresses. | ||
|
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.