ChainSafe / ChainSafe/gossamer

Design and plan network-bridge to rely on `Network` and `NotificationService`

Open
#4,811 0 comments 0 reactions 0 assignees View on GitHub
T-implementation
Dominant language
Go
Stars
454
Forks
144
PR merge metrics
No merged PRs in 30d

Description

## Issue summary

- Currently parachain has the responsability to register its own protocol stream handlers
- The responsability to register protocol stream handlers should not be in the parachains package but in the network layer which should provide to the network bridge an API to be aware of any received message. That's the point of relying on `NotificationService`
- The `Network` interface is the API of network layer where resides the peer reputation and send request methods used by parachains subsystems.

## Implementation details

- Basically the network bridge has its own Network Service interface implemenation that under the hood uses the `NetworkService` implementation of substrate client. What the `network-bridge` Network Service interface has differently is the `start_request` method that should be implemented as it requires the authority discovery as part of the logic and in the end uses substrate NetworkService interface to perform the raw p2p request.

## Other information and links

- https://github.com/paritytech/polkadot-sdk/blob/3ff1b1db36260cbc47297ab753e2dcec1f5999fd/substrate/client/network/src/service/traits.rs#L893
- https://github.com/paritytech/polkadot-sdk/blob/21fbd6b59d37fd18a00d0ec4b6f72dc376d63010/polkadot/node/network/bridge/src/network.rs#L159

## Acceptance criteria

[] Add AC's here..
[] Regression testing (if applicable)
[] New code is 60% covered with unit tests

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.