refactor View to include finalized_number (#2128)

* refactor View to include finalized_number

* guide: update the NetworkBridge on BlockFinalized

* av-store: fix the tests

* actually fix tests

* grumbles

* ignore macro doctest

* use Hash::repeat_bytes more consistently

* broadcast empty leaves updates as well

* fix issuing view updates on empty leaves updates
This commit is contained in:
Andronik Ordian
2020-12-17 18:50:58 +01:00
committed by GitHub
parent 1aa2554000
commit 3f5156e866
24 changed files with 249 additions and 196 deletions
@@ -63,9 +63,7 @@ If we are connected to the same peer on both peer-sets, we will send the peer tw
### Overseer Signal: BlockFinalized
We obtain the number of the block hash in the event by issuing a `ChainApiMessage::BlockNumber` request and then issue a `ProtocolMessage::ViewUpdate` to each connected peer on each peer-set. We also issue a `NetworkBridgeEvent::OurViewChange` to each event handler for each protocol.
If we are connected to the same peer on both peer-sets, we will send the peer two view updates as a result.
We update our view's `finalized_number` to the provided one and delay `ProtocolMessage::ViewUpdate` and `NetworkBridgeEvent::OurViewChange` till the next `ActiveLeavesUpdate`.
### Network Event: Peer Connected
@@ -98,8 +96,6 @@ Map the message onto the corresponding [Event Handler](#event-handlers) based on
### ConnectToValidators
> TODO: Currently, this request is limited to the validators in the current session.
- Determine the DHT keys to use for each validator based on the relay-chain state and Runtime API.
- Recover the Peer IDs of the validators from the DHT. There may be more than one peer ID per validator.
- Send all `(ValidatorId, PeerId)` pairs on the response channel.