Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/cargo/futures-rustls-0.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs authored Mar 25, 2024
2 parents 2dcee44 + edaa2d8 commit 3c5e09e
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 35 deletions.
32 changes: 17 additions & 15 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,24 @@ pull_request_rules:
message: Approvals have been dismissed because the PR was updated after the `send-it` label was applied.
changes_requested: false

# - name: Approve trivial maintainer PRs
# conditions:
# - base=master
# - label=trivial
# - author=@libp2p/rust-libp2p-maintainers
# actions:
# review:
- name: Approve trivial maintainer PRs
conditions:
- base=master
- label=trivial
- author=@libp2p/rust-libp2p-maintainers
actions:
review:
type: APPROVE

# - name: Approve dependabot PRs of semver-compatible updates
# conditions:
# - author=dependabot[bot]
# - or:
# - title~=bump [^\s]+ from ([1-9]+)\..+ to \1\. # For major >= 1 versions, only approve updates with the same major version.
# - title~=bump [^\s]+ from 0\.([\d]+)\..+ to 0\.\1\. # For major == 0 versions, only approve updates with the same minor version.
# actions:
# review:
- name: Approve dependabot PRs of semver-compatible updates
conditions:
- author=dependabot[bot]
- or:
- title~=bump [^\s]+ from ([1-9]+)\..+ to \1\. # For major >= 1 versions, only approve updates with the same major version.
- title~=bump [^\s]+ from 0\.([\d]+)\..+ to 0\.\1\. # For major == 0 versions, only approve updates with the same minor version.
actions:
review:
type: APPROVE

queue_rules:
- name: default
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ libp2p-webrtc = { version = "0.7.1-alpha", path = "transports/webrtc" }
libp2p-webrtc-utils = { version = "0.2.0", path = "misc/webrtc-utils" }
libp2p-webrtc-websys = { version = "0.3.0-alpha", path = "transports/webrtc-websys" }
libp2p-websocket = { version = "0.43.0", path = "transports/websocket" }
libp2p-websocket-websys = { version = "0.3.1", path = "transports/websocket-websys" }
libp2p-websocket-websys = { version = "0.3.2", path = "transports/websocket-websys" }
libp2p-webtransport-websys = { version = "0.2.0", path = "transports/webtransport-websys" }
libp2p-yamux = { version = "0.45.1", path = "muxers/yamux" }
multiaddr = "0.18.1"
Expand Down
4 changes: 2 additions & 2 deletions core/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ pub enum TransportEvent<TUpgr, TErr> {

impl<TUpgr, TErr> TransportEvent<TUpgr, TErr> {
/// In case this [`TransportEvent`] is an upgrade, apply the given function
/// to the upgrade and produce another transport event based the the function's result.
/// to the upgrade and produce another transport event based the function's result.
pub fn map_upgrade<U>(self, map: impl FnOnce(TUpgr) -> U) -> TransportEvent<U, TErr> {
match self {
TransportEvent::Incoming {
Expand Down Expand Up @@ -530,7 +530,7 @@ pub enum TransportError<TErr> {
}

impl<TErr> TransportError<TErr> {
/// Applies a function to the the error in [`TransportError::Other`].
/// Applies a function to the error in [`TransportError::Other`].
pub fn map<TNewErr>(self, map: impl FnOnce(TErr) -> TNewErr) -> TransportError<TNewErr> {
match self {
TransportError::MultiaddrNotSupported(addr) => {
Expand Down
4 changes: 2 additions & 2 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ignore = [
[licenses]
# The lint level for crates which do not have a detectable license
unlicensed = "deny"
# List of explictly allowed licenses
# List of explicitly allowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.7 short identifier (+ optional exception)].
allow = [
Expand All @@ -46,7 +46,7 @@ allow = [
"MIT",
"Unlicense",
]
# List of explictly disallowed licenses
# List of explicitly disallowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.7 short identifier (+ optional exception)].
deny = []
Expand Down
2 changes: 1 addition & 1 deletion examples/stream/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To run the example, follow these steps:
cargo run --bin stream-example -- <address>
```

3. Both terminals should now continuosly print messages.
3. Both terminals should now continuously print messages.

## Conclusion

Expand Down
2 changes: 1 addition & 1 deletion identity/src/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl PublicKey {
self.0.serialize()
}

/// Decode a public key from a byte slice in the the format produced
/// Decode a public key from a byte slice in the format produced
/// by `encode`.
pub fn try_from_bytes(k: &[u8]) -> Result<PublicKey, DecodingError> {
libsecp256k1::PublicKey::parse_slice(k, Some(libsecp256k1::PublicKeyFormat::Compressed))
Expand Down
2 changes: 1 addition & 1 deletion protocols/gossipsub/src/behaviour/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ fn test_dont_graft_to_negative_scored_peers() {
}

///Note that in this test also without a penalty the px would be ignored because of the
/// acceptPXThreshold, but the spec still explicitely states the rule that px from negative
/// acceptPXThreshold, but the spec still explicitly states the rule that px from negative
/// peers should get ignored, therefore we test it here.
#[test]
fn test_ignore_px_from_negative_scored_peer() {
Expand Down
8 changes: 4 additions & 4 deletions protocols/gossipsub/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ impl Config {
self.unsubscribe_backoff
}

/// Number of heartbeat slots considered as slack for backoffs. This gurantees that we wait
/// Number of heartbeat slots considered as slack for backoffs. This guarantees that we wait
/// at least backoff_slack heartbeats after a backoff is over before we try to graft. This
/// solves problems occuring through high latencies. In particular if
/// solves problems occurring through high latencies. In particular if
/// `backoff_slack * heartbeat_interval` is longer than any latencies between processing
/// prunes on our side and processing prunes on the receiving side this guarantees that we
/// get not punished for too early grafting. The default is 1.
Expand Down Expand Up @@ -660,9 +660,9 @@ impl ConfigBuilder {
self
}

/// Number of heartbeat slots considered as slack for backoffs. This gurantees that we wait
/// Number of heartbeat slots considered as slack for backoffs. This guarantees that we wait
/// at least backoff_slack heartbeats after a backoff is over before we try to graft. This
/// solves problems occuring through high latencies. In particular if
/// solves problems occurring through high latencies. In particular if
/// `backoff_slack * heartbeat_interval` is longer than any latencies between processing
/// prunes on our side and processing prunes on the receiving side this guarantees that we
/// get not punished for too early grafting. The default is 1.
Expand Down
2 changes: 1 addition & 1 deletion protocols/kad/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2203,7 +2203,7 @@ where
Some(peer) => peer,
};

// We should order addresses from decreasing likelyhood of connectivity, so start with
// We should order addresses from decreasing likelihood of connectivity, so start with
// the addresses of that peer in the k-buckets.
let key = kbucket::Key::from(peer_id);
let mut peer_addrs =
Expand Down
2 changes: 1 addition & 1 deletion protocols/kad/src/kbucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ enum ClosestBucketsIterState {
/// The starting state of the iterator yields the first bucket index and
/// then transitions to `ZoomIn`.
Start(BucketIndex),
/// The iterator "zooms in" to to yield the next bucket cotaining nodes that
/// The iterator "zooms in" to yield the next bucket cotaining nodes that
/// are incrementally closer to the local node but further from the `target`.
/// These buckets are identified by a `1` in the corresponding bit position
/// of the distance bit string. When bucket `0` is reached, the iterator
Expand Down
2 changes: 1 addition & 1 deletion swarm/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ impl<UserData, Upgrade> Future for SubstreamRequested<UserData, Upgrade> {

/// The options for a planned connection & handler shutdown.
///
/// A shutdown is planned anew based on the the return value of
/// A shutdown is planned anew based on the return value of
/// [`ConnectionHandler::connection_keep_alive`] of the underlying handler
/// after every invocation of [`ConnectionHandler::poll`].
///
Expand Down
7 changes: 7 additions & 0 deletions transports/websocket-websys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.3.2

- Change close code in drop implementation to `1000` given that in browsers only
the code `1000` and codes between `3000` and `4999` are allowed to be set by
userland code.
See [PR 5229](https://github.com/libp2p/rust-libp2p/pull/5229).

## 0.3.1

- Add support for different WASM environments by introducing a `WebContext` that
Expand Down
2 changes: 1 addition & 1 deletion transports/websocket-websys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-websocket-websys"
edition = "2021"
rust-version = "1.60.0"
description = "WebSocket for libp2p under WASM environment"
version = "0.3.1"
version = "0.3.2"
authors = ["Vince Vasta <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
5 changes: 3 additions & 2 deletions transports/websocket-websys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,13 +434,14 @@ impl AsyncWrite for Connection {

impl Drop for Connection {
fn drop(&mut self) {
const GO_AWAY_STATUS_CODE: u16 = 1001; // See https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1.
// In browsers, userland code is not allowed to use any other status code than 1000: https://websockets.spec.whatwg.org/#dom-websocket-close
const REGULAR_CLOSE: u16 = 1000; // See https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1.

if let ReadyState::Connecting | ReadyState::Open = self.inner.ready_state() {
let _ = self
.inner
.socket
.close_with_code_and_reason(GO_AWAY_STATUS_CODE, "connection dropped");
.close_with_code_and_reason(REGULAR_CLOSE, "connection dropped");
}

WebContext::new()
Expand Down
2 changes: 1 addition & 1 deletion transports/websocket/src/framed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ fn parse_ws_dial_addr<T>(addr: Multiaddr) -> Result<WsAddress, Error<T>> {
};

// The original address, stripped of the `/ws` and `/wss` protocols,
// makes up the the address for the inner TCP-based transport.
// makes up the address for the inner TCP-based transport.
let tcp_addr = match p2p {
Some(p) => protocols.with(p),
None => protocols,
Expand Down

0 comments on commit 3c5e09e

Please sign in to comment.