Commit Graph

223 Commits

Author SHA1 Message Date
Wei Tang 9fdd4672b0 Use tracing-based subscriber logging (#6825)
* init_logger: switch from log-based to tracing-based and add compatibility layer

* Move tracing profiling subscriber related config realization

* sp-tracing: change profiling to be a layer instead of a subscriber

* Enable profiling layer in cli

* Change all test env_logger init to sp_tracing::try_init_simple

* Remove all local env_logger dependency

* Add missing tracing-subscriber dependency

* frame-sudo: fix tests

* frame-support: fix tests

* Fix frame/pallet and executor tests

* Fix the remaining tests

* Use subscriber's try_init as recommended by @davidbarsky

* Be explict that the tracing-log feature is needed

* Set subscriber writer to stderr

* Shorter line width

* Update cargo lock tracing version

* Fix sc_tracing crate compile

* Fix sc_authority_discovery crate test

* unremove default-features

* Leave enabled to default true

* Warn if global default cannot be set

* Fix unused import

* Remove unused PROXY_TARGET

* Change all reference from rc5 to rc6

* Change all reference of rc2 to rc6

* Fix styling

* Fix typo

* make logger init error'ing

* re-fixing the test issue

Co-authored-by: Benjamin Kampmann <ben@parity.io>
2020-09-17 11:04:43 +02:00
Pierre Krieger eadf5b09f9 Allow remotes to not open a legacy substream (#7075)
* Allow remotes to not open a legacy substream

* Misc fixes

* Special case first protocol as the one bearing the handshake
2020-09-14 15:08:23 +00:00
Roman Borschel 51706a7620 Upgrade to libp2p-0.28. (#7077)
* Upgrade to libp2p-0.28

* Clean up test imports.

* CI

* CI

* CI?

* CI once more.

* One more.

* CI

* CI

* CI
2020-09-14 14:27:58 +00:00
Pierre Krieger 34980ec88a Stop sending messages on legacy substream altogether (#6975)
* Stop sending messages on legacy substream altogether

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

* Add warning for sending on non-registered protocol

* Register GrandPa protocol in tests

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-02 15:28:03 +00:00
Pierre Krieger 2f9e2577c1 Ensure that handshake is sent back even in case of back-pressure (#6979)
* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-02 14:30:41 +00:00
Pierre Krieger e9d446a4ce Use AsyncReadExt::read_exact, not just read (#6977) 2020-08-31 08:55:43 +00:00
Max Inden 8fd343e39d client/*: Treat protocol name as str and not [u8] (#6967)
* 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
2020-08-28 15:34:25 +00:00
Pierre Krieger 1bd6082cf7 Enforce that ProtocolId is a string (#6953)
* Enforce that ProtocolId is a string

* Fix test
2020-08-26 12:27:30 +00:00
Pierre Krieger 6d9928e4bf Wait for all notifications protocols to be open before reporting opening (#6821)
* Wait for all notifications protocols to be open before reporting opening

* Update client/network/src/protocol/generic_proto/handler/notif_out.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Concern

* Fix attempt

* Another fix attempt

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: parity-processbot <>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-08-23 22:26:42 +02:00
André Silva 0777a93532 network: don't log re-discovered addresses (#6881)
* network: move LruHashSet to network crate utils

* network: don't log re-discovered external addresses

* Update client/network/src/utils.rs

Co-authored-by: mattrutherford <44339188+mattrutherford@users.noreply.github.com>

Co-authored-by: mattrutherford <44339188+mattrutherford@users.noreply.github.com>
2020-08-13 18:38:14 +00:00
Pierre Krieger ee35dc9415 Fix legacy substream fallback not working (#6826)
* Fix legacy substream fallback not working

* Make it nicer
2020-08-05 16:20:09 +00:00
Pierre Krieger a1786a92ec Don't close inbound notifications substreams immediately (#6781)
* Don't close inbound notifications substreams immediately

* Fix not closing in return to node A closing
2020-07-31 14:42:53 +00:00
Gavin Wood 6bfbb7c6f1 Cleanup our sort usage (#6754) 2020-07-29 14:00:51 +02:00
Pierre Krieger 1ab7719314 Add a back-pressure-friendly alternative to NetworkService::write_notifications 🎉 (#6692)
* Add NetworkService::send_notifications

* Doc

* Doc

* API adjustment

* Address concerns

* Make it compile

* Start implementation

* Progress in the implementation

* Change implementation strategy again

* More work before weekend

* Finish changes

* Minor doc fix

* Revert some minor changes

* Apply suggestions from code review

* GroupError -> NotifsHandlerError

* Apply suggestions from code review

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>

* state_transition_waker -> close_waker

* Apply suggestions from code review

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>

* Finish renames in service.rs

* More renames

* More review suggestsions applied

* More review addressing

* Final change

* 512 -> 2048

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-07-29 11:23:19 +00:00
pscott 046fda914a Improve overall performance (#6699)
* Improve overall performance

* Clean up code

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

* Remove needless ::

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

* Remove needless ::

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2020-07-21 14:46:49 +02:00
Pierre Krieger 4720f0fdda Move the legacy protocol handshake to the legacy substream (#5938)
* Move the legacy protocol handshake to the legacy substream

* Fix tests

* Remove line that wasn't supposed to be committed

* Remove hack

* Rework how it's done

* Some little changes

* update_chain wasn't doing its thing

* Fix service tests not calling update_chain

* Update client/network/src/protocol/generic_proto/behaviour.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* [WIP]

* Revert "[WIP]"

This reverts commit 2b892e6a7637c0b1297e6ecdbb919321c9098ff5.

* Update client/network/src/protocol.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix received message not being handshake

* Update client/network/src/protocol/generic_proto/behaviour.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>
2020-07-15 09:29:10 +00:00
Pierre Krieger 4613dc2af4 Remove legacy Clogged event (#6652) 2020-07-14 15:43:08 +00:00
Pierre Krieger 8ca05879e8 Send Status message on all newly-opened legacy substreams (#6593)
* Send Status message on all newly-opened legacy substreams

* Fix tests
2020-07-08 11:44:51 +00:00
Bastian Köcher 53be6ec510 Support synching of blocks that are not new_best (#6508)
* Start

* Remove debug println

* Add tests
2020-06-30 14:44:52 +00:00
André Silva d9776d8233 network: remove unused variable (#6460) 2020-06-22 20:41:37 +02:00
arkpar 850ee8b43a Revert "Block packet size limit"
This reverts commit 08e0747d2b.
2020-06-18 10:43:03 +02:00
arkpar 08e0747d2b Block packet size limit 2020-06-18 10:39:54 +02:00
Svyatoslav Nikolsky 194b3dfb17 fix BlockAttributes encoding (#6281) 2020-06-16 22:51:45 +02:00
Roman Borschel 731e7d77c7 Find the alive incoming entry on disconnect. (#6320)
When a peer in `Incoming` state disconnects, the "alive" entry
in the `incoming` list for that peer must be updated (set to `false`).
Currently the entry that is updated may be an earlier entry for the
same peer that is already no longer alive. This can happen if a
peer repeatedly connects (incoming) and disconnects between invocations to
`poll()` of the behaviour.
2020-06-11 11:55:55 +02:00
Arkadiy Paronyan 31921c4eb9 Use number of downloaded blocks for test (#6234) 2020-06-04 23:41:48 +02:00
Pierre Krieger 9906a2e39d Don't iterate over peers in generic_proto::behaviour::poll (#6142)
* Don't iterate over peers in generic_proto::behaviour::poll

* Improve comment

* Rework to use DelayIds
2020-05-26 21:23:32 +02:00
Arkadiy Paronyan 5bf9e63181 Optimize network poll (#6099) 2020-05-21 13:54:50 +02:00
Pierre Krieger c8339f9694 Turn a SmallVec into VecDeque for performances (#6091)
* Turn a SmallVec into VecDeque for performances

* Fix the other SmallVecs
2020-05-20 21:12:49 +02:00
Pierre Krieger 717fa95bc7 Restore the empty line after the license (#6088) 2020-05-20 13:08:27 +00:00
Pierre Krieger 7536de97b1 Print an error if we discover our own network identity (#6047)
* Add an error if we discover our own network identity

* Fix tests
2020-05-18 18:42:44 +02:00
Nikolay Volf d5411969ac fix whitespace (#6062) 2020-05-18 13:51:28 +02:00
Arkadiy Paronyan cdb7808a0e Remove on_block_imported (#6039)
* remove on_block_imported

* Update client/network/src/service.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-05-16 12:59:34 +02:00
Pierre Krieger 6ecdf20a1f Fix lots of small nits in sc-network (#6028)
* Fix lots of small nits in sc-network

* Update client/network/src/protocol/sync/blocks.rs

Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>

* Fix warning

* Yes. The line width.

Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
2020-05-15 12:58:52 +01:00
Benjamin Kampmann be8c96adec Relax substrate licensing scheme (#5947) 2020-05-15 13:21:56 +02:00
Pierre Krieger 074d80f519 Fix potential state mismatch in behaviour.rs (#6013)
* Fix state mismatch in behaviour.rs

* Add TODO
2020-05-13 19:50:01 +02:00
Pierre Krieger 10492c0689 Add mitigation for the state inconsistency issue (#5996)
* Add mitigation for the state inconsistency issue

* Add logging
2020-05-13 14:54:59 +02:00
Pierre Krieger 0a11c48aa1 Turn an error! into a debug! (#6000) 2020-05-12 19:22:41 +02:00
Arkadiy Paronyan 8606b886aa Validate block bodies when syncing (#5894) 2020-05-05 16:21:12 +02:00
Bastian Köcher 3d188ef17d Fix sync logging (#5879) 2020-05-04 13:43:08 +02:00
Pierre Krieger 929bd07bef Move around stuff in sc_network (#5847) 2020-04-30 13:08:38 +00:00
Nikolay Volf c09bb1f350 Use mem::take instead of mem::replace where appropriate (#5846)
* replace replace with take

* Update client/api/src/cht.rs

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

* Update client/api/src/cht.rs

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

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-04-30 12:53:36 +00:00
Arkadiy Paronyan fdde90077b Optimize collecting pending block requests (#5829)
* Optimized collecting pending block requests

* Make sure request iterator is consumed
2020-04-30 09:50:08 +02:00
Arkadiy Paronyan ba50664fea Reputation penalty for sending empty block response (#5814) 2020-04-29 10:12:23 +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
Pierre Krieger 636ddd95d2 Extra timeout handling in block_requests (#5794) 2020-04-27 12:17:26 +02: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
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 f2578bdc3b Pass an encoded Roles as the notifications protocols handshakes (#5665) 2020-04-21 10:47:37 +02:00