36 Commits

Author SHA1 Message Date
dependabot[bot]
95eca886f2
deps: bump tokio from 1.28.1 to 1.28.2
Pull-Request: #4001.
2023-05-29 09:59:17 +00:00
Thomas Eizinger
25bc30f07e
feat(ping): don't close connections upon failures
Previously, the `libp2p-ping` module came with a policy to close a connection after X failed pings. This is only one of many possible policies on how users would want to do connection management.

We remove this policy without a replacement. If users wish to restore this functionality, they can easily implement such policy themselves: The default value of `max_failures` was 1. To restore the previous functionality users can simply close the connection upon the first received ping error.

In this same patch, we also simplify the API of `ping::Event` by removing the layer of `ping::Success` and instead reporting the RTT to the peer directly.

Related: #3591.

Pull-Request: #3947.
2023-05-24 12:33:18 +00:00
dependabot[bot]
74fa48b43f
deps: bump tokio from 1.28.0 to 1.28.1
Pull-Request: #3931.
2023-05-18 15:47:10 +00:00
Thomas Eizinger
fbd471cd79
feat(websocket): remove deflate compression option
This option is the only reason we pull in a dependency on the shared `zlib` library. Unfortunately, we cannot use a pure Rust backend here because that one does not support configuring the window bits of the deflate algorithm which is used in the deflate websocket extension.

Using websockets in libp2p is already crazy inefficient because you end up with double encryption when using `/wss` (which is enforced by browsers if your website is served via https). A good encryption algorithm like noise or TLS produces an output that looks completely random. Any attempt in compressing this is pretty much wasted CPU power.

Thus, I think removing this configuration option does not really hurt and allows us to remove the dependency on the `zlib` shared library.

Pull-Request: #3949.
2023-05-16 09:40:00 +00:00
Thomas Eizinger
0bc724ab00
ci: reduce size of Rust interop-test image
By using a multi-stage docker build, a distroless base image and a release build, we can get the size of the Rust interop test down to 50MB. Previously, the image would be around 500MB. A debug build image would still have ~400MB. The release build slows down our interop build step by about 1min 20s. That however is only because we don't currently seem to utilize the caches that from what I understand should work on self-hosted runners. I opted https://github.com/libp2p/rust-libp2p/issues/3925 for that.

Resolves: #3881.

Pull-Request: #3926.
2023-05-15 11:58:28 +00:00
Thomas Eizinger
996b5c8bd0
chore: leverage cargo's workspace inheritance
Previously, we would specify the version and path of our workspace dependencies in each of our crates. This is error prone as https://github.com/libp2p/rust-libp2p/pull/3658#discussion_r1153278072 for example shows. Problems like these happened in the past too.

There is no need for us to ever depend on a earlier version than the most current one in our crates. It thus makes sense that we manage this version in a single place.

Cargo supports a feature called "workspace inheritance" which allows us to share a dependency declaration across a workspace and inherit it with `{ workspace = true }`.

We do this for all our workspace dependencies and for the MSRV.

Resolves #3787.

Pull-Request: #3715.
2023-05-02 09:14:14 +00:00
Thomas Eizinger
b1cdf8d4bb
feat(yamux): rename symbols to follow module-based naming convention
Implements our naming convention for the `libp2p-yamux` crate.

Related: #2217.

Pull-Request: #3852.
2023-05-01 02:25:52 +00:00
Thomas Eizinger
2f5270ba76
feat(noise): deprecate all handshake patterns apart from XX
In the libp2p specs, the only handshake pattern that is specified is the XX handshake. Support for other handshake patterns can be added through external modules. While we are at it, we rename the remaining types to following the laid out naming convention.

The tests for handshakes other than XX are removed. The handshakes still work as we don't touch them in this patch.

Related #2217.

Pull-Request: #3768.
2023-04-28 13:50:31 +00:00
dependabot[bot]
8a0e61e3ac
deps: bump tokio from 1.27.0 to 1.28.0
Pull-Request: #3834.
2023-04-28 10:49:08 +00:00
Thomas Eizinger
585a84e182
feat(core): deprecate {In,Out}boundUpgradeExt
These functions were only used for some code in the interop-tests which is easily mitigated and perhaps even easier to understand now. We can thus deprecate these functions and their related types and thereby reduce the API surface of `libp2p-core` and the maintenance burden.

This change is motivated by the work around making protocols always strings which requires/required updates to all these upgrades.

Related #3806.
Related #3271.
Related #3745.

Pull-Request: #3807.
2023-04-25 12:26:16 +00:00
Max Inden
0d5cac0cb5
fix(interop): use webrtc-direct as browser-to-server identifier
See https://github.com/multiformats/multiaddr/pull/150#issuecomment-1468791586 for context on the rename.

Pull-Request: #3781.
2023-04-12 13:57:19 +00:00
dependabot[bot]
7261856e7a
deps: bump redis from 0.22.3 to 0.23.0
Pull-Request: #3755.
2023-04-11 19:58:16 +00:00
dependabot[bot]
17dd72755d
deps: bump tokio from 1.26.0 to 1.27.0
Pull-Request: #3729.
2023-04-05 14:37:42 +00:00
dependabot[bot]
95fa913923
deps: bump multiaddr from 0.17.0 to 0.17.1
Pull-Request: #3688.
2023-04-04 13:38:53 +00:00
Thomas Coratger
44d4b1133d
feat(libp2p): deprecate mplex
`mplex` module (no flow control and no streams limit) is deprecated to encourage `yamux` usage.

Resolves #3677.

Pull-Request: #3689.
2023-04-04 09:49:59 +00:00
dependabot[bot]
0ff0ef7a35
deps: bump futures from 0.3.27 to 0.3.28
Pull-Request: #3725.
2023-04-03 14:43:42 +00:00
Thomas Eizinger
ab9555c8b6
feat: deprecate webrtc and quic features in libp2p crate
We currently expose `libp2p-quic` and `libp2p-webrtc` as submodules from the `libp2p` crate despite those only being "alpha" status. This causes problems because we need to pin those dependencies due to `cargo` automatically upgrading alphas (which are allowed to incur breaking changes as per semver spec). Additionally, exposing these modules practically hides the "alpha" state of those modules, rendering it kind of obsolete.

The "alpha" state is still true for those modules, thus to properly communicate this to users, we deprecate the modules and require users to spell out the dependency and the alpha version in their manifest.

Pull-Request: #3580.
2023-03-21 17:52:47 +00:00
Victor Ermolaev
2ec5402474
feat(swarm): enforce creation of Swarm via SwarmBuilder
Mark constructors `Swarm::with_X_executor` as deprecated.
Move the deprecated functionality to `SwarmBuilder::with_X_executor`
Use `SwarmBuilder` throughout.

Resolves #3186.
Resolves #3107.

Pull-Request: #3588.
2023-03-13 19:53:14 +00:00
dependabot[bot]
9d0ec7e074
deps: bump futures from 0.3.26 to 0.3.27
Pull-Request: #3597.
2023-03-13 11:35:04 +00:00
Thomas Eizinger
ab35c55fc9
feat(ci): remove protoc installation where possible
We only retain it for the test job which runs `cargo semver-checks` which may need to build the rustdoc for the baseline version which still requires `protoc` to be installed until we make the next round of releases.

Pull-Request: #3592.
2023-03-13 08:01:47 +00:00
Thomas Eizinger
d53cfed236
chore: move libp2p crate to a dedicated directory
Currently, our top-level `Cargo.toml` manifest represents a crate AND a workspace. This causes surprising behaviour (e.g. #2949) where we need to explicitly pass `--workpace` to every command to run it on the entire workspace and not just the meta crate.

My moving the meta crate into its own directory, the root manifest file is a virtual manifest only and thus, every `cargo` command will automatically default to running on the entire workspace.

On top of this, I personally find it easier to understand if workspace and crate manifests are not mixed.

Pull-Request: #3536.
2023-03-08 13:20:39 +00:00
Miguel Guarniz
db82e0210e
feat: migrate to quick-protobuf
Instead of relying on `protoc` and buildscripts, we generate the bindings using `pb-rs` and version them within our codebase. This makes for a better IDE integration, a faster build and an easier use of `rust-libp2p` because we don't force the `protoc` dependency onto them.

Resolves #3024.

Pull-Request: #3312.
2023-03-02 10:45:07 +00:00
Thomas Eizinger
73013de3f1
refactor: remove unused dependencies
Pull-Request: #3530.
2023-02-28 23:39:01 +00:00
Thomas Eizinger
2ca93e12c5
refactor(interop-test): remove easy to replace strum dependency
We only use `strum` for the interop-tests but we add 3 dependencies to a full build of the repository for it, including a proc-macro which needs to be pipelined in front of other crates which makes them hard to parallelize. Remove it in favor of fairly trivial reimplementation of `FromStr`.

Pull-Request: #3513.
2023-02-28 05:04:59 +00:00
dependabot[bot]
ac97e28d45
deps: bump env_logger from 0.9.3 to 0.10.0
Pull-Request: #3518.
2023-02-28 01:35:40 +00:00
Thomas Eizinger
d6ebac4e78
refactor(interop-tests): disable unused features
This removes a few dependencies from our dependency tree without any impact on functionality.

Pull-Request: #3512.
2023-02-28 00:37:04 +00:00
Marco Munizaga
eeca244ca5
feat(interop-tests): build test binary inside container (#3441)
Building inside the container allows Windows and MacOS users to also build this binary. Thanks to a new feature from docker, `--mount=type=cache`, rebuilding layers is fast without any additional hacks.
2023-02-10 06:14:25 +00:00
Thomas Eizinger
696c644fef
feat(ci): use interop-tests action instead of workflow (#3414) 2023-02-06 00:48:53 +00:00
João Oliveira
53e477d442
refactor(interop): update ping to conform to the new interop spec (#3423) 2023-02-02 11:41:59 +00:00
Thomas Eizinger
b7fa2bccdf
refactor(inter-op): misc clean-up (#3409)
This patch contains misc cleanup that I did as part of reading through the code to understand how it works.
2023-02-01 22:20:25 +00:00
dependabot[bot]
0c94237e16
deps: bump futures from 0.3.25 to 0.3.26 (#3405) 2023-01-31 23:34:17 +00:00
dependabot[bot]
15e0faadf5
deps: update if-addrs requirement from 0.7.0 to 0.8.0 (#3354) 2023-01-30 13:50:26 +00:00
Thomas Eizinger
1c596af1cf
feat: publish container images for interop-test binaries (#3383)
This patch adds a workflow that automatically publishes a docker image of our `ping` interop-test binaries on every release. Releases are different from Git tags. We publish a tag for each version of each crate but only a single release for each version of the `libp2p` crate.

Alternatively, this workflow can also be triggered manually:

![image](https://user-images.githubusercontent.com/5486389/214460448-d4fca593-d323-4476-956f-d180aadf8850.png)

1. Select the Git ref you want to run the workflow on. This should be the version of `libp2p` you want to publish the test binary for. For example, if you want to publish a version of the test binary for a hotfix release of a sub-crate, you would pick the respective tag of the hotfix release.
2. Choose the tag of the docker image.

To resolve https://github.com/libp2p/test-plans/issues/112, I am planning to create branches off current master that hardcodes the libp2p version in the test-binary to a particular one and then trigger this workflow for the respective branch.
2023-01-26 09:35:16 +00:00
Thomas Eizinger
c94aabf8f6
feat(inter-op): make Dockerfile generic over test binary (#3382)
We make the binary that should be copied into the container configurable via a build time `ARG`. This will allow us to reuse the same `Dockerfile` once we write more tests.
Additionally, this allows us to remove some of the directory switching and creation code. In order to not send the entire repository over to the docker daemon as a build context, we introduce a `.dockerignore` file that only allows select binary to be sent over.

The downside of this is that we need to extend this ignore file every time we add a new test. This shouldn't happen very often though and is easily discovered because the building of the docker container will fail.
2023-01-26 03:46:51 +00:00
Marco Munizaga
1b45d5e4dd
feat(ci): Add support for test_timeout option (#3379)
Node and browser tests take a little bit longer to spin up in the interop tests. The multidim-interop can tell the tests to increase the timeout when testing against these targets, but the test itself needs to use the passed in value.

This updates the test code to handle the new test_timeout option. See https://github.com/libp2p/test-plans/issues/107
2023-01-25 22:05:03 +00:00
João Oliveira
62c0532de6
ci: Interop tests fixes and updates pending from #3331 (#3360) 2023-01-24 22:28:57 +00:00