Commit Graph

2601 Commits

Author SHA1 Message Date
6880469340 fix(webrtc): unwoken task in webrtc transport (#3408)
Add an explicit waker to report the last event.
2023-02-01 06:11:28 +00:00
96c93b9a52 fix(quic): unwoken task in quic transport (#3407)
Add an explicit waker to report the last event.
2023-02-01 05:34:48 +00:00
0c94237e16 deps: bump futures from 0.3.25 to 0.3.26 (#3405) 2023-01-31 23:34:17 +00:00
8f3b7e3876 fix: deal with new lints from beta clippy (#3389)
Most of this is trivial, apart from the rename of the `clippy::derive_hash_xor_eq` lint to `clippy::derived_hash_with_manual_eq`.

Instead of allowing that lint, we manually implement `PartialEq` and add a comment why the difference between the `PartialEq` and `Hash` implementations are okay.
2023-01-31 13:20:26 +00:00
3ec7c797e5 deps(ci): use v0.17.0 of cargo semver-checks (#3401) 2023-01-31 03:03:53 +00:00
fb64c3dfdb deps: bump docker/login-action from 1.10.0 to 2.1.0 (#3394) 2023-01-30 22:44:54 +00:00
c15e6517b1 refactor(tcp): use SelectAll for driving listener streams (#3361)
The PR optimizes polling of the listeners in the TCP transport by using `futures::SelectAll` instead of storing them in a queue and polling manually.

Resolves #2781.
2023-01-30 22:09:51 +00:00
47c1d5a019 docs(websocket): showcase wrapping dns and tcp transport (#3385) 2023-01-30 15:11:27 +00:00
15e0faadf5 deps: update if-addrs requirement from 0.7.0 to 0.8.0 (#3354) 2023-01-30 13:50:26 +00:00
2d080dc7ee feat: track Cargo.lock in CI (#3399)
Resolves https://github.com/libp2p/rust-libp2p/issues/2853.
2023-01-30 11:59:37 +00:00
d344406235 fix(tcp): remove correct listener inTransport::remove_listener (#3387)
`libp2p_tcp::Transport::remove_listener` previously removed the first listener that *did not match* the provided `ListenerId`. This small fix brings it inline with other implementations.
2023-01-27 17:32:40 +00:00
ab59af4d46 refactor(gossipsub): revise symbol naming to follow conventions (#3303)
Changes regarding the  #2217
2023-01-27 04:44:04 +00:00
e2b3c1190a fix(mdns): Don't expire mDNS nodes on connection close (#3367)
mDNS records should not be expiring when an unrelated connection timeout with said peer is reached.

Fixes #3309.
2023-01-27 04:02:20 +00:00
47cb72908d fix(tutorial): Update ping tutorial to match examples/ping.rs (#3289)
While following the ping tutorial myself, I noticed it was out of date from the ping example in `examples/ping.rs`, and the code given in the tutorial no longer cleanly builds. I decided to update the tutorial to build the exact code in the example.
2023-01-27 02:33:17 +00:00
d1336a7d81 feat(swarm)!: introduce ListenError (#3375)
In case an error happens for an outgoing connection, `Pool` reports an `OutgoingConnectionError`. This one is mapped to a `DialError` and reported via `SwarmEvent::OutgoingConnectionError` and `FromSwarm::DialFailure`.

For incoming connections, we didn't quite do the same thing. For one, `SwarmEvent::IncomingConnectionError` directly contained a `PendingInboundConnectionError`. Two, `FromSwarm::ListenFailure` did not include an error at all.

With this patch, we now introduce a `ListenError` enum which we use in `SwarmEvent::IncomingConnectionError` and we pass a reference to it along in `FromSwarm::ListenFailure`.
2023-01-26 23:23:55 +00:00
e55202200c refactor(gossipsub)!: initialize ProtocolConfig from GossipsubConfig (#3381)
This simplifies the tests as we don't have to go through the `new_handler` abstraction.
2023-01-26 14:39:48 +00:00
4de54f00f9 refactor: expose and use THandlerOutEvent type alias (#3368)
Previously, we used the full reference to the `OutEvent` of the `ConnectionHandler` in all implementations of `NetworkBehaviour`. Not only is this very verbose, it is also more brittle to changes. With the current implementation plan for #2824, we will be removing the `IntoConnectionHandler` abstraction. Using a type-alias to refer to the `OutEvent` makes the migration much easier.
2023-01-26 11:55:02 +00:00
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
14825c7ecb feat(swarm): remove unused DialError::ConnectionIo variant (#3374)
This variant is never constructed.
2023-01-26 08:10:08 +00:00
9f7145912a feat(swarm)!: report connections to our own PeerId in separate error (#3377)
Previously, inbound connections that happened to resolve to our own `PeerId` were reported as `WrongPeerId`. With this patch, we now report those in a dedicated `LocalPeerId` error.

Related: #3205.
2023-01-26 07:20:23 +00:00
90af08cb59 feat(swarm)!: remove unused PendingConnectionError::Io variant (#3373)
This variant is never constructed.
2023-01-26 05:26:54 +00:00
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
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
43909fa9b0 feat(ci): use latest release of cargo semver-checks (#3380) 2023-01-25 21:16:01 +00:00
a25ab7e444 refactor(gossipsub): use dummy handler instead of calling new_handler (#3384)
The gossipsub tests are calling lifecycle functions of the `NetworkBehaviour` that aren't meant to be called outside of `Swarm`. This already surfaced as a problem in https://github.com/libp2p/rust-libp2p/pull/3327 and it is coming up again in https://github.com/libp2p/rust-libp2p/pull/3254 where `new_handler` gets deprecated.

Try to mitigate that by constructing a dummy handler instead. Functionally, there is no difference as in both cases, the given handler has never seen a connection.
2023-01-25 11:51:51 +00:00
62c0532de6 ci: Interop tests fixes and updates pending from #3331 (#3360) 2023-01-24 22:28:57 +00:00
d3dc398134 refactor(relay): directly store actions instead of events (#3372)
Storing `NetworkBehaviourAction`s within the behaviour is more flexible than only storing `OutEvent`s. Additionally, I find expression-oriented code easier to reason about because it typically doesn't contain side-effects.
2023-01-24 21:00:13 +00:00
520523b696 feat(kad): Limit number of active outbound streams (#3287)
Limit number of active outbound streams to not exceed configured number of streams.

Resolves https://github.com/libp2p/rust-libp2p/issues/3236.
2023-01-24 18:22:35 +00:00
687fba8b06 fix(ci): apply shorter timeout to cache download (#3376)
Sometimes, GitHub Actions gets stuck in downloading the cache. My hypothesis is that because we have so many jobs, some of them get rate-limited and end up failing the download.

Typically, GitHub Actions downloads with a speed of 100MB/s. With the maximum allowed cache size of 10GB, any cache download should not take longer than 100 seconds. With this patch, we set the timeout to 120 seconds for the continuous integration workflow.

Upon failure, the job will continue with a cache-miss which is nice because it means the workflow will continue and not fail.

More information here: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout

Example workflows:

- https://github.com/libp2p/rust-libp2p/actions/runs/3992478158/jobs/6848975863
- https://github.com/libp2p/rust-libp2p/actions/runs/3992492999/jobs/6848989008
- https://github.com/libp2p/rust-libp2p/actions/runs/3992564680/jobs/6849012006
2023-01-24 14:29:23 +00:00
47fe699f5e feat(ci): download cargo-semver-checks instead of building it (#3378)
This is much quicker to execute. To keep our CI reproducible, I opted to link to a specific version instead of the "latest" release. Updating to a new version is as easy as switching out the version number in the URL.
2023-01-24 13:59:10 +00:00
ba4015d0d2 docs(roadmap): Update WebRTC browser-to-browser entry (#3355)
- Add dependency on WASM support and move below WASM entry
- List browser-to-browser spec dependency.
2023-01-24 11:16:45 +00:00
9e1f775478 fix(autonat): Skip unparsable multiaddr (#3363)
With this commit `libp2p-autonat` no longer discards the whole remote payload in case an addr is unparsable, but instead logs the failure and skips the unparsable multiaddr.

See libp2p#3244 for details.
2023-01-24 08:49:59 +00:00
d73613251f docs(roadmap): Mark WebRTC browser-to-server as done (#3357)
- Added in https://github.com/libp2p/rust-libp2p/pull/2622
- Interoperability tests added in https://github.com/libp2p/test-plans/pull/100
2023-01-24 02:51:00 +00:00
d7ee0e4d35 fix(swarm)!: make on_connection_handler_event impl mandatory. (#3364)
Sorry I missed this on https://github.com/libp2p/rust-libp2p/pull/3264
2023-01-24 01:10:26 +00:00
dcfa7ecf5d feat(quic): Wake transport when adding a new dialer or listener (#3342)
Wake `quic::GenTransport` if a new dialer or listener is added.
2023-01-23 23:39:13 +00:00
778f7a2d1a feat(core)!: make ConnectionIds globally unique (#3327)
Instead of offering a public constructor, users are now no longer able to construct `ConnectionId`s at all. They only public API exposed are the derived traits. Internally, `ConnectionId`s are monotonically incremented using a static atomic counter, thus no two connections will ever get assigned the same ID.
2023-01-23 16:29:41 +00:00
b0b035b2ff docs(roadmap): Remove milestones section (#3359)
I suggest we remove the milestones section. @p-shahi let me know if you feel strongly about keeping it.

- Most items in milestones are either done or outdated
- Milestones are already tracked on each item
- Items are ordered by priority / date
2023-01-23 13:59:30 +00:00
4b41f5a994 refactor(core)!: remove EitherOutput (#3341)
The trick with this one is to use `futures::Either` everywhere where we may wrap something that implements any of the `futures` traits. This includes the output of `EitherFuture` itself. We also need to implement `StreamMuxer` on `future::Either` because `StreamMuxer`s may be the the `Output` of `InboundUpgrade`.
2023-01-23 12:31:30 +00:00
8d6a2fc4a9 docs(roadmap): Mark alpha QUIC as done and add quinn work (#3356)
- Implementation based on `quinn-proto` was added in https://github.com/libp2p/rust-libp2p/pull/2289
- Add new entry to evaluate using `quinn` directly
2023-01-23 07:01:59 +00:00
f522057a80 docs(roadmap): Remove bitswap entry (#3358)
We will not implement Bitswap anytime soon. See
https://github.com/libp2p/rust-libp2p/issues/2632#issuecomment-1309147441 for rational.
2023-01-22 21:22:33 +00:00
d82c2a1a7a refactor(swarm): simplify DialOpts (#3335)
Instead of tracking an inner enum, move all fields of `Opts` into `DialOpts`, setting them directly once we construct them. This makes the getters a lot simpler to implement and reduces code duplication.
2023-01-19 23:30:09 +00:00
b5a3f81c3d refactor(swarm)!: don't share event buffer for established connections (#3188)
Currently, we only have a single channel for all established connections. This requires us to construct the channel ahead of time, before we even have a connection. As it turns out, sharing this buffer across all connections actually has downsides. In particular, this means a single, very busy connection can starve others by filling up this buffer, forcing other connections to wait until they can emit an event.
2023-01-19 22:49:11 +00:00
a34411c528 ci: update interop workflow (#3331)
Addresses https://github.com/libp2p/test-plans/pull/99
2023-01-19 20:20:37 +00:00
73cbbe2967 refactor(core)!: remove EitherFuture2 (#3340)
We can completely replace `EitherFuture2` with `EitherFuture`. `EitherFuture` itself cannot be removed for now because the `Future` implementation on `future::Either` forces both `Future`s to evaluate to the same type.
2023-01-18 10:17:18 +00:00
475dc80a07 refactor!: Move ConnectionId and PendingPoint to libp2p-swarm (#3346)
Both of these are only needed as part of `libp2p-swarm`. Them residing in `libp2p-core` is a left-over from when `libp2p-core` still contained `Pool`.
2023-01-18 08:56:32 +00:00
db2cd43826 refactor(core)!: remove EitherUpgrade (#3339)
We don't need to define our own type here, we can simply implement `UpgradeInfo`, `InboundUpgrade` and `OutboundUpgrade` on `either::Either`.
2023-01-18 02:35:07 +00:00
8cd14e6a3a refactor(relay): introduce Handler::new functions (#3334) 2023-01-18 01:29:43 +00:00
c18939f8dc refactor(core)!: remove EitherTransport (#3338)
We don't need to define our own type here, we can simply implement `Transport` on `either::Either`.
2023-01-18 00:58:09 +00:00
f4fed3880b refactor(core)!: remove EitherError in favor of either::Either (#3337)
Defining our own `EitherError` type has no value now that `Either` provides the same implementation.

Related: https://github.com/libp2p/rust-libp2p/issues/3271
2023-01-17 23:05:59 +00:00
29a77164f1 fix(ci): properly escape PR title (#3318)
Within double quoted strings, bash tries to evaluate everything within backticks as a command. The GitHub security guide recommends to use an intermediary environment variable instead: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable

See https://github.com/libp2p/rust-libp2p/actions/runs/3889880383/jobs/6638520274#step:3:11.
2023-01-17 22:13:09 +00:00