1. Aug 28, 2020
    • Max Inden's avatar
      client/*: Treat protocol name as str and not [u8] (#6967) · beb74f49
      Max Inden authored
      * client/*: Treat protocol name as str and not [u8]
      
      Notification protocol names are in practice always valid utf8 strings.
      Instead of treating them as such in the type system, thus far they were
      casted to a [u8] at creation time.
      
      With this commit protocol names are instead treated as valid utf8
      strings throughout the codebase and passed as `Cow<'static, str>`
      instead of `Cow<'static, [u8]>`. Among other things this eliminates the
      need for string casting when logging.
      
      * client/network: Don't allocate when protocol name is borrowed
      beb74f49
  2. Jul 21, 2020
  3. Jun 30, 2020
    • André Silva's avatar
      grandpa: minor cleanups in communication module (#6371) · 996a86ca
      André Silva authored
      * grandpa: replace Result<(), ()> with Option<()>
      
      * grandpa: replace &Option<T> with Option<&T>
      
      * grandpa: cleanup local id and keystore usages
      
      * grandpa: return bool on check_message_signature
      
      * grandpa: fix erroneous log message on startup
      
      * grandpa: fix test
      996a86ca
  4. Jun 09, 2020
  5. May 20, 2020
  6. May 18, 2020
  7. May 15, 2020
  8. May 13, 2020
    • Jon Häggblad's avatar
      Fix minor clippy lints in grandpa (#5988) · 69a89fa7
      Jon Häggblad authored
      * grandpa: fix clippy lints about identity conversions
      
      * grandpa: fix clippy lints about unwrap_or_default
      
      * grandpa: fix clippy lints about explicit return
      
      * grandpa: fix clippy lints about unnecessary intermediary
      
      * grandpa: fix clippy lints about to_string
      
      * grandpa: fix clippy lints about unused imports
      
      * grandpa: fix clippy lints about increments
      
      * grandpa: fix clippy lints about unnecessary matches
      
      * grandpa: fix clippy lints about struct arguments
      
      * Fix clippy::redundant_clone
      
      * Fix clippy::clone_on_copy
      
      * Fix clippy::or_fun_call
      
      * Fix clippy::identity_conversion
      69a89fa7
  9. May 06, 2020
    • André Silva's avatar
      grandpa: report equivocations (#3868) · a2512e83
      André Silva authored
      * session: runtime api for generating session membership proofs
      
      * grandpa: add runtime api for creating equivocation report txs
      
      * grandpa: submit signed equivocation report transactions
      
      * grandpa: use proper equivocation report type
      
      * grandpa: report equivocations
      
      * grandpa: validate equivocation proof
      
      * grandpa: update to finality-grandpa 0.9.1
      
      * grandpa: fix encoding of session membership proof
      
      * grandpa: initialize set id session mapping for genesis session
      
      * grandpa: fix bug in set_id session validation
      
      * fix compilation
      
      * cleanup from merge conflicts
      
      * cleanup crate tomls
      
      * grandpa: refactor equivocation handling to separate trait
      
      * node-template: fix compilation
      
      * fix test compilation
      
      * bump finality-grandpa to v0.10.2
      
      * rpc: fix runtime version test
      
      * CHERRY-PICK #4200: Add documentation to SubmitSignedTransaction and actually make it work
      
      Squashed commit of the following:
      
      commit dc8d71c3
      Author: Tomasz Drwięga <[email protected]>
      Date:   Tue Dec 3 16:29:33 2019 +0100
      
          Split the method to avoid confusing type error message.
      
      commit 0c4c0378
      Author: Tomasz Drwięga <[email protected]>
      Date:   Tue Dec 3 16:19:55 2019 +0100
      
          Make accounts optional, fix logic.
      
      commit d715f645
      Author: Tomasz Drwięga <[email protected]>
      Date:   Tue Dec 3 10:06:20 2019 +0100
      
          Remove warning.
      
      commit 3f38218a
      Merge: f85b8903 368318c9
      Author: Tomasz Drwięga <[email protected]>
      Date:   Tue Dec 3 07:08:05 2019 +0100
      
          Merge branch 'master' into td-signed-transactions
      
      commit f85b8903
      Merge: f8c95403 d8d5da2c
      Author: Tomasz Drwięga <[email protected]>
      Date:   Mon Dec 2 13:57:25 2019 +0100
      
          Merge branch 'master' into td-signed-transactions
      
      commit f8c95403
      Author: Tomasz Drwięga <[email protected]>
      Date:   Mon Nov 25 17:34:52 2019 +0100
      
          Forgotten import.
      
      commit a645b90d
      Author: Tomasz Drwięga <[email protected]>
      Date:   Mon Nov 25 17:32:10 2019 +0100
      
          Fix naming and bounds.
      
      commit bc28c605
      Author: Tomasz Drwięga <[email protected]>
      Date:   Mon Nov 25 17:01:05 2019 +0100
      
          Add documentation to signed transactions and actually make them work.
      
      * grandpa: skip block initialization on report submission method
      
      * primitives: allow transaction pool access by default for offchain calls
      
      * grandpa: unused parameters
      
      * grandpa: remove unused method
      
      * grandpa: enable equivocation reporting
      
      * grandpa: add workaround for parameter encoding
      
      * grandpa: fix localized_payload calls in tests
      
      * fix submit_report_equivocation_extrinsic in runtimes
      
      * node: fix submit transaction test compilation
      
      * node: bump spec_version
      
      * rpc: fix api version test
      
      * grandpa: allow custom equivocation offence type
      
      * grandpa: add test for authorities::next_change_height
      
      * grandpa: cleanup report_equivocation function
      
      * node: move reporting app crypto to node-primitives
      
      * grandpa: move equivocation traits to own module
      
      * grandpa: rename app-crypto crate import
      
      * grandpa: export equivocation types
      
      * node: bump spec_version
      
      * grandpa: rename EquivocationReport to EquivocationProof
      
      * grandpa: add missing docs to primitives
      
      * grandpa: add missing docs to equivocation
      
      * node: fix compilation
      
      * grandpa: add missing docs to pallet
      
      * node: bump spec_version
      
      * fix whitespace
      
      * grandpa: return error on offence reporting
      
      * grandpa: expose session and validator count in proofs through traits
      
      * grandpa: use strong key in module KeyOwnerProofSystem
      
      * grandpa: move key ownership proof to grandpa runtime api
      
      * grandpa: remove unnecessary cloning when checking equivocation proof
      
      * grandpa: make report_equivocation a method in Environment
      
      * support: implement KeyOwnerProofSystem for ()
      
      * grandpa: move KeyOwnerProofSystem to module trait
      
      * test-utils: fix runtime compilation
      
      * grandpa: fix test compilation
      
      * grandpa: fix test compilation after merge
      
      * grandpa: simplify transaction submission types
      
      * grandpa: validate equivocation report in signed extension
      
      * client: fix test
      
      * node: use ValidateEquivocationReport signed extension
      
      * grandpa: expose key ownership proof under opaque type
      
      * grandpa: better docs on key ownership proofs
      
      * grandpa: add note about signed extension
      
      * grandpa: add ValidateEquivocationReport::new
      
      * grandpa: remove skip_initialize_block from runtime api
      
      * grandpa: use new offchain transaction submission API
      
      * grandpa: take set_id in generate_key_ownership_proof
      
      * grandpa: update to finality-grandpa v0.12.2
      
      * grandpa: cleanup usages of AuthoritySet::current
      
      * grandpa: fix test
      
      * grandpa: add mocking utilities for equivocation reporting
      
      * grandpa: add test for equivocation reporting
      
      * grandpa: move SetIdSession initialization
      
      * grandpa: add more tests
      
      * node: enable historical session manager
      
      * node: bump spec_version
      
      * node: use strong key types in KeyOwnerProofSystem definitions
      
      * grandpa: export GrandpaEquivocationOffence type
      a2512e83
  10. Apr 30, 2020
    • André Silva's avatar
      grandpa: update to finality-grandpa v0.12.0 (#5853) · 100f6116
      André Silva authored
      * grandpa: update to v0.12.0
      
      * grandpa: fix tests
      
      * grandpa: better validation of authority set invariants
      
      * grandpa: avoid duplicating invalid authority list check
      
      * grandpa: add missing doc
      
      * grandpa: better validation of expect proofs
      
      * grandpa: fix test compilation
      
      * grandpa: fix tests
      
      * grandpa: add test for AuthoritySet invariants
      
      * grandpa: bump finality-grandpa to v0.12.0
      100f6116
  11. Apr 04, 2020
    • Benjamin Kampmann's avatar
      Additional Metrics collected and exposed via prometheus (#5414) · 8991aab9
      Benjamin Kampmann authored
      
      
      This PR refactors the metrics measuring and Prometheus exposing entity in sc-service into its own submodule and extends the parameters it exposes by:
      
      - system load average (over one, five and 15min)
      - the TCP connection state of the process (lsof), refs #5304
      - number of tokio threads
      - number of known forks
      - counter for items in each unbounded queue (with internal unbounded channels)
      - number of file descriptors opened by this process (*nix only at this point)
      - number of system threads (*nix only at this point)
      
      refs #4679
      
      Co-authored-by: default avatarMax Inden <[email protected]>
      Co-authored-by: default avatarAshley <[email protected]>
      8991aab9
  12. Mar 18, 2020
    • Max Inden's avatar
      client/network-gossip/src/bridge: Finish when network event stream closes (#5282) · 48701053
      Max Inden authored
      * client/network-gossip/src/bridge: Finish when network even stream closes
      
      Previously within `<GossipEngine as Future>::poll` one would poll the
      `network_event_stream` ignoring all messages other than
      `Poll::Ready(Some())`. Ignoring `Poll::Ready(None)` leads to a panic on
      the next poll of the stream, gien that it is not fused.
      
      By design `network_event_stream` does not close unless an unbounded send
      into it fails, or the `NetworkWorker` gets shut down.
      
      > The stream never ends (unless the `NetworkWorker` gets shut down).
      > (client/network/src/service.rs)
      
      An `unbounded_send` to fail on an unbounded channel is unlikely. The
      `NetworkWorker` shutting down is not unlikely. In such case the
      `GossipEngine` should shut down as well.
      
      With this patch a `<GossipEngine as Future>` finishes on
      `Poll::Ready(None)` returned from `network_event_stream`.
      
      * client/finality-grandpa/communication: Error on gossip engine finished
      
      Have `<NetworkBridge as Future>::poll` return `Poll::Ready(Err)` instead
      of `Poll::Ready(Ok)` to be consistent with the handling of the neighbor
      packet worker stream and the gossip validator report stream. Both `Err`
      as well as `Ok` shut down the `NetworkBridge` as well as the
      `VoterWorker`.
      
      * client/network-gossip/src/bridge: Add regression test
      
      * client/network-gossip: Move substrate test client to dev dependencies
      
      * client/network-gossip: Remove TODO
      
      Addressed in a follow up pull request.
      
      * client/network-gossip/bridge: Put match on newline after loop
      
      * client/finality-grandpa/src/observer: Fix regression test
      
      Make sure the event stream sender side is not dropped till the end.
      48701053
  13. Mar 17, 2020
  14. Mar 14, 2020
    • Max Inden's avatar
      client/finality-grandpa: Add Prometheus metrics to GossipValidator (#5237) · dd194a4c
      Max Inden authored
      * client/finality-grandpa: Add Prometheus metrics to GossipValidator
      
      Instrument finality grandpa `GossipValidator` exposing count of messages
      validated by message type and message action.
      
      ```
      \# HELP substrate_finality_grandpa_communication_gossip_validator_messages Number of messages validated by the finality grandpa gossip validator.
      \# TYPE substrate_finality_grandpa_communication_gossip_validator_messages counter
      substrate_finality_grandpa_communication_gossip_validator_messages{action="discard",message="neighbor"} 39
      substrate_finality_grandpa_communication_gossip_validator_messages{action="keep",message="vote"} 28
      ```
      
      * client/finality-grandpa: Add None as Prometheus registry in tests
      
      * client/finality-granpda/src/communication: Refactor metric registration
      dd194a4c
  15. Mar 09, 2020
    • André Silva's avatar
      grandpa: improve handling of global gossip messages (#5133) · 971cdc3e
      André Silva authored
      * grandpa: only gossip commits to peers on the same set
      
      * grandpa: track commits uniquely by round and set
      
      * grandpa: fix communication test
      
      * grandpa: add tests for commit gossip handling
      
      * grandpa: add missing docs
      971cdc3e
    • Max Inden's avatar
      client/network-gossip: Merge GossipEngine and GossipEngineInner (#5042) · 78cdd3bf
      Max Inden authored
      * client/network-gossip: Merge GossipEngine and GossipEngineInner
      
      Given that GossipEngine and GossipEngineInner are not shared between
      threads anyone (public interface + background tasks), neither depends on
      being Send or Sync. Thus one can merge the two as done in this patch.
      One only needs to wrap an `Arc<Mutex<>>` around the whole structure when
      the owner (e.g. finality-grandpa) needs to share the gossip engine
      between threads.
      
      * client/finality-grandpa: Wrap GossipEngine in Arc Mutex & lock it on use
      
      GossipEngine in itself has no need to be Send and Sync, given that it
      does not rely on separately spawned background tasks anymore. Given that
      finality-grandpa shares the `NetworkBridge` potentially between threads
      its components need to be clonable, thus this patch wraps `GossipEngine`
      in an `Arc<Mutex<>>`.
      78cdd3bf
  16. Feb 21, 2020
  17. Feb 17, 2020
    • Shawn Tabrizi's avatar
      Fix various spelling errors (#4940) · db1ab7d1
      Shawn Tabrizi authored
      
      
      * meaningfull -> meaningful
      
      * initialise -> initialize
      
      * tokans -> tokens
      
      * incentivise -> incentivize
      
      * lenght -> length
      
      * incentivisation -> incentivization
      
      * doesnt't -> doesn't
      
      * overwriten -> overwritten
      
      * lifecycle -> life cycle
      
      * lifecycle -> life cycle
      
      * usefull -> useful
      
      * noone -> no one
      
      * spaming -> spamming
      
      * defered -> deferred
      
      * hieght -> height
      
      * sumation -> summation
      
      * ingore -> ignore
      
      * registed -> registered
      
      * Auxialary -> Auxiliary
      
      * loggin -> logging
      
      * independance -> independence
      
      * trailling -> trailing
      
      * responsability -> responsibility
      
      * trunkated -> truncated
      
      * Weither -> Whether
      
      * informations -> information
      
      * Runtume -> Runtime
      
      * choosen -> chosen
      
      * delcataion -> declaration
      
      * Unchekced -> Unchecked
      
      * defintion -> definition
      
      * scrach -> scratch
      
      * imput -> input
      
      * transfered -> transferred
      
      * endownment -> endowment
      
      * Determinator -> Determiner
      
      * relevent -> relevant
      
      * emited -> emitted
      
      * acocunt -> account
      
      * proprotional -> proportional
      
      * instantiaion -> instantiation
      
      * commited -> committed
      
      * tombstonedead -> tombstone
      
      * uwnrap -> unwrap
      
      * acount -> account
      
      * specialised -> specialized
      
      * existant -> existent
      
      * requried -> required
      
      * Anull -> Annul
      
      * AUTHORITES -> AUTHORITIES
      
      * underyling -> underlying
      
      * recognisable -> recognizable
      
      * Capitalise -> Capitalize
      
      * reportfor -> report for
      
      * hearbeat -> heartbeat
      
      * onlineness -> being online
      
      * creater -> creator
      
      * Bytearray -> Byte array
      
      * Despoit -> Deposit
      
      * substratced -> subtracted
      
      * Curent -> Current
      
      * imbalanes -> imbalances
      
      * countfown -> countdown
      
      * inexisting -> inexistent
      
      * additionaly -> additionally
      
      * substracted -> subtracted
      
      * auxilary -> auxiliary
      
      * parital -> partial
      
      * in't -> isn't
      
      * compatability -> compatibility
      
      * infomation -> information
      
      * etected -> detected
      
      * extrinsiscs -> extrinsics
      
      * reprensentation -> representation
      
      * coonfiguration -> configuration
      
      * primtives -> primitives
      
      * miscelanious -> miscellaneous
      
      * VERISON -> VERSION
      
      * endcoded -> encoded
      
      * Genrates -> Generates
      
      * miliseconds -> milliseconds
      
      * occured -> occurred
      
      * trully -> truely
      
      * truely -> truly
      
      * conjuction -> conjunction
      
      * encouters -> encounters
      
      * customised -> customized
      
      * deterministicly -> deterministically
      
      * finalisation -> finalization
      
      * pluggable -> plugable
      
      * wakeup -> wake-up
      
      * interemdiate -> intermediate
      
      * intepreting -> interpreting
      
      * finalzied -> finalized
      
      * throgh -> through
      
      * extinsic -> extrinsic
      
      * convient -> convenient
      
      * allocater -> allocator
      
      * propagateable -> propagatable
      
      * succesfuly -> successfully
      
      * finalising -> finalizing
      
      * publically -> publicly
      
      * phrasee -> phrase
      
      * substration -> substractions
      
      * substractions -> subtractions
      
      * neccessarily -> necessarily
      
      * Inlucde -> Include
      
      * unefficient -> inefficient
      
      * thay -> they
      
      * funtion -> function
      
      * datastructures -> data structures
      
      * infromation -> information
      
      * propagatable -> propagable
      
      * ecountered -> encountered
      
      * recognise -> recognize
      
      * intergration -> integration
      
      * lastet -> latest
      
      * datatypes -> data types
      
      * datatype -> data type
      
      * Strongarming -> Strong Arming
      
      * avaible -> available
      
      * Commiting -> Committing
      
      * Retreiving -> Retrieving
      
      * shoud -> should
      
      * canonicaliziation -> canonicalization
      
      * comitted -> committed
      
      * clonable -> cloneable
      
      * Uknown -> Unknown
      
      * reponse -> response
      
      * arbitary -> arbitrary
      
      * Capapbilities -> Capabilities
      
      * responsbile -> responsible
      
      * initialisation -> initialization
      
      * cames -> came
      
      * intemediate -> intermediate
      
      * reqeust -> request
      
      * intance -> instance
      
      * explcitly -> explicitly
      
      * neighor -> neighbor
      
      * reolving -> resolving
      
      * untill -> until
      
      * Validte -> Validate
      
      * deserailize -> deserialize
      
      * literaly -> literally
      
      * preceeding -> preceding
      
      * abpve -> above
      
      * chcecked -> checked
      
      * numbet -> number
      
      * Unknow -> Unknown
      
      * halfs -> halves
      
      * gossup -> gossip
      
      * givent -> given
      
      * immediatelly -> immediately
      
      * slicable -> sliceable
      
      * conensus -> consensus
      
      * Mimicks -> Mimics
      
      * acccept -> accept
      
      * serialise -> serialize
      
      * exstrinsics -> extrinsics
      
      * panicks -> panics
      
      * maintaince -> maintenance
      
      * repeatidely -> repeatedly
      
      * anecstor -> ancestor
      
      * becasue -> because
      
      * processer -> processor
      
      * Prunning -> Pruning
      
      * insterested -> interested
      
      * unuseful -> not useful
      
      * yeided -> yielded
      
      * descendfing -> descending
      
      * corresponts -> corresponds
      
      * survivew -> survive
      
      * keps -> keeps
      
      * ligh -> light
      
      * prerequisities -> prerequisites
      
      * positiion -> position
      
      * depedency -> dependency
      
      * extrinisic -> extrinsic
      
      * atomicaly -> atomically
      
      * staticly -> statically
      
      * resul -> result
      
      * timestamb -> timestamp
      
      * Utilites -> Utilities
      
      * ammount -> amount
      
      * pocess -> process
      
      * exteral -> external
      
      * Update client/finality-grandpa/src/tests.rs
      
      * Update primitives/io/src/lib.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update primitives/blockchain/src/lib.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update frame/support/src/weights.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update bin/node/cli/tests/common.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update client/api/src/execution_extensions.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update client/cli/src/params.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update client/executor/common/src/sandbox.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update client/api/src/execution_extensions.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update client/finality-grandpa/src/communication/mod.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update client/state-db/src/pruning.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update frame/contracts/src/tests.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update client/api/src/execution_extensions.rs
      
      * bump impl
      
      * timestamb -> timestamp
      
      Co-authored-by: default avatarjoe petrowski <[email protected]>
      db1ab7d1
  18. Feb 12, 2020
    • Max Inden's avatar
      client/network-gossip: Integrate GossipEngine tasks into Future impl (#4767) · e1668c2a
      Max Inden authored
      `GossipEngine` spawns two tasks, one for a periodic tick, one to forward
      messages from the network to subscribers. These tasks hold an `Arc` to a
      `GossipEngineInner`.
      
      To reduce the amount of shared ownership (locking) this patch integrates
      the two tasks into a `Future` implementation on the `GossipEngine`
      struct. This `Future` implementation can now be called from a single
      owner, e.g. the `finality-grandpa` `NetworkBridge`.
      
      As a side effect this removes the requirement on the `network-gossip`
      crate to spawn tasks and thereby removes the requirement on the
      `finality-grandpa` crate to spawn any tasks.
      
      This is part of a greater effort to reduce the number of owners of
      components within `finality-grandpa`, `network` and `network-gossip` as
      well as to reduce the amount of unbounded channels. For details see
      d4fbb897, f0c18520 and 5afc7777.
      e1668c2a
  19. Jan 31, 2020
    • Gavin Wood's avatar
      client/finality-grandpa: Add regression test for observer polling network (was #4778) (#4795) · 85b65a38
      Gavin Wood authored
      * client/finality-grandpa: Add regression test observer polling network
      
      Ensure `Future` implementation of `ObserverWork` is polling its
      `NetworkBridge`. Regression test for bug introduced in d4fbb897 and
      fixed in 7d58ceeb
      
      .
      
      When polled, `NetworkBridge` forwards reputation change requests from
      the `GossipValidator` to the underlying `dyn Network`. This test
      triggers a reputation change by calling `GossipValidator::validate` with
      an invalid gossip message. After polling the `ObserverWork` which should
      poll the `NetworkBridge`, the reputation change should be forwarded to
      the test network.
      
      * Nits
      
      Co-authored-by: default avatarMax Inden <[email protected]>
      85b65a38
  20. Jan 24, 2020
    • Ashley's avatar
      Switch GrandPa to std futures (replaces #3909) (#4612) · fca8058f
      Ashley authored
      
      
      * Switch GrandPa to new futures
      
      * Work on making tests work
      
      * until_imported tests working again
      
      * Work on switching tests to stable futures
      
      * Modifications
      
      * Re-add test as #[ignore]
      
      * Don't ignore
      
      * Add manual unpins
      
      * Remove Header import
      
      * Return concrete Sink type
      
      * Switch to crates.io finality-grandpa version
      
      * Remove use statement that slipped in
      
      * Fix some nitpicks
      
      * Remove unpin from i
      
      * Fixed typo
      
      * Move futures01 to dev-deps
      
      * Fix nitpicks
      
      * Update client/finality-grandpa/src/communication/mod.rs
      
      Co-Authored-By: default avatarAndré Silva <[email protected]>
      
      * nitpicking
      
      Co-authored-by: default avatarPierre Krieger <[email protected]>
      Co-authored-by: default avatarAndré Silva <[email protected]>
      fca8058f
  21. Jan 23, 2020
    • Max Inden's avatar
      client/finality-grandpa: Make round_communication use bounded channel (#4691) · 5afc7777
      Max Inden authored and asynchronous rob's avatar asynchronous rob committed
      * clinet/finality-grandpa: Make round_communication use bounded channel
      
      `round_communication` returns a `Sink` and a `Stream` for outgoing and
      incoming messages. The messages send into the `Sink` are forwarded down
      to the network as well as send back into the `Stream` to ensure the node
      processes its own messages.
      
      So far, to send messages into the `Sink` back into the `Stream`, an
      unbounded channel was used. This patch updates `round_communication` and
      `OutgoingMessages` to use a bounded channel.
      
      This is part of a greater effort to reduce the number of owners of
      components within `finality-grandpa` and `network` as well as to reduce
      the amount of unbounded channels. For details see d4fbb897 and
      f0c18520.
      
      * client/finality-grandpa: Import futures03::future::ready at the top
      
      * client/finality-grandpa: Make tests use compat of future 03
      
      * client/finality-grandpa: Do not import ready into scope
      
      Instead of importing futures03::future::ready into the scope, only
      import futures::future03 into scope and call ready as furure03::ready.
      5afc7777
  22. Jan 21, 2020
  23. Jan 17, 2020
    • Max Inden's avatar
      client/finality-grandpa: Reintegrate gossip validator report stream (#4661) · f0c18520
      Max Inden authored
      * client/finality-grandpa: Reintegrate gossip validator report stream
      
      The `finality-grandpa` `GossipValidator` is called by the `GossipEngine`
      in a synchronous fashion on each gossip message. Its main task is to
      decide whether to gossip the given message on, or whether to drop it.
      
      In addition it also updates the reputation of a node's peers based on
      the incoming gossip messages. To do so it needs to be able to report the
      reputation change which it does through an unbounded channel (in order
      to stay synchronous).
      
      Previously the receiving side of this channel would be handled by a new
      task, polling the channel and forwarding the changes to a clone of the
      `GossipEngine` that it would own.
      
      Instead the receiver of the above mentioned channel is now being polled
      by the `NetworkBridge` within its `Future::poll` implementation.
      Reputation changes are reported through the already existing
      `GossipEngine` instance within `NetworkBridge`.
      
      For details on the overall goal, see d4fbb897.
      
      * client/finality-grandpa: Remove exit future from test NetworkBridges
      f0c18520
    • Max Inden's avatar
      client/finality-grandpa: Reintegrate periodic neighbor packet worker (#4631) · d4fbb897
      Max Inden authored
      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.
      d4fbb897
  24. Jan 05, 2020
  25. Dec 18, 2019
    • asynchronous rob's avatar
      client: Do not set fork sync request via network-gossip (#4439) · b84a4c6b
      asynchronous rob authored
      The finality-grandpa module needs two sets of functionalities from the
      network:
      
      1. Everything gossip related, e.g. event_stream, write_notification, ...
      
      2. The ability to set a fork sync request for a specific block hash.
      
      Instead of embedding (2) inside of (1) this patch extracts (2) from (1)
      having finality-grandpa depend on a `Network` that fulfills the
      `network_gossip::Network` trait and that can set block sync requests.
      
      On the one hand this improves the overall structure splitting things
      that don't logically belong together. On the other hand it does
      reintroduce a lot of trait bounds within finality-grandpa.
      b84a4c6b
  26. Dec 16, 2019
    • Tomasz Drwięga's avatar
      [big refactor] Remove crate aliasing. (#4395) · 40a16efe
      Tomasz Drwięga authored
      * Rename: Phase 1.
      
      * Unify codec.
      
      * Fixing: Phase 2
      
      * Fixing: Phase 3.
      
      * Fixing: Phase 4.
      
      * Fixing: Phase 5.
      
      * Fixing: Phase 6.
      
      * Fixing: Phase 7.
      
      * Fixing: Phase 8. Tests
      
      * Fixing: Phase 9. Tests!!!
      
      * Fixing: Phase 10. Moar tests!
      
      * Finally done!
      
      * More fixes.
      
      * Rename primitives:: to sp_core::
      
      * Apply renames in finality-grandpa.
      
      * Fix benches.
      
      * Fix benches 2.
      
      * Revert node-template.
      
      * Fix frame-system in our modules.
      40a16efe
  27. Dec 13, 2019
    • Pierre Krieger's avatar
      Extract consensus_gossip.rs and put it in its own crate (#4284) · 723148f1
      Pierre Krieger authored
      
      
      * Extract gossiping system from network
      
      * Finish porting GRANDPA tests
      
      * Try put correct engine ID
      
      * Fix messages encoding
      
      * Fix communication tests
      
      * Use a threads pool to spawn stuff
      
      * Fix compilation everywhere
      
      * Fix bad merge conflict
      
      * Remove dependency on async-std
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarRobert Habermeier <[email protected]>
      
      * More suggestions
      
      * Remove network startup GP future
      
      * Update to futures_timer
      
      * adjust wait_when_behind test
      
      * Pass correct Roles after handshake
      
      * Revert "adjust wait_when_behind test"
      
      This reverts commit 9e310244.
      
      * Crate root documentation
      
      * Remove MessageRecipient
      
      * Address concerns
      
      * Fix more concerns
      
      * Forgot Cargo.lock
      723148f1
  28. Dec 04, 2019
  29. Dec 03, 2019
  30. Dec 02, 2019
    • Benjamin Kampmann's avatar
      The crate rename (#4223) · 28c329e0
      Benjamin Kampmann authored
      * Adding script for rename, could be applicable for nodes on top of it, too
      
      * add stderr and gitlab ci features
      
      * apply script
      
      * fix now minor details in expected stderr
      
      * Update the Cargo.lock
      
      * fix name: sc-transaction -> sc-tracing
      
      * fix rename in script, too
      28c329e0
  31. Nov 14, 2019
    • Benjamin Kampmann's avatar
      Reorganising the repository - external renames and moves (#4074) · f44873dc
      Benjamin Kampmann authored
      * Adding first rough ouline of the repository structure
      
      * Remove old CI stuff
      
      * add title
      
      * formatting fixes
      
      * move node-exits job's script to scripts dir
      
      * Move docs into subdir
      
      * move to bin
      
      * move maintainence scripts, configs and helpers into its own dir
      
      * add .local to ignore
      
      * move core->client
      
      * start up 'test' area
      
      * move test client
      
      * move test runtime
      
      * make test move compile
      
      * Add dependencies rule enforcement.
      
      * Fix indexing.
      
      * Update docs to reflect latest changes
      
      * Moving /srml->/paint
      
      * update docs
      
      * move client/sr-* -> primitives/
      
      * clean old readme
      
      * remove old broken code in rhd
      
      * update lock
      
      * Step 1.
      
      * starting to untangle client
      
      * Fix after merge.
      
      * start splitting out client interfaces
      
      * move children and blockchain interfaces
      
      * Move trie and state-machine to primitives.
      
      * Fix WASM builds.
      
      * fixing broken imports
      
      * more interface moves
      
      * move backend and light to interfaces
      
      * move CallExecutor
      
      * move cli off client
      
      * moving around more interfaces
      
      * re-add consensus crates into the mix
      
      * fix subkey path
      
      * relieve client from executor
      
      * starting to pull out client from grandpa
      
      * move is_decendent_of out of client
      
      * grandpa still depends on client directly
      
      * lemme tests pass
      
      * rename srml->paint
      
      * Make it compile.
      
      * rename interfaces->client-api
      
      * Move keyring to primitives.
      
      * fixup libp2p dep
      
      * fix broken use
      
      * allow dependency enforcement to fail
      
      * move fork-tree
      
      * Moving wasm-builder
      
      * make env
      
      * move build-script-utils
      
      * fixup broken crate depdencies and names
      
      * fix imports for authority discovery
      
      * fix typo
      
      * update cargo.lock
      
      * fixing imports
      
      * Fix paths and add missing crates
      
      * re-add missing crates
      f44873dc
  32. Nov 09, 2019
  33. Oct 29, 2019
  34. Oct 27, 2019
  35. Oct 24, 2019
    • Max Inden's avatar
      core/finality-grandpa: Request block sync from network after import timeout (#3800) · 5bd69ac2
      Max Inden authored
      * core/finality-grandpa: Pass Grandpa msg sender up to UntilImported
      
      * core/finality-grandpa: Track senders to maybe later request blocks
      
      * core/finality-grandpa: Make BlockStatus pub only within crate
      
      * core/finality-grandpa: Abstract NetworkBridge with BlockSyncRequester
      
      * core/finality-grandpa: Pass BlockSyncRequester to UntilImported
      
      * core/finality-grandpa: Track block number of pending within UntilImported
      
      * core/finality-grandpa: Request block sync on long wait
      
      * core/finality-grandpa: Adjust unit tests to previous changes
      
      * core/finality-grandpa: Fix line length
      
      * core/finality-grandpa: Add comment explaining in & out vote combination
      
      * core/finality-grandpa: Log after, not before, timeout expired
      
      The UntilImported component should log whenever waiting for a specific
      block to be imported surpassed a defined constant timeout. Without this
      patch the code would log whenever the current time was below the
      timeout.
      
      * core/finality-grandpa: Collect senders as HashSet for deduplication
      
      * Revert "core/finality-grandpa: Track senders to maybe later request blocks"
      
      This reverts commit 61ac9dd7.
      
      * Revert "core/finality-grandpa: Pass Grandpa msg sender up to UntilImported"
      
      This reverts commit afdc9646.
      
      * core/network/sync: Ask for block from all peers if none provided
      
      When requesting an explicit fork sync, try to sync from all known peers,
      when no specific peers were provided.
      
      * core/network/sync: Request specific fork sync from peers ahead or on par
      
      When making an explicit fork sync request without specifying any peers,
      make sure to only request it from the locally known peers that are
      either ahead or on a par compared to the block number we are looking
      for.
      
      * grandpa: fix tests
      
      * grandpa: fix warnings
      
      * grandpa: add test for block sync request on until_imported
      
      * grandpa: rename Environment field inner to client
      
      * grandpa: fix minor nits
      
      * grandpa: minor nits in until_imported
      
      * grandpa: copy docs for set_sync_fork_request
      
      * grandpa: remove stale TODO on UntilImported
      5bd69ac2
  36. Oct 23, 2019