Skip to content

Commit

Permalink
Merge branch 'master' into impl-gossipsub-backpressure-2
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs authored Oct 3, 2024
2 parents cddab5a + 8ceadaa commit d339f2e
Show file tree
Hide file tree
Showing 50 changed files with 219 additions and 102 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- 'master'
tags:
- 'libp2p-server-**'
pull_request:

jobs:
server:
Expand Down Expand Up @@ -34,11 +33,6 @@ jobs:
with:
context: .
file: ./misc/server/Dockerfile
push: ${{ ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} # Only push image if we have the required permissions, i.e. not running from a fork
cache-from: ${{ ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' && type=s3,mode=max,bucket=libp2p-by-tf-aws-bootstrap,region=us-east-1,prefix=buildCache,name=rust-libp2p-server }}
cache-to: ${{ ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' && type=s3,mode=max,bucket=libp2p-by-tf-aws-bootstrap,region=us-east-1,prefix=buildCache,name=rust-libp2p-server }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
env:
AWS_ACCESS_KEY_ID: ${{ vars.TEST_PLANS_BUILD_CACHE_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_PLANS_BUILD_CACHE_KEY }}
18 changes: 9 additions & 9 deletions .github/workflows/interop-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Interoperability Testing
on:
pull_request:
push:
branches:
- "master"
Expand All @@ -24,18 +23,19 @@ jobs:
- name: Build ${{ matrix.flavour }} image
run: ./scripts/build-interop-image.sh
env:
AWS_ACCESS_KEY_ID: ${{ vars.TEST_PLANS_BUILD_CACHE_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_PLANS_BUILD_CACHE_KEY }}
AWS_BUCKET_NAME: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
FLAVOUR: ${{ matrix.flavour }}

- name: Run ${{ matrix.flavour }} tests
uses: libp2p/test-plans/.github/actions/run-transport-interop-test@master
with:
test-filter: ${{ matrix.flavour }}-rust-libp2p-head
extra-versions: ${{ github.workspace }}/interop-tests/${{ matrix.flavour }}-ping-version.json
s3-cache-bucket: libp2p-by-tf-aws-bootstrap
s3-access-key-id: ${{ vars.TEST_PLANS_BUILD_CACHE_KEY_ID }}
s3-secret-access-key: ${{ secrets.TEST_PLANS_BUILD_CACHE_KEY }}
s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }}
s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
worker-count: 16
run-holepunching-interop:
name: Run hole-punch interoperability tests
Expand All @@ -50,7 +50,7 @@ jobs:
with:
test-filter: rust-libp2p-head
extra-versions: ${{ github.workspace }}/hole-punching-tests/version.json
s3-cache-bucket: libp2p-by-tf-aws-bootstrap
s3-access-key-id: ${{ vars.TEST_PLANS_BUILD_CACHE_KEY_ID }}
s3-secret-access-key: ${{ secrets.TEST_PLANS_BUILD_CACHE_KEY }}
s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }}
s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
worker-count: 16
77 changes: 29 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ futures-bounded = { version = "0.2.4" }
futures-rustls = { version = "0.26.0", default-features = false }
libp2p = { version = "0.54.1", path = "libp2p" }
libp2p-allow-block-list = { version = "0.4.1", path = "misc/allow-block-list" }
libp2p-autonat = { version = "0.13.0", path = "protocols/autonat" }
libp2p-autonat = { version = "0.13.1", path = "protocols/autonat" }
libp2p-connection-limits = { version = "0.4.0", path = "misc/connection-limits" }
libp2p-core = { version = "0.42.0", path = "core" }
libp2p-dcutr = { version = "0.12.0", path = "protocols/dcutr" }
Expand All @@ -102,7 +102,7 @@ libp2p-rendezvous = { version = "0.15.0", path = "protocols/rendezvous" }
libp2p-request-response = { version = "0.27.0", path = "protocols/request-response" }
libp2p-server = { version = "0.12.7", path = "misc/server" }
libp2p-stream = { version = "0.2.0-alpha", path = "protocols/stream" }
libp2p-swarm = { version = "0.45.1", path = "swarm" }
libp2p-swarm = { version = "0.45.2", path = "swarm" }
libp2p-swarm-derive = { version = "=0.35.0", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required.
libp2p-swarm-test = { version = "0.4.0", path = "swarm-test" }
libp2p-tcp = { version = "0.42.0", path = "transports/tcp" }
Expand Down
2 changes: 1 addition & 1 deletion examples/autonatv2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.75-alpine as builder
FROM rust:1.81-alpine as builder

RUN apk add musl-dev

Expand Down
2 changes: 1 addition & 1 deletion hole-punching-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.5-labs
FROM rust:1.75.0 as builder
FROM rust:1.81.0 as builder

# Run with access to the target cache to speed up builds
WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion interop-tests/Dockerfile.chromium
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.5-labs
FROM rust:1.75.0 as chef
FROM rust:1.81 as chef
RUN rustup target add wasm32-unknown-unknown
RUN wget -q -O- https://github.com/rustwasm/wasm-pack/releases/download/v0.12.1/wasm-pack-v0.12.1-x86_64-unknown-linux-musl.tar.gz | tar -zx -C /usr/local/bin --strip-components 1 --wildcards "wasm-pack-*/wasm-pack"
RUN wget -q -O- https://github.com/WebAssembly/binaryen/releases/download/version_115/binaryen-version_115-x86_64-linux.tar.gz | tar -zx -C /usr/local/bin --strip-components 2 --wildcards "binaryen-version_*/bin/wasm-opt"
Expand Down
2 changes: 1 addition & 1 deletion interop-tests/Dockerfile.native
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.5-labs
FROM lukemathwalker/cargo-chef:0.1.62-rust-1.75.0 as chef
FROM lukemathwalker/cargo-chef:0.1.67-rust-bullseye as chef
WORKDIR /app

FROM chef AS planner
Expand Down
2 changes: 2 additions & 0 deletions misc/allow-block-list/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ where
_: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down
4 changes: 4 additions & 0 deletions misc/connection-limits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ impl NetworkBehaviour for Behaviour {
_: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down Expand Up @@ -586,6 +588,8 @@ mod tests {
_connection_id: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down
2 changes: 2 additions & 0 deletions misc/memory-connection-limits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ impl NetworkBehaviour for Behaviour {
_: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down
2 changes: 2 additions & 0 deletions misc/memory-connection-limits/tests/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ impl<const MEM_PENDING: usize, const MEM_ESTABLISHED: usize> NetworkBehaviour
_: ConnectionId,
event: THandlerOutEvent<Self>,
) {
// TODO: remove when Rust 1.82 is MSRV
#[allow(unreachable_patterns)]
void::unreachable(event)
}

Expand Down
1 change: 1 addition & 0 deletions misc/quick-protobuf-codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod generated;
pub use generated::test as proto;

/// [`Codec`] implements [`Encoder`] and [`Decoder`], uses [`unsigned_varint`]
///
/// to prefix messages with their length and uses [`quick_protobuf`] and a provided
/// `struct` implementing [`MessageRead`] and [`MessageWrite`] to do the encoding.
pub struct Codec<In, Out = In> {
Expand Down
2 changes: 1 addition & 1 deletion misc/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.5-labs
FROM rust:1.75.0 as chef
FROM rust:1.81.0 as chef
RUN wget -q -O- https://github.com/LukeMathWalker/cargo-chef/releases/download/v0.1.62/cargo-chef-x86_64-unknown-linux-gnu.tar.gz | tar -zx -C /usr/local/bin
RUN cargo install --locked --root /usr/local libp2p-lookup --version 0.6.4
WORKDIR /app
Expand Down
3 changes: 3 additions & 0 deletions protocols/autonat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.13.1
- Verify that an incoming AutoNAT dial comes from a connected peer. See [PR 5597](https://github.com/libp2p/rust-libp2p/pull/5597).

## 0.13.0

- Due to the refactor of `Transport` it's no longer required to create a seperate transport for
Expand Down
2 changes: 1 addition & 1 deletion protocols/autonat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-autonat"
edition = "2021"
rust-version = { workspace = true }
description = "NAT and firewall detection for libp2p"
version = "0.13.0"
version = "0.13.1"
authors = ["David Craven <[email protected]>", "Elena Frank <[email protected]>", "Hannes Furmans <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
15 changes: 15 additions & 0 deletions protocols/autonat/src/v1/behaviour/as_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ impl<'a> HandleInnerEvent for AsServer<'a> {
},
} => {
let probe_id = self.probe_id.next();
if !self.connected.contains_key(&peer) {
tracing::debug!(
%peer,
"Reject inbound dial request from peer since it is not connected"
);

return VecDeque::from([ToSwarm::GenerateEvent(Event::InboundProbe(
InboundProbeEvent::Error {
probe_id,
peer,
error: InboundProbeError::Response(ResponseError::DialRefused),
},
))]);
}

match self.resolve_inbound_request(peer, request) {
Ok(addrs) => {
tracing::debug!(
Expand Down
Loading

0 comments on commit d339f2e

Please sign in to comment.