162 Commits

Author SHA1 Message Date
Aleksey Proshutisnkiy
43544e635a
Identity rework (#49) 2021-04-15 21:07:50 +03:00
folex
47f5452f66 Update TrustGraph 2021-03-09 17:47:13 +03:00
folex
4d6478a38e Merge branch 'upstream_master' into merge_0.36
# Conflicts:
#	Cargo.toml
#	core/Cargo.toml
#	examples/distributed-key-value-store.rs
#	misc/multiaddr/Cargo.toml
#	misc/multiaddr/src/onion_addr.rs
#	misc/multistream-select/Cargo.toml
#	muxers/mplex/Cargo.toml
#	muxers/yamux/Cargo.toml
#	protocols/floodsub/Cargo.toml
#	protocols/gossipsub/Cargo.toml
#	protocols/identify/Cargo.toml
#	protocols/kad/Cargo.toml
#	protocols/kad/src/addresses.rs
#	protocols/kad/src/behaviour.rs
#	protocols/kad/src/behaviour/test.rs
#	protocols/kad/src/kbucket/bucket.rs
#	protocols/kad/src/kbucket/key.rs
#	protocols/mdns/Cargo.toml
#	protocols/ping/Cargo.toml
#	protocols/request-response/Cargo.toml
#	protocols/secio/Cargo.toml
#	swarm-derive/Cargo.toml
#	swarm/Cargo.toml
#	transports/deflate/Cargo.toml
#	transports/dns/Cargo.toml
#	transports/noise/Cargo.toml
#	transports/plaintext/Cargo.toml
#	transports/tcp/Cargo.toml
#	transports/uds/Cargo.toml
#	transports/wasm-ext/Cargo.toml
#	transports/websocket/Cargo.toml
2021-03-05 15:20:08 +03:00
Roman S. Borschel
f241bce7c1 Update release dates. 2021-02-17 11:05:20 +01:00
Roman Borschel
c072cd29d4
Update to yamux-0.8.1 (#1959) 2021-02-17 10:57:07 +01:00
Roman Borschel
cda7c3504e
Prepare v0.35 (#1957) 2021-02-15 20:06:50 +01:00
folex
159cb6b2ca
Add function to get neighborhood locally (#40) 2021-02-15 15:52:47 +03:00
Roman Borschel
6499e924a3
Make clippy "happy". (#1950)
* Make clippy "happy".

Address all clippy complaints that are not purely stylistic (or even
have corner cases with false positives). Ignore all "style" and "pedantic" lints.

* Fix tests.

* Undo unnecessary API change.
2021-02-15 11:59:51 +01:00
dependabot[bot]
639e5c678e
Update unsigned-varint and asynchronous-codec (#1946)
* Update unsigned-varint requirement from 0.6 to 0.7

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/compare/v0.6.0...v0.7.0)

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

* *: Update to asynchronous-codec v0.6

* transports/plaintext: Use Framed::into_parts

* *: Update cargo tomls and changelogs

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2021-02-13 20:15:14 +01:00
Roman Borschel
d94d53abbb
Move some crates. (#1941)
Move transport upgrade protocols from `protocols/`
to `transports/`, such that only "application protocols"
that depend on `libp2p-swarm` remain in `protocols/`,
whereas there is no such dependency in `transports/`
outside of integration tests.

Tweak README and top-level CHANGELOG.
2021-02-01 16:37:19 +01:00
Max Inden
db02cfae37
*: Prepare v0.34.0 release (#1918)
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2021-01-12 20:33:43 +01:00
Roman Borschel
ec0f8a3150
[tcp] Port-reuse, async-io, if-watch (#1887)
* Update tomls.

* Let transports decide when to translate.

* Improve tcp transport.

* Update stuff.

* Remove background task. Enhance documentation.

To avoid spawning a background task and thread within
`TcpConfig::new()`, with communication via unbounded channels,
a `TcpConfig` now keeps track of the listening addresses
for port reuse in an `Arc<RwLock>`. Furthermore, an `IfWatcher`
is only used by a `TcpListenStream` if it listens on any interface
and directly polls the `IfWatcher` both for initialisation and
new events.

Includes some documentation and test enhancements.

* Reintroduce feature flags for tokio vs async-io.

To avoid having an extra reactor thread running for tokio
users and to make sure all TCP I/O uses the mio-based
tokio reactor.

Thereby run tests with both backends.

* Add missing files.

* Fix docsrs attributes.

* Update transports/tcp/src/lib.rs

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

* Restore chat-tokio example.

* Forward poll_write_vectored for tokio's AsyncWrite.

* Update changelogs.

Co-authored-by: David Craven <david@craven.ch>
Co-authored-by: Max Inden <mail@max-inden.de>
2021-01-12 13:35:11 +01:00
Max Inden
c98b9ef407
*: Switch futures_codec to asynchronous-codec (#1908)
`futures-codec` has not been updated in the recent months. It still
depends on `bytes` `v0.5` preventing all downstream dependencies to
upgrade to `bytes` `v1.0`.

This commit replaces `futures_codec` in favor of `asynchronous-codec`
The latter is a fully upgraded fork of the former.

In addition this commit upgrades:

- bytes to v1
- unsigned-varint to v0.6.0
- prost to v0.7
2021-01-12 12:48:37 +01:00
folex
e3d6fb4823 Fix everything except trust-graph 2021-01-07 18:31:41 +03:00
folex
f230d74a55 Merge branch 'upstream_master' into merge_0.33
# Conflicts:
#	Cargo.toml
#	core/Cargo.toml
#	examples/distributed-key-value-store.rs
#	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/kad/src/kbucket.rs
#	protocols/kad/src/kbucket/bucket.rs
#	protocols/kad/src/kbucket/key.rs
#	protocols/kad/src/query/peers/closest.rs
#	protocols/kad/src/record.rs
#	protocols/mdns/Cargo.toml
#	protocols/noise/Cargo.toml
#	protocols/ping/Cargo.toml
#	protocols/plaintext/Cargo.toml
#	protocols/request-response/Cargo.toml
#	protocols/secio/Cargo.toml
#	swarm/Cargo.toml
#	transports/dns/Cargo.toml
#	transports/tcp/Cargo.toml
#	transports/uds/Cargo.toml
#	transports/wasm-ext/Cargo.toml
#	transports/websocket/Cargo.toml
2021-01-07 16:47:59 +03:00
folex
02f83ec9d4
Rename crates to 'fluence-fork-$name' (#30) 2021-01-07 16:15:02 +03:00
folex
5d4d0fec51 cargo workspaces: package.metadata.workspaces.independent = true 2020-12-31 11:06:27 +03:00
Max Inden
dd9f56e7f9
*CHANGELOG.md: Prepare v0.33.0 release (#1895) 2020-12-18 10:03:20 +01:00
David Craven
23b0aa016f
Stack allocated PeerId (#1874)
* Stack allocate PeerId.

* Update stuff.

* Upgrade rusttls to fix build.

* Remove unnecessary manual implementations.

* Remove PeerId::into_bytes.

* Remove bytes dependency.

* Perform some cleanup.

* Use Into<kbucket::Key<K>>.

* Update versions and changelogs.

* Fix PR link.

* Fix benchmarks.

Co-authored-by: Roman S. Borschel <roman@parity.io>
2020-12-15 14:40:39 +01:00
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
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
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 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
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
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
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
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
Roman Borschel
bc11739b41
[mplex] Test all substreams closing on error. (#1812) 2020-10-22 18:26:10 +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 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
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
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
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
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
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 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 S. Borschel
c94262d03a Set development versions appropriately and update changelogs. 2020-09-03 12:31:45 +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
9dd1309040 Changelog updates. 2020-08-17 10:14:44 +02:00