1261 Commits

Author SHA1 Message Date
dependabot[bot]
84f9b70763
Update curve25519-dalek requirement from 2.0.0 to 3.0.0 (#1753)
* Update curve25519-dalek requirement from 2.0.0 to 3.0.0

Updates the requirements on [curve25519-dalek](https://github.com/dalek-cryptography/curve25519-dalek) to permit the latest version.
- [Release notes](https://github.com/dalek-cryptography/curve25519-dalek/releases)
- [Changelog](https://github.com/dalek-cryptography/curve25519-dalek/blob/master/CHANGELOG.md)
- [Commits](https://github.com/dalek-cryptography/curve25519-dalek/compare/2.0.0...3.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

* *: Add CHANGELOG and Cargo.toml entries

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-09-15 10:53:14 +02:00
dependabot[bot]
36d33f1eaa
Update sha2 requirement from 0.8.0 to 0.9.1 (#1747)
* Update sha2 requirement from 0.8.0 to 0.9.1

Updates the requirements on [sha2](https://github.com/RustCrypto/hashes) to permit the latest version.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/whirlpool-v0.8.1...sha2-v0.9.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Fix update errors.

* Update CHANGELOGs and versions.

* Update Cargo.toml

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Toralf Wittner <tw@dtex.org>
2020-09-14 13:31:20 +02:00
dependabot[bot]
9647557f0d
Update base64 requirement from 0.11.0 to 0.12.3 (#1749)
* Update base64 requirement from 0.11.0 to 0.12.3

Updates the requirements on [base64](https://github.com/marshallpierce/rust-base64) to permit the latest version.
- [Release notes](https://github.com/marshallpierce/rust-base64/releases)
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.11.0...v0.12.3)

Signed-off-by: dependabot[bot] <support@github.com>

* protocols/gossipsub/CHANGELOG: Make dependency entry generic

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-11 15:19:05 +02:00
dependabot[bot]
51dc834b23
Update lru_time_cache requirement from 0.10.0 to 0.11.0 (#1746)
* Update lru_time_cache requirement from 0.10.0 to 0.11.0

Updates the requirements on [lru_time_cache](https://github.com/maidsafe/lru_time_cache) to permit the latest version.
- [Release notes](https://github.com/maidsafe/lru_time_cache/releases)
- [Changelog](https://github.com/maidsafe/lru_time_cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/maidsafe/lru_time_cache/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* *: Update changelogs and cargo manifests

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-11 12:16:36 +02:00
Max Inden
554e3b071a
.github: Add dependabot.yml (#1744) 2020-09-11 10:07:06 +02:00
Max Inden
6be6c09c19
core/Cargo.toml: Require parity-multiaddr 0.9.2 for Ord bound (#1742)
With b601ed4 libp2p-core requires the `Ord` bound on `Multiaddr`. This
bound is only implemented with parity-multiaddr `0.9.2`. Make sure
libp2p-core requires at least parity-multiaddr `0.9.2`.

* *: Prepare libp2p 0.28.1 release
2020-09-10 11:03:14 +02:00
Roman Borschel
7597485739
Prepare v0.28.0 (#1741) 2020-09-09 15:46:40 +02:00
Toralf Wittner
1e09a1c89b
yamux 0.8.0 upgrade (#1736)
* yamux-0.5.0 upgrade

* yamux-0.6.0 upgrade.

* yamux-0.7.0 upgrade.

* Yamux-0.8.0 upgrade.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-09-09 15:28:57 +02:00
Roman Borschel
2618899b85
Prepare v0.27.0 (#1740) 2020-09-09 15:00:08 +02:00
Toralf Wittner
f351470998
yamux 0.7.0 upgrade (#1735)
* yamux-0.5.0 upgrade

* yamux-0.6.0 upgrade.

* yamux-0.7.0 upgrade.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-09-09 14:41:14 +02:00
Roman Borschel
a8d491bf7b
Prepare v0.26 (#1739) 2020-09-09 14:14:04 +02:00
Toralf Wittner
7438b8a693
yamux-0.6.0 upgrade (#1734)
* yamux-0.5.0 upgrade

* yamux-0.6.0 upgrade.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-09-09 13:07:03 +02:00
Roman S. Borschel
7c3b8a9c86 Update root changelog for SECIO deprecation. 2020-09-09 12:43:41 +02:00
Roman Borschel
a262609db4
Prepare release(s). (#1738) 2020-09-09 12:20:25 +02:00
Toralf Wittner
0621124a87
yamux-0.5.0 upgrade (#1733)
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-09-09 11:38:05 +02:00
Roman Borschel
f0133a0213
[core] Simplify accepting incoming connections. (#1732)
* Simplify incoming connection handling.

Instead of handing out a mutable borrow to the connection
pool in the `IncomingConnectionEvent`, so one can call
`IncomingConnectionEvent::accept()`, just provide
`Network::accept()`.

* Update docs.

* Update CHANGELOG.
2020-09-09 11:21:37 +02:00
Toralf Wittner
f86bc01e20
Add back the LRU cache to Throttled. (#1731)
* Restore `RequestResponse::throttled`.

In contrast to the existing "throttled" approach this PR adds back-
pressure to the protocol without requiring pre-existing knowledge
of all nodes about their limits. It adds small, CBOR-encoded headers
to the actual payload data. Extra credit messages communicate back
to the sender how many more requests it is allowed to send.

* Remove some noise.

* Resend credit grant after connection closed.

Should an error in some lower layer cause a connection to be closed,
our previously sent credit grant may not have reached the remote peer.
Therefore, pessimistically, a credit grant is resent whenever a
connection is closed. The remote ignores duplicate grants.

* Remove inbound/outbound tracking per peer.

* Send ACK as response to duplicate credit grants.

* Simplify.

* Fix grammar.

* Incorporate review feedback.

- Remove `ResponseSent` which was a leftover from previous attemps
  and issue a credit grant immediately in `send_response`.
- Only resend credit grants after a connection is closed if we are
  still connected to this peer.

* Move codec/header.rs to throttled/codec.rs.

* More review suggestions.

* Generalise `ProtocolWrapper` and use shorter prefix.

* Update protocols/request-response/src/lib.rs

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

* Update protocols/request-response/src/throttled.rs

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

* Update protocols/request-response/src/throttled.rs

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

* Minor comment changes.

* Limit max. header size to 8KiB

* Always construct initial limit with 1.

Since honest senders always assume a send budget of 1 and wait for
credit afterwards, setting the default limit to a higher value
can only become effective after informing the peer about it which
means leaving `max_recv` at 1 and setting `next_max` to the desired
value.

* Use LRU cache to keep previous peer infos.

Peers may send all their requests, reconnect and send again all their
requests, starting from a fresh budget. The LRU cache keeps the peer
information around and reuses it when the peer reconnects, continuing
with the previous remaining limit.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-09-09 11:04:20 +02:00
Max Inden
5a3e7f7e6e
protocols/gossipsub/tests/smoke: Improve wait_for reporting (#1737) 2020-09-09 09:54:02 +02:00
Max Inden
244c5aa87a
core/transport/memory: Return dialer address in Upgrade event (#1724)
Previously a `Listener` would return its own address as the
`remote_addr` in the `ListenerEvent::Upgrade` event.

With this commit a `Listener` returns the dialer address as the
`remote_addr` in the `ListenerEvent::Upgrade` event. To do so a
`DialFuture` registers a port with the global `HUB` at construction
which is later on unregistered in the `Drop` implementation of the
dialer's `Chan`. The sending side of the `mpsc::channel` registered in
the `HUB` is dropped at `DialFuture` construction, thus one can not dial
the dialer port. This mimics the TCP transport behaviour preventing both
dialing and listening on the same TCP port.
2020-09-08 12:07:15 +02:00
Roman Borschel
6599ff13e1
[kad] Increase default payload limits. (#1730)
* libp2p-kad: Increase default max packet size.

For better interoperability by default, picking up the
suggestion in https://github.com/libp2p/rust-libp2p/issues/1622.

* Update changelog.
2020-09-08 11:21:01 +02:00
Roman S. Borschel
08a7b1dcd2 Update request-response changelog. 2020-09-07 17:25:15 +02:00
Toralf Wittner
d988b05f85
Restore RequestResponse::throttled. (#1726)
* Restore `RequestResponse::throttled`.

In contrast to the existing "throttled" approach this PR adds back-
pressure to the protocol without requiring pre-existing knowledge
of all nodes about their limits. It adds small, CBOR-encoded headers
to the actual payload data. Extra credit messages communicate back
to the sender how many more requests it is allowed to send.

* Remove some noise.

* Resend credit grant after connection closed.

Should an error in some lower layer cause a connection to be closed,
our previously sent credit grant may not have reached the remote peer.
Therefore, pessimistically, a credit grant is resent whenever a
connection is closed. The remote ignores duplicate grants.

* Remove inbound/outbound tracking per peer.

* Send ACK as response to duplicate credit grants.

* Simplify.

* Fix grammar.

* Incorporate review feedback.

- Remove `ResponseSent` which was a leftover from previous attemps
  and issue a credit grant immediately in `send_response`.
- Only resend credit grants after a connection is closed if we are
  still connected to this peer.

* Move codec/header.rs to throttled/codec.rs.

* More review suggestions.

* Generalise `ProtocolWrapper` and use shorter prefix.

* Update protocols/request-response/src/lib.rs

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

* Update protocols/request-response/src/throttled.rs

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

* Update protocols/request-response/src/throttled.rs

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

* Minor comment changes.

* Limit max. header size to 8KiB

* Always construct initial limit with 1.

Since honest senders always assume a send budget of 1 and wait for
credit afterwards, setting the default limit to a higher value
can only become effective after informing the peer about it which
means leaving `max_recv` at 1 and setting `next_max` to the desired
value.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-09-07 17:22:40 +02:00
Roman Borschel
ed5aec14f3
Deprecate secio. (#1729)
SECIO is removed from all libp2p implementations.
See https://blog.ipfs.io/2020-08-07-deprecating-secio/.
2020-09-07 12:13:10 +02:00
Roman S. Borschel
c94262d03a Set development versions appropriately and update changelogs. 2020-09-03 12:31:45 +02:00
Roman S. Borschel
e62cd44a99 Update core changelog. 2020-09-03 11:29:52 +02:00
Thomas Eizinger
3100444085
Allow any closure to be passed as an executor (#1686)
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-09-03 11:28:15 +02:00
Roman Borschel
6a1279407e
[noise] Remove (by default) support for receiving legacy handshakes. (#1685)
* Remove (by default) support for receiving legacy noise handshakes.

* Update noise version.
2020-09-01 11:20:57 +02:00
Roman S. Borschel
f2c43527f4 Prepare multiaddr-0.9.2 2020-08-31 17:22:43 +02:00
Roman S. Borschel
1c7f6b1c11 Update libp2p-kad changelog. 2020-08-31 17:19:02 +02:00
Max Inden
0136af5025
protocols/kad: Implement ilog2 for Distance (#1719)
In order to make use of the distances returned by `KBucketRef::range` in
a human readable format, one needs to be able to translate the 256 bit in
a `Distance` to a smaller space.
2020-08-28 09:00:07 +02:00
Pierre Krieger
73f596ef32
Re-export the wasm-ext/websocket feature from the frontend crate (#1718) 2020-08-27 11:33:32 +02:00
Max Inden
293f2f83af
docs/release.md: Add release documentation (#1712)
* docs/release.md: Add release documentation

* docs/release.md: Address comments

* docs/release.md: Add annotation -a option

* docs/release: Mention bumping Cargo.toml version

* docs/release.md: Extract name and version with sed

* docs/release.md: Remove instruction for release date in changelog
2020-08-27 11:32:27 +02:00
Roman Borschel
7b415d5e70
Remove temporary peer ID compatibility mode. (#1608)
* Remove temporary peer ID compatibility.

This removes the temporary compatibility mode between
peer IDs using identity hashing and sha256, thus being
the last step in the context of https://github.com/libp2p/rust-libp2p/issues/555.

* Check digest length in PeerId::from_multihash for Identity hash.

* Update core/src/peer_id.rs

Co-authored-by: Toralf Wittner <tw@dtex.org>

* Update core changelog.

* Update core changelog.

Co-authored-by: Toralf Wittner <tw@dtex.org>
2020-08-26 13:03:35 +02:00
Roman S. Borschel
5f7b7d22ab Update core changelog. 2020-08-24 10:48:36 +02:00
André Silva
b601ed41b1
core: remove duplicates when performing address translation (#1697)
* core: remove duplicates when performing address translation

* core: use filter_map instead of flat_map

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

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-08-24 10:46:54 +02:00
Toralf Wittner
0b05b21093
Add ProtocolsHandler::InboundOpenInfo. (#1714)
* Add `ProtocolsHandler::InboundOpenInfo`.

* Update swarm/src/protocols_handler/multi.rs

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

* Update CHANGELOGs and versions.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-08-23 16:57:20 +02:00
Max Inden
740a2e0235
protocols/kad/src/kbuckets: Explicitly convert u8 to usize (#1716)
Compiling libp2p-kad for `--target wasm32-unknown-unknown` fails with
the cryptic error message `cannot infer type for type `usize``.
Explicitly converting to `usize` solves the issue.

Co-authored-by: Andronik Ordian <write@reusable.software>
2020-08-19 17:44:41 +02:00
Max Inden
3d07a05f8b
*: Prepare v0.24.0 release (#1713)
* */CHANGELOG: Update dates

* Cargo.toml: Update to 0.24.0
2020-08-18 17:04:34 +02:00
Roman S. Borschel
d3b1c5d0b0 Update swarm changelog. 2020-08-18 16:28:22 +02:00
Toralf Wittner
21f9447796
Implement ProtocolsHandler methods in wrappers. (#1710)
* Implement ProtocolsHandler methods in wrappers.

This PR forwards calls to some ProtocolsHandler methods that were
previously not implemented in wrappers such as `MapInEvent`.

It is unclear though how this can be implemented in some handlers
such as `MultiHandler` as the information at hand does not enable
it to decide which handler to forward the call to.

* Add `MultiHandler::inject_listen_ugrade_error`.
2020-08-18 16:27:02 +02:00
Max Inden
cbdbf656c0
protocols/mdns: Make libp2p-mdns socket agnostic (#1699)
Allow libp2p-mdns to use either async-std or tokio to drive required UDP
socket.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-08-18 14:51:03 +02:00
Toralf Wittner
b4ad2d6297
Disable RequestResponse::throttled. (#1711)
Can be enabled again after #1706 is resolved.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-08-18 14:29:38 +02:00
Roman Borschel
e1df920703
[kad] Store addresses of provider records. (#1708)
* Store addresses of provider records.

So far, provider records are stored without their
addresses and the addresses of provider records are
obtained from the routing table on demand. This has
two shortcomings:

  1. We can only return provider records whose provider
  peers happen to currently be in the local routing table.

  2. The local node never returns itself as a provider for
  a key, even if it is indeed a provider.

These issues are addressed here by storing the addresses
together with the provider records, falling back to
addresses from the routing table only for backward-compatibility
with existing implementations of `RecordStore` using persistent
storage.

Resolves https://github.com/libp2p/rust-libp2p/issues/1526.

* Update protocols/kad/src/behaviour.rs

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

* Remove negligible use of with_capacity.

* Update changelog.

Co-authored-by: Max Inden <mail@max-inden.de>
2020-08-18 14:14:31 +02:00
Arnaud Lefebvre
269a2ac2a8
Examples: adapt distributed-key-value-store to also GET / PUT providers (#1704)
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-08-17 16:30:45 +02:00
Roman S. Borschel
9dd1309040 Changelog updates. 2020-08-17 10:14:44 +02:00
Toralf Wittner
91d50b2723
Custom yamux mode (#1691)
* Allow override the yamux connection mode.

* Add `multiplex_ext` to transport `Builder`.

This method exposes the connection info and connected point to a provided
function which creates the upgrade and can base the decision on `PeerId`
or other connection information such as IP address.

* Re-export `yamux::Mode`.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-08-17 10:07:41 +02:00
Arnaud Lefebvre
d1024d272c
protocols/kad: fix doc for the event emitted by start_providing (#1705) 2020-08-14 16:10:39 +02:00
Roman Borschel
96484fcd5e
Fix connection keep-alive for request-response. (#1700) 2020-08-13 13:13:23 +02:00
Toralf Wittner
7d47ada077
Fix ping test in request-response. (#1702)
The codec impl did not check that it actually read any bytes in
`read_request` and `read_response`. The used `read_one` function
does not error on EOF either, so instead of signalling connection
loss the codec could produce empty `Ping` or `Pong` messages.
2020-08-13 12:49:16 +02:00
Rüdiger Klaehn
0d26f50304
protocols/gossipsub: Add public accessors (#1677)
Co-authored-by: Toralf Wittner <tw@dtex.org>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-08-13 12:10:52 +02:00