585 Commits

Author SHA1 Message Date
Thomas Eizinger
44236b5ba3
Bump snow to version 0.7.0 (#1610) 2020-06-16 14:58:06 +02:00
Roman Borschel
e8bf34fcf1
[libp2p-ping] Properly close the substream in the InboundUpgrade. (#1606)
Not doing so may result in FIN/RST frames being sent before
earlier data frames. See https://github.com/paritytech/yamux/pull/81#issuecomment-643169973.
2020-06-12 17:41:04 +02:00
folex
d7c1989340
better iterlog (#20) 2020-06-10 18:11:36 +03:00
Taiki Endo
9aaf042410
Remove uses of pin_project::project attribute (#1604)
pin-project will deprecate the project attribute due to some unfixable
limitations.

Refs: https://github.com/taiki-e/pin-project/issues/225
2020-06-09 18:01:57 +02:00
folex
c36397b7de
Report bucket size to prometheus (#19) 2020-06-09 15:17:16 +03:00
folex
b7ec948326
Add prometheus metrics (#18) 2020-06-05 21:15:18 +03:00
folex
3e2ed64faa
Weighted routing (#17) 2020-06-05 20:04:53 +03:00
Pierre Krieger
c76327e6b5
Pin async-std in a different way (#1600) 2020-06-05 11:14:02 +02:00
Pierre Krieger
a4eb67a40d
Fix some libp2p-kad types not being reexported (#1595)
* Fix QueryRef/QueryMut not being reexported

* More reexports
2020-06-02 10:33:32 +02:00
Roman Borschel
fbccf4c72a
Readd lost noise upgrades. (#1580) 2020-05-25 18:39:56 +02:00
Pierre Krieger
a921b7cb73
Publish v0.19.1 (#1592) 2020-05-25 16:02:30 +02:00
Roman Borschel
25dc7c08e3
Temporarily bound all async-std dependencies. (#1589)
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-05-25 14:49:16 +02:00
folex
0bd3d9b6b6
Use master branch on fluencelabs/fluence #16 2020-05-20 13:06:15 +03:00
folex
0fea4a1986 fix wasm build: imports 2020-05-19 23:17:33 +03:00
folex
b4681cca12 fix wasm build 2020-05-19 23:10:33 +03:00
folex
d78805364d ssh => https 2020-05-19 21:45:41 +03:00
folex
27c30a9f2d arqada => fluence 2020-05-19 19:36:25 +03:00
folex
e6915be539 0.19 WIP 2020-05-19 19:23:44 +03:00
folex
8bc0c9db51 Merge branch 'rust_master' into fluence_master
# Conflicts:
#	examples/distributed-key-value-store.rs
#	examples/ipfs-kad.rs
#	protocols/kad/src/behaviour.rs
#	protocols/kad/src/behaviour/test.rs
#	protocols/kad/src/lib.rs
#	protocols/kad/src/query/peers/closest.rs
2020-05-19 19:11:50 +03:00
Pierre Krieger
34faf94538
Publish 0.19.0 (#1579) 2020-05-18 15:45:21 +02:00
Kevin Zhang
2fbd1a5503
Keep consistency with Upgrade Inbound by using PING_SIZE (#1578)
although 32 is prefect fine in our case, it would be consistent to use the const value PING_SIZE.

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-05-18 11:14:31 +02:00
Roman Borschel
3a96ebf57f
More insight into Kademlia queries. (#1567)
* [libp2p-kad] Provide more insight and control into Kademlia queries.

More insight: The API allows iterating over the active queries and
inspecting their state and execution statistics.

More control: The API allows aborting queries prematurely
at any time.

To that end, API operations that initiate new queries return the query ID
and multi-phase queries such as `put_record` retain the query ID across all
phases, each phase being executed by a new (internal) query.

* Cleanup

* Cleanup

* Update examples and re-exports.

* Incorporate review feedback.

* Update CHANGELOG

* Update CHANGELOG

Co-authored-by: Max Inden <mail@max-inden.de>
2020-05-16 10:43:09 +02:00
folex
a378a1daec
Make trust graph a public field (#14) 2020-05-14 17:45:07 +03:00
folex
f737645609
Print latency logs after ClosestIter has finished (#13) 2020-05-14 17:44:07 +03:00
folex
2eb4622a74
Show PeerId as pubkey-inlining if possible, add .as_public_key() #11 2020-05-14 17:40:50 +03:00
David Craven
0443fea157
Update to latest multihash. (#1566)
* Update to latest multihash.

* Update changelog.

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-05-13 17:51:11 +02:00
Rüdiger Klaehn
a83654ca4c
Add a method to create a pre shared key when you already have the raw bytes (#1570) 2020-05-13 17:08:12 +02:00
Max Inden
06721128f1
protocols/kad: Remove unnecessary PeerId conversion for fixed iter (#1573)
`FixedPeersIter` requires the initial set of peers to be passed as
`PeerId`s and not as `Key<PeerId>`s. This commit removes the unnecessary
conversion.
2020-05-13 16:47:02 +02:00
Max Inden
70e797112f
protocols/kad/query/closest: Make quickcheck deterministic (#1571)
Instead of creating unconstrained random number generators in quickcheck
tests to generate test data, have quickcheck provide a `Seed` to seed
those random number generators and thus make the test execution
deterministic / reproducible.
2020-05-12 21:31:20 +02:00
Max Inden
44c0c76981
protocols/kad/query/fixed: Decrease num_waiting on failure (#1572)
Make sure to decrease `num_waiting` when being notified of a peer
failure to allow an additional peer to be queried.

Given that `FixedPeersIter` is initialized with `replication_factor` by
`QueryPool` this bug will not surface today.
2020-05-12 12:23:40 +02:00
Roman Borschel
bd5e81fedb
Spec-compliant Noise Protocol (#1545)
* Add spec-compliant x25519 protocol.

* Cosmetic protobuf spec compliance.

* Keep support for IK/IX. Update changelog.

* Update docs.

* CI
2020-05-06 14:30:23 +02:00
Max Inden
1be34fd7a3
protocols/gossipsub: Correct max transmit size error handling (#1558)
If a user sends a message that is over the maximum transmission size gossipsub
will disconnect from the peer being sent the message.

This PR updates the logic to simply emit an error, not send the over-sized
message but maintain the long-lived streams for future messages.

Co-authored-by: Age Manning <Age@AgeManning.com>
2020-04-28 16:18:35 +02:00
folex
403315dab4 ProtoRecords 2020-04-21 21:45:29 +03:00
folex
122bb921d7 Merge branch 'fluence_master' into memory_store_set 2020-04-21 21:40:48 +03:00
folex
9a865e3735 pub use proto::Record 2020-04-21 21:38:08 +03:00
folex
eb837aad33 make record_{to,from}_proto public 2020-04-21 21:27:35 +03:00
folex
838edad224 impl Hash 2020-04-21 19:54:44 +03:00
folex
51bdf2757d Fix kad behaviour test.rs 2020-04-21 19:54:30 +03:00
folex
807217653a fluence janus branch 2020-04-20 19:36:17 +03:00
folex
5e49b42b77 Merge Libp2p 0.18 & 0.18.1 2020-04-20 19:34:21 +03:00
folex
9863c11cd3 Merge branch 'master' into fluence_master
# Conflicts:
#	CHANGELOG.md
#	Cargo.toml
#	core/Cargo.toml
#	misc/core-derive/Cargo.toml
#	misc/peer-id-generator/Cargo.toml
#	muxers/mplex/Cargo.toml
#	muxers/yamux/Cargo.toml
#	protocols/deflate/Cargo.toml
#	protocols/floodsub/Cargo.toml
#	protocols/gossipsub/Cargo.toml
#	protocols/identify/Cargo.toml
#	protocols/kad/Cargo.toml
#	protocols/kad/src/behaviour.rs
#	protocols/kad/src/behaviour/test.rs
#	protocols/mdns/Cargo.toml
#	protocols/noise/Cargo.toml
#	protocols/ping/Cargo.toml
#	protocols/plaintext/Cargo.toml
#	protocols/pnet/Cargo.toml
#	protocols/secio/Cargo.toml
#	swarm/Cargo.toml
#	swarm/src/lib.rs
#	transports/dns/Cargo.toml
#	transports/tcp/Cargo.toml
#	transports/uds/Cargo.toml
#	transports/wasm-ext/Cargo.toml
#	transports/websocket/Cargo.toml
2020-04-20 19:29:58 +03:00
folex
8d8901302b
Better routing table printing (#8) 2020-04-20 16:22:13 +03:00
Max Inden
9f981a4bb6
src/query/peers/closest: Consider K_VALUE peers at initialization (#1536)
* protocols/kad/query/peers/closest: Consider K_VALUE nodes at init

By considering `K_VALUE` at `ClosestPeersIter` initialization, the initial peer
set length is independent of `num_results` and thus of the `replication_factor`.

* protocols/kad/src/behaviour/test: Enable building single nodes

Introduces the `build_node` function to build a single not connected
node. Along the way replace the notion of a `port_base` with returning
the actual `Multiaddr` of the node.

* protocols/kad/behaviour/test: Fix bootstrap test initialization

When looking for the closest node to a key, Kademlia considers
ALPHA_VALUE nodes to query at initialization. If `num_groups` is larger
than ALPHA_VALUE the remaining locally known nodes will not be
considered. Given that no other node is aware of them other than node 1,
they would be lost entirely. To prevent the above restrict `num_groups`
to be equal or smaller than ALPHA_VALUE.

* protocols/kad/behaviour/test: Fix put_record and get_provider

In the past, when trying to find the closest nodes to a key, Kademlia
would consider `num_result` amount of nodes to query out of all the
nodes it is aware of.

Both the `put_record` and the `get_provider` tests initialized their
swarms in the same way. The tests took the replication factor to use as
an input. The number of results to get was equal to the replication
factor. The amount of swarms to start was twice the replication factor.
Nodes would be grouped in two groups a replication factor nodes. The
first node would be aware of all of the nodes in the first group. The
last node of the first group would be aware of all the nodes in the
second group.

By coincidence (I assume) these numbers played together very well. At
initialization the first node would consider `num_results` amount of
peers (see first paragraph). It would then contact each of them. As the
first node is aware of the last node of the first group which in turn is
aware of all nodes in the second group, the first node would eventually
discover all nodes.

Recently the amount of nodes Kademlia considers at initialization when
looking for the nodes closest to a key was changed to only consider
ALPHA nodes.

With this in mind playing through the test setup above again would
result in (1) `replication_factor - ALPHA` nodes being entirely lost as
the first node would never consider them and (2) the first node probably
never contacting the last node out of the first group and thus not
discovering any nodes of the second group.

To keep the multi hop discovery in place while not basing ones test
setup on the lucky assumption of Kademlia considering replication factor
amount of nodes at initialization, this patch alters the two tests:

Build a fully connected set of nodes and one addition node (the first
node). Connect the first node to a single node of the fully connected
set (simulating a boot node). Continue as done previously.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-04-17 19:57:35 +02:00
Max Inden
77a34c0a0d
protocols/kad/query/peers/closest: Make at_capacity use max (#1548)
When not making progress for `parallelism` time a `ClosestPeersIter`
becomes `State::Stalled`. When stalled an iterator is allowed to make
more parallel requests up to `num_results`. If `num_results` is smaller
than `parallelism` make sure to still allow up to `parallelism` requests
in-flight.

Co-Authored-By: Roman Borschel <romanb@users.noreply.github.com>
2020-04-16 15:33:09 +02:00
Pierre Krieger
aa71158e5c
Publish 0.18.0 (#1547) 2020-04-09 16:54:01 +02:00
Joonas Koivunen
80ea2f6fd7
feat: allow sent messages seen as subscribed (#1520)
* feat: allow sent messages seen as subscribed

minor feature to allow mimicing the behaviour expected by ipfs api tests.

* refactor: rename per review comments

* refactor: rename Floodsub::options to config

* chore: update changelog

* Update CHANGELOG.md

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

Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-04-09 15:15:17 +02:00
Max Inden
c1191d5f83
protocols/kad/behaviour: Return peers independent of record existence (#1544)
A node receiving a `GetRecord` request first checks whether it has the
given record. If it does have the record it does not return closer
nodes.

A node that knows the record for the given key is likely within a
neighborhood of nodes that know the record as well. In addition the node
likely knows its neighboorhood well.

When querying for a key with a quorum of 1 the above behavior of only
returning the record but not any close peers is fine. Once one queries
with a higher quorum having a node respond with the record as well as
close nodes is likely going to speed up the query, given that the
returned peers probably know the record as well.
2020-04-08 10:31:45 +02:00
vms
9d078e87ea another fix 2020-04-06 14:26:00 +03:00
vms
910ffd580c wip 2020-04-06 13:48:36 +03:00
vms
077b3301ab libp2p 0.17 2020-04-06 12:55:56 +03:00