1560 Commits

Author SHA1 Message Date
Roman Borschel
bc102bc923
Prepare release of libp2p-v0.31 and all unreleased sub-crates. (#1857)
* Prepare v0.31

* Update core-derive

* Update minimum multiaddr patch version in libp2p crate.
2020-11-25 15:30:13 +01:00
Roman Borschel
83e87f76c0
[swarm] Permit configuration override for the substream upgrade protocol to use. (#1858)
* Permit global configuration of a substream upgrade protocol override.

* Revert temporary test.

* Revert temporary test.

* Update swarm changelog.
2020-11-25 14:26:49 +01:00
Roman Borschel
65c4bf88dc
[multistream] Make the lazy variant more interoperable. (#1855)
* Make the lazy variant interoperable.

The remaining optimisation for `V1Lazy` for a listener
in the negotiation, whereby the listener delays flushing
of the multistream version header, is hereby removed.
The remaining effect of `V1Lazy` is only on the side of
the dialer, which delays flushing of its singular
protocol proposal in order to send it together with
the first application data (or an attempt is made to
read from the negotiated stream, which similarly
triggers a flush of the protocol proposal). This
permits `V1Lazy` dialers to be interoperable with
`V1` listeners. The remaining theoretical pitfall whereby
application data gets misinterpreted as another protocol
proposal by a listener remains, however unlikely.

`V1` remains the default, but we may eventually risk
just making this lazy dialer flush a part of the default
`V1` implementation, removing the dedicated `V1Lazy`
version identifier.

* Update CHANGELOG

* Separate versions from mere header lines.

Every multistream-select version maps to a specific header line,
but there may be different variants of the same multistream-select
version using the same header line, i.e. the same wire protocol.

* Cleanup

* Update misc/multistream-select/CHANGELOG.md
2020-11-25 10:21:02 +01:00
dependabot[bot]
c01ac52745
Update webpki-roots requirement from 0.20 to 0.21 (#1851)
* Update webpki-roots requirement from 0.20 to 0.21

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.20.0...v/0.21.0)

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

* transports/websocket: Update changelog

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-11-24 19:08:44 +01:00
Roman S. Borschel
86d2281222 Tweak docs of StreamMuxer::poll_event 2020-11-24 17:36:44 +01:00
Max Inden
e3af8b7d03
*: Apply clippy suggestions and enable clippy on CI (#1850)
* *: Apply clippy suggestions

* .github: Add clippy check

* protocols/kad/record: Implement custom PartialEq for ProviderRecord
2020-11-24 15:59:22 +01:00
Pierre Krieger
5e21806a38
Some petty changes head of QUIC (#1854) 2020-11-24 12:40:11 +01:00
Roman Borschel
cef75ab7e1
[core/swarm] Refactor and extend configurable connection limits. (#1848)
* Refactor and extend configurable connection limits.

To better track different connection counts, permit configurable
limits for these counts and make these available for
inspection efficiently, introduce dedicated connection counters
via a `ConnectionCounters` structure that is exposed on the
API via the `NetworkInfo`. All connection or connection
states that are counted in this way can also have effective
configurable limits.

* Cleanup

* Add missing file.

* Refine naming and config API.

* Update core/CHANGELOG.md

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

* Update core/CHANGELOG.md

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

Co-authored-by: Max Inden <mail@max-inden.de>
2020-11-23 17:22:15 +01:00
Roman Borschel
1bd013c843
[swarm] Configurable and "infinite" scores for external addresses. (#1842)
* Add "infinite" scores for external addresses.

Extend address scores with an infinite cardinal, permitting
addresses to be retained "forever" or until explicitly removed.

Expose (external) address scores on the API.

* Update swarm/src/registry.rs

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

* Fix compilation.

* Update CHANGELOG

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-11-18 15:52:33 +01:00
Roman Borschel
edb99eded6
[multistream-select] Fix ls response encoding/decoding (spec-compliance). (#1811)
* Fix ls response encoding/decoding.

Thereby remove the now unnecessary arbitrary protocol name
length limit. Since it an 'ls' response is always terminated
with a dedicated newline (and thus ends with two newlines),
an 'ls' response with a single protocol can be disambiguated
from a single protocol response by this additional newline.

* More commentary

* Update versions and changelogs.

* Resolve remaining conflict.

* Permit empty ls responses, as before.
2020-11-18 12:03:07 +01:00
dependabot[bot]
5e2ad029ca
Bump styfle/cancel-workflow-action from 0.4.1 to 0.6.0 (#1846)
Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.4.1 to 0.6.0.
- [Release notes](https://github.com/styfle/cancel-workflow-action/releases)
- [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.4.1...ce177499ccf9fd2aded3b0426c97e5434c2e8a73)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-17 15:42:43 +01:00
Denis Pisarev
6477d04e29
Update CI (#1837)
* fix (CI): upda dependabotchecks and actions versions

* fix (CI): readability

* change (CI): interrupt prev run on the subsequent commit, simplify caching

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-11-17 15:20:38 +01:00
Volker Mische
3f38c1c8bb
feat: upgrade multihash (#1792)
* feat: upgrade to multihash 0.13

`multihash` changes a lot internally, it is using stack allocation instead
of heap allocation. This leads to a few limitations in regards on how
`Multihash` can be used.

Therefore `PeerId` is now using a `Bytes` internally so that only minimal
changes are needed.

* Update versions and changelogs.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Roman S. Borschel <roman@parity.io>
2020-11-17 11:15:20 +01:00
Roman S. Borschel
650812abc3 Prepare parity-multiaddr-0.9.6 2020-11-17 10:39:11 +01:00
Roman S. Borschel
4876ac0d7e Update multiaddr CHANGELOG. 2020-11-17 10:32:51 +01:00
Mikhail Zabaluev
fe6e622f3b
multiaddr: feature gate url dependency (#1843)
* multiaddr: feature gate url dependency

Make it possible to exclude url and its dependencies
from the dependency tree, by feature gating the
from_url* functions in the public API.

* Document feature gating of multiaddr::from_url*
2020-11-17 10:31:04 +01:00
Roman Borschel
41d3f72f0e
[mplex] Add benchmark, tweak default split_send_size. (#1834)
* [mplex]  Benchmark different split_send_size configurations.

With both TCP and memory transports. As a result, change the
default `split_send_size` to 8KiB.

* Cleanup

* [mplex] Update CHANGELOG.

* Add throughput information.
2020-11-16 17:41:00 +01:00
Max Inden
6f1edb0e6a
misc/multiaddr: Prepare v0.9.5 release 2020-11-14 20:40:36 +01:00
Max Inden
2e6b0ec1fa
misc/multiaddr: Increase patch version and update changelog 2020-11-14 18:12:52 +01:00
Pawan Dhananjay
f7ab4f7869
misc/multiaddr: Limit initial memory allocation in visit_seq (#1833)
Without a limit, one can send malformed input such that seq.size_hint() returns
a very large value and crashes the program even if the following data is pretty
small.
2020-11-14 18:08:49 +01:00
Roman S. Borschel
9c74b40870 Prepare 0.30.1 2020-11-11 14:11:17 +01:00
Roman Borschel
f771bcc35f
[plaintext] Retain remaining read buffer after handshake. (#1831)
* Retain remaining read buffer.

When the plaintext protocol handshake finishes and
the `Framed` I/O is discarded in favour of the underlying
I/O stream, the remaining read buffer of `Framed` must
be retained, as it may have buffered data beyond the
end of the handshake.

* Update versions and changelogs.
2020-11-11 14:09:33 +01:00
Max Inden
fabb00c21b
*: Bump changelogs and cargo tomls for parity-multiaddr 2020-11-09 17:56:54 +01:00
Max Inden
5f8a003bcd
*: Update changelogs to release v0.30.0 (#1829)
* *: Update changelogs to release v0.30.0

* muxers/mplex/CHANGELOG: Reference pull request

* misc/multistream-select/CHANGELOG: Update date
2020-11-09 17:46:07 +01:00
Max Inden
70bb2d7c11
misc/multistream-select: Interpretation of EOF as Failed negotiation (#1823)
Treat EOF error as [`NegotiationError::Failed`], not as
[`NegotiationError::ProtocolError`], allowing dropping or closing an I/O stream
as a permissible way to "gracefully" fail a negotiation.

This is e.g. important when a listener rejects a protocol with
[`Message::NotAvailable`] and the dialer does not have alternative protocols to
propose. Then the dialer will stop the negotiation and drop the corresponding
stream. As a listener this EOF should be interpreted as a failed negotiation.
2020-11-09 16:04:00 +01:00
Roman Borschel
3859116bca
[mplex] Tweak default config and yield before exceeding buffer limits. (#1825)
* [mplex] Tweak default config and yield before exceeding buffer limits.

* Update CHANGELOG
2020-11-09 15:25:03 +01:00
dependabot[bot]
cc588ec592
Update bs58 requirement from 0.3.0 to 0.4.0 (#1827)
Updates the requirements on [bs58](https://github.com/mycorrhiza/bs58-rs) to permit the latest version.
- [Release notes](https://github.com/mycorrhiza/bs58-rs/releases)
- [Commits](https://github.com/mycorrhiza/bs58-rs/compare/0.3.0...0.4.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-09 14:49:25 +01:00
Max Inden
c48cacfcf5
*/Cargo.toml: Update multihash (#1828) 2020-11-09 14:31:51 +01:00
Pierre Krieger
b482833c3c
Fix the multiaddr parsing in the JS snippet (#1824)
* Fix the multiaddr parsing in the JS snippet

* Update CHANGELOG
2020-11-06 09:46:47 +01:00
Roman Borschel
2ba78b4ce7
[mplex, yamux] Streamline configuration API. (#1822)
* Streamline mplex and yamux configurations.

  * For all configuration options that exist for both multiplexers
    and have the same semantics, use the same names for the
    configuration.
  * Rename `Config` to `YamuxConfig` for consistentcy with
    the majority of other protocols, e.g. `MplexConfig`, `PingConfig`,
    `KademliaConfig`, etc.
  * Completely hide `yamux` APIs within `libp2p-yamux`. This allows
    to fully control the libp2p API and streamline it with other
    muxer APIs, consciously choosing e.g. which configuration options
    to make configurable in libp2p and which to fix to certain values.
    It does also not necessarily prescribe new incompatible version bumps of
    yamux for `libp2p-yamux`, as no `yamux` types are exposed. The cost
    is some more duplication of configuration options in the API, as well
    as the need to update `libp2p-yamux` if `yamux` introduces new
    configuration options that `libp2p-yamux` wants to expose as well.

* Update CHANGELOGs.
2020-11-06 09:46:22 +01:00
Roman Borschel
689eeaf533
[kad] Update local routing table on new connections after protocol confirmation. (#1821)
* Delay routing table update on new connections.

In order to avoid adding peers to the local routing table
which use a different protocol name and thus a different
overlay network, only update the local routing table
for newly established connections once the associated
connection handler reports that the protocol has been
confirmed.

* Update CHANGELOG.
2020-11-05 20:58:14 +01:00
dependabot[bot]
c812b8d56c
Update tokio requirement from 0.2 to 0.3 (#1796)
* Update tokio requirement from 0.2 to 0.3

Updates the requirements on [tokio](https://github.com/tokio-rs/tokio) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.2.0...tokio-0.3.0)

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

* protocols/mdns: Ensure to set non_blocking on tokio udp socket

* transports/tcp: Ensure to set non_blocking on tokio tcp socket

See https://github.com/tokio-rs/tokio/pull/3016 for details.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-11-03 14:09:10 +01:00
dependabot[bot]
8f53ec61fd
Update minicbor requirement from 0.6 to 0.7 (#1819)
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.6.0...minicbor-v0.7.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-02 09:27:11 +01:00
Thomas Eizinger
335e55e60d
Remove ConnectionInfo trait (#1813)
In all cases, we pass the PeerId directly as the connection info.
The flexbility of doing something different here was originally
envisioned but turned out to be never needed.

For reference see: https://github.com/libp2p/rust-libp2p/issues/1798#issuecomment-714526056

Co-authored-by: Max Inden <mail@max-inden.de>
2020-10-30 15:51:27 +01:00
Roman Borschel
421ae9d9c9
Be lenient with duplicate Close frames. (#1816) 2020-10-28 16:33:48 +01:00
folex
8ea09b93ef Hide QueryFinished log to trace 2020-10-23 14:06:42 +03:00
Roman Borschel
bc11739b41
[mplex] Test all substreams closing on error. (#1812) 2020-10-22 18:26:10 +02:00
folex
82dd950771 Move bucket printing & iterlog to Level::Trace 2020-10-21 13:43:54 +03:00
Max Inden
91d7db46a3
Prepare v0.29.1 (#1809)
* *: Update date in changelogs

* core/Cargo.toml: Bump multistream-select to v0.8.4
2020-10-20 17:42:10 +02:00
Max Inden
177567b177
core/Cargo.toml: Update to ed25519-dalek v1.0.1 (#1808) 2020-10-20 17:03:10 +02:00
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