Commit Graph

2121 Commits

Author SHA1 Message Date
2ae9dba53f deps: bump async-trait from 0.1.63 to 0.1.64 (#3404) 2023-02-16 08:26:52 +00:00
6d689ed420 deps: bump once_cell from 1.17.0 to 1.17.1 (#3466) 2023-02-16 07:13:37 +00:00
51ca602893 deps: bump anyhow from 1.0.68 to 1.0.69 (#3433) 2023-02-16 06:01:54 +00:00
239a62c764 test(swarm): Wait for swarm1 to disconnect (#3465)
This commit does two things:

- Check that swarm1, given that it has no ban, establishes 21 connections and swarm2, given that it has a ban, establishes 20 connections.

- Wait for swarm1 to notice disconnect, given that swarm2 closed the connection to the banned swarm1.

Fixes flake introduced in caed1fe2c7.
2023-02-14 20:51:27 +00:00
7c73bc365a ci(interop): Use run-interop-ping-test master latest hash (#3462)
With https://github.com/libp2p/test-plans/pull/121 merged, we should be able to use @master
directly. Still pointing to a concrete git hash.

This includes
6d1aed2ed5, thus
allowing interop tests to run from fork pull requests.
2023-02-14 18:33:37 +01:00
caed1fe2c7 refactor(swarm)!: remove handler from NetworkBehaviourAction::Dial (#3328)
We create the `ConnectionId` for the new connection as part of `DialOpts`. This allows `NetworkBehaviour`s to accurately track state regarding their own dial attempts.

This patch is the main enabler of https://github.com/libp2p/rust-libp2p/pull/3254. Removing the `handler` field will allow us to deprecate the `NetworkBehaviour::new_handler` function in favor of four new ones that give more control over the connection lifecycle.
2023-02-14 01:09:29 +00:00
9247cfa878 feat(ci): pin Rust version for clippy job (#3445)
Always referencing the latest version of Rust for clippy creates problems during backporting as already fixed problems in master come up again during a backport.
2023-02-11 06:04:25 +00:00
43b6e2f8e5 fix(dependabot): avoid lockfile updates (#3434)
This is an attempt to _avoid_ lockfile-only updates now that we are tracking the `Cargo.lock` in Git.
2023-02-10 13:00:48 +00:00
eddbb2bda0 docs(quic): Add changelog entry for #3420 (#3452) 2023-02-10 11:32:36 +01:00
eeca244ca5 feat(interop-tests): build test binary inside container (#3441)
Building inside the container allows Windows and MacOS users to also build this binary. Thanks to a new feature from docker, `--mount=type=cache`, rebuilding layers is fast without any additional hacks.
2023-02-10 06:14:25 +00:00
351a166b39 feat: don't publish docker containers for interop-tests (#3437)
As per outcome of discussion here: https://github.com/libp2p/test-plans/pull/121#discussion_r1099109241
2023-02-08 19:27:39 +00:00
0bffad98c0 deps: bump dtolnay/rust-toolchain (#3424) 2023-02-08 08:39:41 +00:00
3c120322a9 fix(quic): discard correct waker upon accepting inbound stream (#3420) 2023-02-07 08:08:26 +00:00
696c644fef feat(ci): use interop-tests action instead of workflow (#3414) 2023-02-06 00:48:53 +00:00
53e477d442 refactor(interop): update ping to conform to the new interop spec (#3423) 2023-02-02 11:41:59 +00:00
babf7e3753 fix(ci): replace actions-rs/toolchain with dtolnay/toolchain (#3391)
This one seems it [got a blessing](https://github.com/rust-lang/regex/pull/883) from rust-lang.

Closes #3352.
2023-02-02 05:25:50 +00:00
b7fa2bccdf refactor(inter-op): misc clean-up (#3409)
This patch contains misc cleanup that I did as part of reading through the code to understand how it works.
2023-02-01 22:20:25 +00:00
b98b03eb7e fix(swarm-derive): add bounds to OutEvent on generic fields (#3393)
This PR isolates the bugfix for the `NetworkBehaviour` derive implementation for structures with generic fields. When `out_event` was not provided, the generated enum was missing the `NetworkBehaviour` impl constraint for the generic variants whilst using the generics for `<Generic>::OutEvent`.

Meanwhile I also found that the generated `poll` function `loop`s the sub behaviours and either `return`'s when `Poll::Ready` or `break`'s when `Poll::Pending`. This is a relict from when we still had `NetworkBehaviourEventProcess` which had added a branch within this loop that did not `return` but consume the event and `continue`. This trait was removed a while ago meaning this `loop` is no longer needed.
2023-02-01 21:30:27 +00:00
063aab5909 deps: bump bytes from 1.3.0 to 1.4.0 (#3422) 2023-02-01 11:34:26 +00:00
4569e498b4 deps: bump snow from 0.9.0 to 0.9.1 (#3421) 2023-02-01 11:02:18 +00:00
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