Commit Graph

2601 Commits

Author SHA1 Message Date
2d81b99c90 chore(core): remove deprecated upgrades
Related https://github.com/libp2p/rust-libp2p/issues/3647.

Pull-Request: #3867.
2023-05-02 18:11:28 +00:00
62a06f9ac0 fix(ci): use env variables to ensure escaping
Environment variables are properly escaped in GitHub, thus reducing the risk of code injection.

Pull-Request: #3790.
2023-05-02 17:36:35 +00:00
4bd4653fa9 chore(request-response): remove deprecated items
Related: https://github.com/libp2p/rust-libp2p/issues/3647.

Pull-Request: #3703.
2023-05-02 16:17:15 +00:00
25d14349cc chore(gossipsub): remove deprecated items
Removes deprecated items from gossipsub and make certain modules crate-private.

Related https://github.com/libp2p/rust-libp2p/issues/3647.

Pull-Request: #3862.
2023-05-02 16:02:21 +00:00
f858ec6237 feat(identify): immediately run identify protocol on new connections
Previously, and for unknown legacy reasons, we waited for a configurable delay (default 500ms) upon new connections before we ran the identify protocol. This unnecessarily slows down applications that wait for the identify handshake to complete before performing further actions.

Resolves #3485.

Pull-Request: #3545.
2023-05-02 14:24:56 +00:00
9fc2da0180 deps: bump anyhow from 1.0.70 to 1.0.71
Pull-Request: #3856.
2023-05-02 14:11:57 +00:00
e135e55065 deps: bump flate2 from 1.0.25 to 1.0.26
Pull-Request: #3857.
2023-05-02 13:58:44 +00:00
cacfb59781 chore(dcutr): remove deprecated items
Removes deprecated items from `libp2p-dcutr`.

Related https://github.com/libp2p/rust-libp2p/issues/3647

Pull-Request: #3700.
2023-05-02 13:30:04 +00:00
3e5f64345b chore(identify): remove deprecated items
Related: https://github.com/libp2p/rust-libp2p/issues/3647.

Pull-Request: #3698.
2023-05-02 13:15:34 +00:00
4ca888580c refactor(noise): implement tests using futures_ringbuf
Instead of creating a connection via a TCP transport, we can use the `futures_ringbuf` crate and run the noise encryption on an in-memory transport. This removes the dependency on the `libp2p_core::upgrade::apply` function and takes less code to implement.

Related #3748.

Pull-Request: #3773.
2023-05-02 12:15:22 +00:00
c728824440 feat(relay): hide internals of Connection
Relayed connections to other peers are created from streams to the relay itself. Internally, such a connection has different states. These however are not relevant to the user and should be encapsulated to allow for more backwards-compatible changes. The only interface exposed is `AsyncRead` and `AsyncWrite`.

Resolves: #3255.

Pull-Request: #3829.
2023-05-02 11:49:07 +00:00
30d2c75206 chore(mdns): remove deprecated items
Related: https://github.com/libp2p/rust-libp2p/issues/3647.

Pull-Request: #3699.
2023-05-02 11:32:28 +00:00
02d87155a5 feat(mdns): change mdns::Event to hold Vec
In previous PR #3606 we've made `mdns::Event` `Clone`, but cloning single-use iterators doesn't sound right. Also you have to create an iterator from the actual data returned before putting it into events. So in this PR the iterators are replaced by `Vec`, as it's the type the data originally come from.



Related #3612.

Pull-Request: #3621.
2023-05-02 11:13:41 +00:00
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
d1fadc592d fix(identity): handle warnings related to feature flags
Some of the feature-flags weren't set correctly and thus produced warnings for unused code. We can fix this by using absolute paths instead of imports and allow `dead_code` for the error constructor. It might be possible to write a correct `cfg` for this as well but I think it will be very verbose, hence I didn't bother.

Pull-Request: #3859.
2023-05-01 14:10:37 +00:00
c8a064b74c chore(doc): Add missing PR to yamux CHANGELOG.md
Add missing PR to yamux CHANGELOG.md

Pull-Request: #3855.
2023-05-01 08:22:39 +00:00
2d9ae3800f chore: prepare patch releases on top of v0.51.3
Note that this does not release v0.51.4, i.e. there is no patch release of the meta crate `libp2p`.

Pull-Request: #3854.
2023-05-01 02:56:32 +00:00
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
193d2a1a6c deps: bump sha3 from 0.10.6 to 0.10.7
Pull-Request: #3799.
2023-04-28 14:36:12 +00:00
cfdf5c3345 deps: bump clap from 4.2.4 to 4.2.5
Pull-Request: #3849.
2023-04-28 14:21:17 +00:00
e3a1650933 feat(identify): do not implicitly dial on push
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.
2023-04-28 14:06:33 +00:00
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
99ad3b6eaf refactor(kad): don't use OutboundOpenInfo
As part of pushing #3268 forward, remove the use of `OutboundOpenInfo` from `libp2p-kad`.

Related #3268.

Pull-Request: #3760.
2023-04-28 13:37:06 +00:00
4ebb4d0a30 deps: bump serde_json from 1.0.95 to 1.0.96
Pull-Request: #3798.
2023-04-28 12:00:43 +00:00
8445079622 refactor(perf): don't use OutboundOpenInfo
Instead of passing the command along, we store it in a buffer and retrieve it once the stream is upgraded.

Related: https://github.com/libp2p/rust-libp2p/issues/3268.

Pull-Request: #3763.
2023-04-28 11:47:10 +00:00
66466c43af refactor(dcutr): don't use OutboundOpenInfo
In a previous refactoring, we actually removed the usage of this openinfo so this is just removing dead code.

Related: #3268.

Pull-Request: #3762.
2023-04-28 11:33:31 +00:00
a836bb471f deps: bump clap from 4.2.1 to 4.2.4
Pull-Request: #3808.
2023-04-28 11:19:43 +00:00
a0613e4af8 deps: bump hyper from 0.14.25 to 0.14.26
Pull-Request: #3797.
2023-04-28 11:03:03 +00:00
8a0e61e3ac deps: bump tokio from 1.27.0 to 1.28.0
Pull-Request: #3834.
2023-04-28 10:49:08 +00:00
3f6f08d8e0 feat(request-response): make handler and codec modules private
Resolves #3704.

Pull-Request: #3847.
2023-04-28 10:12:07 +00:00
d66c8271b5 refactor(core): remove EitherIter
`EitherIter` is an implementation detail and can be removed without breaking users.

Related: https://github.com/libp2p/rust-libp2p/pull/3746.

Pull-Request: #3841.
2023-04-27 13:04:16 +00:00
fadcc43e69 refactor(core): remove InfoIterChain
This type can be replaced with std-lib components.

Related: https://github.com/libp2p/rust-libp2p/pull/3746.

Pull-Request: #3842.
2023-04-27 12:50:06 +00:00
31dbcabe7c ci: enable cargo debug logging in semver-checks
This PR enables debug logging on requests from cargo to the registry in semver-checks action (https://github.com/rust-lang/cargo/issues/7662#issuecomment-561809348). Hopefully, it will let us debug the network issue reported here: https://github.com/libp2p/rust-libp2p/pull/3782#issuecomment-1523346255

Pull-Request: #3838.
2023-04-27 12:31:06 +00:00
9d1058df7b fix(gossipsub): always honor support_floodsub setting
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.
2023-04-27 05:20:19 +00:00
71805caaec refactor(gossipsub): miscellaneous tidy-up of config tests
- Move helpers to the bottom
- Restructure tests to follow arrange-act-assert
- Only set necessary options on builder for each test

Pull-Request: #3836.
2023-04-26 17:05:08 +00:00
e0d74bd78f deps: bump tokio-util from 0.7.7 to 0.7.8
Pull-Request: #3833.
2023-04-26 14:42:02 +00:00
4dd2e0eb59 refactor(plaintext): implement tests with futures_ringbuf
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.
2023-04-26 13:12:57 +00:00
35132c4ab6 refactor(muxer): replace MemoryTransport with futures_ringbuf
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.
2023-04-26 12:55:06 +00:00
7fa8beff21 refactor(deflate): implement tests with futures_ringbuf
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.
2023-04-26 12:37:28 +00:00
ed392af864 feat(ci): use cargo-semver-checks v0.20 for a massive perf improvement
`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.
2023-04-26 11:18:30 +00:00
58085418d1 feat(ci): bump version for stable clippy to 1.69
Pull-Request: #3820.
2023-04-26 08:17:07 +00:00
135942d319 chore: enforce unreachable_pub lint
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.
2023-04-26 07:31:56 +00:00
e5dbeb3e08 feat(core): deprecate OptionalUpgrade
This is dead-code, we don't use it in our codebase. I am suggesting to remove it because it creates an unnecessary API surface.

Related: https://github.com/libp2p/rust-libp2p/pull/3747.
Related: https://github.com/libp2p/rust-libp2p/issues/3271.

Pull-Request: #3806.
2023-04-26 06:05:45 +00:00
9681116b02 ci(mergify): automatically approve PRs from maintainers
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.
2023-04-26 07:29:17 +02:00
9d78331ca1 ci: run test on self-hosted runners
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.
2023-04-25 14:57:06 +00:00
e5300fac78 deps: bump syn from 2.0.11 to 2.0.15
Pull-Request: #3824.
2023-04-25 14:42:24 +00:00
13623b2da7 fix(identity): build with all features on docs.rs
Resolves #3810.

Pull-Request: #3828.
2023-04-25 14:06:54 +00:00
70ca3243ad fix(docs): correct link to chat-example in examples readme
Resolves #3830.

Pull-Request: #3831.
2023-04-25 13:16:12 +00:00
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
5657f5c9aa fix: apply suggestions from clippy beta (1.70)
Pull-Request: #3819.
2023-04-25 09:18:40 +00:00