Commit Graph

76 Commits

Author SHA1 Message Date
Pierre Krieger 6e394464b8 Replace NodeIndex with PeerId everywhere (#2077)
* Replace NodeIndex with PeerId

* Fix tests

* More test fixing

* Whitespace
2019-03-23 10:34:28 +01:00
Pierre Krieger 7469713dea Fix #2073 (#2087) 2019-03-22 18:21:24 +01:00
Pierre Krieger b712795aa2 Fix #1777 (#2072) 2019-03-21 16:49:21 +01:00
Pierre Krieger 90c6f85db5 Add a substrate-peerset crate (#2042)
* Add a substrate-peerset crate

* Some adjustements

* More adjustements

* Use a temporary libp2p branch

* Add back-off mechanism

* Fix RPC tests

* Some adjustements

* Another libp2p bugfix

* Do a round-robin in the peerset

* Use a real dependency instead of a patch for libp2p

* Initialize reserved nodes correctly

* Better diagnostic for no address

* Don't allocate slots if in reserved only

* Ban node on dial failure

* Fix indentation
2019-03-21 14:02:28 +01:00
Pierre Krieger b5957a6aa2 Show the remote PeerId in the handler's logs (#2057) 2019-03-20 17:18:53 +01:00
Pierre Krieger 98a88a7d42 Start the handler init timer later (#2041) 2019-03-20 09:29:58 +01:00
Pierre Krieger 002143d0a2 Remove support for multiple network protocols (#2005)
* Remove support multiple network protocols

* Address concerns

* Add back debug_asserts
2019-03-19 11:56:56 +01:00
Roman Borschel 57387ef585 libp2p-0.5.0 (#1971)
* Update libp2p. Add support for ed25519 node (network) keys.

  * Update networking to the changes from https://github.com/libp2p/rust-libp2p/pull/972.
  * Add support for using ed25519 keys for libp2p networking.
  * Add support for reading libp2p secret keys from (external) files.

* Adapt to changes from https://github.com/libp2p/rust-libp2p/pull/992

* More tests.

* Cosmetics

* Deduplicate tests.

* Remove quickcheck from tests that don't use extra random inputs.

* Remove quickcheck.

* Swap new/default impls for NetworkConfiguration.

* Use libp2p-0.5.0 from crates.io.

* Post-rebase update.

* Remove unnecessary wildcard pattern.

* Combine two overlapping tests.
2019-03-19 11:16:25 +01:00
Pierre Krieger 35a67b31e5 Add a 16MiB hard limit to Substrate packets (#2009) 2019-03-15 14:52:22 +01:00
Pierre Krieger e91426ac77 Add a warning when banning or dropping reserved peers (#1976) 2019-03-12 15:43:22 +01:00
Pierre Krieger ead437d0f4 Remove dialing without a PeerId 2019-03-12 11:47:08 +01:00
Pierre Krieger a3a5031d9d Add timeouts for initialization and opening (#1948)
* Add timeouts for initialization and opening

* Don't keep alive opening and init

* Reset deadline when timer error
2019-03-11 12:09:03 +01:00
Pierre Krieger 0a300b061e Remove the error from network-libp2p (#1950) 2019-03-11 11:40:22 +01:00
Pierre Krieger 97fd1831e9 Fix old connections not being reused (#1934)
* Fix old connections not being reused

* Address issues
2019-03-07 22:15:40 +01:00
Bastian Köcher 7927054f86 Update copyrights to 2019 (#1932) 2019-03-06 15:04:28 +01:00
Gav Wood 828cd9580a Stash/controller model for staking (#1782)
* First steps to stash/controller separation

* More drafting

* More drafting

* Finish draft.

* Optimisation

* Remove accidental commit

* Make it build.

* Fix linked map for traits.

* Fix Option<_> variant.

*  Improve naming a tad

* Rebuild runtime

* Builds!

* First test.

* Bump RT version

* Minor fix

* Update Mock

* adds the correct reward testcase (+staking eras which was already ok)

* fixes the basic staking testcase to work properly (along with a small fix in the module)

* New logic to avoid controller transferring stash.

* Fix some build issues.

* adding some comments to tests

* Fix impls.

* adds a few more lines to explain the test case

* More fixes.

* gets the basic test up and running again

* Fix rest of build

* Rebuild wasm

* Fix docs.

* fix staking test with new chnages

* updating some tests, pending questions

* More working tests

* adds double staking test

* Docs

* remove invalid slashing test

* Payee stuff.

* Fix build

* Docs

* Fix test

* Fix a couple of tests

* Layout plan for finishing tests before Pragmen

* Add some working tests

* re-build staking and reward tests

* Add more tests

* fix offline grace test

* Nominator should have payee checked for cleanup

* adds more nomination tets

* adds validator prefs tests

* Fix and clean up some TODOs

* Fix a couple of issues

* Fix tests

* noting warnings from tests

* final fix of local tests

* Fix slot_stake bug

* Half baked test

* Add logic to limit `unstake_threshold` set in storage

* Make sure to check before writing!

Almost forgot this one

* Move a couple of comments

* fix last broken slot_stake test

* Ignore broken test
2019-03-02 14:31:48 +01:00
Pierre Krieger 90eef10d5c Address review in #1884 (#1906) 2019-03-01 11:40:57 +01:00
Pierre Krieger c21d7436cc Add an RPC request for the state of the network (#1884)
* Add an RPC request for the state of the network

* Fix concerns

* Fix tests

* Replace comment with TODO

* Rename the RPC
2019-02-28 19:28:38 +01:00
Gregory Terzian bc15fa31ff Add connected peers to protocol, use in sync provider (#1857)
* add connected peers to protocol, use in sync provider

* use PeerId::random

* address comments`

* docs

* fix import of PeerId

* rewrite rpc tests using PeerId::random

* whitespace

* nits

* remove option around peer id and remove field

* further removal of the option around peer id

* fix rpc tests
2019-02-27 18:50:47 +01:00
Pierre Krieger 733ce7d616 Split Substrate messages into multiple substreams (#1796)
* Split Substrate messages into multiple substreams

* Add back Clogged event
2019-02-25 11:55:45 +01:00
Andrew Jones 22aa8482ae Use BandwidthLogging struct from libp2p (#1847)
* Delete existing

* Use bandwidth from libp2p
2019-02-21 19:19:25 +01:00
Pierre Krieger 2b71b3e84b Update to libp2p v0.4 (#1836) 2019-02-21 10:04:53 +01:00
Pierre Krieger 8a3f52bdd8 Fix #1825 (#1828)
* Fix #1825

* Add comment
2019-02-21 10:02:27 +01:00
Roman Borschel cf71350186 Ensure config directory exists. (#1802)
Ensure the config directory exists before trying to write the public key file.
It is the responsibility of obtain_private_key to do so, as per the purpose
of this function.
2019-02-15 09:52:35 +01:00
Stanislav Tkach ff5e4ca87e Migrate everything to the 2018 edition (#1758) 2019-02-13 11:45:59 +01:00
Pierre Krieger 6e26c52191 Add debug name in node infos (#1769) 2019-02-12 18:03:46 +01:00
Pierre Krieger 9e999cdd81 Make network-libp2p's Service generic over the message (#1708)
* Make network-libp2p's Service generic over the message

* Apply suggestions from code review

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

* Fix warning
2019-02-12 15:36:15 +01:00
Pierre Krieger d93769b0fd Fix infinite loop in reserved mode (#1759) 2019-02-11 15:04:23 +00:00
Pierre Krieger 35a4aa638c Make the discovery test more strict (#1721) 2019-02-11 13:47:14 +01:00
Pierre Krieger bf2dd5f419 Reduce the spam from network misbehaviours (#1750)
* Reduce the spam from network misbehaviours

* Add protocol id to misbehaviour
2019-02-11 11:39:14 +01:00
Pierre Krieger 3509b69c4c Remove warning about empty list of identify addresses (#1739) 2019-02-08 15:39:15 +03:00
Pierre Krieger 7afe69066f Fix panic in custom protocol handler (#1723) 2019-02-07 16:16:41 +00:00
Pierre Krieger 0da92bf114 Protect against flood of addresses (#1718) 2019-02-07 14:54:59 +01:00
Pierre Krieger b6fd967dfb Update libp2p to v0.3 (#1634)
* Update libp2p

* Some more diagnostics

* 30 seconds back to 5 seconds

* Bump libp2p-core and improve test

* Fix runtime Cargo.lock

* More work

* Finish upgrade to libp2p 0.3

* Add a maximum of 60 seconds for the rounds

* Remove env_logger

* Update Cargo.lock

* Update Cargo.lock in test-runtime

* Fix test compilation

* Make the test pass

* Add identify addresses to Kademlia

* Don't connect to nodes we're already connected to

* Add warning for non-Substrate nodes

* Fix external address not added

* Start in Enabled mode
2019-02-06 16:39:22 +01:00
Gregory Terzian a2d2ed69ab Rewrite network protocol/service to use channels (#1340)
* rewrite network protocol/service to use channels

* remove use of unwrap

* re-introduce with_spec

* remove unnecessary mut

* remove unused param

* improve with_spec, add with_gossip

* rename job to task

* style: re-add comma

* remove extra string allocs

* rename use of channel

* turn TODO into FIXME

* remove mut in match

* remove Self in new

* pass headers by value to network service

* remove network sender from service

* remove TODO

* better expect

* rationalize use of network sender in ondemand
2019-02-06 12:54:02 +01:00
Pierre Krieger ec790acf4d Print the local node address again (#1628) 2019-01-30 23:33:14 +01:00
Svyatoslav Nikolsky 2037c52fbe make --port 30334 work again (#1620) 2019-01-30 14:46:39 +01:00
Benjamin Kampmann ab4c70b379 Update dependencies (#1527)
* update to latest env_logger

* roundabout dependency update

* Update to latest vengen

* Update rand to 0.6

* Update to latest rng shuffle API

* Roundabout update of dependencies

* Update rustc_hex

* Update wasm

* Fix logging setup in tests

* revert to fix test
2019-01-25 12:44:41 +01:00
Bastian Köcher 27a882bfac Refactor CLI handling (#1368)
* Rework cli handling

* Update readme

* Adds support for custom subcommands and extra run parameters

* Update readme

* Fixes compilation after master merge

* Make "Run" the default subcommand

Actually its hidden to the outside that is an subcommand.

* Rewrite CLI to work without breaking old CLI behavior

* Some cleanup

* Fix incorrect config setup

* Update README

* Fixes after merge

* Fixes incorrect README
2019-01-25 10:48:46 +00:00
Pierre Krieger a1586df41b Report the average network bandwidth (#1551)
* Report the average network bandwidth

* Fix concerns
2019-01-25 10:34:34 +00:00
Pierre Krieger d30a8e0bc3 Log the clogging networking messages (#1532) 2019-01-23 15:24:25 +01:00
Pierre Krieger cd86643f33 Report when peer is clogged (#1528) 2019-01-23 14:30:20 +01:00
Pierre Krieger 3c7d6c7b72 Add some networking tests (#1480) 2019-01-21 19:26:12 +01:00
Pierre Krieger f67c2cc181 Store identification info about the remote (#1500)
* Store identification info about the remote

* Add node name on the wire

* Fix tests
2019-01-21 14:33:25 +01:00
Pierre Krieger 763d133173 Put back support for WebSockets in the transport (#1486) 2019-01-19 12:41:17 +01:00
Pierre Krieger b009b42a68 Update network-libp2p to edition 2018 (#1481) 2019-01-19 12:38:52 +01:00
Pierre Krieger f1f32ac620 Don't queue messages after shutdown (#1476) 2019-01-19 12:37:07 +01:00
Pierre Krieger eb000fb1ae Remove warning for large buffer (#1357) 2019-01-17 09:33:39 +01:00
Pierre Krieger 9018d752dc Update libp2p-kad and libp2p-secio (#1447)
* Update libp2p-kad and libp2p-secio

* Fix concern
2019-01-16 12:59:24 -03:00
Xiliang Chen 623775ad96 enable dns transport (#1433) 2019-01-15 11:23:32 +01:00