1345 Commits

Author SHA1 Message Date
Roman Borschel
e5adb67d73
[multistream-select] Temporarily disable "parallel" negotiation. (#1807)
* [multistream-select] Temp. disable "parallel" negotiation.

In order to later change the "ls" responses for spec-compliance.

* Update version.

* Update misc/multistream-select/CHANGELOG.md

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

Co-authored-by: Max Inden <mail@max-inden.de>
2020-10-20 15:11:20 +02:00
dependabot[bot]
a3d6c8149e
Update env_logger requirement from 0.7.1 to 0.8.1 (#1806)
Updates the requirements on [env_logger](https://github.com/env-logger-rs/env_logger) to permit the latest version.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/commits/v0.8.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-20 10:00:18 +02:00
Roman S. Borschel
e901c082d7 Remove wildcard dev dependency. 2020-10-16 20:51:26 +02:00
Roman Borschel
a5f210adf3
Prepare release. (#1797) 2020-10-16 20:36:47 +02:00
Roman Borschel
dc56d44edb
Refine boxing during transport construction. (#1794)
* Rework boxing during transport construction.

* Cleanup

* Fix chat-tokio example.

* Update changelogs and versions.
2020-10-16 16:53:02 +02:00
Roman S. Borschel
2dbf834d10 Update mplex changelog. 2020-10-15 11:41:19 +02:00
Roman Borschel
f4a65e72bb
[mplex] Small enhancements. (#1785)
* More granular execution of pending flushes.

Also replace fnv hashing with nohash-hasher.

* Don't forget the pending case.

* Simplify.

* Use AtomicU32 for connection IDs.

* Revert to random u64.
2020-10-15 11:39:49 +02:00
dependabot[bot]
b48b93f4f7
Update pin-project requirement from 0.4.17 to 1.0.0 (#1793)
Updates the requirements on [pin-project](https://github.com/taiki-e/pin-project) to permit the latest version.
- [Release notes](https://github.com/taiki-e/pin-project/releases)
- [Changelog](https://github.com/taiki-e/pin-project/blob/master/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project/compare/v0.4.17...v1.0.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-14 11:17:15 +02:00
Roman S. Borschel
d5793fed37 Update mplex changelog. 2020-10-13 17:59:27 +02:00
Roman Borschel
b766d45b1c
[mplex] Split the receive buffer per substream. (#1784)
* Split the receive buffer per substream.

This split allows more efficient reading from the buffer
for a particular substream and to reset only the
offending substream if it reaches its buffer limit
with `MaxBufferBehaviour::ResetStream`. Previously
this was implemented as `MaxBufferBehaviour::CloseAll`
and resulted in the entire connection closing.

The buffer split should be advantageous whenever
not all substreams are read at the same pace and
some temporarily fall behind in consuming inbound
data frames.

* Tweak logging.

* Oops.

* Update muxers/mplex/src/io.rs

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

* Rename field as per review suggestion.

* Adjust and clarify max-buffer-behaviour.

* Set max_buffer_len to 32.

Since the limit is now per substream and the default
`max_substreams` is `128`, this new limit retains the
previous overall resource bounds for the buffers.

* Expand tests and small cleanup.

Co-authored-by: Max Inden <mail@max-inden.de>
2020-10-13 17:58:18 +02:00
Roman Borschel
6ed92ab4be
[swarm] MultiHandler: Respect inbound timeouts and upgrade versions. (#1786)
* Respect inbound timeouts and upgrade versions.

* Update CHANGELOG
2020-10-12 11:39:50 +02:00
Max Inden
6528114fe8
Cargo.toml: Bump libp2p-tcp patch version (#1790) 2020-10-11 22:56:46 +02:00
Max Inden
0c02a8ace7
swarm/src/protocols_handler: Use FuturesUnordered in NodeHandlerWrapper (#1775)
> Futures managed by FuturesUnordered will only be polled when they
generate wake-up notifications. This reduces the required amount of work
needed to poll large numbers of futures.

https://docs.rs/futures/0.3.5/futures/stream/struct.FuturesUnordered.html

Instead of iterating each inbound and outbound upgrade looking for one
to make progress, use a `FuturesUnordered` for both pending inbound and
pending outbound upgrades. As a result only those upgrades are polled
that are ready to progress.
2020-10-09 19:37:17 +02:00
Qinxuan Chen
b74285a8fb
protocols/tcp: Replace get_if_addrs with if-addrs (#1788)
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2020-10-09 14:18:39 +02:00
Zyansheep
6b3500b931
Add another chat example (but it uses tokio instead of async_std) (#1780)
* add tokio floodsub chat example

* use swarmbuilder to specify tokio executor

* fix comments

* Tweak tokio chat example.

Co-authored-by: Roman S. Borschel <roman@parity.io>
2020-10-08 12:37:16 +02:00
Roman Borschel
3e31ea9337
[multistream-select] Fix panic with V1Lazy (regression) and more convenient transport boxing. (#1783)
* [multistream-select] Fix panic with V1Lazy and add integration tests.

Fixes a panic when using the `V1Lazy` negotiation protocol,
a regression introduced in https://github.com/libp2p/rust-libp2p/pull/1484.

Thereby adds integration tests for a transport upgrade with both
`V1` and `V1Lazy` to the `multistream-select` crate to prevent
future regressions.

* Cleanup.

* Update changelog.
2020-10-07 11:10:54 +02:00
dependabot[bot]
2a5c1832a1
Update base64 requirement from 0.12.3 to 0.13.0 (#1782)
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.12.3...v0.13.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-05 10:12:40 +02:00
Roman S. Borschel
049d808566 Update mdns version and changelog. 2020-10-05 10:11:50 +02:00
Robert Klotzner
fe30849eec
Fix #1778: Double mdns recv_buffer to 4096 bytes (#1779)
Also add warn if parsing of a packet fails, so problems with for example packet
sizes can more easily be detected.

Reasoning:

The previous 2048 bytes is already larger than the recommend size by
[rfc6762](https://tools.ietf.org/html/rfc6762#page-46), which recommends
a packet size that fits within the interface MTU.

Nevertheless the rfc also states, that if more data needs to be
transmitted one should rely on IP fragments, which would only pose
problems when interfacing with devices not understanding IP fragments.
The standard also imposes a strict upper limit of 9000 bytes.

Therefore raising `recv_buffer` to 4096 seems sensible, given that we
already exceed the recommend size and given that we are not restricting
the size when sending in any way. Meaning the implementation already
sends packets larger than recommended, just can't handle them on
reception.
2020-10-05 10:03:21 +02:00
Roman Borschel
8cec457b5e
[multistream-select] Require remaining negotiation data to be flushed. (#1781)
* Require remaining negotiation data to be flushed.

There appears to still be an edge-case whereby the
`remaining` data to send w.r.t. protocol negotiation to send
is successfully written before a `poll_read` on a `Negotiated` stream,
but where the subsequent `poll_flush()` is pending.
Now `remaining` is empty and the next `poll_read()`
will go straight to reading from the underlying
I/O stream, despite the flush not having happened
yet, which can lead to a form of deadlock during
protocol negotiation.

Rather than complicating the existing code further in
order to accommodate for this case, it seems preferable
to simplify the code by giving up on this optimisation
that only affects the last negotiation protocol message
sent by the "listener". So we give up on the ability
to combine data sent by the "listener" immediately
after protocol negotiation together with the final
negotiation frame in the same transport-level frame/packet.

* Update changelog.

* Add missing comma.
2020-10-01 12:29:51 +02:00
Qinxuan Chen
c19344dee7
Update dependencies not detected by dependabot (#1776)
- parking_lot to 0.11.0
- salsa20 to 0.6.0
- sha3  to 0.9

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2020-09-30 18:26:35 +02:00
dependabot[bot]
aaa6e4add3
Update cuckoofilter requirement from 0.3.2 to 0.5.0 (#1763)
* Update cuckoofilter requirement from 0.3.2 to 0.5.0

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

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

* protocols/floodsub: Warn when Cuckoofilter has to evict item

With Cuckoofilter `v0.4.0` `add` and `test_and_add` return an error when
an old element has to be evicted in favor of a new one to take its
place. The previous behavior was panicing.

With this commit the error is logged on `warn` level.

* *: Update changelogs and cargo tomls

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-29 11:46:57 +02:00
Roman Borschel
f66f40bcd7
[ping] Add missing flush after write. (#1770)
After sending the ping and before awaiting the pong,
the stream must be flushed to guarantee the data is
sent before awaiting the reply.
2020-09-28 10:57:02 +02:00
Roman Borschel
0b18b864f2
[mplex] Refactoring with Patches (#1769)
* Refactor Mplex.

Thereby addressing the following issues:

  * Send a `Reset` frame when open substreams get dropped (313).
  * Avoid stalls caused by a read operation on one substream
    reading (and buffering) frames for another substream without
    notifying the corresponding task. I.e. the tracked read-interest
    must be scoped to a substream.
  * Remove dropped substreams from the tracked set of open
    substreams, to avoid artificially running into substream
    limits.

* Update CHANGELOG.

* Refine behaviour of dropping substreams.

By taking the substream state into account. The refined
behaviour is modeled after the behaviour of Yamux.

* Tweak docs and recv buffer retention.

* Further small tweaks.

 * Make the pending frames a FIFO queue.
 * Take more care to avoid keeping read-wakers around
   and to notify them when streams close.

* Prefer wake over unregister.

It is probably safer to always wake pending wakers.

* Update muxers/mplex/src/codec.rs

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

* Update muxers/mplex/src/io.rs

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

* Some review feedback and cosmetics.

* Update muxers/mplex/src/io.rs

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

* Revise read control flow for clarity.

While seemingly duplicating some control flow between
`poll_next_strean` and `poll_read_stream`, the individual
control flow of each read operation is easier to follow.

* CI

* Rename Status::Ok to Status::Open.

* Rename pending_flush to pending_flush_open.

* Finishing touches.

* Tweak changelog.

Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-28 10:30:49 +02:00
Max Inden
9365be711f
swarm/src/protocols_handler.rs: Remove redundant trait bound (#1773)
`Send` and `'static` are already implied by `InboundUpgradeSend`.
2020-09-25 13:12:15 +02:00
dependabot[bot]
c14f0c5b18
Update minicbor requirement from 0.5 to 0.6 (#1772)
* Update minicbor requirement from 0.5 to 0.6

Updates the requirements on [minicbor](https://gitlab.com/twittner/minicbor) to permit the latest version.
- [Release notes](https://gitlab.com/twittner/minicbor/tags)
- [Commits](https://gitlab.com/twittner/minicbor/compare/minicbor-v0.5.0...minicbor-v0.6.0)

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

* *: Update changelogs and cargo tomls

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-23 21:28:15 +02:00
Max Inden
ecdce0fed7
core/src/identity: Fix typo (#1768) 2020-09-17 20:50:58 +02:00
Max Inden
87f3cb8024
protocols/plaintext: Do not UVI encode goodput (#1765)
* protocols/plaintext: Do not UVI encode goodput

Only prefix handshake messages with the message length in bytes as an
unsigned varint. Return a plain socket once handshaking succeeded.

* *: Bump minor version in changelogs and cargo tomls
2020-09-17 15:29:47 +02:00
dependabot[bot]
3c72b07e55
Update atomic requirement from 0.4.6 to 0.5.0 (#1766)
* Update atomic requirement from 0.4.6 to 0.5.0

Updates the requirements on [atomic](https://github.com/Amanieu/atomic-rs) to permit the latest version.
- [Release notes](https://github.com/Amanieu/atomic-rs/releases)
- [Commits](https://github.com/Amanieu/atomic-rs/compare/v0.4.6...v0.5.0)

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

* .github/workflows: Update Rust nightly

* misc/multistream-select: Don't mention private item in public doc

* .github/workflows: Update renamed doc flag

* core/src/connection/pool: Don't mention private item in public doc

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-17 10:41:23 +02:00
dependabot[bot]
5099ab592f
Update unsigned-varint requirement from 0.4 to 0.5 (#1761)
* Update unsigned-varint requirement from 0.4 to 0.5

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

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

* *: Update changelogs and Cargo tomls

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-16 10:27:33 +02:00
dependabot[bot]
df93116d19
Update async-tls requirement from 0.8.0 to 0.10.0 (#1762)
Updates the requirements on [async-tls](https://github.com/async-std/async-tls) to permit the latest version.
- [Release notes](https://github.com/async-std/async-tls/releases)
- [Commits](https://github.com/async-std/async-tls/commits/v0.10.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-16 09:57:06 +02:00
Max Inden
e300ba323a
protocols/plaintext: Remove wrong debug log (#1759)
Don't log errors happening after plaintext handshake as errors happening
during plaintext handshake.
2020-09-16 09:08:45 +02:00
dependabot[bot]
dbf5a8521f
Update webpki-roots requirement from 0.18 to 0.20 (#1757)
* Update webpki-roots requirement from 0.18 to 0.20

Updates the requirements on [webpki-roots](https://github.com/ctz/webpki-roots) to permit the latest version.
- [Release notes](https://github.com/ctz/webpki-roots/releases)
- [Commits](https://github.com/ctz/webpki-roots/compare/v/0.18.0...v/0.20.0)

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

* *: Update patch version in CHANGELOG and Cargo.toml

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-09-15 15:44:36 +02:00
dependabot[bot]
7aac4e971c
Update x25519-dalek requirement from 0.6.0 to 1.1.0 (#1745)
* Update x25519-dalek requirement from 0.6.0 to 1.1.0

Updates the requirements on [x25519-dalek](https://github.com/dalek-cryptography/x25519-dalek) to permit the latest version.
- [Release notes](https://github.com/dalek-cryptography/x25519-dalek/releases)
- [Changelog](https://github.com/dalek-cryptography/x25519-dalek/blob/master/CHANGELOG.md)
- [Commits](https://github.com/dalek-cryptography/x25519-dalek/compare/0.6.0...1.1.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 11:17:58 +02:00
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