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

client/finality-grandpa: Reintegrate periodic neighbor packet worker #4631

Merged
merged 5 commits into from
Jan 17, 2020

Commits on Jan 15, 2020

  1. client/finality-grandpa: Reintegrate periodic neighbor packet worker

    The `NeighborPacketWorker` within `client/finality-grandpa` does two
    things:
    
    1. It receives neighbor packets from components within
    `client/finality-grandpa`, sends them down to the `GossipEngine` in
    order for neighboring nodes to receive.
    
    2. It periodically sends out the most recent neighbor packet to the
    `GossipEngine`.
    
    In order to send out packets it had a clone to a `GossipEgine` within
    an atomic reference counter and a mutex. The `NeighborPacketWorker` was
    then spawned onto its own asynchronous task.
    
    Instead of running in its own task, this patch reintegrates the
    `NeighborPacketWorker` into the main `client/finality-grandpa` task not
    requiring the `NeighborPacketWorker` to own a clone of the
    `GossipEngine`.
    
    The greater picture
    
    This is a tiny change within a greater refactoring. The overall goal is
    to **simplify** how finality-grandpa interacts with the network and to
    **reduce** the amount of **unbounded channels** within the logic.
    
    Why no unbounded channels: Bounding channels is needed for backpressure
    and proper scheduling. With unbounded channels there is no way of
    telling the producer side to slow down for the consumer side to catch
    up.  Rephrased, there is no way for the scheduler to know when to favour
    the consumer task over the producer task on a crowded channel and the
    other way round for an empty channel.
    
    Reducing the amount of shared ownership simplifies the logic and enables
    one to use async-await syntax-suggar, given that one does not need to
    hold a lock across poll invocations. Using async-await enables one to
    use bounded channels without complex logic.
    mxinden committed Jan 15, 2020
    Configuration menu
    Copy the full SHA
    030f26f View commit details
    Browse the repository at this point in the history

Commits on Jan 16, 2020

  1. client/finality-grandpa: Implement Unpin on structs instead of bound

    Instead of requiring `Unpin` on all generic trait bounds involved in
    anything ever `poll`ed, one can implement `Unpin` on the structs being
    `poll`ed themselves.
    mxinden committed Jan 16, 2020
    Configuration menu
    Copy the full SHA
    799356e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5ff36e6 View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2020

  1. client/finality-grandpa/src/communication/mod.rs: Fix typo

    Co-Authored-By: André Silva <andre.beat@gmail.com>
    mxinden and andresilva authored Jan 17, 2020
    Configuration menu
    Copy the full SHA
    a72797b View commit details
    Browse the repository at this point in the history
  2. client/finality-grandpa/src/communication/mod.rs: Fix typo

    Co-Authored-By: André Silva <andre.beat@gmail.com>
    mxinden and andresilva authored Jan 17, 2020
    Configuration menu
    Copy the full SHA
    01d8d4e View commit details
    Browse the repository at this point in the history