1. Mar 20, 2023
    • Davide Galassi's avatar
      Keystore overhaul (iter 2) (#13634) · 480396fe
      Davide Galassi authored
      * Remove bloat about remote keystore
      
      * Update docs and remove unused 'KeystoreRef' trait
      
      * Use wherever possible, MemoryKeystore for testing
      
      * Remove unrequired fully qualified method syntax for Keystore
      480396fe
  2. Mar 17, 2023
    • Davide Galassi's avatar
      Keystore overhaul (#13615) · f110941b
      Davide Galassi authored
      * Remove 'supported_keys' 'sign_with_any' and 'sign_with_all' from keystore trait
      
      * Remove the aync keystore
      
      * Renaming:
      - SyncCryptoStore -> Keystore
      - SyncCryptoStorePtr -> KeystorePtr
      - KeyStore -> MemoryKeystore
      
      * Fix authority discovery worker and tests
      
      * Rename 'insert_unknown' to 'insert'
      
      * Remove leftover
      f110941b
  3. Mar 16, 2023
    • Adrian Catangiu's avatar
      sc-consensus-beefy: improve beefy gossip validator (#13606) · 3708b156
      Adrian Catangiu authored
      
      
      * sc-consensus-beefy: improve beefy gossip validator
      
      Old gossip validator was pretty dumb, being very permissive with
      incoming votes - only condition it had was to be newer than best
      finalized.
      
      New filter conditions:
       - voter rounds are initialized (discarding votes until voter is
         actually active),
       - only votes for current active set id are accepted,
       - only votes for rounds in the current voting session are accepted,
       - only votes for GRANDPA finalized blocks are accepted,
       - when BEEFY voter reaches mandatory round, only votes for said
         mandatory round are accepted.
      
      New validator uses the VoterOracle to easily implement above conditions
      and only allow through votes that are immediately useful to the voter.
      
      After every GRANDPA or BEEFY finality, the gossip validator filter is
      updated.
      
      * sc-consensus-beefy: remove votes enqueueing
      
      Since gossip validator will simply disallow votes for future rounds,
      and only allow votes that the voter can immediately process, there
      is no need for the voter to enqueue votes.
      
      It will see these "future" votes later in rebroadcasts, when voter
      will also be able to process them. Only at that point does gossip
      accept and consume them.
      
      * sc-consensus-beefy: refactor persistent state
      
      Move best-beefy and best-grandpa into VoterOracle instead
      of passing them around as params.
      VoterOracle ultimately needs to know best-beefy and/or best-grandpa
      for most of its functions.
      
      * sc-consensus-beefy: further restrict gossip validator
      
      Assuming mandatory done in current session:
      Instead of allowing votes for any round in the current session, only
      accept votes for rounds equal or better than best BEEFY finalized.
      
      * sc-consensus-beefy: add a couple of comments
      
      * sc-consensus-beefy: fix tests involving multiple tasks
      
      Finalize blocks one a time in tests where we want gossip to happen
      in a certain round. Otherwise, some tasks may be left behind in
      terms of gossip round numbers because once "scheduled" a task will
      greedily process as much as possible.
      
      This change should be in line with the real-world scenario where
      voters run "in parallel" across nodes, the only points of
      synchronization being the finality notifications.
      
      * sc-consensus-beefy: address review comments
      
      ---------
      
      Signed-off-by: default avataracatangiu <[email protected]>
      3708b156
  4. Mar 14, 2023
    • Adrian Catangiu's avatar
      sc-consensus-beefy: fix on-demand async state machine (#13599) · 81a02cb7
      Adrian Catangiu authored
      
      
      `futures_util::pending!()` macro only yields to the event loop once,
      resulting in many calls to the `OnDemandJustificationsEngine::next()`
      made by the tokio reactor even though the on-demand-engine is idle.
      
      Replace it with the correct `futures::future::pending::<()>()` function
      which forever yields to the event loop, which is what we want when
      the engine is idle.
      
      Signed-off-by: default avatarAdrian Catangiu <[email protected]>
      81a02cb7
    • Aaro Altonen's avatar
      Move code from `sc-network-common` back to `sc-network` (#13592) · 9ced14e2
      Aaro Altonen authored
      
      
      * Move service tests to `client/network/tests`
      
      These tests depend on `sc-network` and `sc-network-sync` so they should
      live outside the crate.
      
      * Move some configs from `sc-network-common` to `sc-network`
      
      * Move `NetworkService` traits to `sc-network`
      
      * Move request-responses to `sc-network`
      
      * Remove more stuff
      
      * Remove rest of configs from `sc-network-common` to `sc-network`
      
      * Remove more stuff
      
      * Fix warnings
      
      * Update client/network/src/request_responses.rs
      
      Co-authored-by: default avatarDmitry Markin <[email protected]>
      
      * Fix cargo doc
      
      ---------
      
      Co-authored-by: default avatarDmitry Markin <[email protected]>
      9ced14e2
  5. Mar 07, 2023
  6. Mar 06, 2023
    • Aaro Altonen's avatar
      Extract syncing protocol from `sc-network` (#12828) · 1a7f5be0
      Aaro Altonen authored
      
      
      * Move import queue out of `sc-network`
      
      Add supplementary asynchronous API for the import queue which means
      it can be run as an independent task and communicated with through
      the `ImportQueueService`.
      
      This commit removes removes block and justification imports from
      `sc-network` and provides `ChainSync` with a handle to import queue so
      it can import blocks and justifications. Polling of the import queue is
      moved complete out of `sc-network` and `sc_consensus::Link` is
      implemented for `ChainSyncInterfaceHandled` so the import queue
      can still influence the syncing process.
      
      * Move stuff to SyncingEngine
      
      * Move `ChainSync` instanation to `SyncingEngine`
      
      Some of the tests have to be rewritten
      
      * Move peer hashmap to `SyncingEngine`
      
      * Let `SyncingEngine` to implement `ChainSyncInterface`
      
      * Introduce `SyncStatusProvider`
      
      * Move `sync_peer_(connected|disconnected)` to `SyncingEngine`
      
      * Implement `SyncEventStream`
      
      Remove `SyncConnected`/`SyncDisconnected` events from
      `NetworkEvenStream` and provide those events through
      `ChainSyncInterface` instead.
      
      Modify BEEFY/GRANDPA/transactions protocol and `NetworkGossip` to take
      `SyncEventStream` object which they listen to for incoming sync peer
      events.
      
      * Introduce `ChainSyncInterface`
      
      This interface provides a set of miscellaneous functions that other
      subsystems can use to query, for example, the syncing status.
      
      * Move event stream polling to `SyncingEngine`
      
      Subscribe to `NetworkStreamEvent` and poll the incoming notifications
      and substream events from `SyncingEngine`.
      
      The code needs refactoring.
      
      * Make `SyncingEngine` into an asynchronous runner
      
      This commits removes the last hard dependency of syncing from
      `sc-network` meaning the protocol now lives completely outside of
      `sc-network`, ignoring the hardcoded peerset entry which will be
      addressed in the future.
      
      Code needs a lot of refactoring.
      
      * Fix warnings
      
      * Code refactoring
      
      * Use `SyncingService` for BEEFY
      
      * Use `SyncingService` for GRANDPA
      
      * Remove call delegation from `NetworkService`
      
      * Remove `ChainSyncService`
      
      * Remove `ChainSync` service tests
      
      They were written for the sole purpose of verifying that `NetworWorker`
      continues to function while the calls are being dispatched to
      `ChainSync`.
      
      * Refactor code
      
      * Refactor code
      
      * Update client/finality-grandpa/src/communication/tests.rs
      
      Co-authored-by: default avatarAnton <[email protected]>
      
      * Fix warnings
      
      * Apply review comments
      
      * Fix docs
      
      * Fix test
      
      * cargo-fmt
      
      * Update client/network/sync/src/engine.rs
      
      Co-authored-by: default avatarAnton <[email protected]>
      
      * Update client/network/sync/src/engine.rs
      
      Co-authored-by: default avatarAnton <[email protected]>
      
      * Add missing docs
      
      * Refactor code
      
      ---------
      
      Co-authored-by: default avatarAnton <[email protected]>
      1a7f5be0
  7. Mar 01, 2023
  8. Feb 28, 2023