2425 Commits

Author SHA1 Message Date
dependabot[bot]
a836bb471f
deps: bump clap from 4.2.1 to 4.2.4
Pull-Request: #3808.
2023-04-28 11:19:43 +00:00
dependabot[bot]
a0613e4af8
deps: bump hyper from 0.14.25 to 0.14.26
Pull-Request: #3797.
2023-04-28 11:03:03 +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 Coratger
3f6f08d8e0
feat(request-response): make handler and codec modules private
Resolves #3704.

Pull-Request: #3847.
2023-04-28 10:12:07 +00:00
Thomas Eizinger
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
Thomas Eizinger
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
Piotr Galar
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
Thomas Eizinger
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
Thomas Eizinger
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
dependabot[bot]
e0d74bd78f
deps: bump tokio-util from 0.7.7 to 0.7.8
Pull-Request: #3833.
2023-04-26 14:42:02 +00:00
Thomas Eizinger
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
Thomas Eizinger
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
Thomas Eizinger
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
Predrag Gruevski
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
Thomas Eizinger
58085418d1
feat(ci): bump version for stable clippy to 1.69
Pull-Request: #3820.
2023-04-26 08:17:07 +00:00
Thomas Eizinger
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
Thomas Eizinger
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
Thomas Eizinger
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
Piotr Galar
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
dependabot[bot]
e5300fac78
deps: bump syn from 2.0.11 to 2.0.15
Pull-Request: #3824.
2023-04-25 14:42:24 +00:00
Thomas Coratger
13623b2da7
fix(identity): build with all features on docs.rs
Resolves #3810.

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

Pull-Request: #3831.
2023-04-25 13:16:12 +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
Thomas Eizinger
5657f5c9aa
fix: apply suggestions from clippy beta (1.70)
Pull-Request: #3819.
2023-04-25 09:18:40 +00:00
dependabot[bot]
df19abbbf2
deps: bump serde from 1.0.159 to 1.0.160
Pull-Request: #3796.
2023-04-24 18:41:38 +00:00
dependabot[bot]
2065348867
deps: bump libc from 0.2.141 to 0.2.142
Pull-Request: #3815.
2023-04-24 18:09:41 +00:00
dependabot[bot]
b4bfaacd05
deps: bump regex from 1.7.3 to 1.8.1
Pull-Request: #3816.
2023-04-24 17:23:39 +00:00
Nathaniel Cook
1f508095dc
fix(kad): preserve deadline in keep alive logic
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.
2023-04-24 08:55:46 +00:00
Thomas Coratger
270d204db2
feat(gossipsub): make gossipsub modules private
Resolves #3494.

Pull-Request: #3777.
2023-04-23 21:00:23 +00:00
Doug A
e6f9d49109
fix(identity): add From & Into for public keys
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.
2023-04-22 10:16:58 +00:00
Thomas Eizinger
28da3d4180
fix(ci): ensure all examples compile with the specified feature-set
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.
2023-04-21 09:58:08 +00:00
Thomas Eizinger
0fe9791829
feat(core): deprecate upgrade::from_fn
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.
2023-04-19 22:07:42 +00:00
Thomas Eizinger
5df321d8b9
fix(allowblocklist): correctly remove Peer from sets
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.
2023-04-19 15:51:20 +00:00
Victor Ermolaev
96288b8984
fix(gossipsub): gracefully disable handler on stream errors
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.
2023-04-14 15:19:47 +00:00
DrHuangMHT
058c2d85ec
refactor(identity): follow naming conventions for conversion methods
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.
2023-04-14 08:55:13 +00:00
dependabot[bot]
8ffcff9624
deps: bump h2 from 0.3.15 to 0.3.17
Pull-Request: #3788.
2023-04-13 21:57:28 +00:00
Thomas Eizinger
9e09c60301
refactor(ci): simplify jq command for gather_workspace_crates
With best regards from ChatGPT.

Pull-Request: #3783.
2023-04-12 18:54:51 +00:00
dependabot[bot]
aef481a420
deps: bump tj-actions/glob from 16 to 17
Pull-Request: #3778.
2023-04-12 14:48:02 +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
Thomas Eizinger
9eb3030b1f
fix(relay): ensure stable connect test
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.
2023-04-12 12:04:01 +00:00
Max Inden
3c5940aead
chore: prepare v0.51.3
Pull-Request: #3779.
2023-04-12 10:28:30 +00:00
Thomas Eizinger
af63130a41
fix(relay): send correct PeerId to client in outbound STOP message
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.
2023-04-11 22:11:51 +00:00
Elena Frank
436459b018
chore(README): update maintainer list
Pull-Request: #3744.
2023-04-11 21:16:54 +00:00
Thomas Eizinger
f7c3db9d6b
chore(metrics): move example to examples/
Related: #3111.

Pull-Request: #3661.
2023-04-11 20:47:43 +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]
3e6d5862a2
deps: bump hyper from 0.14.24 to 0.14.25
Pull-Request: #3598.
2023-04-11 18:33:53 +00:00
dependabot[bot]
849554abb0
deps: bump lru from 0.9.0 to 0.10.0
Pull-Request: #3558.
2023-04-11 17:54:56 +00:00
Max Inden
eeddf2791b
fix(relay): flush relayed connection once idle
As a relay, when forwarding data between relay-connection-source and -destination and vice versa, flush write side when read currently has no more data available.

Pull-Request: #3765.
2023-04-11 16:13:23 +00:00
Thomas Coratger
4cac590765
feat(kad): make implementation modules private
Similar to #3494, make implementation modules private for Kademlia (`kad`).

Resolves #3608.

Pull-Request: #3738.
2023-04-11 14:44:46 +00:00
Darius Clark
8f8c86d347
fix(autonat): prohibit potentially large memory consumption
Autonat uses `Vec` for the servers field to hold a list of `PeerId` when calling `Behaviour::add_server`, but there is no check to prevent duplicated entries of the `PeerId`, which would cause unnecessary allocation overtime with repeated calls to the function.

Resolves #3733.

Pull-Request: #3736.
2023-04-11 11:40:35 +00:00