Commit Graph

561 Commits

Author SHA1 Message Date
Benjamin Kampmann bb94695a4e Fixup package releasing (#5821)
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2020-04-29 18:44:12 +02:00
Benjamin Kampmann 0ca88bbb18 activate compat feature on futures 2020-04-29 14:23:38 +02:00
Arkadiy Paronyan ba50664fea Reputation penalty for sending empty block response (#5814) 2020-04-29 10:12:23 +02:00
André Silva 29c127a082 babe: fix overflow in check_equivocation (#5818) 2020-04-29 00:17:16 +02:00
Pierre Krieger 1be634da85 Add metrics about block requests (#5811)
* Add metrics about block requests

* Apply suggestions from code review

Co-Authored-By: Max Inden <mail@max-inden.de>

Co-authored-by: Gavin Wood <i@gavwood.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-04-28 17:47:40 +02:00
Seun Lanlege 4fa5941f44 Move sc-client into sc-service (#5502)
* Drop client from sc-network and sc-client-db, move LongestChain to sc-client-api

* move leaves, cht, in_mem to sc-client-api, drop client from sc-finality-grandpa

* drop sc-service from sc-rpc

* drop sc-service from sc-consensus-aura

* drop sc-client from manual-seal and babe

* drop sc-client from utils/frame/rpc/system and utils/frame/benchmarking-cli

* drop sc-client from bin/node and bin/node-template

* drop sc-client

* fix tests

* remove check -p sc-client from gitlab.yml

* fix warnings

* fixes ui test

* fix light client tests

* adds associated Client type to AbstractService

* adds UsageProvider to Client

* fixed ui test, again

* tried and failed to get node-cli to compile for wasm

* thanks to tomaka for helping me get node-cli to compile for wasmm

* ui test pls pas 🙏🏾

* all tests passing 🪄

* no_run documentation code

* rm -f documentation code

* ClientProvider

* fix mega trait

* move LongestChain to sc-consensus, use adds minimal bounds to AbstractService::Client

* adds license to sc-consensus

Co-authored-by: Benjamin Kampmann <ben@parity.io>
2020-04-28 11:59:31 +00:00
Wei Tang 7784bdeffe Versioned NextConfigDescriptor for BABE (#5789) 2020-04-28 11:50:40 +01:00
Cecile Tonglet 8ae3ecf3cd Fix remaining issues with unsafe_pruning (#5810)
* Initial commit

Forked at: bf61cece1c
Parent branch: origin/master

* Fix remaining issues with unsafe_pruning

* Revert "Fix remaining issues with unsafe_pruning"

This reverts commit 9c42c2f9b361b13ee19f39b264e52dfaa46cfcbb.

* Just remove is_dev
2020-04-28 11:44:44 +02:00
André Silva 5662501258 cli: fix unused unsafe-pruning flag (#5803) 2020-04-27 22:01:35 +02:00
Cecile Tonglet 9e4901f3d5 Add method with_default_block_announcer to ServiceBuilder (#5797)
* Initial commit

Forked at: 64ed36d093
Parent branch: origin/master

* Add method with_default_block_announcer to ServiceBuilder
2020-04-27 15:05:11 +00:00
Arkadiy Paronyan 64ed36d093 Support reference-counting state backend. (#5769)
* Optimize pinning

* Ref counting state backend

* Style

Co-Authored-By: Wei Tang <hi@that.world>

* Update Cargo.lock

* Handle empty node

Co-authored-by: Wei Tang <hi@that.world>
2020-04-27 12:24:50 +02:00
Pierre Krieger 636ddd95d2 Extra timeout handling in block_requests (#5794) 2020-04-27 12:17:26 +02:00
Joshy Orndorff a08bf89662 Support Justification and FinalityProof import in pow import queue. (#5781) 2020-04-25 10:57:06 +00:00
André Silva 3793fbf9cc babe: remove error fallback from threshold calculation (#5764)
* babe: remove error fallbacks from threshold calculation

* babe: fix indent

* babe: fix domain

* babe: fix compilation

* babe: improve expect

* babe: add one more note about p's limit
2020-04-24 17:56:41 -04:00
Max Inden 324e51fbbf client/authority-discovery: Reduce log level replaced by metrics
Instead of logging value-found-event-handling failures or value-put
failures on error level, log them on debug level only additionally
recording them via Prometheus.

Motivation is that both events can happen in "normal" operations and
thus clutter the logs.
2020-04-24 17:40:48 +02:00
Wei Tang 969720c2ad babe: secondary blocks with VRF (#5501)
* babe: secondary blocks with VRF

* Fix node runtime compile

* Fix test-utils runtime interface

* Fix babe tests

* typo: v == 2

* babe: support online configuration upgrades

* Fix rpc tests

* Fix runtime version tests

* Switch to use NextConfigDescriptor instead of changing runtime interface

* Fix tests

* epoch-changes: map function that allows converting with different epoch types

* Add migration script for the epoch config change

* Fix docs for PrimaryAndSecondaryVRFSlots

* Add docs of `SecondaryVRF` in babe crate

* babe-primitives: Secondary -> SecondaryPlain

* babe-client: Secondary -> SecondaryPlain

* Fix migration tests

* test-utils-runtime: Secondary -> SecondaryPlain

* Fix missing name change in test-utils-runtime

* Fix migration: Epoch should be EpochV0

* Update client/consensus/babe/src/lib.rs

Co-Authored-By: André Silva <123550+andresilva@users.noreply.github.com>

* Fix new epochChanges version

* Fix babe-primitives naming changes

* Fix merge issues in babe-client

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: André Silva <andre.beat@gmail.com>
2020-04-24 16:03:03 +01:00
Bernhard Schuster 72ee7d5797 feat/ocw/bookkeeping (#5200)
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2020-04-24 16:46:19 +02:00
Pierre Krieger f66168505b Fix the cfg guards in service/metrics.rs (#5770) 2020-04-24 16:16:54 +02:00
Wei Tang 770cc24c47 babe: support online configuration upgrades (#5514)
* babe: support online configuration upgrades

* Switch to use NextConfigDescriptor instead of changing runtime interface

* Fix tests

* epoch-changes: map function that allows converting with different epoch types

* Add migration script for the epoch config change

* Fix migration tests

* Fix migration: Epoch should be EpochV0

* Update client/consensus/babe/src/lib.rs

Co-Authored-By: André Silva <123550+andresilva@users.noreply.github.com>

* Fix new epochChanges version

* Fix unused imports

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
2020-04-24 14:59:14 +01:00
Pierre Krieger 6a7e86e677 Use new block requests protocol (#5760)
* Use new block requests protocol

* Tweak comment
2020-04-24 13:48:22 +02:00
Chevdor e731817e24 Fix error message when providing an incorrect peer-id (#5724)
* Fix error message when providing an incorrect peer-id

* Fix error message to cover all cases

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-04-23 22:20:24 +02:00
Arkadiy Paronyan 59f13e6e0d Refactored in-mem backed to use the actual trie (#5730) 2020-04-23 19:00:36 +02:00
Bastian Köcher 46677555ac Allow missing functions when checking the new runtime's version (#5741) 2020-04-23 14:54:52 +02:00
Svyatoslav Nikolsky 8689a97a0d make GrandpaJustification::decode_and_verify_finalizes public (#5746) 2020-04-23 12:07:08 +01:00
Benjamin Kampmann 624e95b1af Fix leak in stream notifications (#5739) 2020-04-23 12:01:09 +02:00
Max Inden e84b06a8c0 client/network-gossip/state_machine: Reduce indentation level (#5714)
* client/network-gossip/src/state_machine: Add unit test for on_incoming

Add two unit tests to ensure `on_incoming` is ingoring discarded
messages and reports and ignores messages from unknown peers.

* client/network-gossip/state_machine: Reduce indentation level

* client/network-gossip/bridge: Remove unnecessary into_iter

* client/network-gossip/state_machine: Report success after register check

* client/network-gossip/state_machine: Error not report on unregistered

`peers` contains all the peers we're connected to. If we receive a
message from a peer not in this list, that means there's an internal
problem within the local client. It's not the fault of the peer in
question.

With the above in mind instead of reducing the reputation of such peer,
log an error.
2020-04-23 09:58:43 +02:00
Toralf Wittner 421ef498f4 network: Only insert global addresses into the DHT. (#5735)
* network: Only insert global addresses into the DHT.

Currently every address reported via libp2p-identify is inserted into
the DHT which thus contains a multitude of unreachable addresses such
as from 127.0.0.0/8 or 10.0.0.0/8.

Issue #5099 suggested a dedicated service over UDP to gauge the
reachability of an address, which would however incur extra I/O costs
and be of limited use.

As an alternative and simpler tactic, this PR only allows global IP
addresses to be inserted into the DHT unless an explicit command-line
flag `--allow-non-global-addresses-in-dht` is given or a node is
started with `--dev`. This opt-in behaviour is meant to allow
site-local networks to still make use of a DHT.

* Enable non-global in more test setups.

* Replace command-line option with different name.

* Another test fix.
2020-04-23 09:52:20 +02:00
André Silva 96b7cec1ce slots: fix slot lenience methods (#5742)
* slots: extract slot lenience from babe and aura

* slots: add tests for slot lenience

* slots: fix comment in test
2020-04-23 09:42:53 +02:00
Pierre Krieger c424ce94a3 Enable yamux flow control by default (#5734)
* Enable yamux flow control by default

* Tweak description

* Apply suggestions from code review
2020-04-22 14:31:05 +02:00
Pierre Krieger a7f578d63a Add a protocol that answers finality proofs (#5718)
* Add a protocol that answers finality proofs

* Fix documentation

* Use Toggle
2020-04-22 10:58:26 +02:00
Pierre Krieger 3ad9f65f11 Send a status message on block announce handshake (#5726)
* Send a status message on block announce handshake

* Make sure to send the handshake to all handlers
2020-04-22 10:20:52 +02:00
Pierre Krieger 25c3ab2c1e Fix warning reported in out_events when Registry is None (#5716) 2020-04-22 00:36:12 +02:00
pscott f5d7b5bc92 Remove TaskManagerBuilder (#5725)
* Remove TaskManagerBuilder

* Clean up use declaration fo SpawnTaskHandle

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-04-22 00:35:01 +02:00
Max Inden 798de8337b client/authority-discovery: Add metric exposing priority group size (#5707)
Expose the amount of addresses that are passed from the authority
discovery module down to the network peer set manager as a priority
group in order to connect to the corresponding nodes.

```
authority_discovery_priority_group_size 10
```
2020-04-21 10:54:37 +02:00
Pierre Krieger f2578bdc3b Pass an encoded Roles as the notifications protocols handshakes (#5665) 2020-04-21 10:47:37 +02:00
Max Inden 5db336c743 client/network-gossip: Move sink IO outside of state_machine (#5669)
* client/network-gossip: Move sink IO outside of state_machine

`ConsensusGossip` is supposed to be a deterministic state machine.
`GossipEngine` wrapping `ConsensusGossip` should handle IO operations.

This commit moves the `message_sink` IO operations to `GossipEngine`.
More specifically on incoming messages a `GossipEngine` calls
`ConsensusGossip::on_incoming` to validate and register the messages.
`ConsensusGossip` returns the valid messages which are then forwarded by
`GossipEngine` to the upper layer via the `message_sinks`.

* client/network-gossip: Adjust and extend tests

* Update client/network-gossip/src/bridge.rs

Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
2020-04-20 16:40:44 -04:00
Yuanchao Sun 52d0173ec3 Add RPC function state_getProof, resolves #1110 (#5649)
* Add RPC function state_getProof, resolves #1110

* Apply suggestions from code review

* Update client/rpc/src/state/state_full.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update Cargo.lock

* Make block hash optional

* Wrap StorageProof as Bytes

* Add struct ReadProof

* Fix typo

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-04-20 21:09:55 +02:00
cheme 4ffcf98d8d Child trie api changes BREAKING (#4857)
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
2020-04-20 15:21:22 +02:00
Bastian Köcher 1d1caed335 Improve tracing (#5698)
* Improve tracing implementation

* Enable tracing in runtime interfaces

* Switch to `TRACE` level
2020-04-20 14:37:27 +02:00
Pierre Krieger ca1c60c2cf Move around definitions in sc_network (#5701) 2020-04-20 14:35:17 +02:00
Igor Matuszewski 4b1f7d187f Allow to expose a subset of unsafe RPCs (#5233)
* sc-cli: Use type-safe constructors for RPC/Prometheus interfaces

* service: Simplify rpc handler creation

Could probably be further simplifies once [this][commit] lands.

[commit]: https://github.com/paritytech/jsonrpc/commit/20485387ed06a48f1a70bf4d609a7cde6cf0accf

* service: Streamline some HTTP & WS server start logic

* client: Introduce a simple RPC policy mechanism

* rpc/system: Check unsafe RPCs

* rpc/offchain: Check unsafe RPCs

* rpc/author: Check unsafe RPCs
2020-04-20 11:03:58 +02:00
Pierre Krieger cff487dd22 Refactor misleading log in discovery (#5679)
* Refactor misleading log

* Forgot to git add the compilation fix
2020-04-18 14:04:23 +02:00
Pierre Krieger bc6ebabf23 Force libp2p 0.18.1 (#5689) 2020-04-17 23:00:44 +02:00
Pierre Krieger f544907bd2 Revert listening on IPv6 by default (#5687) 2020-04-17 20:34:23 +02:00
Ashley 95dc400bb8 Make network_config_path an Option (#5661)
* Make network_config_path an Option

* Fix network tests

* Use None as the network config path

* Fix cli

* Don't make PathBuf an Option in a cli context
2020-04-17 14:48:45 +02:00
Gavin Wood fd2cb9ca83 Transaction versioning in the RuntimeVersion (#5582)
* Add transaction_version

* Semantic versioning for runtimes

* Move new field to bottom

* Versioning

* Runtime versioning stuff.

* Fix test

* Adds tests and fixes bugs

* Bump runtime

Co-authored-by: Bastian Köcher <git@kchr.de>
2020-04-17 12:10:31 +02:00
Nikolay Volf fea626ca84 Add prometheus registry to transaction pool, with couple of initial metrics (#5657)
* make new contructor

* add metrics to txpool

* fix review

* fix doc comment

* change to counters

* Update client/transaction-pool/src/metrics.rs

Co-Authored-By: Max Inden <mail@max-inden.de>

* Update client/transaction-pool/src/metrics.rs

Co-Authored-By: Max Inden <mail@max-inden.de>

* Update client/transaction-pool/src/metrics.rs

Co-Authored-By: Max Inden <mail@max-inden.de>

* Update client/transaction-pool/src/lib.rs

Co-Authored-By: Max Inden <mail@max-inden.de>

* Update client/transaction-pool/src/lib.rs

Co-Authored-By: Max Inden <mail@max-inden.de>

* use dedicated wrapper

Co-authored-by: Max Inden <mail@max-inden.de>
2020-04-17 11:02:45 +02:00
Bastian Köcher c5c9b56e94 Listen on ipv6 by default as well (#5677)
Instead of just listening on ipv4 by default, this enables listening on
ipv6 as well. While doing this, it also fixes a bug which lead to always
listen on all sockets, even if we specify listen addresses explicitly.
2020-04-17 09:53:52 +02:00
Pierre Krieger 0fd5643e84 Adjustments to Kademlia-related metrics (#5660)
* Turn kbuckets_num_nodes into a GaugeVec

* random_kademlia_queries -> kademlia_random_queries

* kademalia_random_queries_total now a CounterVec

* Add metrics about records store
2020-04-17 09:11:47 +02:00
Tomasz Drwięga bc0b8fbddf Add performance tracing to validate_transaction (#5671)
* Validate transaction timeouts

* Add timing

* Add tracing to transaction validation.

* Fix docs.

Co-authored-by: NikVolf <nikvolf@gmail.com>
2020-04-17 08:42:50 +02:00