Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
More doc fixes.
  • Loading branch information
eskimor committed Jan 13, 2021
commit c06c965017c1be1a01cdf981dca656b9db6a5c72
8 changes: 7 additions & 1 deletion node/network/bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const EMPTY_VIEW_COST: ReputationChange = ReputationChange::new(-500, "Peer sent
// network bridge log target
const LOG_TARGET: &'static str = "network_bridge";

/// Messages received on the network.
/// Messages from and to the network.
#[derive(Debug, Encode, Decode, Clone)]
pub enum WireMessage<M> {
/// A message from a peer on a specific protocol.
Expand Down Expand Up @@ -256,6 +256,11 @@ struct PeerData {
view: View,
}

/// Internal type combining all actions a `NetworkBridge` might perform.
///
/// Both messages coming from the network (`NetworkEvent`) and messages coming from other
/// subsystems (`FromOverseer`) will be converted to `Action` in `run_network` before being
/// processed.
#[derive(Debug)]
enum Action {
SendValidationMessages(Vec<(Vec<PeerId>, protocol_v1::ValidationProtocol)>),
Expand Down Expand Up @@ -597,6 +602,7 @@ async fn dispatch_collation_events_to_all<I>(
ctx.send_messages(events.into_iter().flat_map(messages_for)).await
}

/// Main driver, processing network events and messages from other subsystems.
#[tracing::instrument(skip(network_service, authority_discovery_service, ctx), fields(subsystem = LOG_TARGET))]
async fn run_network<N, AD>(
mut network_service: N,
Expand Down
6 changes: 3 additions & 3 deletions roadmap/implementers-guide/src/node/utility/network-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Output:
This network bridge sends messages of these types over the network.

```rust
enum ProtocolMessage<M> {
enum WireMessage<M> {
ProtocolMessage(M),
ViewUpdate(View),
}
Expand All @@ -41,8 +41,8 @@ enum ProtocolMessage<M> {
and instantiates this type twice, once using the [`ValidationProtocolV1`][VP1] message type, and once with the [`CollationProtocolV1`][CP1] message type.

```rust
type ValidationV1Message = ProtocolMessage<ValidationProtocolV1>;
type CollationV1Message = ProtocolMessage<CollationProtocolV1>;
type ValidationV1Message = WireMessage<ValidationProtocolV1>;
type CollationV1Message = WireMessage<CollationProtocolV1>;
```

### Startup
Expand Down