Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

network: Use "one shot" protocol handler. #3520

Merged
merged 4 commits into from
Feb 12, 2020

Commits on Feb 10, 2020

  1. network: Use "one shot" protocol handler.

    Add two new `NetworkBehaviour`s, one handling remote block requests
    and another one to handle light client requests (both local and from
    remote). The change is motivated by the desire to use multiple
    substreams of a single connection for different protocols. To achieve
    this, libp2p's `OneShotHandler` is used as a protocol handler in each
    behaviour. It will open a fresh substream for the duration of the
    request and close it afterwards. For block requests, we currently only
    handle incoming requests from remote and tests are missing. For light
    client handling we support incoming requests from remote and also
    ported a substantial amount of functionality over from
    `light_dispatch.rs` (including several tests). However the result lacks
    in at least two aspects:
    
    (1) We require external updates w.r.t. the best block per peer and
    currently nothing updates this information.
    (2) We carry a lot of peer-related state around.
    
    Both aspects could be simplified by externalising peer selection and
    just requiring a specific peer ID where the request should be sent to.
    We still have to maintain some peer related state due to the way
    libp2p's swarm and network behaviour work (e.g. we must make sure to
    always issue `NetworkBehaviourAction::SendEvent`s to peers we are
    connected to, otherwise the actions die a silent death.
    
    Another change implemented here is the use of protocol buffers as the
    encoding for network messages. Certain individual fields of messages
    are still SCALE encoded. There has been some discussion about this
    in another PR (paritytech#3452), so
    far without resolution.
    twittner committed Feb 10, 2020
    Configuration menu
    Copy the full SHA
    c5b5c0d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cb038dd View commit details
    Browse the repository at this point in the history

Commits on Feb 11, 2020

  1. Configuration menu
    Copy the full SHA
    13b093f View commit details
    Browse the repository at this point in the history
  2. Add license headers.

    twittner committed Feb 11, 2020
    Configuration menu
    Copy the full SHA
    79a65a0 View commit details
    Browse the repository at this point in the history