cleanup validator discovery (#1992)

* use snake_case for log targets

* remove unused continue

* validator_discovery: when disconnecting, use all addresses

* validator_discovery: simplify request revokation

* fix a typo
This commit is contained in:
Andronik Ordian
2020-11-20 19:34:57 +01:00
committed by GitHub
parent 0a5bc82529
commit 97f5bd9047
9 changed files with 33 additions and 128 deletions
@@ -54,8 +54,8 @@ enum ApprovalVotingMessage {
/// Check if the assignment is valid and can be accepted by our view of the protocol.
/// Should not be sent unless the block hash is known.
CheckAndImportAssignment(
Hash,
AssignmentCert,
Hash,
AssignmentCert,
ValidatorIndex,
ResponseChannel<VoteCheckResult>,
),
@@ -68,11 +68,11 @@ enum ApprovalVotingMessage {
ResponseChannel<VoteCheckResult>,
),
/// Returns the highest possible ancestor hash of the provided block hash which is
/// acceptable to vote on finality for.
/// acceptable to vote on finality for.
/// The `BlockNumber` provided is the number of the block's ancestor which is the
/// earliest possible vote.
///
/// It can also return the same block hash, if that is acceptable to vote upon.
///
/// It can also return the same block hash, if that is acceptable to vote upon.
/// Return `None` if the input hash is unrecognized.
ApprovedAncestor(Hash, BlockNumber, ResponseChannel<Option<Hash>>),
}
@@ -122,8 +122,8 @@ Messages received by the availability recovery subsystem.
enum AvailabilityRecoveryMessage {
/// Recover available data from validators on the network.
RecoverAvailableData(
CandidateDescriptor,
SessionIndex,
CandidateDescriptor,
SessionIndex,
ResponseChannel<Option<AvailableData>>,
),
}
@@ -293,6 +293,7 @@ enum NetworkBridgeMessage {
///
/// Also ask the network to stay connected to these peers at least
/// until the request is revoked.
/// This can be done by dropping the receiver.
ConnectToValidators {
/// Ids of the validators to connect to.
validator_ids: Vec<AuthorityDiscoveryId>,
@@ -300,13 +301,6 @@ enum NetworkBridgeMessage {
/// the validators as they are connected.
/// The response is sent immediately for already connected peers.
connected: ResponseStream<(AuthorityDiscoveryId, PeerId)>,
/// By revoking the request the caller allows the network to
/// free some peer slots thus freeing the resources.
/// It doesn't necessarily lead to peers disconnection though.
/// The revokation is enacted on in the next connection request.
///
/// This can be done by sending to the channel or dropping the sender.
revoke: ReceiverChannel<()>,
},
}
```
@@ -409,7 +403,7 @@ enum RuntimeApiRequest {
SessionIndex(ResponseChannel<SessionIndex>),
/// Get the validation code for a specific para, using the given occupied core assumption.
ValidationCode(ParaId, OccupiedCoreAssumption, ResponseChannel<Option<ValidationCode>>),
/// Fetch the historical validation code used by a para for candidates executed in
/// Fetch the historical validation code used by a para for candidates executed in
/// the context of a given block height in the current chain.
HistoricalValidationCode(ParaId, BlockNumber, ResponseChannel<Option<ValidationCode>>),
/// with the given occupied core assumption.