Previously, we would implicitly establish a connection when the user wanted to push identify information to a peer. I believe that this is the wrong behaviour. Instead, I am suggesting to log a message that we are skipping the push to this peer.
Additionally, the way this is currently implemented does not make much sense. Dialing a peer takes time. In case we don't have a connection at all, it could be that we drop the push requests because there isn't an active handler and thus we would have unnecessarily established the connection.
Instead of fixing this - which would require buffering the push messages - I think we should just remove the implicit dial.
Pull-Request: #3843.
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.
Previously, we only honored the `support_floodsub` setting when the user did not specify a custom protocol for gossipsub. This patch fixes this and allows users to advertise floodsub even when they use a custom protocol.
Pull-Request: #3837.
- Move helpers to the bottom
- Restructure tests to follow arrange-act-assert
- Only set necessary options on builder for each test
Pull-Request: #3836.
Instead of doing an entire connection establishment dance, we simply use a futures-aware ringbuffer to implement the test. This removes the dependency of `libp2p-plaintext` on the `libp2p_core::upgrade::apply` function.
Related #3748.
Pull-Request: #3770.
Instead of relying on the `MemoryTransport` to provide us with a duplex stream, we use the `futures_ringbuf` crate. This saves us several lines of code and removes the dependency on `libp2p_core::upgrade::apply`.
Related #3748.
Pull-Request: #3772.
Previously, we used a TCP transport to test the deflate compression. Really, all we need is an in-memory ringbuffer that we can plug in at both ends. This PR uses `futures_ringbuf` for that.
Related #3748.
Pull-Request: #3771.
`cargo-semver-checks` v0.20 uses Trustfall's newly-added optimization API to make semver-checking scale as `O(n)` instead of `O(n^2)`. On one large crate this was a 2354x speedup: 5h3min turned into 7.7s!
Pull-Request: #3822.
The `unreachable_pub` lint makes us aware of uses of `pub` that are not actually reachable from the crate root. This is considered good because it means reading a `pub` somewhere means it is actually public API. Some of our crates are quite large and keeping their entire API surface in your head is difficult.
We should strive for most items being `pub(crate)`. This lint helps us enforce that.
Pull-Request: #3735.
We have a limit of 1 approval for each PR in order to go into the merge queue.
To make life for us maintainers easier, we configure mergify to approve our and
only our PRs. This allows a single maintainer to land small PRs without having
to ping another maintainer.
Pull-Request: #3832.
This PR moves Test jobs from Continuous Integration workflow and Interoperability Testing job to self-hosted runners.
The former are moved to machines backed by either c5.large/m5.large, c5.xlarge/m5.xlarge or c5.2xlarge AWS instances while the latter c5.4xlarge.
The self-hosted runners are set up using https://github.com/pl-strflt/tf-aws-gh-runner.
The jobs are being moved to self-hosted because we're exhausting hosted GHA limits.
Pull-Request: #3782.
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.
Previous to this change if the ConnectionHandler::poll for kad was called more frequently than the connection idle timeout the timeout would continually be pushed further into the future. After this change kad now will preserve the existing idle deadline.
Pull-Request: #3801.
This patch removes the `version 0.2.0` for deprecations as libp2p-identity is only at `0.1.1` and this can be confusing to the reader.
It also adds `impl From<ed25519::PublicKey> for PublicKey` (et al.) so that `PublicKey::from(ed25519::PublicKey)` works.
Fixes https://github.com/libp2p/rust-libp2p/issues/3802.
Pull-Request: #3805.
Due to cargo's feature unification, a full build of our workspace doesn't actually check whether the examples compile as standalone projects.
We add a new CI check that iterates through all crates in the `examples/` directory and runs a plain `cargo check` on them. Any failure is bubbled up via `set -e`, thus failing CI in case one of the `cargo check` commands fails.
To fix the current failures, we construct a simple TCP transport everywhere where we were previously using `development_transport`. That is because `development_transport` requires `mplex` which is now deprecated.
Related #3657.
Related #3809.
Pull-Request: #3811.
This functionality isn't needed anywhere in `rust-libp2p` so we can deprecate and later remove it and thus reduce our API surface. Users relying on this function can vendor it.
Pull-Request: #3747.
Previously, we reinserted the `Peer` in the "undo" function which is obviously wrong. This patch fixes the behaviour to be correct and adds two regression tests.
Pull-Request: #3789.
Previously, we closed the entire connection upon receiving too many upgrade errors. This is unnecessarily aggressive. For example, an upgrade error may be caused by the remote dropping a stream during the initial handshake which is completely isolated from other protocols running on the same connection.
Instead of closing the connection, set `KeepAlive::No`.
Related: #3591.
Resolves: #3690.
Pull-Request: #3625.
This PR renames some method names that don't follow Rust naming conventions or behave differently from what the name suggests:
- Enforce "try" prefix on all methods that return `Result`.
- Enforce "encode" method name for methods that return encoded bytes.
- Enforce "to_bytes" method name for methods that return raw bytes.
- Enforce "decode" method name for methods that convert encoded key.
- Enforce "from_bytes" method name for methods that convert raw bytes.
Pull-Request: #3775.
With the changes from #3767, we made the `connect` test flaky because the `Swarm` was fully passed to the future and thus dropped as soon as the connection was established. We pass a mutable reference instead which keeps the `Swarm` alive.
Pull-Request: #3780.
Previously, the relay server would erroneously send its own `PeerId` in the STOP message to the client upon an incoming relay connection. This is obviously wrong and results in failed connection upgrades in other implementations.
Pull-Request: #3767.