Skip to content

Commit 50c9ed2

Browse files
committed
Merge remote-tracking branch 'origin/master' into altonen-refactor-webrtc
2 parents 9766e08 + b142c9e commit 50c9ed2

File tree

142 files changed

+43959
-42371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+43959
-42371
lines changed

.github/workflows/ci.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
7+
# Disable previous runs
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
# ${{ vars.CI_UNIFIED_IMAGE }} is defined in the repository variables
13+
env:
14+
CI_IMAGE: "paritytech/ci-unified:bullseye-1.75.0-2024-01-22-v20240222"
15+
16+
jobs:
17+
set-image:
18+
# This workaround sets the container image for each job using 'set-image' job output.
19+
# env variables don't work for PR from forks, so we need to use outputs.
20+
runs-on: ubuntu-latest
21+
outputs:
22+
CI_IMAGE: ${{ steps.set_image.outputs.CI_IMAGE }}
23+
steps:
24+
- id: set_image
25+
run: echo "CI_IMAGE=${{ env.CI_IMAGE }}" >> $GITHUB_OUTPUT
26+
fmt:
27+
name: Cargo fmt
28+
runs-on: ubuntu-latest
29+
needs: [set-image]
30+
container:
31+
image: ${{ needs.set-image.outputs.CI_IMAGE }}
32+
steps:
33+
- name: Checkout sources
34+
uses: actions/checkout@v4
35+
36+
- name: Rust Cache
37+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
38+
with:
39+
cache-on-failure: true
40+
cache-all-crates: true
41+
42+
- name: Cargo fmt
43+
run: cargo +nightly fmt --all -- --check
44+
45+
machete:
46+
name: Check unused dependencies
47+
runs-on: ubuntu-latest
48+
needs: [set-image]
49+
container:
50+
image: ${{ needs.set-image.outputs.CI_IMAGE }}
51+
steps:
52+
- name: Checkout sources
53+
uses: actions/checkout@v4
54+
55+
- name: Rust Cache
56+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
57+
with:
58+
cache-on-failure: true
59+
cache-all-crates: true
60+
61+
- name: Install cargo-machete
62+
run: cargo install cargo-machete
63+
64+
- name: Check unused dependencies
65+
run: cargo machete
66+
67+
check:
68+
name: Cargo check
69+
runs-on: ubuntu-latest
70+
needs: [set-image]
71+
container:
72+
image: ${{ needs.set-image.outputs.CI_IMAGE }}
73+
steps:
74+
- name: Checkout sources
75+
uses: actions/checkout@v4
76+
77+
- name: Rust Cache
78+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
79+
with:
80+
cache-on-failure: true
81+
cache-all-crates: true
82+
83+
- name: Cargo check
84+
run: cargo check
85+
86+
doc:
87+
name: Check documentation
88+
runs-on: ubuntu-latest
89+
needs: [set-image]
90+
container:
91+
image: ${{ needs.set-image.outputs.CI_IMAGE }}
92+
steps:
93+
- name: Checkout sources
94+
uses: actions/checkout@v4
95+
96+
- name: Rust Cache
97+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
98+
with:
99+
cache-on-failure: true
100+
cache-all-crates: true
101+
- name: Check documentation
102+
run: RUSTDOCFLAGS="-D warnings -D rustdoc::broken_intra_doc_links" cargo doc --workspace --no-deps --document-private-items
103+
104+
clippy:
105+
name: Cargo clippy
106+
runs-on: ubuntu-latest
107+
needs: [set-image]
108+
container:
109+
image: ${{ needs.set-image.outputs.CI_IMAGE }}
110+
steps:
111+
- name: Checkout sources
112+
uses: actions/checkout@v4
113+
114+
- name: Rust Cache
115+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
116+
with:
117+
cache-on-failure: true
118+
cache-all-crates: true
119+
120+
# TODO: Allow clippy to fail and do not cancel other tasks.
121+
# Clippy is fixed by: https://github.com/paritytech/litep2p/pull/57.
122+
- name: Run clippy
123+
continue-on-error: true
124+
run: cargo clippy
125+
126+
test:
127+
name: Test
128+
runs-on: ubuntu-latest
129+
timeout-minutes: 15
130+
needs: [set-image]
131+
container:
132+
image: ${{ needs.set-image.outputs.CI_IMAGE }}
133+
options: --sysctl net.ipv6.conf.all.disable_ipv6=0
134+
steps:
135+
- name: Checkout sources
136+
uses: actions/checkout@v4
137+
138+
- name: Rust Cache
139+
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
140+
with:
141+
cache-on-failure: true
142+
cache-all-crates: true
143+
144+
- name: Run tests
145+
run: cargo test

CHANGELOG.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.3.0] - 2023-04-05
9+
10+
### Added
11+
12+
- Expose `reuse_port` option for TCP and WebSocket transports ([#69](https://github.com/paritytech/litep2p/pull/69))
13+
- protocol/mdns: Use `SO_REUSEPORT` for the mDNS socket ([#68](https://github.com/paritytech/litep2p/pull/68))
14+
- Add support for protocol/agent version ([#64](https://github.com/paritytech/litep2p/pull/64))
15+
16+
## [0.2.0] - 2023-09-05
17+
18+
This is the second release of litep2p, v0.2.0. The quality of the first release was so bad that this release is a complete rewrite of the library.
19+
20+
Support is added for the following features:
21+
22+
* Transport protocols:
23+
* TCP
24+
* QUIC
25+
* WebRTC
26+
* WebSocket
27+
28+
* Protocols:
29+
* [`/ipfs/identify/1.0.0`](https://github.com/libp2p/specs/tree/master/identify)
30+
* [`/ipfs/ping/1.0.0`](https://github.com/libp2p/specs/blob/master/ping/ping.md)
31+
* [`/ipfs/kad/1.0.0`](https://github.com/libp2p/specs/tree/master/kad-dht)
32+
* [`/ipfs/bitswap/1.2.0`](https://github.com/ipfs/specs/blob/main/BITSWAP.md)
33+
* Request-response protocol
34+
* Notification protocol
35+
* Multicast DNS
36+
* API for creating custom protocols
37+
38+
This time the architecture has been designed to be extensible and integrating new transport and/or user-level protocols should be easier. Additionally, the test coverage is higher both in terms of unit and integration tests. The project also contains conformance tests which test the behavior of `litep2p` against, [`rust-libp2p`](https://github.com/libp2p/rust-libp2p/), [`go-libp2p`](https://github.com/libp2p/go-libp2p/) and Substrate's [`sc-network`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/client/network). Currently the Substrate conformance tests are not enabled by default as they require unpublished/unaccepted changes to Substrate.
39+
40+
## [0.1.0] - 2023-04-04
41+
42+
This is the first release of `litep2p`, v0.1.0.
43+
44+
Support is added for the following:
45+
46+
* TCP + Noise + Yamux (compatibility with `libp2p`)
47+
* [`/ipfs/identify/1.0.0`](https://github.com/libp2p/specs/tree/master/identify)
48+
* [`/ipfs/ping/1.0.0`](https://github.com/libp2p/specs/blob/master/ping/ping.md)
49+
* Request-response protocol
50+
* Notification protocol
51+
52+
The code quality is atrocious but it works and the second release focuses on providing high test coverage for the library. After that is done and most of the functionality is covered (unit, integration and conformance tests, benchmarks), the focus can be turned to refactoring the code into something clean and efficient.

Cargo.lock

Lines changed: 14 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "litep2p"
33
description = "Peer-to-peer networking library"
44
license = "MIT"
5-
version = "0.2.0"
5+
version = "0.3.0"
66
edition = "2021"
77

88
[build-dependencies]
@@ -15,7 +15,6 @@ bytes = "1.4.0"
1515
cid = "0.10.1"
1616
ed25519-dalek = "1.0.1"
1717
futures = "0.3.27"
18-
futures-rustls = "0.22.2"
1918
futures-timer = "3.0.2"
2019
hex-literal = "0.4.1"
2120
indexmap = { version = "2.0.0", features = ["std"] }
@@ -51,9 +50,10 @@ url = "2.4.0"
5150
webpki = "0.22.2"
5251
x25519-dalek = "2.0.0"
5352
x509-parser = "0.15.0"
54-
yamux = "0.11.0"
5553
yasna = "0.5.0"
5654
zeroize = "1.5.7"
55+
nohash-hasher = "0.2.0"
56+
static_assertions = "1.1.0"
5757

5858
# Exposed dependencies. Breaking changes to these are breaking changes to us.
5959
[dependencies.rustls]
@@ -78,6 +78,7 @@ libp2p = { version = "0.51.3", features = [
7878
"quic",
7979
]}
8080
quickcheck = "1.0.3"
81+
rand_xorshift = "0.3.0"
8182
sc-network = "0.28.0"
8283
sc-utils = "8.0.0"
8384
serde_json = "1.0.108"

build.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
fn main() {
2-
prost_build::compile_protos(
3-
&[
4-
"src/schema/keys.proto",
5-
"src/schema/noise.proto",
6-
"src/schema/webrtc.proto",
7-
"src/protocol/libp2p/schema/identify.proto",
8-
"src/protocol/libp2p/schema/kademlia.proto",
9-
"src/protocol/libp2p/schema/bitswap.proto",
10-
],
11-
&["src"],
12-
)
13-
.unwrap();
2+
prost_build::compile_protos(
3+
&[
4+
"src/schema/keys.proto",
5+
"src/schema/noise.proto",
6+
"src/schema/webrtc.proto",
7+
"src/protocol/libp2p/schema/identify.proto",
8+
"src/protocol/libp2p/schema/kademlia.proto",
9+
"src/protocol/libp2p/schema/bitswap.proto",
10+
],
11+
&["src"],
12+
)
13+
.unwrap();
1414
}

0 commit comments

Comments
 (0)