2359 Commits

Author SHA1 Message Date
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
dependabot[bot]
06ea8cef7e
deps: bump asn1_der from 0.7.5 to 0.7.6
Pull-Request: #3752.
2023-04-10 15:40:51 +00:00
dependabot[bot]
7144734ba6
deps: bump libc from 0.2.140 to 0.2.141
Pull-Request: #3757.
2023-04-10 14:48:34 +00:00
dependabot[bot]
235043c013
deps: bump yasna from 0.5.1 to 0.5.2
Pull-Request: #3756.
2023-04-10 13:58:49 +00:00
dependabot[bot]
7fe2f1cd6d
deps: bump getrandom from 0.2.8 to 0.2.9
Pull-Request: #3751.
2023-04-10 12:54:34 +00:00
dependabot[bot]
ecb55bbd86
deps: bump hex-literal from 0.4.0 to 0.4.1
Pull-Request: #3750.
2023-04-10 11:24:08 +00:00
Benno
1b2de2df3f
fix(kad): export RoutingUpdate
The `RoutingUpdate` type that `add_address` returns was not made available publicly. This type is added in this PR by `pub use`.

Resolves #3737.

Pull-Request: #3739.
2023-04-09 16:35:05 +00:00
Thomas Eizinger
6b6187bd1c
fix(identity): remove prost dependency
Pull-Request: #3713.
2023-04-09 15:48:43 +00:00
dependabot[bot]
23c3d24610
deps: bump if-watch from 3.0.0 to 3.0.1
Pull-Request: #3730.
2023-04-09 14:27:58 +00:00
Thomas Eizinger
451c64a8b8
fix: specify correct libp2p-swarm dependency
With https://github.com/libp2p/rust-libp2p/pull/3658, these crates depend on the `0.42.1` release to access the new `ToSwarm` type. With the currently specified version, a user could theoretically run into a compile error if they pin `libp2p-swarm` to `0.42.0` in their lockfile but update to the latest patch release of one of these crates.

Pull-Request: #3711.
2023-04-05 19:44:32 +00:00
dependabot[bot]
bdc618e9c7
deps: bump tempfile from 3.4.0 to 3.5.0
Pull-Request: #3720.
2023-04-05 15:35:00 +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
Thomas Eizinger
7c85f92e31
refactor(gossipsub): use pop instead of remove
Doesn't change any functionality but `pop` returns an `Option` whereas `remove` will panic on out-of-bounds. I am more comfortable with `pop` and a pattern match. Also, usage of `continue` allows us to not use an `else`.

Pull-Request: #3734.
2023-04-04 16:04:40 +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
Max Inden
5f2fff58c3
fix(.github): use run-interop-ping @master
We are currently using an old version of the ping interop tests. E.g. we are missing https://github.com/libp2p/test-plans/pull/148 which adds rust-libp2p v0.51.0.

Pull-Request: #3708.
2023-04-04 12:22:41 +00:00
Darius Clark
f2a7457fde
fix(gossipsub): prevent erroneously duplicate message IDs
Previously, we only mutably borrowed the `last_seq_no` in the current scope but did not modify the underlying number. This is because `u64` is copy and calling `wrapping_add` consumes `self` so the compiler just copied it. We introduce a new-type instead that is not `Copy`.

Additionally, `wrapping_add` and initializing with a random u64 might actually warp the number and thus not give us sequential numbers as intended in #3551. To solve this, we initialize with the current unix timestamp in nanoseconds. This allows a node to publish 1000000 messages a second and still not reuse sequence numbers even after a restart / re-initialization of the configuration. This is also what the go implementation does.

Resolves #3714.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

Pull-Request: #3716.
2023-04-04 10:52:16 +00:00
dependabot[bot]
e350630caf
deps: bump webpki-roots from 0.22.6 to 0.23.0
Pull-Request: #3723.
2023-04-04 10:23:21 +00:00