From 7dd0ea0037a9b4c7c3b879284e84b2f4f6135cd4 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 14 Mar 2023 15:53:49 -0500 Subject: [PATCH 001/102] update libp2p to v0.51.1 --- beacon_node/lighthouse_network/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index dda797187ba..f3a820a564c 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -46,7 +46,7 @@ delay_map = "0.3.0" void = "1" [dependencies.libp2p] -version = "0.50.0" +version = "0.51.1" default-features = false features = ["websocket", "identify", "mplex", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] From f3693c261e524bf00b84f690c23e634dd9427373 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 14 Mar 2023 15:59:49 -0500 Subject: [PATCH 002/102] Revert "Ensure protoc is installed for release CI (#3621)" This reverts commit 58bd2f76d0819c7147684cb10f994480545ee769. --- .github/workflows/local-testnet.yml | 4 +--- .github/workflows/release.yml | 9 --------- Cross.toml | 4 ++-- lcli/Dockerfile | 4 ++-- scripts/cross/aarch64-unknown-linux-gnu.dockerfile | 14 ++++++++++++++ ...kerfile => x86_64-unknown-linux-gnu.dockerfile} | 0 6 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 scripts/cross/aarch64-unknown-linux-gnu.dockerfile rename scripts/cross/{Dockerfile => x86_64-unknown-linux-gnu.dockerfile} (100%) diff --git a/.github/workflows/local-testnet.yml b/.github/workflows/local-testnet.yml index a522f2efb99..5ce6876fa40 100644 --- a/.github/workflows/local-testnet.yml +++ b/.github/workflows/local-testnet.yml @@ -21,9 +21,7 @@ jobs: - name: Get latest version of stable Rust run: rustup update stable - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + uses: arduino/setup-protoc@v1 - name: Install ganache run: npm install ganache@latest --global diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e63b4d6c24..e133703e195 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,15 +79,6 @@ jobs: if: startsWith(matrix.arch, 'x86_64-windows') run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - # ============================== - # Windows & Mac dependencies - # ============================== - - name: Install Protoc - if: contains(matrix.arch, 'darwin') || contains(matrix.arch, 'windows') - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - # ============================== # Builds # ============================== diff --git a/Cross.toml b/Cross.toml index 9c3e441cba5..963e22d0e02 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,5 +1,5 @@ [target.x86_64-unknown-linux-gnu] -dockerfile = './scripts/cross/Dockerfile' +dockerfile = './scripts/cross/x86_64-unknown-linux-gnu.dockerfile' [target.aarch64-unknown-linux-gnu] -dockerfile = './scripts/cross/Dockerfile' +dockerfile = './scripts/cross/aarch64-unknown-linux-gnu.dockerfile' diff --git a/lcli/Dockerfile b/lcli/Dockerfile index 079e5c779b5..22f42612b95 100644 --- a/lcli/Dockerfile +++ b/lcli/Dockerfile @@ -2,7 +2,7 @@ # - from the `lighthouse` dir with the command: `docker build -f ./lcli/Dockerflie .` # - from the current directory with the command: `docker build -f ./Dockerfile ../` FROM rust:1.66.0-bullseye AS builder -RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev protobuf-compiler +RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev COPY . lighthouse ARG PORTABLE ENV PORTABLE $PORTABLE @@ -10,4 +10,4 @@ RUN cd lighthouse && make install-lcli FROM ubuntu:22.04 RUN apt-get update && apt-get -y upgrade && apt-get clean && rm -rf /var/lib/apt/lists/* -COPY --from=builder /usr/local/cargo/bin/lcli /usr/local/bin/lcli +COPY --from=builder /usr/local/cargo/bin/lcli /usr/local/bin/lcli \ No newline at end of file diff --git a/scripts/cross/aarch64-unknown-linux-gnu.dockerfile b/scripts/cross/aarch64-unknown-linux-gnu.dockerfile new file mode 100644 index 00000000000..691639cd413 --- /dev/null +++ b/scripts/cross/aarch64-unknown-linux-gnu.dockerfile @@ -0,0 +1,14 @@ +ARG CROSS_BASE_IMAGE +FROM $CROSS_BASE_IMAGE + +RUN apt-get update -y && apt-get upgrade -y + +RUN apt-get install -y unzip && \ + PB_REL="https://github.com/protocolbuffers/protobuf/releases" && \ + curl -L $PB_REL/download/v3.15.8/protoc-3.15.8-linux-aarch_64.zip -o protoc.zip && \ + unzip protoc.zip -d /usr && \ + chmod +x /usr/bin/protoc + +RUN apt-get install -y cmake clang-3.9 + +ENV PROTOC=/usr/bin/protoc diff --git a/scripts/cross/Dockerfile b/scripts/cross/x86_64-unknown-linux-gnu.dockerfile similarity index 100% rename from scripts/cross/Dockerfile rename to scripts/cross/x86_64-unknown-linux-gnu.dockerfile From b7007712f75e247a656420991948750366afce15 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 14 Mar 2023 17:03:20 -0500 Subject: [PATCH 003/102] Revert "Merge pull request #3546 from divagant-martian/cross-update" This reverts commit ab8dad60b11471aaacf1f6bdb6d86838cf0ce3c7, reversing changes made to d1a9635c8317892cf707914bcb50c05bff31bdf4. --- Cross.toml | 4 ++-- scripts/cross/aarch64-unknown-linux-gnu.dockerfile | 14 -------------- scripts/cross/x86_64-unknown-linux-gnu.dockerfile | 14 -------------- 3 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 scripts/cross/aarch64-unknown-linux-gnu.dockerfile delete mode 100644 scripts/cross/x86_64-unknown-linux-gnu.dockerfile diff --git a/Cross.toml b/Cross.toml index 963e22d0e02..d5f7a5d5068 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,5 +1,5 @@ [target.x86_64-unknown-linux-gnu] -dockerfile = './scripts/cross/x86_64-unknown-linux-gnu.dockerfile' +pre-build = ["apt-get install -y cmake clang-3.9"] [target.aarch64-unknown-linux-gnu] -dockerfile = './scripts/cross/aarch64-unknown-linux-gnu.dockerfile' +pre-build = ["apt-get install -y cmake clang-3.9"] diff --git a/scripts/cross/aarch64-unknown-linux-gnu.dockerfile b/scripts/cross/aarch64-unknown-linux-gnu.dockerfile deleted file mode 100644 index 691639cd413..00000000000 --- a/scripts/cross/aarch64-unknown-linux-gnu.dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -ARG CROSS_BASE_IMAGE -FROM $CROSS_BASE_IMAGE - -RUN apt-get update -y && apt-get upgrade -y - -RUN apt-get install -y unzip && \ - PB_REL="https://github.com/protocolbuffers/protobuf/releases" && \ - curl -L $PB_REL/download/v3.15.8/protoc-3.15.8-linux-aarch_64.zip -o protoc.zip && \ - unzip protoc.zip -d /usr && \ - chmod +x /usr/bin/protoc - -RUN apt-get install -y cmake clang-3.9 - -ENV PROTOC=/usr/bin/protoc diff --git a/scripts/cross/x86_64-unknown-linux-gnu.dockerfile b/scripts/cross/x86_64-unknown-linux-gnu.dockerfile deleted file mode 100644 index 5472b980bad..00000000000 --- a/scripts/cross/x86_64-unknown-linux-gnu.dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -ARG CROSS_BASE_IMAGE -FROM $CROSS_BASE_IMAGE - -RUN apt-get update -y && apt-get upgrade -y - -RUN apt-get install -y unzip && \ - PB_REL="https://github.com/protocolbuffers/protobuf/releases" && \ - curl -L $PB_REL/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip -o protoc.zip && \ - unzip protoc.zip -d /usr && \ - chmod +x /usr/bin/protoc - -RUN apt-get install -y cmake clang-3.9 - -ENV PROTOC=/usr/bin/protoc From 28e02c421d41d7257fd275e93afa356fc575a0ac Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 14 Mar 2023 17:11:07 -0500 Subject: [PATCH 004/102] remove protobuf installation ops and instructions --- .github/workflows/local-testnet.yml | 2 - .github/workflows/test-suite.yml | 70 +---------------------- Dockerfile | 4 +- book/src/installation-source.md | 12 +--- book/src/setup.md | 2 - testing/antithesis/Dockerfile.libvoidstar | 2 +- 6 files changed, 6 insertions(+), 86 deletions(-) diff --git a/.github/workflows/local-testnet.yml b/.github/workflows/local-testnet.yml index 5ce6876fa40..a295bd3f219 100644 --- a/.github/workflows/local-testnet.yml +++ b/.github/workflows/local-testnet.yml @@ -20,8 +20,6 @@ jobs: - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@v1 - name: Install ganache run: npm install ganache@latest --global diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 445f71fa096..81e684ca0f5 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -53,10 +53,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install ganache run: sudo npm install -g ganache - name: Run tests in release @@ -75,7 +71,7 @@ jobs: node-version: '14' - name: Install windows build tools run: | - choco install python protoc visualstudio2019-workload-vctools -y + choco install python visualstudio2019-workload-vctools -y npm config set msvs_version 2019 - name: Install ganache run: npm install -g ganache --loglevel verbose @@ -97,10 +93,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Run beacon_chain tests for all known forks run: make test-beacon-chain op-pool-tests: @@ -111,10 +103,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Run operation_pool tests for all known forks run: make test-op-pool slasher-tests: @@ -135,10 +123,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install ganache run: sudo npm install -g ganache - name: Run tests in debug @@ -151,10 +135,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Run state_transition_vectors in release. run: make run-state-transition-tests ef-tests-ubuntu: @@ -165,10 +145,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Run consensus-spec-tests with blst, milagro and fake_crypto run: make test-ef dockerfile-ubuntu: @@ -191,10 +167,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install ganache run: sudo npm install -g ganache - name: Run the beacon chain sim that starts from an eth1 contract @@ -207,10 +179,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install ganache run: sudo npm install -g ganache - name: Run the beacon chain sim and go through the merge transition @@ -223,10 +191,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install ganache run: sudo npm install -g ganache - name: Run the beacon chain sim without an eth1 connection @@ -239,10 +203,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install ganache run: sudo npm install -g ganache - name: Run the syncing simulator @@ -255,10 +215,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install ganache run: sudo npm install -g ganache - name: Install lighthouse and lcli @@ -287,10 +243,6 @@ jobs: dotnet-version: '6.0.201' - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Run exec engine integration tests in release run: make test-exec-engine check-benchmarks: @@ -300,14 +252,6 @@ jobs: steps: - uses: actions/checkout@v3 - name: Get latest version of stable Rust - run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Typecheck benchmark code without running it - run: make check-benches - clippy: name: clippy runs-on: ubuntu-latest needs: cargo-fmt @@ -315,10 +259,6 @@ jobs: - uses: actions/checkout@v3 - name: Get latest version of stable Rust run: rustup update stable - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Lint code for quality and style with Clippy run: make lint - name: Certify Cargo.lock freshness @@ -331,10 +271,6 @@ jobs: - uses: actions/checkout@v3 - name: Install Rust @ MSRV (${{ needs.extract-msrv.outputs.MSRV }}) run: rustup override set ${{ needs.extract-msrv.outputs.MSRV }} - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Run cargo check run: cargo check --workspace arbitrary-check: @@ -373,10 +309,6 @@ jobs: - uses: actions/checkout@v3 - name: Install Rust (${{ env.PINNED_NIGHTLY }}) run: rustup toolchain install $PINNED_NIGHTLY - - name: Install Protoc - uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install cargo-udeps run: cargo install cargo-udeps --locked --force - name: Create Cargo config dir diff --git a/Dockerfile b/Dockerfile index 25ca075387f..53cab0493c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM rust:1.66.0-bullseye AS builder -RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev protobuf-compiler +RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev COPY . lighthouse ARG FEATURES ENV FEATURES $FEATURES @@ -11,4 +11,4 @@ RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-reco ca-certificates \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -COPY --from=builder /usr/local/cargo/bin/lighthouse /usr/local/bin/lighthouse +COPY --from=builder /usr/local/cargo/bin/lighthouse /usr/local/bin/lighthouse \ No newline at end of file diff --git a/book/src/installation-source.md b/book/src/installation-source.md index c89dd1add4f..e3d7b76d645 100644 --- a/book/src/installation-source.md +++ b/book/src/installation-source.md @@ -16,7 +16,7 @@ operating system. Install the following packages: ```bash -sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang protobuf-compiler +sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang ``` > Note: Lighthouse requires CMake v3.12 or newer, which isn't available in the package repositories @@ -32,10 +32,6 @@ sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clan brew install cmake ``` -1. Install protoc using Homebrew: -``` -brew install protobuf -``` [Homebrew]: https://brew.sh/ @@ -43,7 +39,7 @@ brew install protobuf 1. Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). 1. Install the [Chocolatey](https://chocolatey.org/install) package manager for Windows. -1. Install Make, CMake, LLVM and protoc using Chocolatey: +1. Install Make, CMake and LLVM using Chocolatey: ``` choco install make @@ -57,10 +53,6 @@ choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' choco install llvm ``` -``` -choco install protoc -``` - These dependencies are for compiling Lighthouse natively on Windows. Lighthouse can also run successfully under the [Windows Subsystem for Linux (WSL)][WSL]. If using Ubuntu under WSL, you should follow the instructions for Ubuntu listed in the [Dependencies (Ubuntu)](#ubuntu) section. diff --git a/book/src/setup.md b/book/src/setup.md index a1febe4a026..e8c56623bec 100644 --- a/book/src/setup.md +++ b/book/src/setup.md @@ -14,8 +14,6 @@ The additional requirements for developers are: don't have `ganache` available on your `PATH` or if ganache is older than v7. - [`cmake`](https://cmake.org/cmake/help/latest/command/install.html). Used by some dependencies. See [`Installation Guide`](./installation.md) for more info. -- [`protoc`](https://github.com/protocolbuffers/protobuf/releases) required for - the networking stack. - [`java 11 runtime`](https://openjdk.java.net/projects/jdk/). 11 is the minimum, used by web3signer_tests. diff --git a/testing/antithesis/Dockerfile.libvoidstar b/testing/antithesis/Dockerfile.libvoidstar index bae18073297..182e9544f42 100644 --- a/testing/antithesis/Dockerfile.libvoidstar +++ b/testing/antithesis/Dockerfile.libvoidstar @@ -1,5 +1,5 @@ FROM rust:1.66.1-bullseye AS builder -RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev protobuf-compiler +RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev COPY . lighthouse # Build lighthouse directly with a cargo build command, bypassing the Makefile. From 672807b6e6fd035e7f990f9a8168f3ccbe32dfd7 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 14 Mar 2023 18:18:49 -0500 Subject: [PATCH 005/102] update path for ConnectionId --- beacon_node/lighthouse_network/src/discovery/mod.rs | 6 +++--- beacon_node/lighthouse_network/src/rpc/mod.rs | 5 ++--- beacon_node/lighthouse_network/src/service/api_types.rs | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 13fdf8ed577..b8b1042f38b 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -25,10 +25,10 @@ use libp2p::multiaddr::Protocol; use libp2p::swarm::behaviour::{DialFailure, FromSwarm}; use libp2p::swarm::AddressScore; pub use libp2p::{ - core::{connection::ConnectionId, ConnectedPoint, Multiaddr, PeerId}, + core::{ConnectedPoint, Multiaddr, PeerId}, swarm::{ - dummy::ConnectionHandler, DialError, NetworkBehaviour, NetworkBehaviourAction as NBAction, - NotifyHandler, PollParameters, SubstreamProtocol, + dummy::ConnectionHandler, ConnectionId, DialError, NetworkBehaviour, + NetworkBehaviourAction as NBAction, NotifyHandler, PollParameters, SubstreamProtocol, }, }; use lru::LruCache; diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 31569b820b1..33e8413d5f2 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -6,10 +6,9 @@ use futures::future::FutureExt; use handler::{HandlerEvent, RPCHandler}; -use libp2p::core::connection::ConnectionId; use libp2p::swarm::{ - handler::ConnectionHandler, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, - PollParameters, SubstreamProtocol, + handler::ConnectionHandler, ConnectionId, NetworkBehaviour, NetworkBehaviourAction, + NotifyHandler, PollParameters, SubstreamProtocol, }; use libp2p::PeerId; use rate_limiter::{RPCRateLimiter as RateLimiter, RateLimitedErr}; diff --git a/beacon_node/lighthouse_network/src/service/api_types.rs b/beacon_node/lighthouse_network/src/service/api_types.rs index bd3df797699..bd4b013e4b9 100644 --- a/beacon_node/lighthouse_network/src/service/api_types.rs +++ b/beacon_node/lighthouse_network/src/service/api_types.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use libp2p::core::connection::ConnectionId; +use libp2p::swarm::ConnectionId; use types::light_client_bootstrap::LightClientBootstrap; use types::{EthSpec, SignedBeaconBlock}; From 2cbd05a202815a05c07fdd8e6f6bb92317dace88 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 14 Mar 2023 22:19:31 -0500 Subject: [PATCH 006/102] update deprecated type aliases --- beacon_node/lighthouse_network/src/config.rs | 4 ++-- beacon_node/lighthouse_network/src/discovery/enr_ext.rs | 4 ++-- beacon_node/lighthouse_network/src/discovery/mod.rs | 3 ++- beacon_node/lighthouse_network/src/service/behaviour.rs | 2 +- .../src/service/gossipsub_scoring_parameters.rs | 3 ++- beacon_node/lighthouse_network/src/service/mod.rs | 4 ++-- beacon_node/lighthouse_network/src/types/pubsub.rs | 4 +++- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/beacon_node/lighthouse_network/src/config.rs b/beacon_node/lighthouse_network/src/config.rs index d8efa20209c..9ca5de311cc 100644 --- a/beacon_node/lighthouse_network/src/config.rs +++ b/beacon_node/lighthouse_network/src/config.rs @@ -7,8 +7,8 @@ use directory::{ }; use discv5::{Discv5Config, Discv5ConfigBuilder}; use libp2p::gossipsub::{ - FastMessageId, GossipsubConfig, GossipsubConfigBuilder, GossipsubMessage, MessageId, - RawGossipsubMessage, ValidationMode, + ConfigBuilder as GossipsubConfigBuilder, Config as GossipsubConfig, FastMessageId, + Message as GossipsubMessage, MessageId, RawMessage as RawGossipsubMessage, ValidationMode, }; use libp2p::Multiaddr; use serde_derive::{Deserialize, Serialize}; diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index e9cca6667a2..8a9fa15c998 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -199,7 +199,7 @@ impl CombinedKeyPublicExt for CombinedPublicKey { match self { Self::Secp256k1(pk) => { let pk_bytes = pk.to_bytes(); - let libp2p_pk = libp2p::core::PublicKey::Secp256k1( + let libp2p_pk = libp2p::identity::PublicKey::Secp256k1( libp2p::core::identity::secp256k1::PublicKey::decode(&pk_bytes) .expect("valid public key"), ); @@ -207,7 +207,7 @@ impl CombinedKeyPublicExt for CombinedPublicKey { } Self::Ed25519(pk) => { let pk_bytes = pk.to_bytes(); - let libp2p_pk = libp2p::core::PublicKey::Ed25519( + let libp2p_pk = libp2p::identity::PublicKey::Ed25519( libp2p::core::identity::ed25519::PublicKey::decode(&pk_bytes) .expect("valid public key"), ); diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index b8b1042f38b..12e34dc958f 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -25,7 +25,8 @@ use libp2p::multiaddr::Protocol; use libp2p::swarm::behaviour::{DialFailure, FromSwarm}; use libp2p::swarm::AddressScore; pub use libp2p::{ - core::{ConnectedPoint, Multiaddr, PeerId}, + core::{ConnectedPoint, Multiaddr}, + identity::PeerId, swarm::{ dummy::ConnectionHandler, ConnectionId, DialError, NetworkBehaviour, NetworkBehaviourAction as NBAction, NotifyHandler, PollParameters, SubstreamProtocol, diff --git a/beacon_node/lighthouse_network/src/service/behaviour.rs b/beacon_node/lighthouse_network/src/service/behaviour.rs index 7d20b87ad1c..c83b7c67488 100644 --- a/beacon_node/lighthouse_network/src/service/behaviour.rs +++ b/beacon_node/lighthouse_network/src/service/behaviour.rs @@ -6,7 +6,7 @@ use crate::types::SnappyTransform; use libp2p::gossipsub::subscription_filter::{ MaxCountSubscriptionFilter, WhitelistSubscriptionFilter, }; -use libp2p::gossipsub::Gossipsub as BaseGossipsub; +use libp2p::gossipsub::Behaviour as BaseGossipsub; use libp2p::identify::Behaviour as Identify; use libp2p::swarm::NetworkBehaviour; use types::EthSpec; diff --git a/beacon_node/lighthouse_network/src/service/gossipsub_scoring_parameters.rs b/beacon_node/lighthouse_network/src/service/gossipsub_scoring_parameters.rs index 88becd686e5..b058fc0ff13 100644 --- a/beacon_node/lighthouse_network/src/service/gossipsub_scoring_parameters.rs +++ b/beacon_node/lighthouse_network/src/service/gossipsub_scoring_parameters.rs @@ -1,7 +1,8 @@ use crate::types::{GossipEncoding, GossipKind, GossipTopic}; use crate::{error, TopicHash}; use libp2p::gossipsub::{ - GossipsubConfig, IdentTopic as Topic, PeerScoreParams, PeerScoreThresholds, TopicScoreParams, + Config as GossipsubConfig, IdentTopic as Topic, PeerScoreParams, PeerScoreThresholds, + TopicScoreParams, }; use std::cmp::max; use std::collections::HashMap; diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index f815e3bd36b..fc03c6e7578 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -23,11 +23,11 @@ use api_types::{PeerRequestId, Request, RequestId, Response}; use futures::stream::StreamExt; use gossipsub_scoring_parameters::{lighthouse_gossip_thresholds, PeerScoreSettings}; use libp2p::bandwidth::BandwidthSinks; -use libp2p::gossipsub::error::PublishError; use libp2p::gossipsub::metrics::Config as GossipsubMetricsConfig; use libp2p::gossipsub::subscription_filter::MaxCountSubscriptionFilter; +use libp2p::gossipsub::PublishError; use libp2p::gossipsub::{ - GossipsubEvent, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, + Event as GossipsubEvent, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, }; use libp2p::identify::{Behaviour as Identify, Config as IdentifyConfig, Event as IdentifyEvent}; use libp2p::multiaddr::{Multiaddr, Protocol as MProtocol}; diff --git a/beacon_node/lighthouse_network/src/types/pubsub.rs b/beacon_node/lighthouse_network/src/types/pubsub.rs index bb0397de1e2..7dceb271157 100644 --- a/beacon_node/lighthouse_network/src/types/pubsub.rs +++ b/beacon_node/lighthouse_network/src/types/pubsub.rs @@ -2,7 +2,9 @@ use crate::types::{GossipEncoding, GossipKind, GossipTopic}; use crate::TopicHash; -use libp2p::gossipsub::{DataTransform, GossipsubMessage, RawGossipsubMessage}; +use libp2p::gossipsub::{ + DataTransform, Message as GossipsubMessage, RawMessage as RawGossipsubMessage, +}; use snap::raw::{decompress_len, Decoder, Encoder}; use ssz::{Decode, Encode}; use std::boxed::Box; From 77681d265e42bec167b4101092bcd34e5e48dc49 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 14 Mar 2023 22:34:04 -0500 Subject: [PATCH 007/102] use new identity top level crate --- beacon_node/lighthouse_network/src/discovery/enr.rs | 2 +- .../lighthouse_network/src/discovery/enr_ext.rs | 11 ++++++----- beacon_node/lighthouse_network/src/discovery/mod.rs | 2 +- beacon_node/lighthouse_network/src/service/utils.rs | 8 ++++---- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr.rs b/beacon_node/lighthouse_network/src/discovery/enr.rs index 938e7cfa257..d90dfc0f27c 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr.rs @@ -7,7 +7,7 @@ use super::ENR_FILENAME; use crate::types::{Enr, EnrAttestationBitfield, EnrSyncCommitteeBitfield}; use crate::NetworkConfig; use discv5::enr::EnrKey; -use libp2p::core::identity::Keypair; +use libp2p::identity::Keypair; use slog::{debug, warn}; use ssz::{Decode, Encode}; use ssz_types::BitVector; diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 8a9fa15c998..b71f9a8f3c8 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -1,7 +1,8 @@ //! ENR extension trait to support libp2p integration. use crate::{Enr, Multiaddr, PeerId}; use discv5::enr::{CombinedKey, CombinedPublicKey}; -use libp2p::core::{identity::Keypair, identity::PublicKey, multiaddr::Protocol}; +use libp2p::core::multiaddr::Protocol; +use libp2p::identity::{Keypair, PublicKey}; use tiny_keccak::{Hasher, Keccak}; /// Extend ENR for libp2p types. @@ -35,7 +36,7 @@ pub trait CombinedKeyPublicExt { /// Extend ENR CombinedKey for conversion to libp2p keys. pub trait CombinedKeyExt { /// Converts a libp2p key into an ENR combined key. - fn from_libp2p(key: &libp2p::core::identity::Keypair) -> Result; + fn from_libp2p(key: &libp2p::identity::Keypair) -> Result; } impl EnrExt for Enr { @@ -200,7 +201,7 @@ impl CombinedKeyPublicExt for CombinedPublicKey { Self::Secp256k1(pk) => { let pk_bytes = pk.to_bytes(); let libp2p_pk = libp2p::identity::PublicKey::Secp256k1( - libp2p::core::identity::secp256k1::PublicKey::decode(&pk_bytes) + libp2p::identity::secp256k1::PublicKey::decode(&pk_bytes) .expect("valid public key"), ); PeerId::from_public_key(&libp2p_pk) @@ -208,7 +209,7 @@ impl CombinedKeyPublicExt for CombinedPublicKey { Self::Ed25519(pk) => { let pk_bytes = pk.to_bytes(); let libp2p_pk = libp2p::identity::PublicKey::Ed25519( - libp2p::core::identity::ed25519::PublicKey::decode(&pk_bytes) + libp2p::identity::ed25519::PublicKey::decode(&pk_bytes) .expect("valid public key"), ); PeerId::from_public_key(&libp2p_pk) @@ -218,7 +219,7 @@ impl CombinedKeyPublicExt for CombinedPublicKey { } impl CombinedKeyExt for CombinedKey { - fn from_libp2p(key: &libp2p::core::identity::Keypair) -> Result { + fn from_libp2p(key: &libp2p::identity::Keypair) -> Result { match key { Keypair::Secp256k1(key) => { let secret = diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 12e34dc958f..367b64c5cd4 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -16,7 +16,7 @@ pub use enr::{ Eth2Enr, }; pub use enr_ext::{peer_id_to_node_id, CombinedKeyExt, EnrExt}; -pub use libp2p::core::identity::{Keypair, PublicKey}; +pub use libp2p::identity::{Keypair, PublicKey}; use enr::{ATTESTATION_BITFIELD_ENR_KEY, ETH2_ENR_KEY, SYNC_COMMITTEE_BITFIELD_ENR_KEY}; use futures::prelude::*; diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index 625df65ee9d..dab73e7aefd 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -94,9 +94,9 @@ fn keypair_from_hex(hex_bytes: &str) -> error::Result { #[allow(dead_code)] fn keypair_from_bytes(mut bytes: Vec) -> error::Result { - libp2p::core::identity::secp256k1::SecretKey::from_bytes(&mut bytes) + libp2p::identity::secp256k1::SecretKey::from_bytes(&mut bytes) .map(|secret| { - let keypair: libp2p::core::identity::secp256k1::Keypair = secret.into(); + let keypair: libp2p::identity::secp256k1::Keypair = secret.into(); Keypair::Secp256k1(keypair) }) .map_err(|e| format!("Unable to parse p2p secret key: {:?}", e).into()) @@ -116,9 +116,9 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { Ok(_) => { // only accept secp256k1 keys for now if let Ok(secret_key) = - libp2p::core::identity::secp256k1::SecretKey::from_bytes(&mut key_bytes) + libp2p::identity::secp256k1::SecretKey::from_bytes(&mut key_bytes) { - let kp: libp2p::core::identity::secp256k1::Keypair = secret_key.into(); + let kp: libp2p::identity::secp256k1::Keypair = secret_key.into(); debug!(log, "Loaded network key from disk."); return Keypair::Secp256k1(kp); } else { From d273f1b17c0451514716b03c51db92609a38f286 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 14 Mar 2023 23:14:28 -0500 Subject: [PATCH 008/102] fix bandwidth logging code --- .../lighthouse_network/src/service/utils.rs | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index dab73e7aefd..f29533d9464 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -4,13 +4,13 @@ use crate::types::{ error, EnrAttestationBitfield, EnrSyncCommitteeBitfield, GossipEncoding, GossipKind, }; use crate::{GossipTopic, NetworkConfig}; -use libp2p::bandwidth::{BandwidthLogging, BandwidthSinks}; +use libp2p::bandwidth::BandwidthSinks; use libp2p::core::{ identity::Keypair, multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed, }; use libp2p::gossipsub::subscription_filter::WhitelistSubscriptionFilter; use libp2p::gossipsub::IdentTopic as Topic; -use libp2p::{core, noise, PeerId, Transport}; +use libp2p::{core, noise, PeerId, Transport, TransportExt}; use prometheus_client::registry::Registry; use slog::{debug, warn}; use ssz::Decode; @@ -52,8 +52,6 @@ pub fn build_transport( transport.or_transport(libp2p::websocket::WsConfig::new(trans_clone)) }; - let (transport, bandwidth) = BandwidthLogging::new(transport); - // mplex config let mut mplex_config = libp2p::mplex::MplexConfig::new(); mplex_config.set_max_buffer_size(256); @@ -62,20 +60,17 @@ pub fn build_transport( // yamux config let mut yamux_config = libp2p::yamux::YamuxConfig::default(); yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::on_read()); + let multiplexer = core::upgrade::SelectUpgrade::new(yamux_config, mplex_config); + let (transport, bandwidth) = transport + .upgrade(core::upgrade::Version::V1) + .authenticate(generate_noise_config(&local_private_key)) + .multiplex(multiplexer) + .timeout(Duration::from_secs(10)) + .boxed() + .with_bandwidth_logging(); // Authentication - Ok(( - transport - .upgrade(core::upgrade::Version::V1) - .authenticate(generate_noise_config(&local_private_key)) - .multiplex(core::upgrade::SelectUpgrade::new( - yamux_config, - mplex_config, - )) - .timeout(Duration::from_secs(10)) - .boxed(), - bandwidth, - )) + Ok((transport, bandwidth)) } // Useful helper functions for debugging. Currently not used in the client. From d203526a45c3b56d240bb5476ab29953c8457f94 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 13:24:12 -0500 Subject: [PATCH 009/102] update most of the handler required changes --- .../lighthouse_network/src/rpc/handler.rs | 364 ++++++++++-------- 1 file changed, 194 insertions(+), 170 deletions(-) diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index a1743c15fb6..547c072fc60 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -3,18 +3,19 @@ use super::methods::{GoodbyeReason, RPCCodedResponse, RPCResponseErrorCode, ResponseTermination}; use super::outbound::OutboundRequestContainer; -use super::protocol::{max_rpc_size, InboundRequest, Protocol, RPCError, RPCProtocol}; +use super::protocol::{ + max_rpc_size, InboundOutput, InboundRequest, Protocol, RPCError, RPCProtocol, +}; use super::{RPCReceived, RPCSend, ReqId}; use crate::rpc::outbound::{OutboundFramed, OutboundRequest}; use crate::rpc::protocol::InboundFramed; use fnv::FnvHashMap; use futures::prelude::*; use futures::{Sink, SinkExt}; -use libp2p::core::upgrade::{ - InboundUpgrade, NegotiationError, OutboundUpgrade, ProtocolError, UpgradeError, -}; +use libp2p::core::upgrade::{NegotiationError, ProtocolError, UpgradeError}; use libp2p::swarm::handler::{ - ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerUpgrErr, KeepAlive, + ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerUpgrErr, + DialUpgradeError, FullyNegotiatedInbound, FullyNegotiatedOutbound, KeepAlive, SubstreamProtocol, }; use libp2p::swarm::NegotiatedSubstream; @@ -327,121 +328,7 @@ where self.listen_protocol.clone() } - fn inject_fully_negotiated_outbound( - &mut self, - out: >::Output, - request_info: Self::OutboundOpenInfo, - ) { - self.dial_negotiated -= 1; - let (id, request) = request_info; - let proto = request.protocol(); - - // accept outbound connections only if the handler is not deactivated - if matches!(self.state, HandlerState::Deactivated) { - self.events_out.push(Err(HandlerErr::Outbound { - error: RPCError::Disconnected, - proto, - id, - })); - } - - // add the stream to substreams if we expect a response, otherwise drop the stream. - let expected_responses = request.expected_responses(); - if expected_responses > 0 { - // new outbound request. Store the stream and tag the output. - let delay_key = self.outbound_substreams_delay.insert( - self.current_outbound_substream_id, - Duration::from_secs(RESPONSE_TIMEOUT), - ); - let awaiting_stream = OutboundSubstreamState::RequestPendingResponse { - substream: Box::new(out), - request, - }; - let expected_responses = if expected_responses > 1 { - // Currently enforced only for multiple responses - Some(expected_responses) - } else { - None - }; - if self - .outbound_substreams - .insert( - self.current_outbound_substream_id, - OutboundInfo { - state: awaiting_stream, - delay_key, - proto, - remaining_chunks: expected_responses, - req_id: id, - }, - ) - .is_some() - { - crit!(self.log, "Duplicate outbound substream id"; "id" => self.current_outbound_substream_id); - } - self.current_outbound_substream_id.0 += 1; - } - } - - fn inject_fully_negotiated_inbound( - &mut self, - substream: >::Output, - _info: Self::InboundOpenInfo, - ) { - // only accept new peer requests when active - if !matches!(self.state, HandlerState::Active) { - return; - } - - let (req, substream) = substream; - let expected_responses = req.expected_responses(); - - // store requests that expect responses - if expected_responses > 0 { - if self.inbound_substreams.len() < MAX_INBOUND_SUBSTREAMS { - // Store the stream and tag the output. - let delay_key = self.inbound_substreams_delay.insert( - self.current_inbound_substream_id, - Duration::from_secs(RESPONSE_TIMEOUT), - ); - let awaiting_stream = InboundState::Idle(substream); - self.inbound_substreams.insert( - self.current_inbound_substream_id, - InboundInfo { - state: awaiting_stream, - pending_items: VecDeque::with_capacity(std::cmp::min( - expected_responses, - 128, - ) as usize), - delay_key: Some(delay_key), - protocol: req.protocol(), - request_start_time: Instant::now(), - remaining_chunks: expected_responses, - }, - ); - } else { - self.events_out.push(Err(HandlerErr::Inbound { - id: self.current_inbound_substream_id, - proto: req.protocol(), - error: RPCError::HandlerRejected, - })); - return self.shutdown(None); - } - } - - // If we received a goodbye, shutdown the connection. - if let InboundRequest::Goodbye(_) = req { - self.shutdown(None); - } - - self.events_out.push(Ok(RPCReceived::Request( - self.current_inbound_substream_id, - req, - ))); - self.current_inbound_substream_id.0 += 1; - } - - fn inject_event(&mut self, rpc_event: Self::InEvent) { + fn on_behaviour_event(&mut self, rpc_event: Self::InEvent) { match rpc_event { RPCSend::Request(id, req) => self.send_request(id, req), RPCSend::Response(inbound_id, response) => self.send_response(inbound_id, response), @@ -453,56 +340,6 @@ where } } - fn inject_dial_upgrade_error( - &mut self, - request_info: Self::OutboundOpenInfo, - error: ConnectionHandlerUpgrErr< - >::Error, - >, - ) { - let (id, req) = request_info; - if let ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(RPCError::IoError(_))) = error - { - self.outbound_io_error_retries += 1; - if self.outbound_io_error_retries < IO_ERROR_RETRIES { - self.send_request(id, req); - return; - } - } - - // This dialing is now considered failed - self.dial_negotiated -= 1; - - self.outbound_io_error_retries = 0; - // map the error - let error = match error { - ConnectionHandlerUpgrErr::Timer => RPCError::InternalError("Timer failed"), - ConnectionHandlerUpgrErr::Timeout => RPCError::NegotiationTimeout, - ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(e)) => e, - ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Select(NegotiationError::Failed)) => { - RPCError::UnsupportedProtocol - } - ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Select( - NegotiationError::ProtocolError(e), - )) => match e { - ProtocolError::IoError(io_err) => RPCError::IoError(io_err.to_string()), - ProtocolError::InvalidProtocol => { - RPCError::InternalError("Protocol was deemed invalid") - } - ProtocolError::InvalidMessage | ProtocolError::TooManyProtocols => { - // Peer is sending invalid data during the negotiation phase, not - // participating in the protocol - RPCError::InvalidData("Invalid message during negotiation".to_string()) - } - }, - }; - self.events_out.push(Err(HandlerErr::Outbound { - error, - proto: req.protocol(), - id, - })); - } - fn connection_keep_alive(&self) -> KeepAlive { // Check that we don't have outbound items pending for dialing, nor dialing, nor // established. Also check that there are no established inbound substreams. @@ -989,6 +826,193 @@ where Poll::Pending } + + fn on_connection_event( + &mut self, + event: ConnectionEvent< + Self::InboundProtocol, + Self::OutboundProtocol, + Self::InboundOpenInfo, + Self::OutboundOpenInfo, + >, + ) { + match event { + ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { + protocol, + info: _, + }) => self.on_fully_negotiated_inbound(protocol), + ConnectionEvent::FullyNegotiatedOutbound(FullyNegotiatedOutbound { + protocol, + info, + }) => self.on_fully_negotiated_outbound(protocol, info), + ConnectionEvent::AddressChange(_) => todo!(), + ConnectionEvent::DialUpgradeError(DialUpgradeError { info, error }) => { + self.on_dial_upgrade_error(info, error) + } + ConnectionEvent::ListenUpgradeError(_) => todo!(), + } + } +} + +impl RPCHandler { + fn on_fully_negotiated_inbound( + &mut self, + substream: InboundOutput, + ) { + // only accept new peer requests when active + if !matches!(self.state, HandlerState::Active) { + return; + } + + let (req, substream) = substream; + let expected_responses = req.expected_responses(); + + // store requests that expect responses + if expected_responses > 0 { + if self.inbound_substreams.len() < MAX_INBOUND_SUBSTREAMS { + // Store the stream and tag the output. + let delay_key = self.inbound_substreams_delay.insert( + self.current_inbound_substream_id, + Duration::from_secs(RESPONSE_TIMEOUT), + ); + let awaiting_stream = InboundState::Idle(substream); + self.inbound_substreams.insert( + self.current_inbound_substream_id, + InboundInfo { + state: awaiting_stream, + pending_items: VecDeque::with_capacity(std::cmp::min( + expected_responses, + 128, + ) as usize), + delay_key: Some(delay_key), + protocol: req.protocol(), + request_start_time: Instant::now(), + remaining_chunks: expected_responses, + }, + ); + } else { + self.events_out.push(Err(HandlerErr::Inbound { + id: self.current_inbound_substream_id, + proto: req.protocol(), + error: RPCError::HandlerRejected, + })); + return self.shutdown(None); + } + } + + // If we received a goodbye, shutdown the connection. + if let InboundRequest::Goodbye(_) = req { + self.shutdown(None); + } + + self.events_out.push(Ok(RPCReceived::Request( + self.current_inbound_substream_id, + req, + ))); + self.current_inbound_substream_id.0 += 1; + } + + fn on_fully_negotiated_outbound( + &mut self, + substream: OutboundFramed, + (request, id): (Id, OutboundRequest), + ) { + self.dial_negotiated -= 1; + let proto = request.protocol(); + + // accept outbound connections only if the handler is not deactivated + if matches!(self.state, HandlerState::Deactivated) { + self.events_out.push(Err(HandlerErr::Outbound { + error: RPCError::Disconnected, + proto, + id, + })); + } + + // add the stream to substreams if we expect a response, otherwise drop the stream. + let expected_responses = request.expected_responses(); + if expected_responses > 0 { + // new outbound request. Store the stream and tag the output. + let delay_key = self.outbound_substreams_delay.insert( + self.current_outbound_substream_id, + Duration::from_secs(RESPONSE_TIMEOUT), + ); + let awaiting_stream = OutboundSubstreamState::RequestPendingResponse { + substream: Box::new(substream), + request, + }; + let expected_responses = if expected_responses > 1 { + // Currently enforced only for multiple responses + Some(expected_responses) + } else { + None + }; + if self + .outbound_substreams + .insert( + self.current_outbound_substream_id, + OutboundInfo { + state: awaiting_stream, + delay_key, + proto, + remaining_chunks: expected_responses, + req_id: id, + }, + ) + .is_some() + { + crit!(self.log, "Duplicate outbound substream id"; "id" => self.current_outbound_substream_id); + } + self.current_outbound_substream_id.0 += 1; + } + } + fn on_dial_upgrade_error( + &mut self, + request_info: (Id, OutboundRequest), + error: RPCError, + ) { + let (id, req) = request_info; + if let ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(RPCError::IoError(_))) = error + { + self.outbound_io_error_retries += 1; + if self.outbound_io_error_retries < IO_ERROR_RETRIES { + self.send_request(id, req); + return; + } + } + + // This dialing is now considered failed + self.dial_negotiated -= 1; + + self.outbound_io_error_retries = 0; + // map the error + let error = match error { + ConnectionHandlerUpgrErr::Timer => RPCError::InternalError("Timer failed"), + ConnectionHandlerUpgrErr::Timeout => RPCError::NegotiationTimeout, + ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(e)) => e, + ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Select(NegotiationError::Failed)) => { + RPCError::UnsupportedProtocol + } + ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Select( + NegotiationError::ProtocolError(e), + )) => match e { + ProtocolError::IoError(io_err) => RPCError::IoError(io_err.to_string()), + ProtocolError::InvalidProtocol => { + RPCError::InternalError("Protocol was deemed invalid") + } + ProtocolError::InvalidMessage | ProtocolError::TooManyProtocols => { + // Peer is sending invalid data during the negotiation phase, not + // participating in the protocol + RPCError::InvalidData("Invalid message during negotiation".to_string()) + } + }, + }; + self.events_out.push(Err(HandlerErr::Outbound { + error, + proto: req.protocol(), + id, + })); + } } impl slog::Value for SubstreamId { From 0e87da9cc56455fe922252c99b8a36d74b15b591 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 13:32:30 -0500 Subject: [PATCH 010/102] update behaviour function names in the rpc --- beacon_node/lighthouse_network/src/rpc/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 33e8413d5f2..20470bfae65 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -234,7 +234,7 @@ where ) } - fn inject_event( + fn on_connection_handler_event( &mut self, peer_id: PeerId, conn_id: ConnectionId, From d213b6a572c139edd11818987ca1f5184150657d Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 14:37:19 -0500 Subject: [PATCH 011/102] weird change needed for the NetworkBehaviour macro to work --- beacon_node/lighthouse_network/src/service/behaviour.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/service/behaviour.rs b/beacon_node/lighthouse_network/src/service/behaviour.rs index c83b7c67488..a1ef9a2f014 100644 --- a/beacon_node/lighthouse_network/src/service/behaviour.rs +++ b/beacon_node/lighthouse_network/src/service/behaviour.rs @@ -17,7 +17,11 @@ pub type SubscriptionFilter = MaxCountSubscriptionFilter; #[derive(NetworkBehaviour)] -pub(crate) struct Behaviour { +pub(crate) struct Behaviour +where + AppReqId: ReqId, + TSpec: EthSpec, +{ /// The routing pub-sub mechanism for eth2. pub gossipsub: Gossipsub, /// The Eth2 RPC specified in the wire-0 protocol. From 07b711ba598710f595b345d8a64f903b97adbf57 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 14:41:27 -0500 Subject: [PATCH 012/102] update prometheus client --- beacon_node/lighthouse_network/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index f3a820a564c..fe6303f6207 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -40,7 +40,7 @@ directory = { path = "../../common/directory" } regex = "1.5.5" strum = { version = "0.24.0", features = ["derive"] } superstruct = "0.5.0" -prometheus-client = "0.18.0" +prometheus-client = "0.19.0" unused_port = { path = "../../common/unused_port" } delay_map = "0.3.0" void = "1" From ec8fc7d0a5395eea130a05d5e53a1a244ac98eac Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 14:49:07 -0500 Subject: [PATCH 013/102] fix updates to the rpc handler --- beacon_node/lighthouse_network/src/rpc/handler.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index 547c072fc60..6dbb83a228e 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -915,7 +915,7 @@ impl RPCHandler { fn on_fully_negotiated_outbound( &mut self, substream: OutboundFramed, - (request, id): (Id, OutboundRequest), + (id, request): (Id, OutboundRequest), ) { self.dial_negotiated -= 1; let proto = request.protocol(); @@ -969,7 +969,7 @@ impl RPCHandler { fn on_dial_upgrade_error( &mut self, request_info: (Id, OutboundRequest), - error: RPCError, + error: ConnectionHandlerUpgrErr, ) { let (id, req) = request_info; if let ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(RPCError::IoError(_))) = error From 26d24ff7c894c16323b8176034b548b93c527d96 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 15:02:16 -0500 Subject: [PATCH 014/102] partially update the peer manager's network behaviour code --- .../src/peer_manager/network_behaviour.rs | 74 ++++++++++--------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 24de83a61da..41f6a5466da 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -2,11 +2,11 @@ use std::task::{Context, Poll}; use futures::StreamExt; use libp2p::core::ConnectedPoint; +use libp2p::identity::PeerId; use libp2p::swarm::behaviour::{ConnectionClosed, ConnectionEstablished, DialFailure, FromSwarm}; use libp2p::swarm::dial_opts::{DialOpts, PeerCondition}; use libp2p::swarm::dummy::ConnectionHandler; -use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourAction, PollParameters}; -use libp2p::PeerId; +use libp2p::swarm::{ConnectionId, NetworkBehaviour, NetworkBehaviourAction, PollParameters}; use slog::{debug, error}; use types::EthSpec; @@ -28,11 +28,49 @@ impl NetworkBehaviour for PeerManager { ConnectionHandler } + fn on_swarm_event(&mut self, event: FromSwarm) { + match event { + FromSwarm::ConnectionEstablished(ConnectionEstablished { + peer_id, + endpoint, + other_established, + .. + }) => self.on_connection_established(peer_id, endpoint, other_established), + FromSwarm::ConnectionClosed(ConnectionClosed { + peer_id, + remaining_established, + .. + }) => self.on_connection_closed(peer_id, remaining_established), + FromSwarm::DialFailure(DialFailure { peer_id, .. }) => self.on_dial_failure(peer_id), + FromSwarm::AddressChange(_) + | FromSwarm::ListenFailure(_) + | FromSwarm::NewListener(_) + | FromSwarm::NewListenAddr(_) + | FromSwarm::ExpiredListenAddr(_) + | FromSwarm::ListenerError(_) + | FromSwarm::ListenerClosed(_) + | FromSwarm::NewExternalAddr(_) + | FromSwarm::ExpiredExternalAddr(_) => { + // The rest of the events we ignore since they are handled in their associated + // `SwarmEvent` + } + } + } + + fn on_connection_handler_event( + &mut self, + _peer_id: PeerId, + _connection_id: ConnectionId, + _event: libp2p::swarm::THandlerOutEvent, + ) { + todo!() + } + fn poll( &mut self, cx: &mut Context<'_>, _params: &mut impl PollParameters, - ) -> Poll> { + ) -> Poll> { // perform the heartbeat when necessary while self.heartbeat.poll_tick(cx).is_ready() { self.heartbeat(); @@ -96,41 +134,11 @@ impl NetworkBehaviour for PeerManager { opts: DialOpts::peer_id(peer_id) .condition(PeerCondition::Disconnected) .build(), - handler, }); } Poll::Pending } - - fn on_swarm_event(&mut self, event: FromSwarm) { - match event { - FromSwarm::ConnectionEstablished(ConnectionEstablished { - peer_id, - endpoint, - other_established, - .. - }) => self.on_connection_established(peer_id, endpoint, other_established), - FromSwarm::ConnectionClosed(ConnectionClosed { - peer_id, - remaining_established, - .. - }) => self.on_connection_closed(peer_id, remaining_established), - FromSwarm::DialFailure(DialFailure { peer_id, .. }) => self.on_dial_failure(peer_id), - FromSwarm::AddressChange(_) - | FromSwarm::ListenFailure(_) - | FromSwarm::NewListener(_) - | FromSwarm::NewListenAddr(_) - | FromSwarm::ExpiredListenAddr(_) - | FromSwarm::ListenerError(_) - | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddr(_) - | FromSwarm::ExpiredExternalAddr(_) => { - // The rest of the events we ignore since they are handled in their associated - // `SwarmEvent` - } - } - } } impl PeerManager { From d004913d000f9ac3297ee1c22f32da3820bc3f10 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 15:09:34 -0500 Subject: [PATCH 015/102] fix generics over NetworkBehaviourAction --- beacon_node/lighthouse_network/src/discovery/mod.rs | 4 ++-- beacon_node/lighthouse_network/src/rpc/mod.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 367b64c5cd4..1093f750cb4 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -23,7 +23,7 @@ use futures::prelude::*; use futures::stream::FuturesUnordered; use libp2p::multiaddr::Protocol; use libp2p::swarm::behaviour::{DialFailure, FromSwarm}; -use libp2p::swarm::AddressScore; +use libp2p::swarm::{AddressScore, THandlerInEvent}; pub use libp2p::{ core::{ConnectedPoint, Multiaddr}, identity::PeerId, @@ -977,7 +977,7 @@ impl NetworkBehaviour for Discovery { &mut self, cx: &mut Context, _: &mut impl PollParameters, - ) -> Poll> { + ) -> Poll>> { if !self.started { return Poll::Pending; } diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 20470bfae65..562aea832a4 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -6,6 +6,7 @@ use futures::future::FutureExt; use handler::{HandlerEvent, RPCHandler}; +use libp2p::swarm::THandlerInEvent; use libp2p::swarm::{ handler::ConnectionHandler, ConnectionId, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters, SubstreamProtocol, @@ -104,8 +105,7 @@ pub struct RPCMessage { pub event: HandlerEvent, } -type BehaviourAction = - NetworkBehaviourAction, RPCHandler>; +type BehaviourAction = NetworkBehaviourAction, RPCSend>; /// Implements the libp2p `NetworkBehaviour` trait and therefore manages network-level /// logic. @@ -300,7 +300,7 @@ where &mut self, cx: &mut Context, _: &mut impl PollParameters, - ) -> Poll> { + ) -> Poll>> { // let the rate limiter prune. let _ = self.limiter.poll_unpin(cx); From 51445b58c849d94b81919d57193bf5592c730dcf Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 15:56:16 -0500 Subject: [PATCH 016/102] fix rpc network behaviour --- beacon_node/lighthouse_network/src/rpc/mod.rs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 562aea832a4..4994b681c0a 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -6,11 +6,11 @@ use futures::future::FutureExt; use handler::{HandlerEvent, RPCHandler}; -use libp2p::swarm::THandlerInEvent; use libp2p::swarm::{ handler::ConnectionHandler, ConnectionId, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters, SubstreamProtocol, }; +use libp2p::swarm::{FromSwarm, THandlerInEvent}; use libp2p::PeerId; use rate_limiter::{RPCRateLimiter as RateLimiter, RateLimitedErr}; use slog::{crit, debug, o}; @@ -234,6 +234,26 @@ where ) } + fn on_swarm_event(&mut self, event: FromSwarm) { + match event { + FromSwarm::ConnectionEstablished(_) + | FromSwarm::ConnectionClosed(_) + | FromSwarm::AddressChange(_) + | FromSwarm::DialFailure(_) + | FromSwarm::ListenFailure(_) + | FromSwarm::NewListener(_) + | FromSwarm::NewListenAddr(_) + | FromSwarm::ExpiredListenAddr(_) + | FromSwarm::ListenerError(_) + | FromSwarm::ListenerClosed(_) + | FromSwarm::NewExternalAddr(_) + | FromSwarm::ExpiredExternalAddr(_) => { + // Rpc Bheaviour does not act on these swarm events. We use a comprehensive match + // statement tu ensure future events are dealt with appropiately. + } + } + } + fn on_connection_handler_event( &mut self, peer_id: PeerId, From a596d54663c53c23196b58a1bac984f9db8f9d8b Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 16:01:17 -0500 Subject: [PATCH 017/102] fix connection event buffer limits --- beacon_node/lighthouse_network/src/service/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index fc03c6e7578..83341f14ea4 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -353,7 +353,7 @@ impl Network { Executor(executor), ) .notify_handler_buffer_size(std::num::NonZeroUsize::new(7).expect("Not zero")) - .connection_event_buffer_size(64) + .per_connection_event_buffer_size(4) .connection_limits(limits) .build(), bandwidth, From a5c2e7299ed8d40c87d60cf67f2871f3c5f8a089 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 16:53:40 -0500 Subject: [PATCH 018/102] fix discovery and rpc network behaviour impls --- .../lighthouse_network/src/discovery/mod.rs | 54 +++++++++++-------- .../lighthouse_network/src/rpc/handler.rs | 6 ++- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 1093f750cb4..f332d5b3264 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -972,6 +972,35 @@ impl NetworkBehaviour for Discovery { } } + fn on_swarm_event(&mut self, event: FromSwarm) { + match event { + FromSwarm::DialFailure(DialFailure { peer_id, error, .. }) => { + self.on_dial_failure(peer_id, error) + } + FromSwarm::ConnectionEstablished(_) + | FromSwarm::ConnectionClosed(_) + | FromSwarm::AddressChange(_) + | FromSwarm::ListenFailure(_) + | FromSwarm::NewListener(_) + | FromSwarm::NewListenAddr(_) + | FromSwarm::ExpiredListenAddr(_) + | FromSwarm::ListenerError(_) + | FromSwarm::ListenerClosed(_) + | FromSwarm::NewExternalAddr(_) + | FromSwarm::ExpiredExternalAddr(_) => { + // Ignore events not relevant to discovery + } + } + } + + fn on_connection_handler_event( + &mut self, + _peer_id: PeerId, + _connection_id: ConnectionId, + _event: void::Void, + ) { + } + // Main execution loop to drive the behaviour fn poll( &mut self, @@ -1078,27 +1107,6 @@ impl NetworkBehaviour for Discovery { } Poll::Pending } - - fn on_swarm_event(&mut self, event: FromSwarm) { - match event { - FromSwarm::DialFailure(DialFailure { peer_id, error, .. }) => { - self.on_dial_failure(peer_id, error) - } - FromSwarm::ConnectionEstablished(_) - | FromSwarm::ConnectionClosed(_) - | FromSwarm::AddressChange(_) - | FromSwarm::ListenFailure(_) - | FromSwarm::NewListener(_) - | FromSwarm::NewListenAddr(_) - | FromSwarm::ExpiredListenAddr(_) - | FromSwarm::ListenerError(_) - | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddr(_) - | FromSwarm::ExpiredExternalAddr(_) => { - // Ignore events not relevant to discovery - } - } - } } impl Discovery { @@ -1106,9 +1114,9 @@ impl Discovery { if let Some(peer_id) = peer_id { match error { DialError::Banned - | DialError::LocalPeerId + | DialError::LocalPeerId { .. } | DialError::InvalidPeerId(_) - | DialError::ConnectionIo(_) + | DialError::Denied { .. } | DialError::NoAddresses | DialError::Transport(_) | DialError::WrongPeerId { .. } => { diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index 6dbb83a228e..e6c26e5268a 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -854,7 +854,11 @@ where } } -impl RPCHandler { +impl RPCHandler +where + Id: ReqId, + TSpec: EthSpec, +{ fn on_fully_negotiated_inbound( &mut self, substream: InboundOutput, From 05ea5e6fba24ef18a25d5bb28af3a2d33b5d63ef Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 15 Mar 2023 17:53:15 -0500 Subject: [PATCH 019/102] use utf encoding in prometheus to align with open metrics format --- beacon_node/http_metrics/src/metrics.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beacon_node/http_metrics/src/metrics.rs b/beacon_node/http_metrics/src/metrics.rs index 9b156942112..31a3a2da56e 100644 --- a/beacon_node/http_metrics/src/metrics.rs +++ b/beacon_node/http_metrics/src/metrics.rs @@ -9,7 +9,7 @@ pub use lighthouse_metrics::*; pub fn gather_prometheus_metrics( ctx: &Context, ) -> std::result::Result { - let mut buffer = vec![]; + let mut buffer = String::new(); let encoder = TextEncoder::new(); // There are two categories of metrics: @@ -50,7 +50,7 @@ pub fn gather_prometheus_metrics( } encoder - .encode(&lighthouse_metrics::gather(), &mut buffer) + .encode_utf8(&lighthouse_metrics::gather(), &mut buffer) .unwrap(); // encode gossipsub metrics also if they exist if let Some(registry) = ctx.gossipsub_registry.as_ref() { @@ -59,5 +59,5 @@ pub fn gather_prometheus_metrics( } } - String::from_utf8(buffer).map_err(|e| format!("Failed to encode prometheus info: {:?}", e)) + Ok(buffer) } From d425cb516df6646d46f8b3ed50ae8d11f72d8ff4 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 16 Mar 2023 10:51:34 -0500 Subject: [PATCH 020/102] remove unnecesary code --- beacon_node/http_metrics/src/metrics.rs | 2 +- .../lighthouse_network/src/peer_manager/network_behaviour.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/beacon_node/http_metrics/src/metrics.rs b/beacon_node/http_metrics/src/metrics.rs index 31a3a2da56e..785206b757b 100644 --- a/beacon_node/http_metrics/src/metrics.rs +++ b/beacon_node/http_metrics/src/metrics.rs @@ -1,6 +1,6 @@ use crate::Context; use beacon_chain::BeaconChainTypes; -use lighthouse_metrics::{Encoder, TextEncoder}; +use lighthouse_metrics::TextEncoder; use lighthouse_network::prometheus_client::encoding::text::encode; use malloc_utils::scrape_allocator_metrics; diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 41f6a5466da..de6dc746eb3 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -129,7 +129,6 @@ impl NetworkBehaviour for PeerManager { if let Some((peer_id, maybe_enr)) = self.peers_to_dial.pop_first() { self.inject_peer_connection(&peer_id, ConnectingType::Dialing, maybe_enr); - let handler = self.new_handler(); return Poll::Ready(NetworkBehaviourAction::Dial { opts: DialOpts::peer_id(peer_id) .condition(PeerCondition::Disconnected) From b76e3b6a2a066b95a631c829ea4c4dcc4da4fef1 Mon Sep 17 00:00:00 2001 From: Diva M Date: Mon, 20 Mar 2023 11:30:45 -0500 Subject: [PATCH 021/102] update libp2p-identity to latest release --- Cargo.lock | 633 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 370 insertions(+), 263 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08b7e2a8081..8f77bc0c602 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -187,7 +187,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", "once_cell", "version_check", ] @@ -325,9 +336,9 @@ dependencies = [ [[package]] name = "asn1_der" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" +checksum = "155a5a185e42c6b77ac7b88a15143d930a9e9727a5b7b77eed417404ab15c247" [[package]] name = "async-io" @@ -360,9 +371,9 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad445822218ce64be7a341abfb0b1ea43b5c23aa83902542a4542e78309d8e5e" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" dependencies = [ "async-stream-impl", "futures-core", @@ -371,13 +382,13 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -388,7 +399,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -417,9 +428,9 @@ dependencies = [ [[package]] name = "atomic-waker" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" +checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" [[package]] name = "attohttpc" @@ -1158,9 +1169,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" dependencies = [ "crossbeam-utils", ] @@ -1283,9 +1294,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -1437,9 +1448,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-rc.2" +version = "4.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d928d978dbec61a1167414f5ec534f24bea0d7a0d24dd9b6233d3d8223e585" +checksum = "8d4ba9852b42210c7538b75484f9daa0655e9a3ac04f693747bb0f02cf3cfe16" dependencies = [ "cfg-if", "fiat-crypto", @@ -1473,7 +1484,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -1490,7 +1501,7 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -1928,7 +1939,19 @@ dependencies = [ "der", "elliptic-curve", "rfc6979", - "signature", + "signature 1.6.4", +] + +[[package]] +name = "ecdsa" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12844141594ad74185a926d030f3b605f6a903b4e3fec351f3ea338ac5b7637e" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature 2.0.0", ] [[package]] @@ -1937,7 +1960,7 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ - "signature", + "signature 1.6.4", ] [[package]] @@ -2037,7 +2060,7 @@ dependencies = [ "rand 0.8.5", "rlp", "serde", - "sha3 0.10.6", + "sha3 0.10.7", "zeroize", ] @@ -2057,7 +2080,7 @@ dependencies = [ "rand 0.8.5", "rlp", "serde", - "sha3 0.10.6", + "sha3 0.10.7", "zeroize", ] @@ -2120,13 +2143,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2404,7 +2427,7 @@ dependencies = [ "regex", "serde", "serde_json", - "sha3 0.10.6", + "sha3 0.10.7", "thiserror", "uint", ] @@ -2530,7 +2553,7 @@ dependencies = [ "futures-core", "futures-timer", "futures-util", - "getrandom 0.2.8", + "getrandom 0.2.9", "hashers", "hex", "http", @@ -2863,9 +2886,9 @@ checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-lite" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ "fastrand", "futures-core", @@ -2884,7 +2907,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -2989,9 +3012,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", "js-sys", @@ -3067,9 +3090,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "66b91535aa35fea1523ad1b86cb6b53c28e0ae566ba4a460f4457e936cad7c6f" dependencies = [ "bytes", "fnv", @@ -3111,7 +3134,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash", + "ahash 0.7.6", ] [[package]] @@ -3120,7 +3143,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", ] [[package]] @@ -3442,16 +3474,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.54" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c17cc76786e99f8d2f055c11159e7f0091c42474dcc3189fbab96072e873e6d" +checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows 0.46.0", + "windows 0.48.0", ] [[package]] @@ -3680,13 +3712,13 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -3798,10 +3830,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", - "ecdsa", + "ecdsa 0.14.8", "elliptic-curve", "sha2 0.10.6", - "sha3 0.10.6", + "sha3 0.10.7", ] [[package]] @@ -3900,9 +3932,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.140" +version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" [[package]] name = "libflate" @@ -3963,19 +3995,22 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.50.1" +version = "0.51.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7b0104790be871edcf97db9bd2356604984e623a08d825c3f27852290266b8" +checksum = "f210d259724eae82005b5c48078619b7745edb7b76de370b03f8ba59ea103097" dependencies = [ "bytes", "futures", "futures-timer", - "getrandom 0.2.8", + "getrandom 0.2.9", "instant", - "libp2p-core 0.38.0", + "libp2p-allow-block-list", + "libp2p-connection-limits", + "libp2p-core 0.39.1", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", + "libp2p-identity", "libp2p-mdns", "libp2p-metrics", "libp2p-mplex", @@ -3987,52 +4022,39 @@ dependencies = [ "libp2p-webrtc", "libp2p-websocket", "libp2p-yamux", - "multiaddr 0.16.0", - "parking_lot 0.12.1", + "multiaddr 0.17.1", "pin-project", - "smallvec", ] [[package]] -name = "libp2p-core" -version = "0.36.0" +name = "libp2p-allow-block-list" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fff5bd889c82a0aec668f2045edd066f559d4e5c40354e5a4c77ac00caac38" +checksum = "a0c54073648b20bb47335164544a4e5694434f44530f47a4f6618f5f585f3ff5" dependencies = [ - "asn1_der", - "bs58", - "ed25519-dalek", - "either", - "fnv", - "futures", - "futures-timer", - "instant", - "lazy_static", - "libsecp256k1", - "log", - "multiaddr 0.14.0", - "multihash 0.16.3", - "multistream-select 0.11.0", - "p256", - "parking_lot 0.12.1", - "pin-project", - "prost", - "prost-build", - "rand 0.8.5", - "rw-stream-sink", - "sha2 0.10.6", - "smallvec", - "thiserror", - "unsigned-varint 0.7.1", + "libp2p-core 0.39.1", + "libp2p-identity", + "libp2p-swarm", + "void", +] + +[[package]] +name = "libp2p-connection-limits" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4caa33f1d26ed664c4fe2cca81a08c8e07d4c1c04f2f4ac7655c2dd85467fda0" +dependencies = [ + "libp2p-core 0.39.1", + "libp2p-identity", + "libp2p-swarm", "void", - "zeroize", ] [[package]] name = "libp2p-core" -version = "0.38.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f" +checksum = "b1fff5bd889c82a0aec668f2045edd066f559d4e5c40354e5a4c77ac00caac38" dependencies = [ "asn1_der", "bs58", @@ -4042,20 +4064,19 @@ dependencies = [ "futures", "futures-timer", "instant", + "lazy_static", "libsecp256k1", "log", - "multiaddr 0.16.0", + "multiaddr 0.14.0", "multihash 0.16.3", - "multistream-select 0.12.1", - "once_cell", - "p256", + "multistream-select 0.11.0", + "p256 0.11.1", "parking_lot 0.12.1", "pin-project", "prost", "prost-build", "rand 0.8.5", "rw-stream-sink", - "sec1", "sha2 0.10.6", "smallvec", "thiserror", @@ -4094,12 +4115,12 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e42a271c1b49f789b92f7fc87749fa79ce5c7bdc88cbdfacb818a4bca47fec5" +checksum = "146ff7034daae62077c415c2376b8057368042df6ab95f5432ad5e88568b1554" dependencies = [ "futures", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", "log", "parking_lot 0.12.1", "smallvec", @@ -4108,25 +4129,25 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.43.0" +version = "0.44.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a173171c71c29bb156f98886c7c4824596de3903dadf01e2e79d2ccdcf38cd9f" +checksum = "eac213adad69bd9866fe87c37fbf241626715e5cd454fb6df9841aa2b02440ee" dependencies = [ "asynchronous-codec", - "base64 0.13.1", + "base64 0.21.0", "byteorder", "bytes", "fnv", "futures", "hex_fmt", "instant", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", + "libp2p-identity", "libp2p-swarm", "log", "prometheus-client", - "prost", - "prost-build", - "prost-codec", + "quick-protobuf", + "quick-protobuf-codec", "rand 0.8.5", "regex", "sha2 0.10.6", @@ -4138,20 +4159,21 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.41.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c052d0026f4817b44869bfb6810f4e1112f43aec8553f2cb38881c524b563abf" +checksum = "40d1da1f75baf824cfdc80f6aced51f7cbf8dc14e32363e9443570a80d4ee337" dependencies = [ "asynchronous-codec", + "either", "futures", "futures-timer", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", + "libp2p-identity", "libp2p-swarm", "log", - "lru 0.8.1", - "prost", - "prost-build", - "prost-codec", + "lru 0.9.0", + "quick-protobuf", + "quick-protobuf-codec", "smallvec", "thiserror", "void", @@ -4163,28 +4185,35 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a8ea433ae0cea7e3315354305237b9897afe45278b2118a7a57ca744e70fd27" dependencies = [ + "asn1_der", "bs58", "ed25519-dalek", + "libsecp256k1", "log", "multiaddr 0.17.1", "multihash 0.17.0", + "p256 0.12.0", "prost", "quick-protobuf", "rand 0.8.5", + "sec1", + "sha2 0.10.6", "thiserror", + "void", "zeroize", ] [[package]] name = "libp2p-mdns" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f378264aade9872d6ccd315c0accc18be3a35d15fc1b9c36e5b6f983b62b5b" +checksum = "19983e1f949f979a928f2c603de1cf180cc0dc23e4ac93a62651ccb18341460b" dependencies = [ "data-encoding", "futures", "if-watch", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", + "libp2p-identity", "libp2p-swarm", "log", "rand 0.8.5", @@ -4197,11 +4226,11 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad8a64f29da86005c86a4d2728b8a0719e9b192f4092b609fd8790acb9dec55" +checksum = "a42ec91e227d7d0dafa4ce88b333cdf5f277253873ab087555c92798db2ddd46" dependencies = [ - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", "libp2p-gossipsub", "libp2p-identify", "libp2p-swarm", @@ -4210,14 +4239,14 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03805b44107aa013e7cbbfa5627b31c36cbedfdfb00603c0311998882bc4bace" +checksum = "4d34780b514b159e6f3fd70ba3e72664ec89da28dca2d1e7856ee55e2c7031ba" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", "log", "nohash-hasher", "parking_lot 0.12.1", @@ -4228,18 +4257,18 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.41.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a978cb57efe82e892ec6f348a536bfbd9fee677adbe5689d7a93ad3a9bffbf2e" +checksum = "9c87c2803deffeae94108072a0387f8c9ff494af68a4908454c11c811e27b5e5" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", + "libp2p-identity", "log", "once_cell", - "prost", - "prost-build", + "quick-protobuf", "rand 0.8.5", "sha2 0.10.6", "snow", @@ -4251,32 +4280,33 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.38.0" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c43ab37fb4102682ae9a248dc2e6a8e7b941ec75cf24aed103060a788e0fd15" +checksum = "2ff582c0b74ffda004b716b97bc9cfe7f39960204877758b876dde86093beaa8" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", + "libp2p-identity", "log", - "prost", - "prost-build", + "quick-protobuf", "unsigned-varint 0.7.1", "void", ] [[package]] name = "libp2p-quic" -version = "0.7.0-alpha" +version = "0.7.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e7c867e95c8130667b24409d236d37598270e6da69b3baf54213ba31ffca59" +checksum = "c6b26abd81cd2398382a1edfe739b539775be8a90fa6914f39b2ab49571ec735" dependencies = [ "bytes", "futures", "futures-timer", "if-watch", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", + "libp2p-identity", "libp2p-tls", "log", "parking_lot 0.12.1", @@ -4289,31 +4319,30 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.41.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a35472fe3276b3855c00f1c032ea8413615e030256429ad5349cdf67c6e1a0" +checksum = "bd1e223f02fcd7e3790f9b954e2e81791810e3512daeb27fa97df7652e946bc2" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", + "libp2p-identity", "libp2p-swarm-derive", "log", - "pin-project", "rand 0.8.5", "smallvec", - "thiserror", "tokio", "void", ] [[package]] name = "libp2p-swarm-derive" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d527d5827582abd44a6d80c07ff8b50b4ee238a8979e05998474179e79dc400" +checksum = "0fba456131824ab6acd4c7bf61e9c0f0a3014b5fc9868ccb8e10d344594cdc4f" dependencies = [ "heck", "quote", @@ -4322,15 +4351,15 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b257baf6df8f2df39678b86c578961d48cc8b68642a12f0f763f56c8e5858d" +checksum = "33d33698596d7722d85d3ab0c86c2c322254fce1241e91208e3679b4eb3026cf" dependencies = [ "futures", "futures-timer", "if-watch", "libc", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", "log", "socket2 0.4.9", "tokio", @@ -4357,9 +4386,9 @@ dependencies = [ [[package]] name = "libp2p-webrtc" -version = "0.4.0-alpha" +version = "0.4.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb6cd86dd68cba72308ea05de1cebf3ba0ae6e187c40548167955d4e3970f6a" +checksum = "dba48592edbc2f60b4bc7c10d65445b0c3964c07df26fdf493b6880d33be36f8" dependencies = [ "async-trait", "asynchronous-codec", @@ -4368,13 +4397,13 @@ dependencies = [ "futures-timer", "hex", "if-watch", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", + "libp2p-identity", "libp2p-noise", "log", - "multihash 0.16.3", - "prost", - "prost-build", - "prost-codec", + "multihash 0.17.0", + "quick-protobuf", + "quick-protobuf-codec", "rand 0.8.5", "rcgen 0.9.3", "serde", @@ -4388,14 +4417,14 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.40.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d705506030d5c0aaf2882437c70dab437605f21c5f9811978f694e6917a3b54" +checksum = "111273f7b3d3510524c752e8b7a5314b7f7a1fee7e68161c01a7d72cbb06db9f" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", "log", "parking_lot 0.12.1", "quicksink", @@ -4407,12 +4436,12 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f63594a0aa818642d9d4915c791945053877253f08a3626f13416b5cd928a29" +checksum = "d048cd82f72c8800655aa1ee9b808ea8c9d523a649d3579b3ef0cfe23952d7fd" dependencies = [ "futures", - "libp2p-core 0.38.0", + "libp2p-core 0.39.1", "log", "parking_lot 0.12.1", "thiserror", @@ -4689,11 +4718,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +checksum = "71e7d46de488603ffdd5f30afbc64fbba2378214a2c3a2fb83abf3d33126df17" dependencies = [ - "hashbrown 0.12.3", + "hashbrown 0.13.2", ] [[package]] @@ -4982,24 +5011,6 @@ dependencies = [ "url", ] -[[package]] -name = "multiaddr" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aebdb21e90f81d13ed01dc84123320838e53963c2ca94b60b305d3fa64f31e" -dependencies = [ - "arrayref", - "byteorder", - "data-encoding", - "multibase", - "multihash 0.16.3", - "percent-encoding", - "serde", - "static_assertions", - "unsigned-varint 0.7.1", - "url", -] - [[package]] name = "multiaddr" version = "0.17.1" @@ -5503,9 +5514,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.49" +version = "0.10.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d2f106ab837a24e03672c59b1239669a0596406ff657c3c0835b6b7f0f35a33" +checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1" dependencies = [ "bitflags", "cfg-if", @@ -5524,7 +5535,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -5544,9 +5555,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.84" +version = "0.9.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a20eace9dc2d82904039cb76dcf50fb1a0bba071cfd1629720b5d6f1ddba0fa" +checksum = "0d3d193fb1488ad46ffe3aaabc912cc931d02ee8518fe2959aea8ef52718b0c0" dependencies = [ "cc", "libc", @@ -5591,8 +5602,20 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" dependencies = [ - "ecdsa", + "ecdsa 0.14.8", + "elliptic-curve", + "sha2 0.10.6", +] + +[[package]] +name = "p256" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49c124b3cbce43bcbac68c58ec181d98ed6cc7e6d0aa7c3ba97b2563410b0e55" +dependencies = [ + "ecdsa 0.15.1", "elliptic-curve", + "primeorder", "sha2 0.10.6", ] @@ -5602,7 +5625,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" dependencies = [ - "ecdsa", + "ecdsa 0.14.8", "elliptic-curve", "sha2 0.10.6", ] @@ -5671,9 +5694,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" [[package]] name = "parking_lot" @@ -5911,9 +5934,9 @@ dependencies = [ [[package]] name = "polling" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e1f879b2998099c2d69ab9605d145d5b661195627eccc680002c4918a7fb6fa" +checksum = "4be1c66a6add46bff50935c313dae30a5030cf8385c5206e8a95e9e9def974aa" dependencies = [ "autocfg 1.1.0", "bitflags", @@ -5922,7 +5945,7 @@ dependencies = [ "libc", "log", "pin-project-lite 0.2.9", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -6014,6 +6037,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "primeorder" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b54f7131b3dba65a2f414cf5bd25b66d4682e4608610668eae785750ba4c5b2" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "primitive-types" version = "0.10.1" @@ -6083,9 +6115,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.55" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0dd4be24fcdcfeaa12a432d588dc59bbad6cad3510c67e74a2b6b2fc950564" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] @@ -6119,21 +6151,21 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" +checksum = "5d6fa99d535dd930d1249e6c79cb3c2915f9172a540fe2b02a4c8f9ca954721e" dependencies = [ "dtoa", "itoa", "parking_lot 0.12.1", - "prometheus-client-derive-text-encode", + "prometheus-client-derive-encode", ] [[package]] -name = "prometheus-client-derive-text-encode" -version = "0.3.0" +name = "prometheus-client-derive-encode" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd" +checksum = "72b6a5217beb0ad503ee7fa752d451c905113d70721b937126158f3106a48cc1" dependencies = [ "proc-macro2", "quote", @@ -6142,9 +6174,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48e50df39172a3e7eb17e14642445da64996989bc212b583015435d39a58537" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", "prost-derive", @@ -6152,9 +6184,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c828f93f5ca4826f97fedcbd3f9a536c16b12cff3dbbb4a007f932bbad95b12" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", "heck", @@ -6172,24 +6204,11 @@ dependencies = [ "which", ] -[[package]] -name = "prost-codec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc34979ff898b6e141106178981ce2596c387ea6e62533facfc61a37fc879c0" -dependencies = [ - "asynchronous-codec", - "bytes", - "prost", - "thiserror", - "unsigned-varint 0.7.1", -] - [[package]] name = "prost-derive" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea9b0f8cbe5e15a8a042d030bd96668db28ecb567ec37d691971ff5731d2b1b" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", @@ -6200,9 +6219,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379119666929a1afd7a043aa6cf96fa67a6dce9af60c88095a4686dbce4c9c88" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ "prost", ] @@ -6260,6 +6279,19 @@ dependencies = [ "byteorder", ] +[[package]] +name = "quick-protobuf-codec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1693116345026436eb2f10b677806169c1a1260c1c60eaaffe3fb5a29ae23d8b" +dependencies = [ + "asynchronous-codec", + "bytes", + "quick-protobuf", + "thiserror", + "unsigned-varint 0.7.1", +] + [[package]] name = "quickcheck" version = "0.9.2" @@ -6413,7 +6445,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", ] [[package]] @@ -6505,7 +6537,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", "redox_syscall 0.2.16", "thiserror", ] @@ -6754,16 +6786,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.6" +version = "0.37.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d097081ed288dfe45699b72f5b5d648e5f15d64d900c7080273baa20c16a6849" +checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -7047,9 +7079,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.159" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" dependencies = [ "serde_derive", ] @@ -7076,20 +7108,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.159" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] name = "serde_json" -version = "1.0.95" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -7104,7 +7136,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -7226,9 +7258,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +checksum = "54c2bb1a323307527314a36bfb73f24febb08ce2b8a554bf4ffd6f51ad15198c" dependencies = [ "digest 0.10.6", "keccak", @@ -7268,6 +7300,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "signature" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" +dependencies = [ + "digest 0.10.6", + "rand_core 0.6.4", +] + [[package]] name = "simple_asn1" version = "0.6.2" @@ -7505,14 +7547,14 @@ checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" -version = "0.9.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" +checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" dependencies = [ "aes-gcm 0.9.4", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-rc.2", + "curve25519-dalek 4.0.0-rc.1", "rand_core 0.6.4", "ring", "rustc_version 0.4.0", @@ -7532,12 +7574,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc8d618c6641ae355025c449427f9e96b98abf99a772be3cef6708d15c77147a" +checksum = "6d283f86695ae989d1e18440a943880967156325ba025f05049946bff47bcc2b" dependencies = [ "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -7794,9 +7836,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.13" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" dependencies = [ "proc-macro2", "quote", @@ -8000,7 +8042,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -8163,7 +8205,7 @@ checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -8195,7 +8237,7 @@ dependencies = [ "pin-project-lite 0.2.9", "postgres-protocol", "postgres-types", - "socket2 0.5.1", + "socket2 0.5.2", "tokio", "tokio-util 0.7.7", ] @@ -8793,17 +8835,17 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", "serde", ] [[package]] name = "uuid" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +checksum = "5b55a3fef2a1e3b3a00ce878640918820d3c51081576ac657d23af9fc7928fdb" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", ] [[package]] @@ -9349,7 +9391,7 @@ dependencies = [ "hmac 0.12.1", "log", "oid-registry 0.6.1", - "p256", + "p256 0.11.1", "p384", "rand 0.8.5", "rand_core 0.6.4", @@ -9360,13 +9402,13 @@ dependencies = [ "serde", "sha1", "sha2 0.10.6", - "signature", + "signature 1.6.4", "subtle", "thiserror", "tokio", "webpki 0.21.4", "webrtc-util", - "x25519-dalek 2.0.0-rc.2", + "x25519-dalek 2.0.0-pre.1", "x509-parser 0.13.2", ] @@ -9388,7 +9430,7 @@ dependencies = [ "tokio", "turn", "url", - "uuid 1.3.0", + "uuid 1.3.1", "waitgroup", "webrtc-mdns", "webrtc-util", @@ -9554,11 +9596,11 @@ dependencies = [ [[package]] name = "windows" -version = "0.46.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets", + "windows-targets 0.48.0", ] [[package]] @@ -9579,12 +9621,12 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.42.2", "windows_aarch64_msvc 0.42.2", "windows_i686_gnu 0.42.2", "windows_i686_msvc 0.42.2", "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.42.2", "windows_x86_64_msvc 0.42.2", ] @@ -9594,7 +9636,16 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", ] [[package]] @@ -9603,21 +9654,42 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.42.2", "windows_aarch64_msvc 0.42.2", "windows_i686_gnu 0.42.2", "windows_i686_msvc 0.42.2", "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.42.2", "windows_x86_64_msvc 0.42.2", ] +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.34.0" @@ -9630,6 +9702,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.34.0" @@ -9642,6 +9720,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.34.0" @@ -9654,6 +9738,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.34.0" @@ -9666,12 +9756,24 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.34.0" @@ -9684,6 +9786,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + [[package]] name = "winreg" version = "0.10.1" @@ -9740,13 +9848,12 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.0-rc.2" +version = "2.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabd6e16dd08033932fc3265ad4510cc2eab24656058a6dcb107ffe274abcc95" +checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" dependencies = [ - "curve25519-dalek 4.0.0-rc.2", + "curve25519-dalek 3.2.0", "rand_core 0.6.4", - "serde", "zeroize", ] @@ -9827,9 +9934,9 @@ dependencies = [ [[package]] name = "yasna" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aed2e7a52e3744ab4d0c05c20aa065258e84c49fd4226f5191b2ed29712710b4" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ "time 0.3.20", ] @@ -9851,7 +9958,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] From 823828a917b9c414881eca34f5a80ed10433fde8 Mon Sep 17 00:00:00 2001 From: Diva M Date: Mon, 20 Mar 2023 13:55:35 -0500 Subject: [PATCH 022/102] fix warnings where the fix does not bring an unnecesary clone --- beacon_node/lighthouse_network/src/service/utils.rs | 6 +++--- lcli/src/generate_bootnode_enr.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index f29533d9464..19cd9840657 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -92,7 +92,7 @@ fn keypair_from_bytes(mut bytes: Vec) -> error::Result { libp2p::identity::secp256k1::SecretKey::from_bytes(&mut bytes) .map(|secret| { let keypair: libp2p::identity::secp256k1::Keypair = secret.into(); - Keypair::Secp256k1(keypair) + keypair.into() }) .map_err(|e| format!("Unable to parse p2p secret key: {:?}", e).into()) } @@ -115,7 +115,7 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { { let kp: libp2p::identity::secp256k1::Keypair = secret_key.into(); debug!(log, "Loaded network key from disk."); - return Keypair::Secp256k1(kp); + return kp.into(); } else { debug!(log, "Network key file is not a valid secp256k1 key"); } @@ -125,7 +125,7 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { // if a key could not be loaded from disk, generate a new one and save it let local_private_key = Keypair::generate_secp256k1(); - if let Keypair::Secp256k1(key) = local_private_key.clone() { + if let Some(key) = local_private_key.clone().into_secp256k1() { let _ = std::fs::create_dir_all(&config.network_dir); match File::create(network_key_f.clone()) .and_then(|mut f| f.write_all(&key.secret().to_bytes())) diff --git a/lcli/src/generate_bootnode_enr.rs b/lcli/src/generate_bootnode_enr.rs index 8662a804761..70b7d0bdfac 100644 --- a/lcli/src/generate_bootnode_enr.rs +++ b/lcli/src/generate_bootnode_enr.rs @@ -47,8 +47,8 @@ pub fn run(matches: &ArgMatches) -> Result<(), String> { .write_all(enr.to_base64().as_bytes()) .map_err(|e| format!("Unable to write ENR to {}: {:?}", ENR_FILENAME, e))?; - let secret_bytes = match local_keypair { - Keypair::Secp256k1(key) => key.secret().to_bytes(), + let secret_bytes = match local_keypair.into_secp256k1() { + Some(key) => key.secret().to_bytes(), _ => return Err("Key is not a secp256k1 key".into()), }; From c7798b347dbfd6c3c6695168f0684fe065d9d627 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 13 Apr 2023 13:06:45 -0500 Subject: [PATCH 023/102] partially address ConnectionLimits deprecation in favor of connection_limits Behaviour --- .../src/service/behaviour.rs | 4 +- .../lighthouse_network/src/service/mod.rs | 42 +++++++++++-------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/behaviour.rs b/beacon_node/lighthouse_network/src/service/behaviour.rs index a1ef9a2f014..5133b2190b1 100644 --- a/beacon_node/lighthouse_network/src/service/behaviour.rs +++ b/beacon_node/lighthouse_network/src/service/behaviour.rs @@ -34,4 +34,6 @@ where pub identify: Identify, /// The peer manager that keeps track of peer's reputation and status. pub peer_manager: PeerManager, -} + /// Keep track of active and pending connections to enforce hard limits. + pub connection_limits: libp2p::connection_limits::Behaviour, +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 83341f14ea4..104c4b85ea2 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -31,7 +31,7 @@ use libp2p::gossipsub::{ }; use libp2p::identify::{Behaviour as Identify, Config as IdentifyConfig, Event as IdentifyEvent}; use libp2p::multiaddr::{Multiaddr, Protocol as MProtocol}; -use libp2p::swarm::{ConnectionLimits, Swarm, SwarmBuilder, SwarmEvent}; +use libp2p::swarm::{Swarm, SwarmBuilder, SwarmEvent}; use libp2p::PeerId; use slog::{crit, debug, info, o, trace, warn}; use std::path::PathBuf; @@ -304,6 +304,27 @@ impl Network { PeerManager::new(peer_manager_cfg, network_globals.clone(), &log)? }; + let connection_limits = { + let limits = libp2p::connection_limits::ConnectionLimits::default() + .with_max_pending_incoming(Some(5)) + .with_max_pending_outgoing(Some(16)) + .with_max_established_incoming(Some( + (config.target_peers as f32 + * (1.0 + PEER_EXCESS_FACTOR - MIN_OUTBOUND_ONLY_FACTOR)) + .ceil() as u32, + )) + .with_max_established_outgoing(Some( + (config.target_peers as f32 * (1.0 + PEER_EXCESS_FACTOR)).ceil() as u32, + )) + .with_max_established(Some( + (config.target_peers as f32 * (1.0 + PEER_EXCESS_FACTOR + PRIORITY_PEER_EXCESS)) + .ceil() as u32, + )) + .with_max_established_per_peer(Some(MAX_CONNECTIONS_PER_PEER)); + + libp2p::connection_limits::Behaviour::new(limits) + }; + let behaviour = { Behaviour { gossipsub, @@ -311,6 +332,7 @@ impl Network { discovery, identify, peer_manager, + connection_limits, } }; @@ -328,22 +350,6 @@ impl Network { } // sets up the libp2p connection limits - let limits = ConnectionLimits::default() - .with_max_pending_incoming(Some(5)) - .with_max_pending_outgoing(Some(16)) - .with_max_established_incoming(Some( - (config.target_peers as f32 - * (1.0 + PEER_EXCESS_FACTOR - MIN_OUTBOUND_ONLY_FACTOR)) - .ceil() as u32, - )) - .with_max_established_outgoing(Some( - (config.target_peers as f32 * (1.0 + PEER_EXCESS_FACTOR)).ceil() as u32, - )) - .with_max_established(Some( - (config.target_peers as f32 * (1.0 + PEER_EXCESS_FACTOR + PRIORITY_PEER_EXCESS)) - .ceil() as u32, - )) - .with_max_established_per_peer(Some(MAX_CONNECTIONS_PER_PEER)); ( SwarmBuilder::with_executor( @@ -354,7 +360,6 @@ impl Network { ) .notify_handler_buffer_size(std::num::NonZeroUsize::new(7).expect("Not zero")) .per_connection_event_buffer_size(4) - .connection_limits(limits) .build(), bandwidth, ) @@ -1426,6 +1431,7 @@ impl Network { BehaviourEvent::Discovery(de) => self.inject_discovery_event(de), BehaviourEvent::Identify(ie) => self.inject_identify_event(ie), BehaviourEvent::PeerManager(pe) => self.inject_pm_event(pe), + BehaviourEvent::ConnectionLimits(le) => void::unreachable(le), }, SwarmEvent::ConnectionEstablished { .. } => None, SwarmEvent::ConnectionClosed { .. } => None, From b524150de0498df6b1cbdae9df6e86a5ae5900d9 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 14 Apr 2023 15:36:41 -0500 Subject: [PATCH 024/102] allow necessary deprecated variant --- beacon_node/lighthouse_network/src/service/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 104c4b85ea2..06f246e19d5 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -1454,6 +1454,8 @@ impl Network { debug!(self.log, "Failed to dial address"; "peer_id" => ?peer_id, "error" => %error); None } + // We still need to handle this during the deprecation period anyway. + #[allow(deprecated)] SwarmEvent::BannedPeer { peer_id, endpoint: _, From 1245fdea4d65548b36c21c67536543c1289b9a79 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sun, 4 Jun 2023 19:30:38 -0500 Subject: [PATCH 025/102] fix import in tests --- beacon_node/http_api/src/test_utils.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/beacon_node/http_api/src/test_utils.rs b/beacon_node/http_api/src/test_utils.rs index 9880a8ca617..694402a3d78 100644 --- a/beacon_node/http_api/src/test_utils.rs +++ b/beacon_node/http_api/src/test_utils.rs @@ -9,12 +9,9 @@ use directory::DEFAULT_ROOT_DIR; use eth2::{BeaconNodeHttpClient, Timeouts}; use lighthouse_network::{ discv5::enr::{CombinedKey, EnrBuilder}, - libp2p::{ - core::connection::ConnectionId, - swarm::{ - behaviour::{ConnectionEstablished, FromSwarm}, - NetworkBehaviour, - }, + libp2p::swarm::{ + behaviour::{ConnectionEstablished, FromSwarm}, + ConnectionId, NetworkBehaviour, }, rpc::methods::{MetaData, MetaDataV2}, types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield, SyncState}, @@ -170,7 +167,7 @@ pub async fn create_api_server_on_port( local_addr: EXTERNAL_ADDR.parse().unwrap(), send_back_addr: EXTERNAL_ADDR.parse().unwrap(), }; - let connection_id = ConnectionId::new(1); + let connection_id = ConnectionId::new_unchecked(1); pm.on_swarm_event(FromSwarm::ConnectionEstablished(ConnectionEstablished { peer_id, connection_id, From 283982e2baebd41e945d608bceb046f853d13fa4 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 10 Jun 2023 08:13:21 -0500 Subject: [PATCH 026/102] prepare for 0.52 upgrade --- Cargo.lock | 184 ++++++++---------- beacon_node/lighthouse_network/Cargo.toml | 8 +- .../lighthouse_network/src/service/utils.rs | 8 +- 3 files changed, 87 insertions(+), 113 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bbe9669f555..59a1ca8fb77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4055,8 +4055,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.51.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f210d259724eae82005b5c48078619b7745edb7b76de370b03f8ba59ea103097" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "bytes", "futures", @@ -4065,14 +4064,13 @@ dependencies = [ "instant", "libp2p-allow-block-list", "libp2p-connection-limits", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", "libp2p-mdns", "libp2p-metrics", - "libp2p-mplex", "libp2p-noise", "libp2p-plaintext", "libp2p-quic", @@ -4087,11 +4085,10 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "510daa05efbc25184458db837f6f9a5143888f1caa742426d92e1833ddd38a50" +version = "0.1.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "libp2p-swarm", "void", @@ -4100,10 +4097,9 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4caa33f1d26ed664c4fe2cca81a08c8e07d4c1c04f2f4ac7655c2dd85467fda0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "libp2p-swarm", "void", @@ -4135,7 +4131,7 @@ dependencies = [ "prost", "prost-build", "rand 0.8.5", - "rw-stream-sink", + "rw-stream-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.10.6", "smallvec", "thiserror", @@ -4146,9 +4142,8 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.39.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c1df63c0b582aa434fb09b2d86897fa2b419ffeccf934b36f87fcedc8e835c2" +version = "0.39.1" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "either", "fnv", @@ -4165,7 +4160,7 @@ dependencies = [ "pin-project", "quick-protobuf", "rand 0.8.5", - "rw-stream-sink", + "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7)", "smallvec", "thiserror", "unsigned-varint 0.7.1", @@ -4175,11 +4170,11 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146ff7034daae62077c415c2376b8057368042df6ab95f5432ad5e88568b1554" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "futures", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", + "libp2p-identity", "log", "parking_lot 0.12.1", "smallvec", @@ -4188,20 +4183,18 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.44.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70b34b6da8165c0bde35c82db8efda39b824776537e73973549e76cadb3a77c5" +version = "0.44.3" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "asynchronous-codec", "base64 0.21.2", "byteorder", "bytes", - "either", "fnv", "futures", "hex_fmt", "instant", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "libp2p-swarm", "log", @@ -4214,21 +4207,19 @@ dependencies = [ "smallvec", "thiserror", "unsigned-varint 0.7.1", - "void", "wasm-timer", ] [[package]] name = "libp2p-identify" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5455f472243e63b9c497ff320ded0314254a9eb751799a39c283c6f20b793f3c" +version = "0.42.1" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "asynchronous-codec", "either", "futures", "futures-timer", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "libp2p-swarm", "log", @@ -4242,9 +4233,8 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e2d584751cecb2aabaa56106be6be91338a60a0f4e420cf2af639204f596fc1" +version = "0.1.1" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "asn1_der", "bs58", @@ -4266,13 +4256,12 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.43.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19983e1f949f979a928f2c603de1cf180cc0dc23e4ac93a62651ccb18341460b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "data-encoding", "futures", "if-watch", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "libp2p-swarm", "log", @@ -4287,44 +4276,25 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a42ec91e227d7d0dafa4ce88b333cdf5f277253873ab087555c92798db2ddd46" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-gossipsub", "libp2p-identify", + "libp2p-identity", "libp2p-swarm", "prometheus-client", ] -[[package]] -name = "libp2p-mplex" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d34780b514b159e6f3fd70ba3e72664ec89da28dca2d1e7856ee55e2c7031ba" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures", - "libp2p-core 0.39.2", - "log", - "nohash-hasher", - "parking_lot 0.12.1", - "rand 0.8.5", - "smallvec", - "unsigned-varint 0.7.1", -] - [[package]] name = "libp2p-noise" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3673da89d29936bc6435bafc638e2f184180d554ce844db65915113f86ec5e" +version = "0.42.1" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "log", "once_cell", @@ -4341,13 +4311,12 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.39.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ff582c0b74ffda004b716b97bc9cfe7f39960204877758b876dde86093beaa8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "log", "quick-protobuf", @@ -4358,14 +4327,13 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.7.0-alpha.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6b26abd81cd2398382a1edfe739b539775be8a90fa6914f39b2ab49571ec735" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "bytes", "futures", "futures-timer", "if-watch", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "libp2p-tls", "log", @@ -4379,16 +4347,15 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903b3d592d7694e56204d211f29d31bc004be99386644ba8731fc3e3ef27b296" +version = "0.42.1" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "libp2p-swarm-derive", "log", @@ -4401,25 +4368,24 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fba456131824ab6acd4c7bf61e9c0f0a3014b5fc9868ccb8e10d344594cdc4f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "heck", "quote", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] name = "libp2p-tcp" version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d33698596d7722d85d3ab0c86c2c322254fce1241e91208e3679b4eb3026cf" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "futures", "futures-timer", "if-watch", "libc", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", + "libp2p-identity", "log", "socket2 0.4.9", "tokio", @@ -4428,27 +4394,25 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff08d13d0dc66e5e9ba6279c1de417b84fa0d0adc3b03e5732928c180ec02781" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "futures", "futures-rustls", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "rcgen 0.10.0", "ring", "rustls 0.20.8", "thiserror", "webpki 0.22.0", - "x509-parser 0.14.0", + "x509-parser 0.15.0", "yasna", ] [[package]] name = "libp2p-webrtc" version = "0.4.0-alpha.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba48592edbc2f60b4bc7c10d65445b0c3964c07df26fdf493b6880d33be36f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "async-trait", "asynchronous-codec", @@ -4457,7 +4421,7 @@ dependencies = [ "futures-timer", "hex", "if-watch", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "libp2p-identity", "libp2p-noise", "log", @@ -4467,6 +4431,7 @@ dependencies = [ "rand 0.8.5", "rcgen 0.9.3", "serde", + "sha2 0.10.6", "stun", "thiserror", "tinytemplate", @@ -4478,30 +4443,29 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111273f7b3d3510524c752e8b7a5314b7f7a1fee7e68161c01a7d72cbb06db9f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", + "libp2p-identity", "log", "parking_lot 0.12.1", "quicksink", - "rw-stream-sink", + "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7)", "soketto", "url", - "webpki-roots", + "webpki-roots 0.23.1", ] [[package]] name = "libp2p-yamux" -version = "0.43.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd21d950662700a385d4c6d68e2f5f54d778e97068cdd718522222ef513bda" +version = "0.43.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "futures", - "libp2p-core 0.39.2", + "libp2p-core 0.39.1", "log", "thiserror", "yamux", @@ -5132,9 +5096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" dependencies = [ "core2", - "digest 0.10.7", "multihash-derive", - "sha2 0.10.6", "unsigned-varint 0.7.1", ] @@ -5193,8 +5155,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "bytes", "futures", @@ -6354,8 +6315,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1693116345026436eb2f10b677806169c1a1260c1c60eaaffe3fb5a29ae23d8b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" dependencies = [ "asynchronous-codec", "bytes", @@ -6686,7 +6646,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots", + "webpki-roots 0.22.6", "winreg", ] @@ -6949,6 +6909,16 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "rw-stream-sink" +version = "0.3.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + [[package]] name = "ryu" version = "1.0.13" @@ -8418,7 +8388,7 @@ dependencies = [ "tokio-rustls 0.23.4", "tungstenite 0.17.3", "webpki 0.22.0", - "webpki-roots", + "webpki-roots 0.22.6", ] [[package]] @@ -9393,6 +9363,15 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "webpki-roots" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +dependencies = [ + "rustls-webpki", +] + [[package]] name = "webrtc" version = "0.6.0" @@ -9968,12 +9947,11 @@ dependencies = [ [[package]] name = "x509-parser" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +checksum = "bab0c2f54ae1d92f4fcb99c0b7ccf0b1e3451cbd395e5f115ccbdbcb18d4f634" dependencies = [ "asn1-rs 0.5.2", - "base64 0.13.1", "data-encoding", "der-parser 8.2.0", "lazy_static", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index b50dee9c8f7..c21b3d9599b 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -46,9 +46,11 @@ delay_map = "0.3.0" void = "1" [dependencies.libp2p] -version = "0.51.1" +# version = "0.51.3" +git = "https://github.com/libp2p/rust-libp2p" +rev = "9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" default-features = false -features = ["websocket", "identify", "mplex", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] +features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] [dev-dependencies] slog-term = "2.6.0" @@ -60,4 +62,4 @@ quickcheck = "0.9.2" quickcheck_macros = "0.9.1" [features] -libp2p-websocket = [] +libp2p-websocket = [] \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index 19cd9840657..8fb5374f985 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -52,19 +52,13 @@ pub fn build_transport( transport.or_transport(libp2p::websocket::WsConfig::new(trans_clone)) }; - // mplex config - let mut mplex_config = libp2p::mplex::MplexConfig::new(); - mplex_config.set_max_buffer_size(256); - mplex_config.set_max_buffer_behaviour(libp2p::mplex::MaxBufferBehaviour::Block); - // yamux config let mut yamux_config = libp2p::yamux::YamuxConfig::default(); yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::on_read()); - let multiplexer = core::upgrade::SelectUpgrade::new(yamux_config, mplex_config); let (transport, bandwidth) = transport .upgrade(core::upgrade::Version::V1) .authenticate(generate_noise_config(&local_private_key)) - .multiplex(multiplexer) + .multiplex(yamux_config) .timeout(Duration::from_secs(10)) .boxed() .with_bandwidth_logging(); From c413c5a5eb8cb13094838473bd47835f56d69003 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 10 Jun 2023 08:20:15 -0500 Subject: [PATCH 027/102] replace NetworkBehaviourAction with ToSwarm --- .../lighthouse_network/src/discovery/mod.rs | 2 +- .../src/peer_manager/network_behaviour.rs | 8 ++++---- beacon_node/lighthouse_network/src/rpc/mod.rs | 18 +++++++++--------- .../lighthouse_network/src/rpc/self_limiter.rs | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index f332d5b3264..3e0e856e005 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -29,7 +29,7 @@ pub use libp2p::{ identity::PeerId, swarm::{ dummy::ConnectionHandler, ConnectionId, DialError, NetworkBehaviour, - NetworkBehaviourAction as NBAction, NotifyHandler, PollParameters, SubstreamProtocol, + ToSwarm as NBAction, NotifyHandler, PollParameters, SubstreamProtocol, }, }; use lru::LruCache; diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index de6dc746eb3..646d71aa019 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -6,7 +6,7 @@ use libp2p::identity::PeerId; use libp2p::swarm::behaviour::{ConnectionClosed, ConnectionEstablished, DialFailure, FromSwarm}; use libp2p::swarm::dial_opts::{DialOpts, PeerCondition}; use libp2p::swarm::dummy::ConnectionHandler; -use libp2p::swarm::{ConnectionId, NetworkBehaviour, NetworkBehaviourAction, PollParameters}; +use libp2p::swarm::{ConnectionId, NetworkBehaviour, ToSwarm, PollParameters}; use slog::{debug, error}; use types::EthSpec; @@ -70,7 +70,7 @@ impl NetworkBehaviour for PeerManager { &mut self, cx: &mut Context<'_>, _params: &mut impl PollParameters, - ) -> Poll> { + ) -> Poll> { // perform the heartbeat when necessary while self.heartbeat.poll_tick(cx).is_ready() { self.heartbeat(); @@ -122,14 +122,14 @@ impl NetworkBehaviour for PeerManager { } if !self.events.is_empty() { - return Poll::Ready(NetworkBehaviourAction::GenerateEvent(self.events.remove(0))); + return Poll::Ready(ToSwarm::GenerateEvent(self.events.remove(0))); } else { self.events.shrink_to_fit(); } if let Some((peer_id, maybe_enr)) = self.peers_to_dial.pop_first() { self.inject_peer_connection(&peer_id, ConnectingType::Dialing, maybe_enr); - return Poll::Ready(NetworkBehaviourAction::Dial { + return Poll::Ready(ToSwarm::Dial { opts: DialOpts::peer_id(peer_id) .condition(PeerCondition::Disconnected) .build(), diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index ee9328e807e..efe56a02910 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -7,7 +7,7 @@ use futures::future::FutureExt; use handler::{HandlerEvent, RPCHandler}; use libp2p::swarm::{ - handler::ConnectionHandler, ConnectionId, NetworkBehaviour, NetworkBehaviourAction, + handler::ConnectionHandler, ConnectionId, NetworkBehaviour, ToSwarm, NotifyHandler, PollParameters, SubstreamProtocol, }; use libp2p::swarm::{FromSwarm, THandlerInEvent}; @@ -104,7 +104,7 @@ pub struct RPCMessage { pub event: HandlerEvent, } -type BehaviourAction = NetworkBehaviourAction, RPCSend>; +type BehaviourAction = ToSwarm, RPCSend>; /// Implements the libp2p `NetworkBehaviour` trait and therefore manages network-level /// logic. @@ -160,7 +160,7 @@ impl RPC { id: (ConnectionId, SubstreamId), event: RPCCodedResponse, ) { - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push(ToSwarm::NotifyHandler { peer_id, handler: NotifyHandler::One(id.0), event: RPCSend::Response(id.1, event), @@ -180,7 +180,7 @@ impl RPC { } } } else { - NetworkBehaviourAction::NotifyHandler { + ToSwarm::NotifyHandler { peer_id, handler: NotifyHandler::Any, event: RPCSend::Request(request_id, req), @@ -193,7 +193,7 @@ impl RPC { /// Lighthouse wishes to disconnect from this peer by sending a Goodbye message. This /// gracefully terminates the RPC behaviour with a goodbye message. pub fn shutdown(&mut self, peer_id: PeerId, id: Id, reason: GoodbyeReason) { - self.events.push(NetworkBehaviourAction::NotifyHandler { + self.events.push(ToSwarm::NotifyHandler { peer_id, handler: NotifyHandler::Any, event: RPCSend::Shutdown(id, reason), @@ -258,7 +258,7 @@ where Ok(()) => { // send the event to the user self.events - .push(NetworkBehaviourAction::GenerateEvent(RPCMessage { + .push(ToSwarm::GenerateEvent(RPCMessage { peer_id, conn_id, event, @@ -301,7 +301,7 @@ where } else { // No rate limiting, send the event to the user self.events - .push(NetworkBehaviourAction::GenerateEvent(RPCMessage { + .push(ToSwarm::GenerateEvent(RPCMessage { peer_id, conn_id, event, @@ -309,7 +309,7 @@ where } } else { self.events - .push(NetworkBehaviourAction::GenerateEvent(RPCMessage { + .push(ToSwarm::GenerateEvent(RPCMessage { peer_id, conn_id, event, @@ -321,7 +321,7 @@ where &mut self, cx: &mut Context, _: &mut impl PollParameters, - ) -> Poll>> { + ) -> Poll>> { // let the rate limiter prune. if let Some(limiter) = self.limiter.as_mut() { let _ = limiter.poll_unpin(cx); diff --git a/beacon_node/lighthouse_network/src/rpc/self_limiter.rs b/beacon_node/lighthouse_network/src/rpc/self_limiter.rs index 6748a1947bc..09609fad1c0 100644 --- a/beacon_node/lighthouse_network/src/rpc/self_limiter.rs +++ b/beacon_node/lighthouse_network/src/rpc/self_limiter.rs @@ -64,7 +64,7 @@ impl SelfRateLimiter { } /// Checks if the rate limiter allows the request. If it's allowed, returns the - /// [`NetworkBehaviourAction`] that should be emitted. When not allowed, the request is delayed + /// [`ToSwarm`] that should be emitted. When not allowed, the request is delayed /// until it can be sent. pub fn allows( &mut self, @@ -95,7 +95,7 @@ impl SelfRateLimiter { } /// Auxiliary function to deal with self rate limiting outcomes. If the rate limiter allows the - /// request, the [`NetworkBehaviourAction`] that should be emitted is returned. If the request + /// request, the [`ToSwarm`] that should be emitted is returned. If the request /// should be delayed, it's returned with the duration to wait. fn try_send_request( limiter: &mut RateLimiter, From 894cb77785532b7a7d6a14cdc7298c6e95f96de1 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 10 Jun 2023 12:47:12 -0500 Subject: [PATCH 028/102] deprecation warns --- beacon_node/lighthouse_network/src/config.rs | 2 +- .../lighthouse_network/src/discovery/mod.rs | 19 +++++----- .../src/peer_manager/network_behaviour.rs | 2 +- beacon_node/lighthouse_network/src/rpc/mod.rs | 35 +++++++++---------- .../src/service/behaviour.rs | 2 +- 5 files changed, 28 insertions(+), 32 deletions(-) diff --git a/beacon_node/lighthouse_network/src/config.rs b/beacon_node/lighthouse_network/src/config.rs index 910162821fc..b6a349db88d 100644 --- a/beacon_node/lighthouse_network/src/config.rs +++ b/beacon_node/lighthouse_network/src/config.rs @@ -7,7 +7,7 @@ use directory::{ }; use discv5::{Discv5Config, Discv5ConfigBuilder}; use libp2p::gossipsub::{ - ConfigBuilder as GossipsubConfigBuilder, Config as GossipsubConfig, FastMessageId, + Config as GossipsubConfig, ConfigBuilder as GossipsubConfigBuilder, FastMessageId, Message as GossipsubMessage, MessageId, RawMessage as RawGossipsubMessage, ValidationMode, }; use libp2p::Multiaddr; diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 3e0e856e005..970c08c0eae 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -28,8 +28,8 @@ pub use libp2p::{ core::{ConnectedPoint, Multiaddr}, identity::PeerId, swarm::{ - dummy::ConnectionHandler, ConnectionId, DialError, NetworkBehaviour, - ToSwarm as NBAction, NotifyHandler, PollParameters, SubstreamProtocol, + dummy::ConnectionHandler, ConnectionId, DialError, NetworkBehaviour, NotifyHandler, + PollParameters, SubstreamProtocol, ToSwarm, }, }; use lru::LruCache; @@ -1006,7 +1006,7 @@ impl NetworkBehaviour for Discovery { &mut self, cx: &mut Context, _: &mut impl PollParameters, - ) -> Poll>> { + ) -> Poll>> { if !self.started { return Poll::Pending; } @@ -1017,7 +1017,7 @@ impl NetworkBehaviour for Discovery { // Drive the queries and return any results from completed queries if let Some(peers) = self.poll_queries(cx) { // return the result to the peer manager - return Poll::Ready(NBAction::GenerateEvent(DiscoveredPeers { peers })); + return Poll::Ready(ToSwarm::GenerateEvent(DiscoveredPeers { peers })); } // Process the server event stream @@ -1091,7 +1091,7 @@ impl NetworkBehaviour for Discovery { if let Some(address) = addr { // NOTE: This doesn't actually track the external TCP port. More sophisticated NAT handling // should handle this. - return Poll::Ready(NBAction::ReportObservedAddr { + return Poll::Ready(ToSwarm::ReportObservedAddr { address, score: AddressScore::Finite(1), }); @@ -1113,8 +1113,7 @@ impl Discovery { fn on_dial_failure(&mut self, peer_id: Option, error: &DialError) { if let Some(peer_id) = peer_id { match error { - DialError::Banned - | DialError::LocalPeerId { .. } + DialError::LocalPeerId { .. } | DialError::InvalidPeerId(_) | DialError::Denied { .. } | DialError::NoAddresses @@ -1124,9 +1123,9 @@ impl Discovery { debug!(self.log, "Marking peer disconnected in DHT"; "peer_id" => %peer_id); self.disconnect_peer(&peer_id); } - DialError::ConnectionLimit(_) - | DialError::DialPeerConditionFalse(_) - | DialError::Aborted => {} + DialError::DialPeerConditionFalse(_) | DialError::Aborted => {} + #[allow(deprecated)] + DialError::ConnectionLimit(_) | DialError::Banned => {} } } } diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 646d71aa019..c06cb3e63ed 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -6,7 +6,7 @@ use libp2p::identity::PeerId; use libp2p::swarm::behaviour::{ConnectionClosed, ConnectionEstablished, DialFailure, FromSwarm}; use libp2p::swarm::dial_opts::{DialOpts, PeerCondition}; use libp2p::swarm::dummy::ConnectionHandler; -use libp2p::swarm::{ConnectionId, NetworkBehaviour, ToSwarm, PollParameters}; +use libp2p::swarm::{ConnectionId, NetworkBehaviour, PollParameters, ToSwarm}; use slog::{debug, error}; use types::EthSpec; diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index efe56a02910..cb8f926eb71 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -7,8 +7,8 @@ use futures::future::FutureExt; use handler::{HandlerEvent, RPCHandler}; use libp2p::swarm::{ - handler::ConnectionHandler, ConnectionId, NetworkBehaviour, ToSwarm, - NotifyHandler, PollParameters, SubstreamProtocol, + handler::ConnectionHandler, ConnectionId, NetworkBehaviour, NotifyHandler, PollParameters, + SubstreamProtocol, ToSwarm, }; use libp2p::swarm::{FromSwarm, THandlerInEvent}; use libp2p::PeerId; @@ -257,12 +257,11 @@ where match limiter.allows(&peer_id, req) { Ok(()) => { // send the event to the user - self.events - .push(ToSwarm::GenerateEvent(RPCMessage { - peer_id, - conn_id, - event, - })) + self.events.push(ToSwarm::GenerateEvent(RPCMessage { + peer_id, + conn_id, + event, + })) } Err(RateLimitedErr::TooLarge) => { // we set the batch sizes, so this is a coding/config err for most protocols @@ -300,20 +299,18 @@ where } } else { // No rate limiting, send the event to the user - self.events - .push(ToSwarm::GenerateEvent(RPCMessage { - peer_id, - conn_id, - event, - })) - } - } else { - self.events - .push(ToSwarm::GenerateEvent(RPCMessage { + self.events.push(ToSwarm::GenerateEvent(RPCMessage { peer_id, conn_id, event, - })); + })) + } + } else { + self.events.push(ToSwarm::GenerateEvent(RPCMessage { + peer_id, + conn_id, + event, + })); } } diff --git a/beacon_node/lighthouse_network/src/service/behaviour.rs b/beacon_node/lighthouse_network/src/service/behaviour.rs index 5133b2190b1..e541bd8b0ee 100644 --- a/beacon_node/lighthouse_network/src/service/behaviour.rs +++ b/beacon_node/lighthouse_network/src/service/behaviour.rs @@ -36,4 +36,4 @@ where pub peer_manager: PeerManager, /// Keep track of active and pending connections to enforce hard limits. pub connection_limits: libp2p::connection_limits::Behaviour, -} \ No newline at end of file +} From 40aa0d9c473dd1561bc12c480ba50652b228ea31 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 13 Jun 2023 22:37:19 -0500 Subject: [PATCH 029/102] annoying stuff --- beacon_node/lighthouse_network/src/discovery/enr_ext.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index b71f9a8f3c8..26658cf018e 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -1,4 +1,8 @@ //! ENR extension trait to support libp2p integration. + +// TODO: super annoying stuff I really don't want to deal with right now +#![allow(deprecated)] + use crate::{Enr, Multiaddr, PeerId}; use discv5::enr::{CombinedKey, CombinedPublicKey}; use libp2p::core::multiaddr::Protocol; From a0b2cc2a6c2372112a119b9de51a4618b0a441fe Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 15 Jun 2023 09:52:42 -0500 Subject: [PATCH 030/102] wip --- .../src/peer_manager/network_behaviour.rs | 19 ++++++++++++++++++- .../lighthouse_network/src/service/mod.rs | 10 ++-------- beacon_node/network/src/service.rs | 6 ++---- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index c06cb3e63ed..a8a90c13065 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -57,6 +57,23 @@ impl NetworkBehaviour for PeerManager { } } + fn handle_pending_inbound_connection( + &mut self, + _connection_id: ConnectionId, + _local_addr: &libp2p::Multiaddr, + _remote_addr: &libp2p::Multiaddr, + ) -> Result<(), libp2p::swarm::ConnectionDenied> { + } + + fn handle_pending_outbound_connection( + &mut self, + _connection_id: ConnectionId, + maybe_peer: Option, + _addresses: &[libp2p::Multiaddr], + _effective_role: libp2p::core::Endpoint, + ) -> Result, libp2p::swarm::ConnectionDenied> { + } + fn on_connection_handler_event( &mut self, _peer_id: PeerId, @@ -258,4 +275,4 @@ impl PeerManager { } } } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 318567c223a..30368ad3157 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -66,10 +66,6 @@ pub enum NetworkEvent { PeerConnectedIncoming(PeerId), /// A peer has disconnected. PeerDisconnected(PeerId), - /// The peer needs to be banned. - PeerBanned(PeerId), - /// The peer has been unbanned. - PeerUnbanned(PeerId), /// An RPC Request that was sent failed. RPCFailed { /// The id of the failed request. @@ -1373,14 +1369,12 @@ impl Network { Some(NetworkEvent::PeerDisconnected(peer_id)) } PeerManagerEvent::Banned(peer_id, associated_ips) => { - self.swarm.ban_peer_id(peer_id); self.discovery_mut().ban_peer(&peer_id, associated_ips); - Some(NetworkEvent::PeerBanned(peer_id)) + None } PeerManagerEvent::UnBanned(peer_id, associated_ips) => { - self.swarm.unban_peer_id(peer_id); self.discovery_mut().unban_peer(&peer_id, associated_ips); - Some(NetworkEvent::PeerUnbanned(peer_id)) + None } PeerManagerEvent::Status(peer_id) => { // it's time to status. We don't keep a beacon chain reference here, so we inform diff --git a/beacon_node/network/src/service.rs b/beacon_node/network/src/service.rs index 2c919233fca..a4b65d20b5b 100644 --- a/beacon_node/network/src/service.rs +++ b/beacon_node/network/src/service.rs @@ -482,9 +482,7 @@ impl NetworkService { NetworkEvent::PeerConnectedOutgoing(peer_id) => { self.send_to_router(RouterMessage::StatusPeer(peer_id)); } - NetworkEvent::PeerConnectedIncoming(_) - | NetworkEvent::PeerBanned(_) - | NetworkEvent::PeerUnbanned(_) => { + NetworkEvent::PeerConnectedIncoming(_) => { // No action required for these events. } NetworkEvent::PeerDisconnected(peer_id) => { @@ -989,4 +987,4 @@ impl Drop for NetworkService { info!(self.log, "Network service shutdown"); } -} +} \ No newline at end of file From 2fa23a040fa528eebc0680b10cdf20c475f7042d Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 15 Jun 2023 23:44:33 -0500 Subject: [PATCH 031/102] need to stop coding tired --- .../src/peer_manager/network_behaviour.rs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index a8a90c13065..2c9a17826bd 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -63,6 +63,7 @@ impl NetworkBehaviour for PeerManager { _local_addr: &libp2p::Multiaddr, _remote_addr: &libp2p::Multiaddr, ) -> Result<(), libp2p::swarm::ConnectionDenied> { + // TODO... is it guaranteed that the ip the peer is connecting from is in the _remote_addr? } fn handle_pending_outbound_connection( @@ -72,6 +73,27 @@ impl NetworkBehaviour for PeerManager { _addresses: &[libp2p::Multiaddr], _effective_role: libp2p::core::Endpoint, ) -> Result, libp2p::swarm::ConnectionDenied> { + // TODO: + // - _effective_role: will probably be needed once we get quic + // - _addresses: check if addresses to dial contain any banned ip + + // Check to make sure the peer is not supposed to be banned + if let Some(peer_id) = maybe_peer { + match self.ban_status(&peer_id) { + BanResult::BadScore | BanResult::BannedIp(_) => { + // TODO: need to create an error type for this + Err(libp2p::swarm::ConnectionDenied::new(())) + } + BanResult::NotBanned => { + // TODO: do stuff. + // check if the peer is being dialed (so this behaviour dialed) + // if not, check if we want the peer, prevent the dial attempt otherwise + // + // What happens if another behaviour prevents our dial attempt? do we get any + // notification to get the peer out of dialing state? dial failed? + } + } + } } fn on_connection_handler_event( @@ -275,4 +297,4 @@ impl PeerManager { } } } -} \ No newline at end of file +} From 40d0db18f7e55261dec5885406790fcf9f958f26 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 22 Jun 2023 23:19:15 -0500 Subject: [PATCH 032/102] address deprecation warning --- .../src/discovery/enr_ext.rs | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 466d2143c58..0781833e7bd 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -251,32 +251,29 @@ pub fn peer_id_to_node_id(peer_id: &PeerId) -> Result { - let uncompressed_key_bytes = &pk.encode_uncompressed()[1..]; - let mut output = [0_u8; 32]; - let mut hasher = Keccak::v256(); - hasher.update(uncompressed_key_bytes); - hasher.finalize(&mut output); - Ok(discv5::enr::NodeId::parse(&output).expect("Must be correct length")) - } - PublicKey::Ed25519(pk) => { - let uncompressed_key_bytes = pk.encode(); - let mut output = [0_u8; 32]; - let mut hasher = Keccak::v256(); - hasher.update(&uncompressed_key_bytes); - hasher.finalize(&mut output); - Ok(discv5::enr::NodeId::parse(&output).expect("Must be correct length")) - } - PublicKey::Ecdsa(_) => Err(format!( - "Unsupported public key (Ecdsa) from peer {}", - peer_id - )), + })?; + // TODO: wait for libp2p to add a try_into that returns the original value. + if let Some(pk) = public_key.clone().into_secp256k1() { + let uncompressed_key_bytes = &pk.encode_uncompressed()[1..]; + let mut output = [0_u8; 32]; + let mut hasher = Keccak::v256(); + hasher.update(uncompressed_key_bytes); + hasher.finalize(&mut output); + Ok(discv5::enr::NodeId::parse(&output).expect("Must be correct length")) + } else if let Some(pk) = public_key.into_ed25519() { + let uncompressed_key_bytes = pk.encode(); + let mut output = [0_u8; 32]; + let mut hasher = Keccak::v256(); + hasher.update(&uncompressed_key_bytes); + hasher.finalize(&mut output); + Ok(discv5::enr::NodeId::parse(&output).expect("Must be correct length")) + } else { + Err(format!("Unsupported public key from peer {}", peer_id)) } } From d121bc9810e2a07cc30256baf4f47c3201dab0d9 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 22 Jun 2023 23:22:41 -0500 Subject: [PATCH 033/102] address deprecation warning --- beacon_node/lighthouse_network/src/discovery/enr_ext.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 0781833e7bd..1c989014d9c 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -289,7 +289,7 @@ mod tests { let libp2p_sk = libp2p::identity::secp256k1::SecretKey::from_bytes(sk_bytes).unwrap(); let secp256k1_kp: libp2p::identity::secp256k1::Keypair = libp2p_sk.into(); - let libp2p_kp = Keypair::Secp256k1(secp256k1_kp); + let libp2p_kp: Keypair = secp256k1_kp.into(); let peer_id = libp2p_kp.public().to_peer_id(); let enr = discv5::enr::EnrBuilder::new("v4") @@ -310,7 +310,7 @@ mod tests { let libp2p_sk = libp2p::identity::ed25519::SecretKey::from_bytes(sk_bytes).unwrap(); let secp256k1_kp: libp2p::identity::ed25519::Keypair = libp2p_sk.into(); - let libp2p_kp = Keypair::Ed25519(secp256k1_kp); + let libp2p_kp: Keypair = secp256k1_kp.into(); let peer_id = libp2p_kp.public().to_peer_id(); let enr = discv5::enr::EnrBuilder::new("v4") From d66835d11f237aac352aabd868c1c1764bd912e3 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 22 Jun 2023 23:34:48 -0500 Subject: [PATCH 034/102] temp fix errors, see warns --- .../src/discovery/enr_ext.rs | 5 +-- .../src/peer_manager/network_behaviour.rs | 34 ++++++++++--------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 1c989014d9c..eea3029f5d5 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -1,8 +1,5 @@ //! ENR extension trait to support libp2p integration. -// TODO: super annoying stuff I really don't want to deal with right now -#![allow(deprecated)] - use crate::{Enr, Multiaddr, PeerId}; use discv5::enr::{CombinedKey, CombinedPublicKey}; use libp2p::core::multiaddr::Protocol; @@ -320,4 +317,4 @@ mod tests { assert_eq!(enr.node_id(), node_id); } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 2c9a17826bd..6365d43e457 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -64,6 +64,7 @@ impl NetworkBehaviour for PeerManager { _remote_addr: &libp2p::Multiaddr, ) -> Result<(), libp2p::swarm::ConnectionDenied> { // TODO... is it guaranteed that the ip the peer is connecting from is in the _remote_addr? + todo!() } fn handle_pending_outbound_connection( @@ -78,22 +79,23 @@ impl NetworkBehaviour for PeerManager { // - _addresses: check if addresses to dial contain any banned ip // Check to make sure the peer is not supposed to be banned - if let Some(peer_id) = maybe_peer { - match self.ban_status(&peer_id) { - BanResult::BadScore | BanResult::BannedIp(_) => { - // TODO: need to create an error type for this - Err(libp2p::swarm::ConnectionDenied::new(())) - } - BanResult::NotBanned => { - // TODO: do stuff. - // check if the peer is being dialed (so this behaviour dialed) - // if not, check if we want the peer, prevent the dial attempt otherwise - // - // What happens if another behaviour prevents our dial attempt? do we get any - // notification to get the peer out of dialing state? dial failed? - } - } - } + todo!() + // if let Some(peer_id) = maybe_peer { + // match self.ban_status(&peer_id) { + // BanResult::BadScore | BanResult::BannedIp(_) => { + // // TODO: need to create an error type for this + // Err(libp2p::swarm::ConnectionDenied::new(())) + // } + // BanResult::NotBanned => { + // // TODO: do stuff. + // // check if the peer is being dialed (so this behaviour dialed) + // // if not, check if we want the peer, prevent the dial attempt otherwise + // // + // // What happens if another behaviour prevents our dial attempt? do we get any + // // notification to get the peer out of dialing state? dial failed? + // } + // } + // } } fn on_connection_handler_event( From e84095b32605f42af100530c42435a6169e3fbbb Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 11:02:52 -0500 Subject: [PATCH 035/102] move libp2p a bit up to deal with deprecation warnings that had no way to be solved --- Cargo.lock | 94 ++++++++++++----------- beacon_node/lighthouse_network/Cargo.toml | 2 +- 2 files changed, 49 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 760df2da692..22358d9dc55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4191,7 +4191,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.51.3" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "bytes", "futures", @@ -4200,7 +4200,7 @@ dependencies = [ "instant", "libp2p-allow-block-list", "libp2p-connection-limits", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", @@ -4221,10 +4221,10 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" -version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +version = "0.1.1" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "libp2p-swarm", "void", @@ -4233,9 +4233,9 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "libp2p-swarm", "void", @@ -4278,8 +4278,8 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.39.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +version = "0.39.2" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "either", "fnv", @@ -4296,7 +4296,7 @@ dependencies = [ "pin-project", "quick-protobuf", "rand 0.8.5", - "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7)", + "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc)", "smallvec", "thiserror", "unsigned-varint 0.7.1", @@ -4306,10 +4306,10 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.39.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "futures", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "log", "parking_lot 0.12.1", @@ -4320,17 +4320,18 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.44.3" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "asynchronous-codec", "base64 0.21.2", "byteorder", "bytes", + "either", "fnv", "futures", "hex_fmt", "instant", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "libp2p-swarm", "log", @@ -4343,19 +4344,20 @@ dependencies = [ "smallvec", "thiserror", "unsigned-varint 0.7.1", + "void", "wasm-timer", ] [[package]] name = "libp2p-identify" version = "0.42.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "asynchronous-codec", "either", "futures", "futures-timer", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "libp2p-swarm", "log", @@ -4369,8 +4371,8 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.1.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +version = "0.1.2" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "asn1_der", "bs58", @@ -4392,12 +4394,12 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.43.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "data-encoding", "futures", "if-watch", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "libp2p-swarm", "log", @@ -4412,9 +4414,9 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.12.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", @@ -4425,12 +4427,12 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.42.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "log", "once_cell", @@ -4447,12 +4449,12 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.39.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "log", "quick-protobuf", @@ -4463,13 +4465,13 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.7.0-alpha.3" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "bytes", "futures", "futures-timer", "if-watch", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "libp2p-tls", "log", @@ -4483,15 +4485,15 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.42.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +version = "0.42.2" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "libp2p-swarm-derive", "log", @@ -4504,7 +4506,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.32.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "heck", "quote", @@ -4514,13 +4516,13 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.39.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "futures", "futures-timer", "if-watch", "libc", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "log", "socket2 0.4.9", @@ -4530,11 +4532,11 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "futures", "futures-rustls", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "rcgen 0.10.0", "ring", @@ -4548,7 +4550,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.4.0-alpha.4" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "async-trait", "asynchronous-codec", @@ -4557,7 +4559,7 @@ dependencies = [ "futures-timer", "hex", "if-watch", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "libp2p-noise", "log", @@ -4579,17 +4581,17 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "libp2p-identity", "log", "parking_lot 0.12.1", "quicksink", - "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7)", + "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc)", "soketto", "url", "webpki-roots 0.23.1", @@ -4598,10 +4600,10 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "futures", - "libp2p-core 0.39.1", + "libp2p-core 0.39.2", "log", "thiserror", "yamux", @@ -5288,7 +5290,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.12.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "bytes", "futures", @@ -6458,7 +6460,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "asynchronous-codec", "bytes", @@ -7065,7 +7067,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9eb3030b1ffc23c0969a5ce35d755d8afaf99af7#9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 741aa8cfe81..9453b2f16c2 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "9eb3030b1ffc23c0969a5ce35d755d8afaf99af7" +rev = "e6f9d49109d030dfa6b953b9318fe32ca47cccdc" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] From 9a4dde96fdf68807245365f65c463254cf7621f6 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 11:06:02 -0500 Subject: [PATCH 036/102] use Into to get public key --- .../lighthouse_network/src/discovery/enr_ext.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index eea3029f5d5..e2c87410e8d 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -198,21 +198,20 @@ impl CombinedKeyPublicExt for CombinedPublicKey { /// /// This is only available with the `libp2p` feature flag. fn as_peer_id(&self) -> PeerId { + use libp2p::identity::{ed25519, secp256k1}; match self { Self::Secp256k1(pk) => { let pk_bytes = pk.to_sec1_bytes(); - let libp2p_pk = libp2p::identity::PublicKey::Secp256k1( - libp2p::identity::secp256k1::PublicKey::decode(&pk_bytes) - .expect("valid public key"), - ); + let libp2p_pk: PublicKey = secp256k1::PublicKey::try_from_bytes(&pk_bytes) + .expect("valid public key") + .into(); PeerId::from_public_key(&libp2p_pk) } Self::Ed25519(pk) => { let pk_bytes = pk.to_bytes(); - let libp2p_pk = libp2p::identity::PublicKey::Ed25519( - libp2p::identity::ed25519::PublicKey::decode(&pk_bytes) - .expect("valid public key"), - ); + let libp2p_pk: PublicKey = ed25519::PublicKey::try_from_bytes(&pk_bytes) + .expect("valid public key") + .into(); PeerId::from_public_key(&libp2p_pk) } } From 288bfdbf448b1e9bc7b37ad6b756c6f3e5161d35 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 11:36:00 -0500 Subject: [PATCH 037/102] keypair clones everywhere --- .../lighthouse_network/src/discovery/enr.rs | 4 +-- .../src/discovery/enr_ext.rs | 36 +++++++++---------- .../lighthouse_network/src/discovery/mod.rs | 10 +++--- .../lighthouse_network/src/service/mod.rs | 16 ++++++--- .../lighthouse_network/src/types/globals.rs | 4 +-- boot_node/src/config.rs | 4 +-- lcli/src/generate_bootnode_enr.rs | 9 ++--- 7 files changed, 44 insertions(+), 39 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr.rs b/beacon_node/lighthouse_network/src/discovery/enr.rs index 17eb929ec34..429490d9454 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr.rs @@ -133,7 +133,7 @@ pub fn build_or_load_enr( // Build the local ENR. // Note: Discovery should update the ENR record's IP to the external IP as seen by the // majority of our peers, if the CLI doesn't expressly forbid it. - let enr_key = CombinedKey::from_libp2p(&local_key)?; + let enr_key = CombinedKey::from_libp2p(local_key)?; let mut local_enr = build_enr::(&enr_key, config, enr_fork_id)?; use_or_load_enr(&enr_key, &mut local_enr, config, log)?; @@ -258,4 +258,4 @@ pub fn save_enr_to_disk(dir: &Path, enr: &Enr, log: &slog::Logger) { ); } } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index e2c87410e8d..86eb7972c10 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -37,7 +37,7 @@ pub trait CombinedKeyPublicExt { /// Extend ENR CombinedKey for conversion to libp2p keys. pub trait CombinedKeyExt { /// Converts a libp2p key into an ENR combined key. - fn from_libp2p(key: &libp2p::identity::Keypair) -> Result; + fn from_libp2p(key: Keypair) -> Result; } impl EnrExt for Enr { @@ -219,23 +219,21 @@ impl CombinedKeyPublicExt for CombinedPublicKey { } impl CombinedKeyExt for CombinedKey { - fn from_libp2p(key: &libp2p::identity::Keypair) -> Result { - match key { - Keypair::Secp256k1(key) => { - let secret = - discv5::enr::k256::ecdsa::SigningKey::from_slice(&key.secret().to_bytes()) - .expect("libp2p key must be valid"); - Ok(CombinedKey::Secp256k1(secret)) - } - Keypair::Ed25519(key) => { - let ed_keypair = discv5::enr::ed25519_dalek::SigningKey::from_bytes( - &(key.encode()[..32]) - .try_into() - .expect("libp2p key must be valid"), - ); - Ok(CombinedKey::from(ed_keypair)) - } - Keypair::Ecdsa(_) => Err("Ecdsa keypairs not supported"), + fn from_libp2p(key: Keypair) -> Result { + // TODO: more clones that should not be happening. + if let Ok(key) = key.clone().try_into_secp256k1() { + let secret = discv5::enr::k256::ecdsa::SigningKey::from_slice(&key.secret().to_bytes()) + .expect("libp2p key must be valid"); + Ok(CombinedKey::Secp256k1(secret)) + } else if let Ok(key) = key.try_into_ed25519() { + let ed_keypair = discv5::enr::ed25519_dalek::SigningKey::from_bytes( + &(key.to_bytes()[..32]) + .try_into() + .expect("libp2p key must be valid"), + ); + Ok(CombinedKey::from(ed_keypair)) + } else { + Err("Unsupported keypair kind") } } } @@ -316,4 +314,4 @@ mod tests { assert_eq!(enr.node_id(), node_id); } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 8d4c90e20e5..1e956dcd78e 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -192,7 +192,7 @@ pub struct Discovery { impl Discovery { /// NOTE: Creating discovery requires running within a tokio execution environment. pub async fn new( - local_key: &Keypair, + local_key: Keypair, config: &NetworkConfig, network_globals: Arc>, log: &slog::Logger, @@ -1130,7 +1130,7 @@ mod tests { let keypair = libp2p::identity::Keypair::generate_secp256k1(); let mut config = NetworkConfig::default(); config.set_listening_addr(crate::ListenAddress::unused_v4_ports()); - let enr_key: CombinedKey = CombinedKey::from_libp2p(&keypair).unwrap(); + let enr_key: CombinedKey = CombinedKey::from_libp2p(keypair.clone()).unwrap(); let enr: Enr = build_enr::(&enr_key, &config, &EnrForkId::default()).unwrap(); let log = build_log(slog::Level::Debug, false); let globals = NetworkGlobals::new( @@ -1146,7 +1146,7 @@ mod tests { false, &log, ); - Discovery::new(&keypair, &config, Arc::new(globals), &log) + Discovery::new(keypair, &config, Arc::new(globals), &log) .await .unwrap() } @@ -1193,7 +1193,7 @@ mod tests { fn make_enr(subnet_ids: Vec) -> Enr { let mut builder = EnrBuilder::new("v4"); let keypair = libp2p::identity::Keypair::generate_secp256k1(); - let enr_key: CombinedKey = CombinedKey::from_libp2p(&keypair).unwrap(); + let enr_key: CombinedKey = CombinedKey::from_libp2p(keypair).unwrap(); // set the "attnets" field on our ENR let mut bitfield = BitVector::::new(); @@ -1245,4 +1245,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 62f3dced8c5..ed03d39c82b 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -269,22 +269,28 @@ impl Network { let discovery = { // Build and start the discovery sub-behaviour - let mut discovery = - Discovery::new(&local_keypair, &config, network_globals.clone(), &log).await?; + let mut discovery = Discovery::new( + local_keypair.clone(), + &config, + network_globals.clone(), + &log, + ) + .await?; // start searching for peers discovery.discover_peers(FIND_NODE_QUERY_CLOSEST_PEERS); discovery }; let identify = { + let local_public_key = local_keypair.public(); let identify_config = if config.private { IdentifyConfig::new( "".into(), - local_keypair.public(), // Still send legitimate public key + local_public_key, // Still send legitimate public key ) .with_cache_size(0) } else { - IdentifyConfig::new("eth2/1.0.0".into(), local_keypair.public()) + IdentifyConfig::new("eth2/1.0.0".into(), local_public_key) .with_agent_version(lighthouse_version::version_with_platform()) .with_cache_size(0) }; @@ -1527,4 +1533,4 @@ impl Network { pub async fn next_event(&mut self) -> NetworkEvent { futures::future::poll_fn(|cx| self.poll_network(cx)).await } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/types/globals.rs b/beacon_node/lighthouse_network/src/types/globals.rs index 295616f36ba..4d188829e43 100644 --- a/beacon_node/lighthouse_network/src/types/globals.rs +++ b/beacon_node/lighthouse_network/src/types/globals.rs @@ -136,7 +136,7 @@ impl NetworkGlobals { use crate::CombinedKeyExt; let keypair = libp2p::identity::Keypair::generate_secp256k1(); let enr_key: discv5::enr::CombinedKey = - discv5::enr::CombinedKey::from_libp2p(&keypair).unwrap(); + discv5::enr::CombinedKey::from_libp2p(keypair).unwrap(); let enr = discv5::enr::EnrBuilder::new("v4").build(&enr_key).unwrap(); NetworkGlobals::new( enr, @@ -152,4 +152,4 @@ impl NetworkGlobals { log, ) } -} +} \ No newline at end of file diff --git a/boot_node/src/config.rs b/boot_node/src/config.rs index c4e36022a82..60f74dc86d8 100644 --- a/boot_node/src/config.rs +++ b/boot_node/src/config.rs @@ -80,7 +80,7 @@ impl BootNodeConfig { } let private_key = load_private_key(&network_config, &logger); - let local_key = CombinedKey::from_libp2p(&private_key)?; + let local_key = CombinedKey::from_libp2p(private_key)?; let local_enr = if let Some(dir) = matches.value_of("network-dir") { let network_dir: PathBuf = dir.into(); @@ -190,4 +190,4 @@ impl BootNodeConfigSerialization { enable_enr_auto_update: discv5_config.enr_update, } } -} +} \ No newline at end of file diff --git a/lcli/src/generate_bootnode_enr.rs b/lcli/src/generate_bootnode_enr.rs index 70b7d0bdfac..48d1790ef14 100644 --- a/lcli/src/generate_bootnode_enr.rs +++ b/lcli/src/generate_bootnode_enr.rs @@ -30,7 +30,7 @@ pub fn run(matches: &ArgMatches) -> Result<(), String> { config.enr_tcp6_port = Some(tcp_port); let local_keypair = Keypair::generate_secp256k1(); - let enr_key = CombinedKey::from_libp2p(&local_keypair)?; + let enr_key = CombinedKey::from_libp2p(local_keypair.clone())?; let enr_fork_id = EnrForkId { fork_digest: ChainSpec::compute_fork_digest(genesis_fork_version, Hash256::zero()), next_fork_version: genesis_fork_version, @@ -47,8 +47,9 @@ pub fn run(matches: &ArgMatches) -> Result<(), String> { .write_all(enr.to_base64().as_bytes()) .map_err(|e| format!("Unable to write ENR to {}: {:?}", ENR_FILENAME, e))?; - let secret_bytes = match local_keypair.into_secp256k1() { - Some(key) => key.secret().to_bytes(), + // TODO: this error should be unreachable. + let secret_bytes = match local_keypair.try_into_secp256k1() { + Ok(key) => key.secret().to_bytes(), _ => return Err("Key is not a secp256k1 key".into()), }; @@ -59,4 +60,4 @@ pub fn run(matches: &ArgMatches) -> Result<(), String> { .map_err(|e| format!("Unable to write key to {}: {:?}", NETWORK_KEY_FILENAME, e))?; Ok(()) -} +} \ No newline at end of file From bb360eed27d4b6ec41ce5138ccb9c6f1e85d74a2 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 11:46:59 -0500 Subject: [PATCH 038/102] use new function names --- beacon_node/lighthouse_network/src/service/utils.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index 2a0592540cb..447b89ad49e 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -105,7 +105,7 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { Ok(_) => { // only accept secp256k1 keys for now if let Ok(secret_key) = - libp2p::identity::secp256k1::SecretKey::from_bytes(&mut key_bytes) + libp2p::identity::secp256k1::SecretKey::try_from_bytes(&mut key_bytes) { let kp: libp2p::identity::secp256k1::Keypair = secret_key.into(); debug!(log, "Loaded network key from disk."); @@ -119,7 +119,9 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { // if a key could not be loaded from disk, generate a new one and save it let local_private_key = Keypair::generate_secp256k1(); - if let Some(key) = local_private_key.clone().into_secp256k1() { + // TODO: generate the spcific key type first and then convert it to the wrapper type. This + // avoids the clone and the awkward double conversion + if let Ok(key) = local_private_key.clone().try_into_secp256k1() { let _ = std::fs::create_dir_all(&config.network_dir); match File::create(network_key_f.clone()) .and_then(|mut f| f.write_all(&key.secret().to_bytes())) @@ -278,4 +280,4 @@ pub(crate) fn save_metadata_to_disk( ); } } -} +} \ No newline at end of file From 96afe89beb39eb1390b677e0a1a8419f9c6a54f7 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 11:56:15 -0500 Subject: [PATCH 039/102] more deprecation warns --- .../lighthouse_network/src/discovery/enr_ext.rs | 12 ++++++------ beacon_node/lighthouse_network/src/service/utils.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 86eb7972c10..718f85fe102 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -245,22 +245,22 @@ pub fn peer_id_to_node_id(peer_id: &PeerId) -> Result error::Result { #[allow(dead_code)] fn keypair_from_bytes(mut bytes: Vec) -> error::Result { - libp2p::identity::secp256k1::SecretKey::from_bytes(&mut bytes) + libp2p::identity::secp256k1::SecretKey::try_from_bytes(&mut bytes) .map(|secret| { let keypair: libp2p::identity::secp256k1::Keypair = secret.into(); keypair.into() From b433d7f41600ea1e463163d0ed38d74925a75804 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 11:56:15 -0500 Subject: [PATCH 040/102] more deprecation warns --- .../lighthouse_network/src/discovery/enr_ext.rs | 14 +++++++------- .../lighthouse_network/src/service/utils.rs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 86eb7972c10..8e4b701f598 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -245,22 +245,22 @@ pub fn peer_id_to_node_id(peer_id: &PeerId) -> Result error::Result { #[allow(dead_code)] fn keypair_from_bytes(mut bytes: Vec) -> error::Result { - libp2p::identity::secp256k1::SecretKey::from_bytes(&mut bytes) + libp2p::identity::secp256k1::SecretKey::try_from_bytes(&mut bytes) .map(|secret| { let keypair: libp2p::identity::secp256k1::Keypair = secret.into(); keypair.into() From 9ae2f55d52b54b9422c29b63896f868b74759cb5 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 12:07:16 -0500 Subject: [PATCH 041/102] follow suggested code style --- beacon_node/lighthouse_network/src/config.rs | 27 +++++++++---------- .../lighthouse_network/tests/common.rs | 6 ++--- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/beacon_node/lighthouse_network/src/config.rs b/beacon_node/lighthouse_network/src/config.rs index bf5b36e6d20..5b82de5906b 100644 --- a/beacon_node/lighthouse_network/src/config.rs +++ b/beacon_node/lighthouse_network/src/config.rs @@ -6,10 +6,7 @@ use directory::{ DEFAULT_BEACON_NODE_DIR, DEFAULT_HARDCODED_NETWORK, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR, }; use discv5::{Discv5Config, Discv5ConfigBuilder}; -use libp2p::gossipsub::{ - Config as GossipsubConfig, ConfigBuilder as GossipsubConfigBuilder, FastMessageId, - Message as GossipsubMessage, MessageId, RawMessage as RawGossipsubMessage, ValidationMode, -}; +use libp2p::gossipsub; use libp2p::Multiaddr; use serde_derive::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; @@ -83,7 +80,7 @@ pub struct Config { /// Gossipsub configuration parameters. #[serde(skip)] - pub gs_config: GossipsubConfig, + pub gs_config: gossipsub::Config, /// Discv5 configuration parameters. #[serde(skip)] @@ -265,7 +262,7 @@ impl Default for Config { // Note: Using the default config here. Use `gossipsub_config` function for getting // Lighthouse specific configuration for gossipsub. - let gs_config = GossipsubConfigBuilder::default() + let gs_config = gossipsub::ConfigBuilder::default() .build() .expect("valid gossipsub configuration"); @@ -416,16 +413,16 @@ impl From for NetworkLoad { } /// Return a Lighthouse specific `GossipsubConfig` where the `message_id_fn` depends on the current fork. -pub fn gossipsub_config(network_load: u8, fork_context: Arc) -> GossipsubConfig { +pub fn gossipsub_config(network_load: u8, fork_context: Arc) -> gossipsub::Config { // The function used to generate a gossipsub message id // We use the first 8 bytes of SHA256(topic, data) for content addressing - let fast_gossip_message_id = |message: &RawGossipsubMessage| { + let fast_gossip_message_id = |message: &gossipsub::RawMessage| { let data = [message.topic.as_str().as_bytes(), &message.data].concat(); - FastMessageId::from(&Sha256::digest(data)[..8]) + gossipsub::FastMessageId::from(&Sha256::digest(data)[..8]) }; fn prefix( prefix: [u8; 4], - message: &GossipsubMessage, + message: &gossipsub::Message, fork_context: Arc, ) -> Vec { let topic_bytes = message.topic.as_str().as_bytes(); @@ -451,8 +448,8 @@ pub fn gossipsub_config(network_load: u8, fork_context: Arc) -> Gos } let is_merge_enabled = fork_context.fork_exists(ForkName::Merge); - let gossip_message_id = move |message: &GossipsubMessage| { - MessageId::from( + let gossip_message_id = move |message: &gossipsub::Message| { + gossipsub::MessageId::from( &Sha256::digest( prefix(MESSAGE_DOMAIN_VALID_SNAPPY, message, fork_context.clone()).as_slice(), )[..20], @@ -461,7 +458,7 @@ pub fn gossipsub_config(network_load: u8, fork_context: Arc) -> Gos let load = NetworkLoad::from(network_load); - GossipsubConfigBuilder::default() + gossipsub::ConfigBuilder::default() .max_transmit_size(gossip_max_size(is_merge_enabled)) .heartbeat_interval(load.heartbeat_interval) .mesh_n(load.mesh_n) @@ -474,7 +471,7 @@ pub fn gossipsub_config(network_load: u8, fork_context: Arc) -> Gos .max_messages_per_rpc(Some(500)) // Responses to IWANT can be quite large .history_gossip(load.history_gossip) .validate_messages() // require validation before propagation - .validation_mode(ValidationMode::Anonymous) + .validation_mode(gossipsub::ValidationMode::Anonymous) .duplicate_cache_time(DUPLICATE_CACHE_TIME) .message_id_fn(gossip_message_id) .fast_message_id_fn(fast_gossip_message_id) @@ -563,4 +560,4 @@ pub const fn is_global_ipv6(addr: &Ipv6Addr) -> bool { || is_documentation(addr) || is_unique_local(addr) || is_unicast_link_local(addr)) -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/tests/common.rs b/beacon_node/lighthouse_network/tests/common.rs index 64714cbc0a8..99eea04d1ad 100644 --- a/beacon_node/lighthouse_network/tests/common.rs +++ b/beacon_node/lighthouse_network/tests/common.rs @@ -1,5 +1,5 @@ #![cfg(test)] -use libp2p::gossipsub::GossipsubConfigBuilder; +use libp2p::gossipsub; use lighthouse_network::service::Network as LibP2PService; use lighthouse_network::Enr; use lighthouse_network::EnrExt; @@ -81,7 +81,7 @@ pub fn build_config(port: u16, mut boot_nodes: Vec) -> NetworkConfig { config.boot_nodes_enr.append(&mut boot_nodes); config.network_dir = path.into_path(); // Reduce gossipsub heartbeat parameters - config.gs_config = GossipsubConfigBuilder::from(config.gs_config) + config.gs_config = gossipsub::ConfigBuilder::from(config.gs_config) .heartbeat_initial_delay(Duration::from_millis(500)) .heartbeat_interval(Duration::from_millis(500)) .build() @@ -197,4 +197,4 @@ pub async fn build_linear( }; } nodes -} +} \ No newline at end of file From 007e6db5028e842dfae837151f9c2a9cfeeb4ebf Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 12:18:49 -0500 Subject: [PATCH 042/102] follow suggested code style --- .../lighthouse_network/src/service/mod.rs | 41 ++++++++++--------- .../lighthouse_network/src/types/pubsub.rs | 14 +++---- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index ed03d39c82b..c916b66a123 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -24,13 +24,11 @@ use api_types::{PeerRequestId, Request, RequestId, Response}; use futures::stream::StreamExt; use gossipsub_scoring_parameters::{lighthouse_gossip_thresholds, PeerScoreSettings}; use libp2p::bandwidth::BandwidthSinks; -use libp2p::gossipsub::metrics::Config as GossipsubMetricsConfig; use libp2p::gossipsub::subscription_filter::MaxCountSubscriptionFilter; -use libp2p::gossipsub::PublishError; use libp2p::gossipsub::{ - Event as GossipsubEvent, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, + self, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError, }; -use libp2p::identify::{Behaviour as Identify, Config as IdentifyConfig, Event as IdentifyEvent}; +use libp2p::identify; use libp2p::multiaddr::{Multiaddr, Protocol as MProtocol}; use libp2p::swarm::{Swarm, SwarmBuilder, SwarmEvent}; use libp2p::PeerId; @@ -240,7 +238,7 @@ impl Network { // If metrics are enabled for gossipsub build the configuration let gossipsub_metrics = ctx .gossipsub_registry - .map(|registry| (registry, GossipsubMetricsConfig::default())); + .map(|registry| (registry, gossipsub::metrics::Config::default())); let snappy_transform = SnappyTransform::new(config.gs_config.max_transmit_size()); let mut gossipsub = Gossipsub::new_with_subscription_filter_and_transform( @@ -284,17 +282,17 @@ impl Network { let identify = { let local_public_key = local_keypair.public(); let identify_config = if config.private { - IdentifyConfig::new( + identify::Config::new( "".into(), local_public_key, // Still send legitimate public key ) .with_cache_size(0) } else { - IdentifyConfig::new("eth2/1.0.0".into(), local_public_key) + identify::Config::new("eth2/1.0.0".into(), local_public_key) .with_agent_version(lighthouse_version::version_with_platform()) .with_cache_size(0) }; - Identify::new(identify_config) + identify::Behaviour::new(identify_config) }; let peer_manager = { @@ -500,7 +498,7 @@ impl Network { &mut self.swarm.behaviour_mut().discovery } /// Provides IP addresses and peer information. - pub fn identify_mut(&mut self) -> &mut Identify { + pub fn identify_mut(&mut self) -> &mut identify::Behaviour { &mut self.swarm.behaviour_mut().identify } /// The peer manager that keeps track of peer's reputation and status. @@ -521,7 +519,7 @@ impl Network { &self.swarm.behaviour().discovery } /// Provides IP addresses and peer information. - pub fn identify(&self) -> &Identify { + pub fn identify(&self) -> &identify::Behaviour { &self.swarm.behaviour().identify } /// The peer manager that keeps track of peer's reputation and status. @@ -1052,9 +1050,12 @@ impl Network { /* Sub-behaviour event handling functions */ /// Handle a gossipsub event. - fn inject_gs_event(&mut self, event: GossipsubEvent) -> Option> { + fn inject_gs_event( + &mut self, + event: gossipsub::Event, + ) -> Option> { match event { - GossipsubEvent::Message { + gossipsub::Event::Message { propagation_source, message_id: id, message: gs_msg, @@ -1084,7 +1085,7 @@ impl Network { } } } - GossipsubEvent::Subscribed { peer_id, topic } => { + gossipsub::Event::Subscribed { peer_id, topic } => { if let Ok(topic) = GossipTopic::decode(topic.as_str()) { if let Some(subnet_id) = topic.subnet_id() { self.network_globals @@ -1125,7 +1126,7 @@ impl Network { } } } - GossipsubEvent::Unsubscribed { peer_id, topic } => { + gossipsub::Event::Unsubscribed { peer_id, topic } => { if let Some(subnet_id) = subnet_from_topic_hash(&topic) { self.network_globals .peers @@ -1133,7 +1134,7 @@ impl Network { .remove_subscription(&peer_id, &subnet_id); } } - GossipsubEvent::GossipsubNotSupported { peer_id } => { + gossipsub::Event::GossipsubNotSupported { peer_id } => { debug!(self.log, "Peer does not support gossipsub"; "peer_id" => %peer_id); self.peer_manager_mut().report_peer( &peer_id, @@ -1347,10 +1348,10 @@ impl Network { /// Handle an identify event. fn inject_identify_event( &mut self, - event: IdentifyEvent, + event: identify::Event, ) -> Option> { match event { - IdentifyEvent::Received { peer_id, mut info } => { + identify::Event::Received { peer_id, mut info } => { if info.listen_addrs.len() > MAX_IDENTIFY_ADDRESSES { debug!( self.log, @@ -1361,9 +1362,9 @@ impl Network { // send peer info to the peer manager. self.peer_manager_mut().identify(&peer_id, &info); } - IdentifyEvent::Sent { .. } => {} - IdentifyEvent::Error { .. } => {} - IdentifyEvent::Pushed { .. } => {} + identify::Event::Sent { .. } => {} + identify::Event::Error { .. } => {} + identify::Event::Pushed { .. } => {} } None } diff --git a/beacon_node/lighthouse_network/src/types/pubsub.rs b/beacon_node/lighthouse_network/src/types/pubsub.rs index 7dceb271157..fac89c7ccc6 100644 --- a/beacon_node/lighthouse_network/src/types/pubsub.rs +++ b/beacon_node/lighthouse_network/src/types/pubsub.rs @@ -2,9 +2,7 @@ use crate::types::{GossipEncoding, GossipKind, GossipTopic}; use crate::TopicHash; -use libp2p::gossipsub::{ - DataTransform, Message as GossipsubMessage, RawMessage as RawGossipsubMessage, -}; +use libp2p::gossipsub; use snap::raw::{decompress_len, Decoder, Encoder}; use ssz::{Decode, Encode}; use std::boxed::Box; @@ -58,12 +56,12 @@ impl SnappyTransform { } } -impl DataTransform for SnappyTransform { +impl gossipsub::DataTransform for SnappyTransform { // Provides the snappy decompression from RawGossipsubMessages fn inbound_transform( &self, - raw_message: RawGossipsubMessage, - ) -> Result { + raw_message: gossipsub::RawMessage, + ) -> Result { // check the length of the raw bytes let len = decompress_len(&raw_message.data)?; if len > self.max_size_per_message { @@ -77,7 +75,7 @@ impl DataTransform for SnappyTransform { let decompressed_data = decoder.decompress_vec(&raw_message.data)?; // Build the GossipsubMessage struct - Ok(GossipsubMessage { + Ok(gossipsub::Message { source: raw_message.source, data: decompressed_data, sequence_number: raw_message.sequence_number, @@ -321,4 +319,4 @@ impl std::fmt::Display for PubsubMessage { } } } -} +} \ No newline at end of file From c97c5ff45c2b1673307731a03e3662ed7dd1f120 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 13:24:59 -0500 Subject: [PATCH 043/102] follow suggested code style --- .../lighthouse_network/src/service/behaviour.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/behaviour.rs b/beacon_node/lighthouse_network/src/service/behaviour.rs index e541bd8b0ee..6d01f8ac0a6 100644 --- a/beacon_node/lighthouse_network/src/service/behaviour.rs +++ b/beacon_node/lighthouse_network/src/service/behaviour.rs @@ -3,18 +3,18 @@ use crate::peer_manager::PeerManager; use crate::rpc::{ReqId, RPC}; use crate::types::SnappyTransform; +use libp2p::gossipsub; use libp2p::gossipsub::subscription_filter::{ MaxCountSubscriptionFilter, WhitelistSubscriptionFilter, }; -use libp2p::gossipsub::Behaviour as BaseGossipsub; -use libp2p::identify::Behaviour as Identify; +use libp2p::identify; use libp2p::swarm::NetworkBehaviour; use types::EthSpec; use super::api_types::RequestId; pub type SubscriptionFilter = MaxCountSubscriptionFilter; -pub type Gossipsub = BaseGossipsub; +pub type Gossipsub = gossipsub::Behaviour; #[derive(NetworkBehaviour)] pub(crate) struct Behaviour @@ -31,9 +31,9 @@ where /// Keep regular connection to peers and disconnect if absent. // NOTE: The id protocol is used for initial interop. This will be removed by mainnet. /// Provides IP addresses and peer information. - pub identify: Identify, + pub identify: identify::Behaviour, /// The peer manager that keeps track of peer's reputation and status. pub peer_manager: PeerManager, /// Keep track of active and pending connections to enforce hard limits. pub connection_limits: libp2p::connection_limits::Behaviour, -} +} \ No newline at end of file From e01e17ce3b462400e2adc0410d46f2b21d6c161b Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 13:49:09 -0500 Subject: [PATCH 044/102] incrementally addressing deprecations --- Cargo.lock | 188 ++++++++---------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/service/utils.rs | 17 +- 3 files changed, 90 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 22358d9dc55..33f009a0cb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3888,9 +3888,9 @@ dependencies = [ [[package]] name = "interceptor" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5227f64c1b6aa2262b3e6433b75b22e587298cc3edece3ffd8ac86ca180680b8" +checksum = "1e8a11ae2da61704edada656798b61c94b35ecac2c58eb955156987d5e6be90b" dependencies = [ "async-trait", "bytes", @@ -3902,7 +3902,7 @@ dependencies = [ "tokio", "waitgroup", "webrtc-srtp", - "webrtc-util 0.6.0", + "webrtc-util", ] [[package]] @@ -4190,8 +4190,8 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.51.3" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.52.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "bytes", "futures", @@ -4200,7 +4200,7 @@ dependencies = [ "instant", "libp2p-allow-block-list", "libp2p-connection-limits", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", @@ -4221,10 +4221,10 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" -version = "0.1.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.2.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "libp2p-swarm", "void", @@ -4232,10 +4232,10 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" -version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.2.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "libp2p-swarm", "void", @@ -4267,7 +4267,7 @@ dependencies = [ "prost", "prost-build", "rand 0.8.5", - "rw-stream-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rw-stream-sink 0.3.0", "sha2 0.10.7", "smallvec", "thiserror", @@ -4278,8 +4278,8 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.39.2" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.40.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "either", "fnv", @@ -4290,13 +4290,13 @@ dependencies = [ "log", "multiaddr 0.17.1", "multihash 0.17.0", - "multistream-select 0.12.1", + "multistream-select 0.13.0", "once_cell", "parking_lot 0.12.1", "pin-project", "quick-protobuf", "rand 0.8.5", - "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc)", + "rw-stream-sink 0.4.0", "smallvec", "thiserror", "unsigned-varint 0.7.1", @@ -4305,11 +4305,11 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.39.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.40.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "futures", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "log", "parking_lot 0.12.1", @@ -4319,8 +4319,8 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.44.3" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.45.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4331,7 +4331,7 @@ dependencies = [ "futures", "hex_fmt", "instant", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "libp2p-swarm", "log", @@ -4350,14 +4350,14 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.42.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.43.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "asynchronous-codec", "either", "futures", "futures-timer", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "libp2p-swarm", "log", @@ -4371,8 +4371,8 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.1.2" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.2.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "asn1_der", "bs58", @@ -4393,13 +4393,13 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.43.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.44.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "data-encoding", "futures", "if-watch", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "libp2p-swarm", "log", @@ -4413,10 +4413,10 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.12.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.13.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", @@ -4426,13 +4426,13 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.42.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.43.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "log", "once_cell", @@ -4448,13 +4448,13 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.39.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.40.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "log", "quick-protobuf", @@ -4464,14 +4464,14 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.7.0-alpha.3" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.8.0-alpha" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "bytes", "futures", "futures-timer", "if-watch", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "libp2p-tls", "log", @@ -4485,15 +4485,15 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.42.2" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.43.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "libp2p-swarm-derive", "log", @@ -4505,8 +4505,8 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.32.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.33.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "heck", "quote", @@ -4515,14 +4515,14 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.39.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.40.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "futures", "futures-timer", "if-watch", "libc", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "log", "socket2 0.4.9", @@ -4531,12 +4531,12 @@ dependencies = [ [[package]] name = "libp2p-tls" -version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.2.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "futures", "futures-rustls", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "rcgen 0.10.0", "ring", @@ -4549,8 +4549,8 @@ dependencies = [ [[package]] name = "libp2p-webrtc" -version = "0.4.0-alpha.4" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.5.0-alpha" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "async-trait", "asynchronous-codec", @@ -4559,7 +4559,7 @@ dependencies = [ "futures-timer", "hex", "if-watch", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "libp2p-noise", "log", @@ -4580,18 +4580,18 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.42.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "libp2p-identity", "log", "parking_lot 0.12.1", "quicksink", - "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc)", + "rw-stream-sink 0.4.0", "soketto", "url", "webpki-roots 0.23.1", @@ -4599,11 +4599,11 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.44.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "futures", - "libp2p-core 0.39.2", + "libp2p-core 0.40.0", "log", "thiserror", "yamux", @@ -5289,8 +5289,8 @@ dependencies = [ [[package]] name = "multistream-select" -version = "0.12.1" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.13.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "bytes", "futures", @@ -6459,8 +6459,8 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" -version = "0.1.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.2.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "asynchronous-codec", "bytes", @@ -6880,13 +6880,13 @@ dependencies = [ [[package]] name = "rtcp" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70fd6d59c624d6f774b23569d57d255fd0eee3323e6df797d6d606989e8c038e" +checksum = "1919efd6d4a6a85d13388f9487549bb8e359f17198cc03ffd72f79b553873691" dependencies = [ "bytes", "thiserror", - "webrtc-util 0.6.0", + "webrtc-util", ] [[package]] @@ -6915,7 +6915,7 @@ dependencies = [ "rand 0.8.5", "serde", "thiserror", - "webrtc-util 0.7.0", + "webrtc-util", ] [[package]] @@ -7066,8 +7066,8 @@ dependencies = [ [[package]] name = "rw-stream-sink" -version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=e6f9d49109d030dfa6b953b9318fe32ca47cccdc#e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +version = "0.4.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" dependencies = [ "futures", "pin-project", @@ -8023,7 +8023,7 @@ dependencies = [ "thiserror", "tokio", "url", - "webrtc-util 0.7.0", + "webrtc-util", ] [[package]] @@ -8925,7 +8925,7 @@ dependencies = [ "stun", "thiserror", "tokio", - "webrtc-util 0.7.0", + "webrtc-util", ] [[package]] @@ -9589,7 +9589,7 @@ dependencies = [ "webrtc-media", "webrtc-sctp", "webrtc-srtp", - "webrtc-util 0.7.0", + "webrtc-util", ] [[package]] @@ -9604,7 +9604,7 @@ dependencies = [ "thiserror", "tokio", "webrtc-sctp", - "webrtc-util 0.7.0", + "webrtc-util", ] [[package]] @@ -9643,7 +9643,7 @@ dependencies = [ "thiserror", "tokio", "webpki 0.21.4", - "webrtc-util 0.7.0", + "webrtc-util", "x25519-dalek 2.0.0-pre.1", "x509-parser 0.13.2", ] @@ -9669,7 +9669,7 @@ dependencies = [ "uuid 1.3.4", "waitgroup", "webrtc-mdns", - "webrtc-util 0.7.0", + "webrtc-util", ] [[package]] @@ -9682,7 +9682,7 @@ dependencies = [ "socket2 0.4.9", "thiserror", "tokio", - "webrtc-util 0.7.0", + "webrtc-util", ] [[package]] @@ -9712,7 +9712,7 @@ dependencies = [ "rand 0.8.5", "thiserror", "tokio", - "webrtc-util 0.7.0", + "webrtc-util", ] [[package]] @@ -9736,29 +9736,7 @@ dependencies = [ "subtle", "thiserror", "tokio", - "webrtc-util 0.7.0", -] - -[[package]] -name = "webrtc-util" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4921b6a976b5570004e9c1b29ae109a81a73e2370e80627efa315f9ad0105f43" -dependencies = [ - "async-trait", - "bitflags 1.3.2", - "bytes", - "cc", - "ipnet", - "lazy_static", - "libc", - "log", - "nix 0.24.3", - "parking_lot 0.12.1", - "rand 0.8.5", - "thiserror", - "tokio", - "winapi", + "webrtc-util", ] [[package]] diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 9453b2f16c2..990203d0a64 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "e6f9d49109d030dfa6b953b9318fe32ca47cccdc" +rev = "4ca888580c113916a36951106c4caaa13724f1ff" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index f28f3af6f9c..d0f0f9ba66e 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -10,7 +10,7 @@ use libp2p::core::{ }; use libp2p::gossipsub::subscription_filter::WhitelistSubscriptionFilter; use libp2p::gossipsub::IdentTopic as Topic; -use libp2p::{core, noise, PeerId, Transport, TransportExt}; +use libp2p::{core, noise, yamux, PeerId, Transport, TransportExt}; use prometheus_client::registry::Registry; use slog::{debug, warn}; use ssz::Decode; @@ -53,8 +53,8 @@ pub fn build_transport( }; // yamux config - let mut yamux_config = libp2p::yamux::YamuxConfig::default(); - yamux_config.set_window_update_mode(libp2p::yamux::WindowUpdateMode::on_read()); + let mut yamux_config = yamux::Config::default(); + yamux_config.set_window_update_mode(yamux::WindowUpdateMode::on_read()); let (transport, bandwidth) = transport .upgrade(core::upgrade::Version::V1) .authenticate(generate_noise_config(&local_private_key)) @@ -141,13 +141,8 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { } /// Generate authenticated XX Noise config from identity keys -fn generate_noise_config( - identity_keypair: &Keypair, -) -> noise::NoiseAuthenticated { - let static_dh_keys = noise::Keypair::::new() - .into_authentic(identity_keypair) - .expect("signing can fail only once during starting a node"); - noise::NoiseConfig::xx(static_dh_keys).into_authenticated() +fn generate_noise_config(identity_keypair: &Keypair) -> noise::Config { + noise::Config::new(identity_keypair).expect("signing can fail only once during starting a node") } /// For a multiaddr that ends with a peer id, this strips this suffix. Rust-libp2p @@ -280,4 +275,4 @@ pub(crate) fn save_metadata_to_disk( ); } } -} \ No newline at end of file +} From 9949dfabb0d53326f27244f7db99a066809ead28 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 14:02:24 -0500 Subject: [PATCH 045/102] use gossipsub types from the root --- Cargo.lock | 47 +++++++++---------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/discovery/mod.rs | 2 +- .../src/service/behaviour.rs | 8 ++-- .../lighthouse_network/src/service/mod.rs | 7 ++- .../lighthouse_network/src/service/utils.rs | 9 ++-- 6 files changed, 35 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33f009a0cb8..415be203754 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4191,7 +4191,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "bytes", "futures", @@ -4222,7 +4222,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4233,7 +4233,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4279,7 +4279,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "either", "fnv", @@ -4306,7 +4306,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4320,7 +4320,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4342,7 +4342,6 @@ dependencies = [ "regex", "sha2 0.10.7", "smallvec", - "thiserror", "unsigned-varint 0.7.1", "void", "wasm-timer", @@ -4351,7 +4350,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "asynchronous-codec", "either", @@ -4372,7 +4371,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "asn1_der", "bs58", @@ -4394,7 +4393,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "data-encoding", "futures", @@ -4414,7 +4413,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4427,7 +4426,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4449,7 +4448,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "asynchronous-codec", "bytes", @@ -4465,7 +4464,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "bytes", "futures", @@ -4486,7 +4485,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "either", "fnv", @@ -4506,7 +4505,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "heck", "quote", @@ -4516,7 +4515,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "futures", "futures-timer", @@ -4532,7 +4531,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "futures", "futures-rustls", @@ -4550,7 +4549,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "async-trait", "asynchronous-codec", @@ -4581,7 +4580,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "either", "futures", @@ -4600,7 +4599,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5290,7 +5289,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "bytes", "futures", @@ -6460,7 +6459,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "asynchronous-codec", "bytes", @@ -7067,7 +7066,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4ca888580c113916a36951106c4caaa13724f1ff#4ca888580c113916a36951106c4caaa13724f1ff" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 990203d0a64..93c1e6a1a72 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "4ca888580c113916a36951106c4caaa13724f1ff" +rev = "25d14349cc32f7a8e3feffb931ba2e84cccb0013" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 1e956dcd78e..7430cd02add 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -1245,4 +1245,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/service/behaviour.rs b/beacon_node/lighthouse_network/src/service/behaviour.rs index 6d01f8ac0a6..a830a9c1efd 100644 --- a/beacon_node/lighthouse_network/src/service/behaviour.rs +++ b/beacon_node/lighthouse_network/src/service/behaviour.rs @@ -4,16 +4,14 @@ use crate::rpc::{ReqId, RPC}; use crate::types::SnappyTransform; use libp2p::gossipsub; -use libp2p::gossipsub::subscription_filter::{ - MaxCountSubscriptionFilter, WhitelistSubscriptionFilter, -}; use libp2p::identify; use libp2p::swarm::NetworkBehaviour; use types::EthSpec; use super::api_types::RequestId; -pub type SubscriptionFilter = MaxCountSubscriptionFilter; +pub type SubscriptionFilter = + gossipsub::MaxCountSubscriptionFilter; pub type Gossipsub = gossipsub::Behaviour; #[derive(NetworkBehaviour)] @@ -36,4 +34,4 @@ where pub peer_manager: PeerManager, /// Keep track of active and pending connections to enforce hard limits. pub connection_limits: libp2p::connection_limits::Behaviour, -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index c916b66a123..a98d311b63e 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -24,7 +24,6 @@ use api_types::{PeerRequestId, Request, RequestId, Response}; use futures::stream::StreamExt; use gossipsub_scoring_parameters::{lighthouse_gossip_thresholds, PeerScoreSettings}; use libp2p::bandwidth::BandwidthSinks; -use libp2p::gossipsub::subscription_filter::MaxCountSubscriptionFilter; use libp2p::gossipsub::{ self, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError, }; @@ -223,7 +222,7 @@ impl Network { let update_gossipsub_scores = tokio::time::interval(params.decay_interval); let possible_fork_digests = ctx.fork_context.all_fork_digests(); - let filter = MaxCountSubscriptionFilter { + let filter = gossipsub::MaxCountSubscriptionFilter { filter: utils::create_whitelist_filter( possible_fork_digests, ctx.chain_spec.attestation_subnet_count, @@ -238,7 +237,7 @@ impl Network { // If metrics are enabled for gossipsub build the configuration let gossipsub_metrics = ctx .gossipsub_registry - .map(|registry| (registry, gossipsub::metrics::Config::default())); + .map(|registry| (registry, gossipsub::MetricsConfig::default())); let snappy_transform = SnappyTransform::new(config.gs_config.max_transmit_size()); let mut gossipsub = Gossipsub::new_with_subscription_filter_and_transform( @@ -1534,4 +1533,4 @@ impl Network { pub async fn next_event(&mut self) -> NetworkEvent { futures::future::poll_fn(|cx| self.poll_network(cx)).await } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index d0f0f9ba66e..85bb92eadc0 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -8,8 +8,7 @@ use libp2p::bandwidth::BandwidthSinks; use libp2p::core::{ identity::Keypair, multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed, }; -use libp2p::gossipsub::subscription_filter::WhitelistSubscriptionFilter; -use libp2p::gossipsub::IdentTopic as Topic; +use libp2p::gossipsub; use libp2p::{core, noise, yamux, PeerId, Transport, TransportExt}; use prometheus_client::registry::Registry; use slog::{debug, warn}; @@ -222,11 +221,11 @@ pub(crate) fn create_whitelist_filter( possible_fork_digests: Vec<[u8; 4]>, attestation_subnet_count: u64, sync_committee_subnet_count: u64, -) -> WhitelistSubscriptionFilter { +) -> gossipsub::WhitelistSubscriptionFilter { let mut possible_hashes = HashSet::new(); for fork_digest in possible_fork_digests { let mut add = |kind| { - let topic: Topic = + let topic: gossipsub::IdentTopic = GossipTopic::new(kind, GossipEncoding::SSZSnappy, fork_digest).into(); possible_hashes.insert(topic.hash()); }; @@ -248,7 +247,7 @@ pub(crate) fn create_whitelist_filter( add(SyncCommitteeMessage(SyncSubnetId::new(id))); } } - WhitelistSubscriptionFilter(possible_hashes) + gossipsub::WhitelistSubscriptionFilter(possible_hashes) } /// Persist metadata to disk From fcbae566d5fcb826cbd622efc910403ef356fafa Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 14:15:50 -0500 Subject: [PATCH 046/102] remove ProtocolName --- Cargo.lock | 54 +++++++++---------- beacon_node/lighthouse_network/Cargo.toml | 4 +- .../lighthouse_network/src/rpc/protocol.rs | 16 +++--- .../lighthouse_network/src/service/mod.rs | 2 +- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 415be203754..2e36dabde36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4191,7 +4191,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "bytes", "futures", @@ -4222,7 +4222,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4233,7 +4233,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4279,7 +4279,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "either", "fnv", @@ -4306,7 +4306,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4320,7 +4320,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4350,7 +4350,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "asynchronous-codec", "either", @@ -4371,7 +4371,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "asn1_der", "bs58", @@ -4393,7 +4393,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "data-encoding", "futures", @@ -4404,7 +4404,7 @@ dependencies = [ "log", "rand 0.8.5", "smallvec", - "socket2 0.4.9", + "socket2 0.5.3", "tokio", "trust-dns-proto", "void", @@ -4413,7 +4413,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4426,7 +4426,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4448,7 +4448,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "asynchronous-codec", "bytes", @@ -4464,7 +4464,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "bytes", "futures", @@ -4485,7 +4485,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "either", "fnv", @@ -4505,7 +4505,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "heck", "quote", @@ -4515,7 +4515,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "futures", "futures-timer", @@ -4524,14 +4524,14 @@ dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", "log", - "socket2 0.4.9", + "socket2 0.5.3", "tokio", ] [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "futures", "futures-rustls", @@ -4549,7 +4549,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "async-trait", "asynchronous-codec", @@ -4580,7 +4580,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "either", "futures", @@ -4599,7 +4599,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5289,7 +5289,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "bytes", "futures", @@ -6327,9 +6327,9 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6fa99d535dd930d1249e6c79cb3c2915f9172a540fe2b02a4c8f9ca954721e" +checksum = "e227aeb6c2cfec819e999c4773b35f8c7fa37298a203ff46420095458eee567e" dependencies = [ "dtoa", "itoa", @@ -6459,7 +6459,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "asynchronous-codec", "bytes", @@ -7066,7 +7066,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25d14349cc32f7a8e3feffb931ba2e84cccb0013#25d14349cc32f7a8e3feffb931ba2e84cccb0013" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 93c1e6a1a72..35945b89b56 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -40,7 +40,7 @@ directory = { path = "../../common/directory" } regex = "1.5.5" strum = { version = "0.24.0", features = ["derive"] } superstruct = "0.5.0" -prometheus-client = "0.19.0" +prometheus-client = "0.20.0" unused_port = { path = "../../common/unused_port" } delay_map = "0.3.0" void = "1" @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "25d14349cc32f7a8e3feffb931ba2e84cccb0013" +rev = "c93f753018af3a63c07e38c09672e0e1e8f1a385" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/rpc/protocol.rs b/beacon_node/lighthouse_network/src/rpc/protocol.rs index ea39c1423a3..bc445f98070 100644 --- a/beacon_node/lighthouse_network/src/rpc/protocol.rs +++ b/beacon_node/lighthouse_network/src/rpc/protocol.rs @@ -7,7 +7,7 @@ use crate::rpc::{ use futures::future::BoxFuture; use futures::prelude::{AsyncRead, AsyncWrite}; use futures::{FutureExt, StreamExt}; -use libp2p::core::{InboundUpgrade, ProtocolName, UpgradeInfo}; +use libp2p::core::{InboundUpgrade, UpgradeInfo}; use ssz::Encode; use ssz_types::VariableList; use std::io; @@ -313,6 +313,12 @@ pub struct ProtocolId { protocol_id: String, } +impl AsRef for ProtocolId { + fn as_ref(&self) -> &str { + self.protocol_id.as_ref() + } +} + impl ProtocolId { /// Returns min and max size for messages of given protocol id requests. pub fn rpc_request_limits(&self) -> RpcLimits { @@ -407,12 +413,6 @@ impl ProtocolId { } } -impl ProtocolName for ProtocolId { - fn protocol_name(&self) -> &[u8] { - self.protocol_id.as_bytes() - } -} - /* Inbound upgrade */ // The inbound protocol reads the request, decodes it and returns the stream to the protocol @@ -660,4 +660,4 @@ impl RPCError { e => e.into(), } } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index a98d311b63e..f7c6f8ddc40 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -237,7 +237,7 @@ impl Network { // If metrics are enabled for gossipsub build the configuration let gossipsub_metrics = ctx .gossipsub_registry - .map(|registry| (registry, gossipsub::MetricsConfig::default())); + .map(|registry| (registry, Default::default())); let snappy_transform = SnappyTransform::new(config.gs_config.max_transmit_size()); let mut gossipsub = Gossipsub::new_with_subscription_filter_and_transform( From 0ce49bd57454cf8bf404094579cc6bebd6f23ff9 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 14:21:24 -0500 Subject: [PATCH 047/102] no deprecations checkpoint --- Cargo.lock | 91 +++++++++++------------ beacon_node/lighthouse_network/Cargo.toml | 2 +- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e36dabde36..33d58b479bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1692,7 +1692,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", - "pem-rfc7468", + "pem-rfc7468 0.6.0", "zeroize", ] @@ -1703,6 +1703,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" dependencies = [ "const-oid", + "pem-rfc7468 0.7.0", "zeroize", ] @@ -1983,18 +1984,6 @@ dependencies = [ "signature 1.6.4", ] -[[package]] -name = "ecdsa" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12844141594ad74185a926d030f3b605f6a903b4e3fec351f3ea338ac5b7637e" -dependencies = [ - "der 0.6.1", - "elliptic-curve 0.12.3", - "rfc6979 0.3.1", - "signature 2.0.0", -] - [[package]] name = "ecdsa" version = "0.16.7" @@ -2107,7 +2096,7 @@ dependencies = [ "generic-array", "group 0.12.1", "hkdf", - "pem-rfc7468", + "pem-rfc7468 0.6.0", "pkcs8 0.9.0", "rand_core 0.6.4", "sec1 0.3.0", @@ -2127,6 +2116,7 @@ dependencies = [ "ff 0.13.0", "generic-array", "group 0.13.0", + "pem-rfc7468 0.7.0", "pkcs8 0.10.2", "rand_core 0.6.4", "sec1 0.7.2", @@ -4191,7 +4181,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "bytes", "futures", @@ -4222,7 +4212,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4233,7 +4223,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4279,7 +4269,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "either", "fnv", @@ -4306,7 +4296,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4320,7 +4310,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4350,7 +4340,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "asynchronous-codec", "either", @@ -4371,7 +4361,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "asn1_der", "bs58", @@ -4380,10 +4370,10 @@ dependencies = [ "log", "multiaddr 0.17.1", "multihash 0.17.0", - "p256 0.12.0", + "p256 0.13.2", "quick-protobuf", "rand 0.8.5", - "sec1 0.3.0", + "sec1 0.7.2", "sha2 0.10.7", "thiserror", "void", @@ -4393,7 +4383,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "data-encoding", "futures", @@ -4413,7 +4403,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4426,7 +4416,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4448,7 +4438,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "asynchronous-codec", "bytes", @@ -4464,7 +4454,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "bytes", "futures", @@ -4485,7 +4475,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "either", "fnv", @@ -4505,7 +4495,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "heck", "quote", @@ -4515,7 +4505,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "futures", "futures-timer", @@ -4531,7 +4521,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "futures", "futures-rustls", @@ -4549,7 +4539,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "async-trait", "asynchronous-codec", @@ -4580,7 +4570,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "either", "futures", @@ -4599,7 +4589,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5289,7 +5279,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "bytes", "futures", @@ -5775,12 +5765,12 @@ dependencies = [ [[package]] name = "p256" -version = "0.12.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c124b3cbce43bcbac68c58ec181d98ed6cc7e6d0aa7c3ba97b2563410b0e55" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "ecdsa 0.15.1", - "elliptic-curve 0.12.3", + "ecdsa 0.16.7", + "elliptic-curve 0.13.5", "primeorder", "sha2 0.10.7", ] @@ -5960,6 +5950,15 @@ dependencies = [ "base64ct", ] +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.0" @@ -6215,11 +6214,11 @@ dependencies = [ [[package]] name = "primeorder" -version = "0.12.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b54f7131b3dba65a2f414cf5bd25b66d4682e4608610668eae785750ba4c5b2" +checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" dependencies = [ - "elliptic-curve 0.12.3", + "elliptic-curve 0.13.5", ] [[package]] @@ -6459,7 +6458,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "asynchronous-codec", "bytes", @@ -7066,7 +7065,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c93f753018af3a63c07e38c09672e0e1e8f1a385#c93f753018af3a63c07e38c09672e0e1e8f1a385" +source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 35945b89b56..3d72c704da2 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "c93f753018af3a63c07e38c09672e0e1e8f1a385" +rev = "14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] From 06b9da1f05a8450e125be4f8346c73dd3485838d Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 14:32:22 -0500 Subject: [PATCH 048/102] remove handling of error that was dead code in libp2p --- Cargo.lock | 46 +++++++++---------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/rpc/handler.rs | 3 +- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33d58b479bd..97abc83e82b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4181,7 +4181,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "bytes", "futures", @@ -4212,7 +4212,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4223,7 +4223,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4269,7 +4269,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "either", "fnv", @@ -4296,7 +4296,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4310,7 +4310,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4340,7 +4340,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "asynchronous-codec", "either", @@ -4361,7 +4361,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "asn1_der", "bs58", @@ -4383,7 +4383,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "data-encoding", "futures", @@ -4403,7 +4403,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4416,7 +4416,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4438,7 +4438,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "asynchronous-codec", "bytes", @@ -4454,7 +4454,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "bytes", "futures", @@ -4475,7 +4475,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "either", "fnv", @@ -4495,7 +4495,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "heck", "quote", @@ -4505,7 +4505,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "futures", "futures-timer", @@ -4521,7 +4521,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "futures", "futures-rustls", @@ -4539,7 +4539,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "async-trait", "asynchronous-codec", @@ -4570,7 +4570,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "either", "futures", @@ -4589,7 +4589,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5279,7 +5279,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "bytes", "futures", @@ -6458,7 +6458,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "asynchronous-codec", "bytes", @@ -7065,7 +7065,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329#14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 3d72c704da2..9f6ca27aff2 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "14938043cfb6c99a9fc9fb7f6fd3ecc4296b6329" +rev = "53e53709191d57ba893d3dd817285267b49394f8" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index c393679d7c0..2127c8c88d0 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -991,7 +991,6 @@ where self.outbound_io_error_retries = 0; // map the error let error = match error { - ConnectionHandlerUpgrErr::Timer => RPCError::InternalError("Timer failed"), ConnectionHandlerUpgrErr::Timeout => RPCError::NegotiationTimeout, ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(e)) => e, ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Select(NegotiationError::Failed)) => { @@ -1062,4 +1061,4 @@ async fn send_message_to_inbound_substream( // Everything worked as expected return the result. send_result.map(|_| (substream, false)) } -} \ No newline at end of file +} From 0f9f012ed9935c71d4afaea6ca2870427fd8ec0e Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 14:37:05 -0500 Subject: [PATCH 049/102] remove deprecated ban reports --- Cargo.lock | 46 +++++++++---------- beacon_node/lighthouse_network/Cargo.toml | 3 +- .../lighthouse_network/src/discovery/mod.rs | 4 +- .../lighthouse_network/src/service/mod.rs | 9 ---- 4 files changed, 27 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97abc83e82b..1ac16208e75 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4181,7 +4181,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "bytes", "futures", @@ -4212,7 +4212,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4223,7 +4223,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4269,7 +4269,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "either", "fnv", @@ -4296,7 +4296,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4310,7 +4310,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4340,7 +4340,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "asynchronous-codec", "either", @@ -4361,7 +4361,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "asn1_der", "bs58", @@ -4383,7 +4383,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "data-encoding", "futures", @@ -4403,7 +4403,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4416,7 +4416,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4438,7 +4438,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "asynchronous-codec", "bytes", @@ -4454,7 +4454,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "bytes", "futures", @@ -4475,7 +4475,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "either", "fnv", @@ -4495,7 +4495,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "heck", "quote", @@ -4505,7 +4505,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "futures", "futures-timer", @@ -4521,7 +4521,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "futures", "futures-rustls", @@ -4539,7 +4539,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "async-trait", "asynchronous-codec", @@ -4570,7 +4570,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "either", "futures", @@ -4589,7 +4589,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5279,7 +5279,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "bytes", "futures", @@ -6458,7 +6458,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "asynchronous-codec", "bytes", @@ -7065,7 +7065,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=53e53709191d57ba893d3dd817285267b49394f8#53e53709191d57ba893d3dd817285267b49394f8" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 9f6ca27aff2..11e63e23efa 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,8 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "53e53709191d57ba893d3dd817285267b49394f8" +# rev = "0e36c7c072a79e5f32c3a4f98d3423575108cf14" +rev = "b4e724dd72163d7bb25e45feba5371ab2618df67" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 7430cd02add..4df67147e6d 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -1098,7 +1098,7 @@ impl Discovery { } DialError::DialPeerConditionFalse(_) | DialError::Aborted => {} #[allow(deprecated)] - DialError::ConnectionLimit(_) | DialError::Banned => {} + DialError::ConnectionLimit(_) => {} } } } @@ -1245,4 +1245,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index f7c6f8ddc40..5e578dd68ef 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -1464,15 +1464,6 @@ impl Network { debug!(self.log, "Failed to dial address"; "peer_id" => ?peer_id, "error" => %error); None } - // We still need to handle this during the deprecation period anyway. - #[allow(deprecated)] - SwarmEvent::BannedPeer { - peer_id, - endpoint: _, - } => { - debug!(self.log, "Banned peer connection rejected"; "peer_id" => %peer_id); - None - } SwarmEvent::NewListenAddr { address, .. } => { Some(NetworkEvent::NewListenAddr(address)) } From 3a09b5d93271db6ec629fdf06504263461493669 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 23 Jun 2023 15:04:55 -0500 Subject: [PATCH 050/102] placeholders everywhere --- Cargo.lock | 46 +++++++-------- beacon_node/lighthouse_network/Cargo.toml | 3 +- .../lighthouse_network/src/discovery/mod.rs | 55 ++++++++++++++---- .../src/peer_manager/network_behaviour.rs | 26 +++++++-- beacon_node/lighthouse_network/src/rpc/mod.rs | 57 +++++++++++++------ 5 files changed, 128 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1ac16208e75..0c4d7914614 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4181,7 +4181,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "bytes", "futures", @@ -4212,7 +4212,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4223,7 +4223,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4269,7 +4269,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "either", "fnv", @@ -4296,7 +4296,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4310,7 +4310,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4340,7 +4340,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "asynchronous-codec", "either", @@ -4361,7 +4361,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "asn1_der", "bs58", @@ -4383,7 +4383,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "data-encoding", "futures", @@ -4403,7 +4403,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4416,7 +4416,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4438,7 +4438,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "asynchronous-codec", "bytes", @@ -4454,7 +4454,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "bytes", "futures", @@ -4475,7 +4475,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "either", "fnv", @@ -4495,7 +4495,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "heck", "quote", @@ -4505,7 +4505,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "futures", "futures-timer", @@ -4521,7 +4521,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "futures", "futures-rustls", @@ -4539,7 +4539,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "async-trait", "asynchronous-codec", @@ -4570,7 +4570,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "either", "futures", @@ -4589,7 +4589,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5279,7 +5279,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "bytes", "futures", @@ -6458,7 +6458,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "asynchronous-codec", "bytes", @@ -7065,7 +7065,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=b4e724dd72163d7bb25e45feba5371ab2618df67#b4e724dd72163d7bb25e45feba5371ab2618df67" +source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 11e63e23efa..d942efdd753 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,8 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -# rev = "0e36c7c072a79e5f32c3a4f98d3423575108cf14" -rev = "b4e724dd72163d7bb25e45feba5371ab2618df67" +rev = "0e36c7c072a79e5f32c3a4f98d3423575108cf14" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 4df67147e6d..1814ae14f6f 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -928,21 +928,52 @@ impl NetworkBehaviour for Discovery { type ConnectionHandler = ConnectionHandler; type OutEvent = DiscoveredPeers; - fn new_handler(&mut self) -> Self::ConnectionHandler { - ConnectionHandler + fn handle_pending_inbound_connection( + &mut self, + _connection_id: ConnectionId, + _local_addr: &Multiaddr, + _remote_addr: &Multiaddr, + ) -> Result<(), libp2p::swarm::ConnectionDenied> { + todo!() } - // Handles the libp2p request to obtain multiaddrs for peer_id's in order to dial them. - fn addresses_of_peer(&mut self, peer_id: &PeerId) -> Vec { - if let Some(enr) = self.enr_of_peer(peer_id) { - // ENR's may have multiple Multiaddrs. The multi-addr associated with the UDP - // port is removed, which is assumed to be associated with the discv5 protocol (and - // therefore irrelevant for other libp2p components). - enr.multiaddr_tcp() - } else { - // PeerId is not known - Vec::new() + fn handle_pending_outbound_connection( + &mut self, + _connection_id: ConnectionId, + maybe_peer: Option, + _addresses: &[Multiaddr], + _effective_role: libp2p::core::Endpoint, + ) -> Result, libp2p::swarm::ConnectionDenied> { + if let Some(peer_id) = maybe_peer { + if let Some(enr) = self.enr_of_peer(&peer_id) { + // ENR's may have multiple Multiaddrs. The multi-addr associated with the UDP + // port is removed, which is assumed to be associated with the discv5 protocol (and + // therefore irrelevant for other libp2p components). + return Ok(enr.multiaddr_tcp()); + } } + + Ok(vec![]) + } + + fn handle_established_inbound_connection( + &mut self, + _connection_id: ConnectionId, + peer: PeerId, + local_addr: &Multiaddr, + remote_addr: &Multiaddr, + ) -> Result, libp2p::swarm::ConnectionDenied> { + todo!() + } + + fn handle_established_outbound_connection( + &mut self, + _connection_id: ConnectionId, + peer: PeerId, + addr: &Multiaddr, + role_override: libp2p::core::Endpoint, + ) -> Result, libp2p::swarm::ConnectionDenied> { + todo!() } fn on_swarm_event(&mut self, event: FromSwarm) { diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 6365d43e457..1b78e2fcbe6 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -24,10 +24,6 @@ impl NetworkBehaviour for PeerManager { /* Required trait members */ - fn new_handler(&mut self) -> Self::ConnectionHandler { - ConnectionHandler - } - fn on_swarm_event(&mut self, event: FromSwarm) { match event { FromSwarm::ConnectionEstablished(ConnectionEstablished { @@ -179,6 +175,26 @@ impl NetworkBehaviour for PeerManager { Poll::Pending } + + fn handle_established_inbound_connection( + &mut self, + _connection_id: ConnectionId, + peer: PeerId, + local_addr: &libp2p::Multiaddr, + remote_addr: &libp2p::Multiaddr, + ) -> Result, libp2p::swarm::ConnectionDenied> { + todo!() + } + + fn handle_established_outbound_connection( + &mut self, + _connection_id: ConnectionId, + peer: PeerId, + addr: &libp2p::Multiaddr, + role_override: libp2p::core::Endpoint, + ) -> Result, libp2p::swarm::ConnectionDenied> { + todo!() + } } impl PeerManager { @@ -299,4 +315,4 @@ impl PeerManager { } } } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index c9ccbc60edc..7112aad31f6 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -209,22 +209,6 @@ where type ConnectionHandler = RPCHandler; type OutEvent = RPCMessage; - fn new_handler(&mut self) -> Self::ConnectionHandler { - RPCHandler::new( - SubstreamProtocol::new( - RPCProtocol { - fork_context: self.fork_context.clone(), - max_rpc_size: max_rpc_size(&self.fork_context), - enable_light_client_server: self.enable_light_client_server, - phantom: PhantomData, - }, - (), - ), - self.fork_context.clone(), - &self.log, - ) - } - fn on_swarm_event(&mut self, event: FromSwarm) { match event { FromSwarm::ConnectionEstablished(_) @@ -336,6 +320,45 @@ where Poll::Pending } + + fn handle_pending_inbound_connection( + &mut self, + _connection_id: ConnectionId, + _local_addr: &libp2p::Multiaddr, + _remote_addr: &libp2p::Multiaddr, + ) -> Result<(), libp2p::swarm::ConnectionDenied> { + todo!() + } + + fn handle_established_inbound_connection( + &mut self, + _connection_id: ConnectionId, + peer: PeerId, + local_addr: &libp2p::Multiaddr, + remote_addr: &libp2p::Multiaddr, + ) -> Result, libp2p::swarm::ConnectionDenied> { + todo!() + } + + fn handle_pending_outbound_connection( + &mut self, + _connection_id: ConnectionId, + maybe_peer: Option, + _addresses: &[libp2p::Multiaddr], + _effective_role: libp2p::core::Endpoint, + ) -> Result, libp2p::swarm::ConnectionDenied> { + todo!() + } + + fn handle_established_outbound_connection( + &mut self, + _connection_id: ConnectionId, + peer: PeerId, + addr: &libp2p::Multiaddr, + role_override: libp2p::core::Endpoint, + ) -> Result, libp2p::swarm::ConnectionDenied> { + todo!() + } } impl slog::KV for RPCMessage @@ -371,4 +394,4 @@ where slog::Result::Ok(()) } -} +} \ No newline at end of file From ce2c34b03d049d8677d582e0d1a5f6c36d7003ee Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 15:11:17 -0500 Subject: [PATCH 051/102] address change to StreamUpgradeError --- Cargo.lock | 46 +++++++-------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/discovery/mod.rs | 6 +- .../src/peer_manager/network_behaviour.rs | 5 +- .../lighthouse_network/src/rpc/handler.rs | 59 +++++++++---------- beacon_node/lighthouse_network/src/rpc/mod.rs | 12 ++-- 6 files changed, 66 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c4d7914614..f1ba76fea0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4181,7 +4181,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "bytes", "futures", @@ -4212,7 +4212,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4223,7 +4223,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4269,7 +4269,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "either", "fnv", @@ -4296,7 +4296,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4310,7 +4310,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4340,7 +4340,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "asynchronous-codec", "either", @@ -4361,7 +4361,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "asn1_der", "bs58", @@ -4383,7 +4383,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "data-encoding", "futures", @@ -4403,7 +4403,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4416,7 +4416,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4438,7 +4438,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "asynchronous-codec", "bytes", @@ -4454,7 +4454,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "bytes", "futures", @@ -4475,7 +4475,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "either", "fnv", @@ -4495,7 +4495,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "heck", "quote", @@ -4505,7 +4505,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "futures", "futures-timer", @@ -4521,7 +4521,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "futures", "futures-rustls", @@ -4539,7 +4539,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "async-trait", "asynchronous-codec", @@ -4570,7 +4570,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "either", "futures", @@ -4589,7 +4589,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5279,7 +5279,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "bytes", "futures", @@ -6458,7 +6458,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "asynchronous-codec", "bytes", @@ -7065,7 +7065,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=b8a76841530995a41a864e9d63032024862a310e#b8a76841530995a41a864e9d63032024862a310e" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index d942efdd753..0e0b5067fdd 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "0e36c7c072a79e5f32c3a4f98d3423575108cf14" +rev = "b8a76841530995a41a864e9d63032024862a310e" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 1814ae14f6f..39c0048c980 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -956,6 +956,7 @@ impl NetworkBehaviour for Discovery { Ok(vec![]) } + #[allow(unused)] fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, @@ -966,6 +967,7 @@ impl NetworkBehaviour for Discovery { todo!() } + #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -1128,8 +1130,6 @@ impl Discovery { self.disconnect_peer(&peer_id); } DialError::DialPeerConditionFalse(_) | DialError::Aborted => {} - #[allow(deprecated)] - DialError::ConnectionLimit(_) => {} } } } @@ -1276,4 +1276,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 1b78e2fcbe6..9b810b48312 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -63,6 +63,7 @@ impl NetworkBehaviour for PeerManager { todo!() } + #[allow(unused)] fn handle_pending_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -176,6 +177,7 @@ impl NetworkBehaviour for PeerManager { Poll::Pending } + #[allow(unused)] fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, @@ -186,6 +188,7 @@ impl NetworkBehaviour for PeerManager { todo!() } + #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -315,4 +318,4 @@ impl PeerManager { } } } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index 2127c8c88d0..303777ed161 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -12,10 +12,9 @@ use crate::rpc::protocol::InboundFramed; use fnv::FnvHashMap; use futures::prelude::*; use futures::{Sink, SinkExt}; -use libp2p::core::upgrade::{NegotiationError, ProtocolError, UpgradeError}; use libp2p::swarm::handler::{ - ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerUpgrErr, - DialUpgradeError, FullyNegotiatedInbound, FullyNegotiatedOutbound, KeepAlive, + ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, DialUpgradeError, + FullyNegotiatedInbound, FullyNegotiatedOutbound, KeepAlive, StreamUpgradeError, SubstreamProtocol, }; use libp2p::swarm::NegotiatedSubstream; @@ -973,43 +972,39 @@ where fn on_dial_upgrade_error( &mut self, request_info: (Id, OutboundRequest), - error: ConnectionHandlerUpgrErr, + error: StreamUpgradeError, ) { let (id, req) = request_info; - if let ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(RPCError::IoError(_))) = error - { - self.outbound_io_error_retries += 1; - if self.outbound_io_error_retries < IO_ERROR_RETRIES { - self.send_request(id, req); - return; - } - } - // This dialing is now considered failed - self.dial_negotiated -= 1; - - self.outbound_io_error_retries = 0; // map the error let error = match error { - ConnectionHandlerUpgrErr::Timeout => RPCError::NegotiationTimeout, - ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(e)) => e, - ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Select(NegotiationError::Failed)) => { - RPCError::UnsupportedProtocol - } - ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Select( - NegotiationError::ProtocolError(e), - )) => match e { - ProtocolError::IoError(io_err) => RPCError::IoError(io_err.to_string()), - ProtocolError::InvalidProtocol => { - RPCError::InternalError("Protocol was deemed invalid") + StreamUpgradeError::Timeout => RPCError::NegotiationTimeout, + StreamUpgradeError::Apply(RPCError::IoError(e)) => { + // TODO(@divma): we should revisit this logic + self.outbound_io_error_retries += 1; + if self.outbound_io_error_retries < IO_ERROR_RETRIES { + self.send_request(id, req); + return; } - ProtocolError::InvalidMessage | ProtocolError::TooManyProtocols => { - // Peer is sending invalid data during the negotiation phase, not - // participating in the protocol - RPCError::InvalidData("Invalid message during negotiation".to_string()) + RPCError::IoError(e) + } + // TODO(@divma): this might be wrong. A shame this info was lost. + StreamUpgradeError::NegotiationFailed => RPCError::UnsupportedProtocol, + StreamUpgradeError::Io(io_err) => { + self.outbound_io_error_retries += 1; + if self.outbound_io_error_retries < IO_ERROR_RETRIES { + self.send_request(id, req); + return; } - }, + RPCError::IoError(io_err.to_string()) + } + StreamUpgradeError::Apply(other) => other, }; + + // This dialing is now considered failed + self.dial_negotiated -= 1; + + self.outbound_io_error_retries = 0; self.events_out.push(Err(HandlerErr::Outbound { error, proto: req.versioned_protocol().protocol(), diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 7112aad31f6..3cab0da586c 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -8,20 +8,19 @@ use futures::future::FutureExt; use handler::{HandlerEvent, RPCHandler}; use libp2p::swarm::{ handler::ConnectionHandler, ConnectionId, NetworkBehaviour, NotifyHandler, PollParameters, - SubstreamProtocol, ToSwarm, + ToSwarm, }; use libp2p::swarm::{FromSwarm, THandlerInEvent}; use libp2p::PeerId; use rate_limiter::{RPCRateLimiter as RateLimiter, RateLimitedErr}; use slog::{crit, debug, o}; -use std::marker::PhantomData; use std::sync::Arc; use std::task::{Context, Poll}; use types::{EthSpec, ForkContext}; pub(crate) use handler::HandlerErr; pub(crate) use methods::{MetaData, MetaDataV1, MetaDataV2, Ping, RPCCodedResponse, RPCResponse}; -pub(crate) use protocol::{InboundRequest, RPCProtocol}; +pub(crate) use protocol::InboundRequest; pub use handler::SubstreamId; pub use methods::{ @@ -108,6 +107,7 @@ type BehaviourAction = ToSwarm, RPCSend { /// Rate limiter limiter: Option, @@ -321,6 +321,7 @@ where Poll::Pending } + #[allow(unused)] fn handle_pending_inbound_connection( &mut self, _connection_id: ConnectionId, @@ -330,6 +331,7 @@ where todo!() } + #[allow(unused)] fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, @@ -340,6 +342,7 @@ where todo!() } + #[allow(unused)] fn handle_pending_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -350,6 +353,7 @@ where todo!() } + #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -394,4 +398,4 @@ where slog::Result::Ok(()) } -} \ No newline at end of file +} From 0102ee7c64076342116a0e8d19d5c95af6bf9666 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 15:11:17 -0500 Subject: [PATCH 052/102] address change to StreamUpgradeError --- Cargo.lock | 47 +++++++------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/discovery/mod.rs | 6 +- .../src/peer_manager/network_behaviour.rs | 5 +- .../lighthouse_network/src/rpc/handler.rs | 63 +++++++++---------- beacon_node/lighthouse_network/src/rpc/mod.rs | 12 ++-- 6 files changed, 69 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c4d7914614..c66fe6cca7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4181,7 +4181,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "bytes", "futures", @@ -4212,7 +4212,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4223,7 +4223,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4269,7 +4269,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "either", "fnv", @@ -4296,7 +4296,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4310,7 +4310,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4340,7 +4340,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "asynchronous-codec", "either", @@ -4361,7 +4361,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "asn1_der", "bs58", @@ -4383,7 +4383,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "data-encoding", "futures", @@ -4403,7 +4403,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4416,7 +4416,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4438,7 +4438,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "asynchronous-codec", "bytes", @@ -4454,7 +4454,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "bytes", "futures", @@ -4475,7 +4475,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "either", "fnv", @@ -4486,6 +4486,7 @@ dependencies = [ "libp2p-identity", "libp2p-swarm-derive", "log", + "once_cell", "rand 0.8.5", "smallvec", "tokio", @@ -4495,7 +4496,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "heck", "quote", @@ -4505,7 +4506,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "futures", "futures-timer", @@ -4521,7 +4522,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "futures", "futures-rustls", @@ -4539,7 +4540,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "async-trait", "asynchronous-codec", @@ -4570,7 +4571,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "either", "futures", @@ -4589,7 +4590,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5279,7 +5280,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "bytes", "futures", @@ -6458,7 +6459,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "asynchronous-codec", "bytes", @@ -7065,7 +7066,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=0e36c7c072a79e5f32c3a4f98d3423575108cf14#0e36c7c072a79e5f32c3a4f98d3423575108cf14" +source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index d942efdd753..8ea89924846 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "0e36c7c072a79e5f32c3a4f98d3423575108cf14" +rev = "541eba306b251a66f08ab2df0dcd5f753aa1a553" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 1814ae14f6f..39c0048c980 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -956,6 +956,7 @@ impl NetworkBehaviour for Discovery { Ok(vec![]) } + #[allow(unused)] fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, @@ -966,6 +967,7 @@ impl NetworkBehaviour for Discovery { todo!() } + #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -1128,8 +1130,6 @@ impl Discovery { self.disconnect_peer(&peer_id); } DialError::DialPeerConditionFalse(_) | DialError::Aborted => {} - #[allow(deprecated)] - DialError::ConnectionLimit(_) => {} } } } @@ -1276,4 +1276,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 1b78e2fcbe6..9b810b48312 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -63,6 +63,7 @@ impl NetworkBehaviour for PeerManager { todo!() } + #[allow(unused)] fn handle_pending_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -176,6 +177,7 @@ impl NetworkBehaviour for PeerManager { Poll::Pending } + #[allow(unused)] fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, @@ -186,6 +188,7 @@ impl NetworkBehaviour for PeerManager { todo!() } + #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -315,4 +318,4 @@ impl PeerManager { } } } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index 2127c8c88d0..8d418b3d15b 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -12,10 +12,9 @@ use crate::rpc::protocol::InboundFramed; use fnv::FnvHashMap; use futures::prelude::*; use futures::{Sink, SinkExt}; -use libp2p::core::upgrade::{NegotiationError, ProtocolError, UpgradeError}; use libp2p::swarm::handler::{ - ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerUpgrErr, - DialUpgradeError, FullyNegotiatedInbound, FullyNegotiatedOutbound, KeepAlive, + ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, DialUpgradeError, + FullyNegotiatedInbound, FullyNegotiatedOutbound, KeepAlive, StreamUpgradeError, SubstreamProtocol, }; use libp2p::swarm::NegotiatedSubstream; @@ -845,11 +844,11 @@ where protocol, info, }) => self.on_fully_negotiated_outbound(protocol, info), - ConnectionEvent::AddressChange(_) => todo!(), ConnectionEvent::DialUpgradeError(DialUpgradeError { info, error }) => { self.on_dial_upgrade_error(info, error) } - ConnectionEvent::ListenUpgradeError(_) => todo!(), + // TODO(@divma): placeholders + _ => todo!(), } } } @@ -973,43 +972,39 @@ where fn on_dial_upgrade_error( &mut self, request_info: (Id, OutboundRequest), - error: ConnectionHandlerUpgrErr, + error: StreamUpgradeError, ) { let (id, req) = request_info; - if let ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(RPCError::IoError(_))) = error - { - self.outbound_io_error_retries += 1; - if self.outbound_io_error_retries < IO_ERROR_RETRIES { - self.send_request(id, req); - return; - } - } - // This dialing is now considered failed - self.dial_negotiated -= 1; - - self.outbound_io_error_retries = 0; // map the error let error = match error { - ConnectionHandlerUpgrErr::Timeout => RPCError::NegotiationTimeout, - ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(e)) => e, - ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Select(NegotiationError::Failed)) => { - RPCError::UnsupportedProtocol - } - ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Select( - NegotiationError::ProtocolError(e), - )) => match e { - ProtocolError::IoError(io_err) => RPCError::IoError(io_err.to_string()), - ProtocolError::InvalidProtocol => { - RPCError::InternalError("Protocol was deemed invalid") + StreamUpgradeError::Timeout => RPCError::NegotiationTimeout, + StreamUpgradeError::Apply(RPCError::IoError(e)) => { + // TODO(@divma): we should revisit this logic + self.outbound_io_error_retries += 1; + if self.outbound_io_error_retries < IO_ERROR_RETRIES { + self.send_request(id, req); + return; } - ProtocolError::InvalidMessage | ProtocolError::TooManyProtocols => { - // Peer is sending invalid data during the negotiation phase, not - // participating in the protocol - RPCError::InvalidData("Invalid message during negotiation".to_string()) + RPCError::IoError(e) + } + // TODO(@divma): this might be wrong. A shame this info was lost. + StreamUpgradeError::NegotiationFailed => RPCError::UnsupportedProtocol, + StreamUpgradeError::Io(io_err) => { + self.outbound_io_error_retries += 1; + if self.outbound_io_error_retries < IO_ERROR_RETRIES { + self.send_request(id, req); + return; } - }, + RPCError::IoError(io_err.to_string()) + } + StreamUpgradeError::Apply(other) => other, }; + + // This dialing is now considered failed + self.dial_negotiated -= 1; + + self.outbound_io_error_retries = 0; self.events_out.push(Err(HandlerErr::Outbound { error, proto: req.versioned_protocol().protocol(), diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 7112aad31f6..3cab0da586c 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -8,20 +8,19 @@ use futures::future::FutureExt; use handler::{HandlerEvent, RPCHandler}; use libp2p::swarm::{ handler::ConnectionHandler, ConnectionId, NetworkBehaviour, NotifyHandler, PollParameters, - SubstreamProtocol, ToSwarm, + ToSwarm, }; use libp2p::swarm::{FromSwarm, THandlerInEvent}; use libp2p::PeerId; use rate_limiter::{RPCRateLimiter as RateLimiter, RateLimitedErr}; use slog::{crit, debug, o}; -use std::marker::PhantomData; use std::sync::Arc; use std::task::{Context, Poll}; use types::{EthSpec, ForkContext}; pub(crate) use handler::HandlerErr; pub(crate) use methods::{MetaData, MetaDataV1, MetaDataV2, Ping, RPCCodedResponse, RPCResponse}; -pub(crate) use protocol::{InboundRequest, RPCProtocol}; +pub(crate) use protocol::InboundRequest; pub use handler::SubstreamId; pub use methods::{ @@ -108,6 +107,7 @@ type BehaviourAction = ToSwarm, RPCSend { /// Rate limiter limiter: Option, @@ -321,6 +321,7 @@ where Poll::Pending } + #[allow(unused)] fn handle_pending_inbound_connection( &mut self, _connection_id: ConnectionId, @@ -330,6 +331,7 @@ where todo!() } + #[allow(unused)] fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, @@ -340,6 +342,7 @@ where todo!() } + #[allow(unused)] fn handle_pending_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -350,6 +353,7 @@ where todo!() } + #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -394,4 +398,4 @@ where slog::Result::Ok(()) } -} \ No newline at end of file +} From d537025cce4ac3cb51910e61a935e822cd82bf51 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 15:31:40 -0500 Subject: [PATCH 053/102] change to Stream --- Cargo.lock | 47 ++++++++++--------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/rpc/handler.rs | 15 +++--- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef4f1f6d1b0..4ebc3c08245 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4197,7 +4197,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "bytes", "futures", @@ -4228,7 +4228,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4239,7 +4239,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4285,7 +4285,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "either", "fnv", @@ -4312,7 +4312,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4326,7 +4326,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4356,7 +4356,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "asynchronous-codec", "either", @@ -4377,7 +4377,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "asn1_der", "bs58", @@ -4399,7 +4399,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "data-encoding", "futures", @@ -4419,7 +4419,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4432,7 +4432,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4454,7 +4454,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "asynchronous-codec", "bytes", @@ -4470,7 +4470,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "bytes", "futures", @@ -4491,7 +4491,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "either", "fnv", @@ -4502,6 +4502,7 @@ dependencies = [ "libp2p-identity", "libp2p-swarm-derive", "log", + "multistream-select 0.13.0", "once_cell", "rand 0.8.5", "smallvec", @@ -4512,7 +4513,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "heck", "quote", @@ -4522,7 +4523,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "futures", "futures-timer", @@ -4538,7 +4539,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "futures", "futures-rustls", @@ -4556,7 +4557,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "async-trait", "asynchronous-codec", @@ -4587,7 +4588,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "either", "futures", @@ -4606,7 +4607,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5296,7 +5297,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "bytes", "futures", @@ -6475,7 +6476,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "asynchronous-codec", "bytes", @@ -7082,7 +7083,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=541eba306b251a66f08ab2df0dcd5f753aa1a553#541eba306b251a66f08ab2df0dcd5f753aa1a553" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 8ea89924846..fdc98f4558d 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "541eba306b251a66f08ab2df0dcd5f753aa1a553" +rev = "9e625881d53373f3a26284bd88fa8f583878106b" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index 8d418b3d15b..cb1123a28dc 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -17,7 +17,7 @@ use libp2p::swarm::handler::{ FullyNegotiatedInbound, FullyNegotiatedOutbound, KeepAlive, StreamUpgradeError, SubstreamProtocol, }; -use libp2p::swarm::NegotiatedSubstream; +use libp2p::swarm::Stream; use slog::{crit, debug, trace, warn}; use smallvec::SmallVec; use std::{ @@ -47,7 +47,7 @@ const MAX_INBOUND_SUBSTREAMS: usize = 32; #[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)] pub struct SubstreamId(usize); -type InboundSubstream = InboundFramed; +type InboundSubstream = InboundFramed; /// Events the handler emits to the behaviour. pub type HandlerEvent = Result, HandlerErr>; @@ -195,12 +195,12 @@ pub enum OutboundSubstreamState { /// handler because GOODBYE requests can be handled and responses dropped instantly. RequestPendingResponse { /// The framed negotiated substream. - substream: Box>, + substream: Box>, /// Keeps track of the actual request sent. request: OutboundRequest, }, /// Closing an outbound substream> - Closing(Box>), + Closing(Box>), /// Temporary state during processing Poisoned, } @@ -858,10 +858,7 @@ where Id: ReqId, TSpec: EthSpec, { - fn on_fully_negotiated_inbound( - &mut self, - substream: InboundOutput, - ) { + fn on_fully_negotiated_inbound(&mut self, substream: InboundOutput) { // only accept new peer requests when active if !matches!(self.state, HandlerState::Active) { return; @@ -917,7 +914,7 @@ where fn on_fully_negotiated_outbound( &mut self, - substream: OutboundFramed, + substream: OutboundFramed, (id, request): (Id, OutboundRequest), ) { self.dial_negotiated -= 1; From 1a2fe182945a2ff370b704109740192f2a92e442 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 15:41:34 -0500 Subject: [PATCH 054/102] so many renamings omg --- Cargo.lock | 65 +++++++++++-------- beacon_node/lighthouse_network/Cargo.toml | 4 +- .../lighthouse_network/src/discovery/mod.rs | 6 +- .../src/peer_manager/network_behaviour.rs | 4 +- .../lighthouse_network/src/rpc/handler.rs | 8 +-- beacon_node/lighthouse_network/src/rpc/mod.rs | 8 +-- 6 files changed, 54 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ebc3c08245..fd388cbc6c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4197,7 +4197,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "bytes", "futures", @@ -4228,7 +4228,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4239,7 +4239,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4285,7 +4285,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "either", "fnv", @@ -4312,7 +4312,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4326,7 +4326,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4356,7 +4356,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "asynchronous-codec", "either", @@ -4377,7 +4377,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "asn1_der", "bs58", @@ -4399,7 +4399,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "data-encoding", "futures", @@ -4419,20 +4419,21 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", "libp2p-swarm", + "once_cell", "prometheus-client", ] [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4454,7 +4455,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "asynchronous-codec", "bytes", @@ -4464,13 +4465,12 @@ dependencies = [ "log", "quick-protobuf", "unsigned-varint 0.7.1", - "void", ] [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "bytes", "futures", @@ -4491,7 +4491,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "either", "fnv", @@ -4513,9 +4513,11 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "heck", + "proc-macro-warning", + "proc-macro2", "quote", "syn 2.0.21", ] @@ -4523,7 +4525,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "futures", "futures-timer", @@ -4539,7 +4541,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "futures", "futures-rustls", @@ -4557,7 +4559,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "async-trait", "asynchronous-codec", @@ -4588,7 +4590,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "either", "futures", @@ -4607,7 +4609,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5297,7 +5299,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "bytes", "futures", @@ -6306,6 +6308,17 @@ version = "0.5.20+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" +[[package]] +name = "proc-macro-warning" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70550716265d1ec349c41f70dd4f964b4fd88394efe4405f0c1da679c4799a07" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.21", +] + [[package]] name = "proc-macro2" version = "1.0.61" @@ -6344,9 +6357,9 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.20.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e227aeb6c2cfec819e999c4773b35f8c7fa37298a203ff46420095458eee567e" +checksum = "78c2f43e8969d51935d2a7284878ae053ba30034cd563f673cde37ba5205685e" dependencies = [ "dtoa", "itoa", @@ -6476,7 +6489,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "asynchronous-codec", "bytes", @@ -7083,7 +7096,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9e625881d53373f3a26284bd88fa8f583878106b#9e625881d53373f3a26284bd88fa8f583878106b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index fdc98f4558d..06817efb889 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -40,7 +40,7 @@ directory = { path = "../../common/directory" } regex = "1.5.5" strum = { version = "0.24.0", features = ["derive"] } superstruct = "0.5.0" -prometheus-client = "0.20.0" +prometheus-client = "0.21.0" unused_port = { path = "../../common/unused_port" } delay_map = "0.3.0" void = "1" @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "9e625881d53373f3a26284bd88fa8f583878106b" +rev = "5c785b92e73a6c21d52e6f9a560a0f619a33808f" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 39c0048c980..b3d546cffee 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -926,7 +926,7 @@ impl Discovery { impl NetworkBehaviour for Discovery { // Discovery is not a real NetworkBehaviour... type ConnectionHandler = ConnectionHandler; - type OutEvent = DiscoveredPeers; + type ToSwarm = DiscoveredPeers; fn handle_pending_inbound_connection( &mut self, @@ -1012,7 +1012,7 @@ impl NetworkBehaviour for Discovery { &mut self, cx: &mut Context, _: &mut impl PollParameters, - ) -> Poll>> { + ) -> Poll>> { if !self.started { return Poll::Pending; } @@ -1276,4 +1276,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 9b810b48312..1fda5104989 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -20,7 +20,7 @@ use super::{ConnectingType, PeerManager, PeerManagerEvent, ReportSource}; impl NetworkBehaviour for PeerManager { type ConnectionHandler = ConnectionHandler; - type OutEvent = PeerManagerEvent; + type ToSwarm = PeerManagerEvent; /* Required trait members */ @@ -108,7 +108,7 @@ impl NetworkBehaviour for PeerManager { &mut self, cx: &mut Context<'_>, _params: &mut impl PollParameters, - ) -> Poll> { + ) -> Poll> { // perform the heartbeat when necessary while self.heartbeat.poll_tick(cx).is_ready() { self.heartbeat(); diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index cb1123a28dc..b0504be63e3 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -315,8 +315,8 @@ where TSpec: EthSpec, Id: ReqId, { - type InEvent = RPCSend; - type OutEvent = HandlerEvent; + type FromBehaviour = RPCSend; + type ToBehaviour = HandlerEvent; type Error = RPCError; type InboundProtocol = RPCProtocol; type OutboundProtocol = OutboundRequestContainer; @@ -327,7 +327,7 @@ where self.listen_protocol.clone() } - fn on_behaviour_event(&mut self, rpc_event: Self::InEvent) { + fn on_behaviour_event(&mut self, rpc_event: Self::FromBehaviour) { match rpc_event { RPCSend::Request(id, req) => self.send_request(id, req), RPCSend::Response(inbound_id, response) => self.send_response(inbound_id, response), @@ -371,7 +371,7 @@ where ConnectionHandlerEvent< Self::OutboundProtocol, Self::OutboundOpenInfo, - Self::OutEvent, + Self::ToBehaviour, Self::Error, >, > { diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 3cab0da586c..9a3e2390a90 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -207,7 +207,7 @@ where Id: ReqId, { type ConnectionHandler = RPCHandler; - type OutEvent = RPCMessage; + type ToSwarm = RPCMessage; fn on_swarm_event(&mut self, event: FromSwarm) { match event { @@ -233,7 +233,7 @@ where &mut self, peer_id: PeerId, conn_id: ConnectionId, - event: ::OutEvent, + event: ::ToBehaviour, ) { if let Ok(RPCReceived::Request(ref id, ref req)) = event { if let Some(limiter) = self.limiter.as_mut() { @@ -302,7 +302,7 @@ where &mut self, cx: &mut Context, _: &mut impl PollParameters, - ) -> Poll>> { + ) -> Poll>> { // let the rate limiter prune. if let Some(limiter) = self.limiter.as_mut() { let _ = limiter.poll_unpin(cx); @@ -398,4 +398,4 @@ where slog::Result::Ok(()) } -} +} \ No newline at end of file From 0e509e5a9ef787f0f179172e0a48dcd33ad1bd0e Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 15:43:52 -0500 Subject: [PATCH 055/102] rename `Custom` variant to `NotifyBehaviour` --- Cargo.lock | 47 +++++++++---------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/rpc/handler.rs | 14 +++--- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd388cbc6c1..6962f71a0b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4197,7 +4197,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "bytes", "futures", @@ -4228,7 +4228,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4239,7 +4239,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4285,7 +4285,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "either", "fnv", @@ -4312,7 +4312,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4326,7 +4326,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4356,7 +4356,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "asynchronous-codec", "either", @@ -4377,7 +4377,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "asn1_der", "bs58", @@ -4399,7 +4399,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "data-encoding", "futures", @@ -4419,7 +4419,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "libp2p-core 0.40.0", "libp2p-gossipsub", @@ -4433,7 +4433,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4455,7 +4455,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "asynchronous-codec", "bytes", @@ -4470,7 +4470,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "bytes", "futures", @@ -4491,7 +4491,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "either", "fnv", @@ -4513,7 +4513,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "heck", "proc-macro-warning", @@ -4525,7 +4525,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "futures", "futures-timer", @@ -4541,7 +4541,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "futures", "futures-rustls", @@ -4559,7 +4559,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "async-trait", "asynchronous-codec", @@ -4590,7 +4590,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "either", "futures", @@ -4609,7 +4609,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5299,7 +5299,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "bytes", "futures", @@ -6489,7 +6489,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "asynchronous-codec", "bytes", @@ -7096,7 +7096,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=5c785b92e73a6c21d52e6f9a560a0f619a33808f#5c785b92e73a6c21d52e6f9a560a0f619a33808f" +source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" dependencies = [ "futures", "pin-project", @@ -7846,7 +7846,6 @@ checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ "base64 0.13.1", "bytes", - "flate2", "futures", "httparse", "log", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 06817efb889..6d198411cf7 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "5c785b92e73a6c21d52e6f9a560a0f619a33808f" +rev = "9f3c85164cedde7619dc066526e57b4149c1e6b4" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index b0504be63e3..b483adeb2ec 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -384,7 +384,7 @@ where } // return any events that need to be reported if !self.events_out.is_empty() { - return Poll::Ready(ConnectionHandlerEvent::Custom(self.events_out.remove(0))); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(self.events_out.remove(0))); } else { self.events_out.shrink_to_fit(); } @@ -448,7 +448,7 @@ where error: RPCError::StreamTimeout, }; // notify the user - return Poll::Ready(ConnectionHandlerEvent::Custom(Err(outbound_err))); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err(outbound_err))); } else { crit!(self.log, "timed out substream not in the books"; "stream_id" => outbound_id.get_ref()); } @@ -708,7 +708,7 @@ where }), }; - return Poll::Ready(ConnectionHandlerEvent::Custom(received)); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(received)); } Poll::Ready(None) => { // stream closed @@ -723,7 +723,7 @@ where // notify the application error if request.expected_responses() > 1 { // return an end of stream result - return Poll::Ready(ConnectionHandlerEvent::Custom(Ok( + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Ok( RPCReceived::EndOfStream(request_id, request.stream_termination()), ))); } @@ -734,7 +734,7 @@ where proto: request.versioned_protocol().protocol(), error: RPCError::IncompleteStream, }; - return Poll::Ready(ConnectionHandlerEvent::Custom(Err(outbound_err))); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err(outbound_err))); } Poll::Pending => { entry.get_mut().state = @@ -750,7 +750,7 @@ where error: e, }; entry.remove_entry(); - return Poll::Ready(ConnectionHandlerEvent::Custom(Err(outbound_err))); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err(outbound_err))); } }, OutboundSubstreamState::Closing(mut substream) => { @@ -776,7 +776,7 @@ where }; if let Some(termination) = termination { - return Poll::Ready(ConnectionHandlerEvent::Custom(Ok( + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Ok( RPCReceived::EndOfStream(request_id, termination), ))); } From 9c4b429d7f69a7e71d4eca1afc898c8cb9d9e89b Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 15:50:19 -0500 Subject: [PATCH 056/102] use new event field --- Cargo.lock | 72 +++++++++++-------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/service/mod.rs | 12 +++- 3 files changed, 51 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6962f71a0b1..d3ee1c65095 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3085,6 +3085,16 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "futures-rustls" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd3cf68c183738046838e300353e4716c674dc5e56890de4826801a6622a28" +dependencies = [ + "futures-io", + "rustls 0.21.2", +] + [[package]] name = "futures-sink" version = "0.3.28" @@ -4197,7 +4207,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "bytes", "futures", @@ -4228,7 +4238,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4239,7 +4249,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4285,7 +4295,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "either", "fnv", @@ -4312,7 +4322,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4326,7 +4336,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4356,7 +4366,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "asynchronous-codec", "either", @@ -4377,7 +4387,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "asn1_der", "bs58", @@ -4399,7 +4409,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "data-encoding", "futures", @@ -4419,8 +4429,9 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ + "instant", "libp2p-core 0.40.0", "libp2p-gossipsub", "libp2p-identify", @@ -4433,7 +4444,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4455,7 +4466,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "asynchronous-codec", "bytes", @@ -4470,7 +4481,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "bytes", "futures", @@ -4483,7 +4494,7 @@ dependencies = [ "parking_lot 0.12.1", "quinn-proto", "rand 0.8.5", - "rustls 0.20.8", + "rustls 0.21.2", "thiserror", "tokio", ] @@ -4491,7 +4502,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "either", "fnv", @@ -4513,7 +4524,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "heck", "proc-macro-warning", @@ -4525,7 +4536,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "futures", "futures-timer", @@ -4541,15 +4552,15 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "futures", - "futures-rustls", + "futures-rustls 0.24.0", "libp2p-core 0.40.0", "libp2p-identity", "rcgen 0.10.0", "ring", - "rustls 0.20.8", + "rustls 0.21.2", "thiserror", "webpki 0.22.0", "x509-parser 0.15.0", @@ -4559,7 +4570,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "async-trait", "asynchronous-codec", @@ -4590,11 +4601,11 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "either", "futures", - "futures-rustls", + "futures-rustls 0.22.2", "libp2p-core 0.40.0", "libp2p-identity", "log", @@ -4609,7 +4620,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5299,7 +5310,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "bytes", "futures", @@ -6489,7 +6500,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "asynchronous-codec", "bytes", @@ -6534,20 +6545,19 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.9.3" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c10f662eee9c94ddd7135043e544f3c82fa839a1e7b865911331961b53186c" +checksum = "85af4ed6ee5a89f26a26086e9089a6643650544c025158449a3626ebf72884b3" dependencies = [ "bytes", "rand 0.8.5", "ring", "rustc-hash", - "rustls 0.20.8", + "rustls 0.21.2", "slab", "thiserror", "tinyvec", "tracing", - "webpki 0.22.0", ] [[package]] @@ -7096,7 +7106,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=9f3c85164cedde7619dc066526e57b4149c1e6b4#9f3c85164cedde7619dc066526e57b4149c1e6b4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 6d198411cf7..b0ba59eaaa4 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "9f3c85164cedde7619dc066526e57b4149c1e6b4" +rev = "a424310d6081c37c2f00e33f5f937fc307c71d3b" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 5e578dd68ef..48313b050c8 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -1448,6 +1448,7 @@ impl Network { SwarmEvent::IncomingConnection { local_addr, send_back_addr, + connection_id: _, } => { trace!(self.log, "Incoming connection"; "our_addr" => %local_addr, "from" => %send_back_addr); None @@ -1456,11 +1457,16 @@ impl Network { local_addr, send_back_addr, error, + connection_id: _, } => { debug!(self.log, "Failed incoming connection"; "our_addr" => %local_addr, "from" => %send_back_addr, "error" => %error); None } - SwarmEvent::OutgoingConnectionError { peer_id, error } => { + SwarmEvent::OutgoingConnectionError { + peer_id, + error, + connection_id: _, + } => { debug!(self.log, "Failed to dial address"; "peer_id" => ?peer_id, "error" => %error); None } @@ -1490,7 +1496,7 @@ impl Network { None } } - SwarmEvent::Dialing(_) => None, + SwarmEvent::Dialing { .. } => None, }; if let Some(ev) = maybe_event { @@ -1524,4 +1530,4 @@ impl Network { pub async fn next_event(&mut self) -> NetworkEvent { futures::future::poll_fn(|cx| self.poll_network(cx)).await } -} +} \ No newline at end of file From c95c5c5431f6f1b3edcb43cc5432f0590ef10cab Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 16:02:00 -0500 Subject: [PATCH 057/102] add new events reporting addresses --- Cargo.lock | 46 +++++++++---------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/discovery/mod.rs | 14 +++--- .../src/peer_manager/network_behaviour.rs | 7 +-- beacon_node/lighthouse_network/src/rpc/mod.rs | 7 +-- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3ee1c65095..fb2f6e79de2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4207,7 +4207,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "bytes", "futures", @@ -4238,7 +4238,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4249,7 +4249,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4295,7 +4295,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "either", "fnv", @@ -4322,7 +4322,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4336,7 +4336,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4366,7 +4366,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "asynchronous-codec", "either", @@ -4387,7 +4387,7 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "asn1_der", "bs58", @@ -4409,7 +4409,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "data-encoding", "futures", @@ -4429,7 +4429,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "instant", "libp2p-core 0.40.0", @@ -4444,7 +4444,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4466,7 +4466,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "asynchronous-codec", "bytes", @@ -4481,7 +4481,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "bytes", "futures", @@ -4502,7 +4502,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "either", "fnv", @@ -4524,7 +4524,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "heck", "proc-macro-warning", @@ -4536,7 +4536,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "futures", "futures-timer", @@ -4552,7 +4552,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "futures", "futures-rustls 0.24.0", @@ -4570,7 +4570,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "async-trait", "asynchronous-codec", @@ -4601,7 +4601,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "either", "futures", @@ -4620,7 +4620,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5310,7 +5310,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "bytes", "futures", @@ -6500,7 +6500,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "asynchronous-codec", "bytes", @@ -7106,7 +7106,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=a424310d6081c37c2f00e33f5f937fc307c71d3b#a424310d6081c37c2f00e33f5f937fc307c71d3b" +source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index b0ba59eaaa4..62a9c3de941 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "a424310d6081c37c2f00e33f5f937fc307c71d3b" +rev = "25bc30f07e7baeeae22d56e472c90a5cd3949f23" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index b3d546cffee..4ee5a18d8b9 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -23,7 +23,7 @@ use futures::prelude::*; use futures::stream::FuturesUnordered; use libp2p::multiaddr::Protocol; use libp2p::swarm::behaviour::{DialFailure, FromSwarm}; -use libp2p::swarm::{AddressScore, THandlerInEvent}; +use libp2p::swarm::THandlerInEvent; pub use libp2p::{ core::{ConnectedPoint, Multiaddr}, identity::PeerId, @@ -992,8 +992,9 @@ impl NetworkBehaviour for Discovery { | FromSwarm::ExpiredListenAddr(_) | FromSwarm::ListenerError(_) | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddr(_) - | FromSwarm::ExpiredExternalAddr(_) => { + | FromSwarm::NewExternalAddrCandidate(_) + | FromSwarm::ExternalAddrExpired(_) + | FromSwarm::ExternalAddrConfirmed(_) => { // Ignore events not relevant to discovery } } @@ -1097,10 +1098,7 @@ impl NetworkBehaviour for Discovery { if let Some(address) = addr { // NOTE: This doesn't actually track the external TCP port. More sophisticated NAT handling // should handle this. - return Poll::Ready(ToSwarm::ReportObservedAddr { - address, - score: AddressScore::Finite(1), - }); + return Poll::Ready(ToSwarm::NewExternalAddrCandidate(address)); } } Discv5Event::EnrAdded { .. } @@ -1276,4 +1274,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 1fda5104989..7c0b3e139bd 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -45,8 +45,9 @@ impl NetworkBehaviour for PeerManager { | FromSwarm::ExpiredListenAddr(_) | FromSwarm::ListenerError(_) | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddr(_) - | FromSwarm::ExpiredExternalAddr(_) => { + | FromSwarm::NewExternalAddrCandidate(_) + | FromSwarm::ExternalAddrExpired(_) + | FromSwarm::ExternalAddrConfirmed(_) => { // The rest of the events we ignore since they are handled in their associated // `SwarmEvent` } @@ -318,4 +319,4 @@ impl PeerManager { } } } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 9a3e2390a90..fa8af0d5c48 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -221,8 +221,9 @@ where | FromSwarm::ExpiredListenAddr(_) | FromSwarm::ListenerError(_) | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddr(_) - | FromSwarm::ExpiredExternalAddr(_) => { + | FromSwarm::NewExternalAddrCandidate(_) + | FromSwarm::ExternalAddrExpired(_) + | FromSwarm::ExternalAddrConfirmed(_) => { // Rpc Bheaviour does not act on these swarm events. We use a comprehensive match // statement tu ensure future events are dealt with appropiately. } @@ -398,4 +399,4 @@ where slog::Result::Ok(()) } -} \ No newline at end of file +} From 165f2d2a6e8f2de99e9d73eeaa2112a521aea7ee Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 16:34:52 -0500 Subject: [PATCH 058/102] checkpoint --- Cargo.lock | 81 ++++++++++++++--------- beacon_node/lighthouse_network/Cargo.toml | 2 +- 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb2f6e79de2..7d0183e28d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -894,6 +894,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "tinyvec", +] + [[package]] name = "buf_redux" version = "0.8.4" @@ -2140,7 +2149,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26fa0a0be8915790626d5759eb51fe47435a8eac92c2f212bd2da9aa7f30ea56" dependencies = [ "base64 0.13.1", - "bs58", + "bs58 0.4.0", "bytes", "hex", "k256 0.11.6", @@ -2501,7 +2510,7 @@ source = "git+https://github.com/ralexstokes//ethereum-consensus?rev=9b0ee0a8a45 dependencies = [ "async-stream", "blst", - "bs58", + "bs58 0.4.0", "enr 0.6.2", "hex", "integer-sqrt", @@ -3107,6 +3116,17 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +[[package]] +name = "futures-ticker" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9763058047f713632a52e916cc7f6a4b3fc6e9fc1ff8c5b1dc49e5a89041682e" +dependencies = [ + "futures", + "futures-timer", + "instant", +] + [[package]] name = "futures-timer" version = "3.0.2" @@ -3538,7 +3558,7 @@ name = "http_api" version = "0.1.0" dependencies = [ "beacon_chain", - "bs58", + "bs58 0.4.0", "directory", "environment", "eth1", @@ -4207,7 +4227,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "bytes", "futures", @@ -4238,7 +4258,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4249,7 +4269,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4264,7 +4284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1fff5bd889c82a0aec668f2045edd066f559d4e5c40354e5a4c77ac00caac38" dependencies = [ "asn1_der", - "bs58", + "bs58 0.4.0", "ed25519-dalek 1.0.1", "either", "fnv", @@ -4295,7 +4315,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "either", "fnv", @@ -4322,7 +4342,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4336,7 +4356,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4345,6 +4365,8 @@ dependencies = [ "either", "fnv", "futures", + "futures-ticker", + "getrandom 0.2.10", "hex_fmt", "instant", "libp2p-core 0.40.0", @@ -4360,13 +4382,12 @@ dependencies = [ "smallvec", "unsigned-varint 0.7.1", "void", - "wasm-timer", ] [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "asynchronous-codec", "either", @@ -4387,10 +4408,10 @@ dependencies = [ [[package]] name = "libp2p-identity" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "asn1_der", - "bs58", + "bs58 0.5.0", "ed25519-dalek 1.0.1", "libsecp256k1", "log", @@ -4409,7 +4430,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "data-encoding", "futures", @@ -4429,7 +4450,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "instant", "libp2p-core 0.40.0", @@ -4444,7 +4465,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4466,7 +4487,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "asynchronous-codec", "bytes", @@ -4481,7 +4502,7 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "bytes", "futures", @@ -4502,7 +4523,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "either", "fnv", @@ -4524,7 +4545,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "heck", "proc-macro-warning", @@ -4536,7 +4557,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "futures", "futures-timer", @@ -4552,7 +4573,7 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "futures", "futures-rustls 0.24.0", @@ -4570,7 +4591,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc" version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "async-trait", "asynchronous-codec", @@ -4601,7 +4622,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "either", "futures", @@ -4620,7 +4641,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5190,7 +5211,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c580bfdd8803cce319b047d239559a22f809094aaea4ac13902a1fdcfcd4261" dependencies = [ "arrayref", - "bs58", + "bs58 0.4.0", "byteorder", "data-encoding", "multihash 0.16.3", @@ -5310,7 +5331,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "bytes", "futures", @@ -6500,7 +6521,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "asynchronous-codec", "bytes", @@ -7106,7 +7127,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=25bc30f07e7baeeae22d56e472c90a5cd3949f23#25bc30f07e7baeeae22d56e472c90a5cd3949f23" +source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 62a9c3de941..d995d9eba6b 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "25bc30f07e7baeeae22d56e472c90a5cd3949f23" +rev = "09d04fa35c6e774458347dd5f285b8946905e940" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] From 73947b50a69b531d5a974ee5ab399e65eab258ea Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 16:50:16 -0500 Subject: [PATCH 059/102] change identity path --- Cargo.lock | 1105 ++--------------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../src/peer_manager/mod.rs | 5 +- .../lighthouse_network/src/service/utils.rs | 13 +- 4 files changed, 98 insertions(+), 1027 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d0183e28d6..f4fb0c00a32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,15 +79,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" -[[package]] -name = "aead" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" -dependencies = [ - "generic-array", -] - [[package]] name = "aead" version = "0.4.3" @@ -95,28 +86,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array", - "rand_core 0.6.4", -] - -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" -dependencies = [ - "aes-soft", - "aesni", - "cipher 0.2.5", ] [[package]] @@ -126,71 +95,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher", "cpufeatures", - "ctr 0.8.0", + "ctr", "opaque-debug", ] -[[package]] -name = "aes" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" -dependencies = [ - "cfg-if", - "cipher 0.4.4", - "cpufeatures", -] - [[package]] name = "aes-gcm" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" dependencies = [ - "aead 0.4.3", - "aes 0.7.5", - "cipher 0.3.0", - "ctr 0.8.0", - "ghash 0.4.4", - "subtle", -] - -[[package]] -name = "aes-gcm" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209b47e8954a928e1d72e86eca7000ebb6655fe1436d33eefc2201cad027e237" -dependencies = [ - "aead 0.5.2", - "aes 0.8.3", - "cipher 0.4.4", - "ctr 0.9.2", - "ghash 0.5.0", + "aead", + "aes", + "cipher", + "ctr", + "ghash", "subtle", ] -[[package]] -name = "aes-soft" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" -dependencies = [ - "cipher 0.2.5", - "opaque-debug", -] - -[[package]] -name = "aesni" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" -dependencies = [ - "cipher 0.2.5", - "opaque-debug", -] - [[package]] name = "ahash" version = "0.7.6" @@ -289,73 +213,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "asn1-rs" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" -dependencies = [ - "asn1-rs-derive 0.1.0", - "asn1-rs-impl", - "displaydoc", - "nom 7.1.3", - "num-traits", - "rusticata-macros", - "thiserror", - "time 0.3.22", -] - -[[package]] -name = "asn1-rs" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" -dependencies = [ - "asn1-rs-derive 0.4.0", - "asn1-rs-impl", - "displaydoc", - "nom 7.1.3", - "num-traits", - "rusticata-macros", - "thiserror", - "time 0.3.22", -] - -[[package]] -name = "asn1-rs-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - -[[package]] -name = "asn1-rs-derive" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - -[[package]] -name = "asn1-rs-impl" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "asn1_der" version = "0.7.6" @@ -448,12 +305,6 @@ dependencies = [ "pin-project-lite 0.2.9", ] -[[package]] -name = "atomic-waker" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" - [[package]] name = "attohttpc" version = "0.16.3" @@ -803,16 +654,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-modes" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" -dependencies = [ - "block-padding", - "cipher 0.2.5", -] - [[package]] name = "block-padding" version = "0.2.1" @@ -894,15 +735,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" -[[package]] -name = "bs58" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" -dependencies = [ - "tinyvec", -] - [[package]] name = "buf_redux" version = "0.8.4" @@ -1032,17 +864,6 @@ version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" -[[package]] -name = "ccm" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca1a8fbc20b50ac9673ff014abfb2b5f4085ee1a850d408f14a159c5853ac7" -dependencies = [ - "aead 0.3.2", - "cipher 0.2.5", - "subtle", -] - [[package]] name = "cexpr" version = "0.6.0" @@ -1065,7 +886,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher", "cpufeatures", "zeroize", ] @@ -1076,9 +897,9 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ - "aead 0.4.3", + "aead", "chacha20", - "cipher 0.3.0", + "cipher", "poly1305", "zeroize", ] @@ -1099,15 +920,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "cipher" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" -dependencies = [ - "generic-array", -] - [[package]] name = "cipher" version = "0.3.0" @@ -1117,16 +929,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - [[package]] name = "clang-sys" version = "1.6.1" @@ -1289,21 +1091,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" - [[package]] name = "crc32fast" version = "1.3.2" @@ -1429,7 +1216,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "rand_core 0.6.4", "typenum", ] @@ -1480,16 +1266,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" dependencies = [ - "cipher 0.3.0", -] - -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -1536,18 +1313,8 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", -] - -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core 0.14.4", - "darling_macro 0.14.4", + "darling_core", + "darling_macro", ] [[package]] @@ -1564,38 +1331,13 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core 0.14.4", + "darling_core", "quote", "syn 1.0.109", ] @@ -1701,7 +1443,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", - "pem-rfc7468 0.6.0", "zeroize", ] @@ -1712,38 +1453,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" dependencies = [ "const-oid", - "pem-rfc7468 0.7.0", "zeroize", ] -[[package]] -name = "der-parser" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" -dependencies = [ - "asn1-rs 0.3.1", - "displaydoc", - "nom 7.1.3", - "num-bigint", - "num-traits", - "rusticata-macros", -] - -[[package]] -name = "der-parser" -version = "8.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" -dependencies = [ - "asn1-rs 0.5.2", - "displaydoc", - "nom 7.1.3", - "num-bigint", - "num-traits", - "rusticata-macros", -] - [[package]] name = "derivative" version = "2.2.0" @@ -1765,37 +1477,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "derive_builder" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" -dependencies = [ - "darling 0.14.4", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_builder_macro" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" -dependencies = [ - "derive_builder_core", - "syn 1.0.109", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -1932,8 +1613,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77f32d27968ba86689e3f0eccba0383414348a6fc5918b0a639c98dd81e20ed6" dependencies = [ - "aes 0.7.5", - "aes-gcm 0.9.4", + "aes", + "aes-gcm", "arrayvec", "delay_map", "enr 0.8.1", @@ -1958,17 +1639,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "displaydoc" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.21", -] - [[package]] name = "dtoa" version = "1.0.6" @@ -1993,6 +1663,18 @@ dependencies = [ "signature 1.6.4", ] +[[package]] +name = "ecdsa" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12844141594ad74185a926d030f3b605f6a903b4e3fec351f3ea338ac5b7637e" +dependencies = [ + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 2.0.0", +] + [[package]] name = "ecdsa" version = "0.16.7" @@ -2003,7 +1685,7 @@ dependencies = [ "digest 0.10.7", "elliptic-curve 0.13.5", "rfc6979 0.4.0", - "signature 2.1.0", + "signature 2.0.0", "spki 0.7.2", ] @@ -2023,7 +1705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" dependencies = [ "pkcs8 0.10.2", - "signature 2.1.0", + "signature 2.0.0", ] [[package]] @@ -2104,8 +1786,6 @@ dependencies = [ "ff 0.12.1", "generic-array", "group 0.12.1", - "hkdf", - "pem-rfc7468 0.6.0", "pkcs8 0.9.0", "rand_core 0.6.4", "sec1 0.3.0", @@ -2125,7 +1805,6 @@ dependencies = [ "ff 0.13.0", "generic-array", "group 0.13.0", - "pem-rfc7468 0.7.0", "pkcs8 0.10.2", "rand_core 0.6.4", "sec1 0.7.2", @@ -2149,7 +1828,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26fa0a0be8915790626d5759eb51fe47435a8eac92c2f212bd2da9aa7f30ea56" dependencies = [ "base64 0.13.1", - "bs58 0.4.0", + "bs58", "bytes", "hex", "k256 0.11.6", @@ -2387,7 +2066,7 @@ dependencies = [ name = "eth2_keystore" version = "0.1.0" dependencies = [ - "aes 0.7.5", + "aes", "bls", "eth2_key_derivation", "hex", @@ -2401,7 +2080,7 @@ dependencies = [ "sha2 0.9.9", "tempfile", "unicode-normalization", - "uuid 0.8.2", + "uuid", "zeroize", ] @@ -2431,7 +2110,7 @@ dependencies = [ "serde_repr", "tempfile", "tiny-bip39", - "uuid 0.8.2", + "uuid", ] [[package]] @@ -2510,7 +2189,7 @@ source = "git+https://github.com/ralexstokes//ethereum-consensus?rev=9b0ee0a8a45 dependencies = [ "async-stream", "blst", - "bs58 0.4.0", + "bs58", "enr 0.6.2", "hex", "integer-sqrt", @@ -2598,7 +2277,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6085d7fd3cf84bd2b8fec150d54c8467fb491d8db9c460607c5534f653a0ee38" dependencies = [ - "darling 0.13.4", + "darling", "proc-macro2", "quote", "syn 1.0.109", @@ -3094,16 +2773,6 @@ dependencies = [ "webpki 0.22.0", ] -[[package]] -name = "futures-rustls" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd3cf68c183738046838e300353e4716c674dc5e56890de4826801a6622a28" -dependencies = [ - "futures-io", - "rustls 0.21.2", -] - [[package]] name = "futures-sink" version = "0.3.28" @@ -3225,17 +2894,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug", - "polyval 0.5.3", -] - -[[package]] -name = "ghash" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" -dependencies = [ - "opaque-debug", - "polyval 0.6.1", + "polyval", ] [[package]] @@ -3558,7 +3217,7 @@ name = "http_api" version = "0.1.0" dependencies = [ "beacon_chain", - "bs58 0.4.0", + "bs58", "directory", "environment", "eth1", @@ -3883,15 +3542,6 @@ dependencies = [ "hashbrown 0.14.0", ] -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array", -] - [[package]] name = "instant" version = "0.1.12" @@ -3922,25 +3572,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "interceptor" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8a11ae2da61704edada656798b61c94b35ecac2c58eb955156987d5e6be90b" -dependencies = [ - "async-trait", - "bytes", - "log", - "rand 0.8.5", - "rtcp", - "rtp", - "thiserror", - "tokio", - "waitgroup", - "webrtc-srtp", - "webrtc-util", -] - [[package]] name = "io-lifetimes" version = "1.0.11" @@ -4063,7 +3694,7 @@ dependencies = [ "elliptic-curve 0.13.5", "once_cell", "sha2 0.10.7", - "signature 2.1.0", + "signature 2.0.0", ] [[package]] @@ -4227,7 +3858,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "bytes", "futures", @@ -4245,10 +3876,8 @@ dependencies = [ "libp2p-metrics", "libp2p-noise", "libp2p-plaintext", - "libp2p-quic", "libp2p-swarm", "libp2p-tcp", - "libp2p-webrtc", "libp2p-websocket", "libp2p-yamux", "multiaddr 0.17.1", @@ -4258,7 +3887,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4269,7 +3898,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -4284,7 +3913,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1fff5bd889c82a0aec668f2045edd066f559d4e5c40354e5a4c77ac00caac38" dependencies = [ "asn1_der", - "bs58 0.4.0", + "bs58", "ed25519-dalek 1.0.1", "either", "fnv", @@ -4315,7 +3944,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "either", "fnv", @@ -4342,7 +3971,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4356,7 +3985,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4387,7 +4016,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "asynchronous-codec", "either", @@ -4407,20 +4036,21 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e2d584751cecb2aabaa56106be6be91338a60a0f4e420cf2af639204f596fc1" dependencies = [ "asn1_der", - "bs58 0.5.0", + "bs58", "ed25519-dalek 1.0.1", "libsecp256k1", "log", "multiaddr 0.17.1", "multihash 0.17.0", - "p256 0.13.2", + "p256 0.12.0", "quick-protobuf", "rand 0.8.5", - "sec1 0.7.2", + "sec1 0.3.0", "sha2 0.10.7", "thiserror", "void", @@ -4430,7 +4060,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "data-encoding", "futures", @@ -4450,7 +4080,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "instant", "libp2p-core 0.40.0", @@ -4465,7 +4095,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4480,14 +4110,14 @@ dependencies = [ "snow", "static_assertions", "thiserror", - "x25519-dalek 1.1.1", + "x25519-dalek", "zeroize", ] [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "asynchronous-codec", "bytes", @@ -4499,31 +4129,10 @@ dependencies = [ "unsigned-varint 0.7.1", ] -[[package]] -name = "libp2p-quic" -version = "0.8.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" -dependencies = [ - "bytes", - "futures", - "futures-timer", - "if-watch", - "libp2p-core 0.40.0", - "libp2p-identity", - "libp2p-tls", - "log", - "parking_lot 0.12.1", - "quinn-proto", - "rand 0.8.5", - "rustls 0.21.2", - "thiserror", - "tokio", -] - [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "either", "fnv", @@ -4545,7 +4154,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "heck", "proc-macro-warning", @@ -4557,7 +4166,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "futures", "futures-timer", @@ -4570,63 +4179,14 @@ dependencies = [ "tokio", ] -[[package]] -name = "libp2p-tls" -version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" -dependencies = [ - "futures", - "futures-rustls 0.24.0", - "libp2p-core 0.40.0", - "libp2p-identity", - "rcgen 0.10.0", - "ring", - "rustls 0.21.2", - "thiserror", - "webpki 0.22.0", - "x509-parser 0.15.0", - "yasna", -] - -[[package]] -name = "libp2p-webrtc" -version = "0.5.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" -dependencies = [ - "async-trait", - "asynchronous-codec", - "bytes", - "futures", - "futures-timer", - "hex", - "if-watch", - "libp2p-core 0.40.0", - "libp2p-identity", - "libp2p-noise", - "log", - "multihash 0.17.0", - "quick-protobuf", - "quick-protobuf-codec", - "rand 0.8.5", - "rcgen 0.9.3", - "serde", - "sha2 0.10.7", - "stun", - "thiserror", - "tinytemplate", - "tokio", - "tokio-util 0.7.8", - "webrtc", -] - [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "either", "futures", - "futures-rustls 0.22.2", + "futures-rustls", "libp2p-core 0.40.0", "libp2p-identity", "log", @@ -4641,7 +4201,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -5069,7 +4629,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37cb4045d5677b7da537f8cb5d0730d5b6414e3cc81c61e4b50e1f0cbdc73909" dependencies = [ - "darling 0.13.4", + "darling", "itertools", "proc-macro2", "quote", @@ -5211,7 +4771,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c580bfdd8803cce319b047d239559a22f809094aaea4ac13902a1fdcfcd4261" dependencies = [ "arrayref", - "bs58 0.4.0", + "bs58", "byteorder", "data-encoding", "multihash 0.16.3", @@ -5331,7 +4891,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "bytes", "futures", @@ -5493,7 +5053,6 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset 0.6.5", ] [[package]] @@ -5652,24 +5211,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "oid-registry" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" -dependencies = [ - "asn1-rs 0.3.1", -] - -[[package]] -name = "oid-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" -dependencies = [ - "asn1-rs 0.5.2", -] - [[package]] name = "once_cell" version = "1.18.0" @@ -5817,24 +5358,13 @@ dependencies = [ [[package]] name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa 0.16.7", - "elliptic-curve 0.13.5", - "primeorder", - "sha2 0.10.7", -] - -[[package]] -name = "p384" -version = "0.11.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" +checksum = "49c124b3cbce43bcbac68c58ec181d98ed6cc7e6d0aa7c3ba97b2563410b0e55" dependencies = [ - "ecdsa 0.14.8", + "ecdsa 0.15.1", "elliptic-curve 0.12.3", + "primeorder", "sha2 0.10.7", ] @@ -5993,24 +5523,6 @@ dependencies = [ "base64 0.13.1", ] -[[package]] -name = "pem-rfc7468" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" -dependencies = [ - "base64ct", -] - -[[package]] -name = "pem-rfc7468" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" -dependencies = [ - "base64ct", -] - [[package]] name = "percent-encoding" version = "2.3.0" @@ -6183,7 +5695,7 @@ checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ "cpufeatures", "opaque-debug", - "universal-hash 0.4.1", + "universal-hash", ] [[package]] @@ -6195,19 +5707,7 @@ dependencies = [ "cfg-if", "cpufeatures", "opaque-debug", - "universal-hash 0.4.1", -] - -[[package]] -name = "polyval" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash 0.5.1", + "universal-hash", ] [[package]] @@ -6266,11 +5766,11 @@ dependencies = [ [[package]] name = "primeorder" -version = "0.13.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" +checksum = "0b54f7131b3dba65a2f414cf5bd25b66d4682e4608610668eae785750ba4c5b2" dependencies = [ - "elliptic-curve 0.13.5", + "elliptic-curve 0.12.3", ] [[package]] @@ -6521,7 +6021,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "asynchronous-codec", "bytes", @@ -6564,23 +6064,6 @@ dependencies = [ "pin-project-lite 0.1.12", ] -[[package]] -name = "quinn-proto" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85af4ed6ee5a89f26a26086e9089a6643650544c025158449a3626ebf72884b3" -dependencies = [ - "bytes", - "rand 0.8.5", - "ring", - "rustc-hash", - "rustls 0.21.2", - "slab", - "thiserror", - "tinyvec", - "tracing", -] - [[package]] name = "quote" version = "1.0.28" @@ -6725,31 +6208,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "rcgen" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" -dependencies = [ - "pem", - "ring", - "time 0.3.22", - "x509-parser 0.13.2", - "yasna", -] - -[[package]] -name = "rcgen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" -dependencies = [ - "pem", - "ring", - "time 0.3.22", - "yasna", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -6938,17 +6396,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rtcp" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1919efd6d4a6a85d13388f9487549bb8e359f17198cc03ffd72f79b553873691" -dependencies = [ - "bytes", - "thiserror", - "webrtc-util", -] - [[package]] name = "rtnetlink" version = "0.10.1" @@ -6964,20 +6411,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "rtp" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a095411ff00eed7b12e4c6a118ba984d113e1079582570d56a5ee723f11f80" -dependencies = [ - "async-trait", - "bytes", - "rand 0.8.5", - "serde", - "thiserror", - "webrtc-util", -] - [[package]] name = "rusqlite" version = "0.28.0" @@ -7023,18 +6456,9 @@ dependencies = [ name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.17", -] - -[[package]] -name = "rusticata-macros" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "nom 7.1.3", + "semver 1.0.17", ] [[package]] @@ -7127,7 +6551,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=09d04fa35c6e774458347dd5f285b8946905e940#09d04fa35c6e774458347dd5f285b8946905e940" +source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" dependencies = [ "futures", "pin-project", @@ -7156,7 +6580,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecbd2eb639fd7cab5804a0837fe373cc2172d15437e804c054a9fb885cb923b0" dependencies = [ - "cipher 0.3.0", + "cipher", ] [[package]] @@ -7254,18 +6678,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "sdp" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d22a5ef407871893fd72b4562ee15e4742269b173959db4b8df6f538c414e13" -dependencies = [ - "rand 0.8.5", - "substring", - "thiserror", - "url", -] - [[package]] name = "sec1" version = "0.3.0" @@ -7454,7 +6866,7 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ - "darling 0.13.4", + "darling", "proc-macro2", "quote", "syn 1.0.109", @@ -7589,9 +7001,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.1.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", @@ -7838,7 +7250,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" dependencies = [ - "aes-gcm 0.9.4", + "aes-gcm", "blake2", "chacha20poly1305", "curve25519-dalek 4.0.0-rc.1", @@ -8066,34 +7478,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "stun" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" -dependencies = [ - "base64 0.13.1", - "crc", - "lazy_static", - "md-5", - "rand 0.8.5", - "ring", - "subtle", - "thiserror", - "tokio", - "url", - "webrtc-util", -] - -[[package]] -name = "substring" -version = "1.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "subtle" version = "2.4.1" @@ -8106,7 +7490,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a99807a055ff4ff5d249bb84c80d9eabb55ca3c452187daae43fd5b51ef695" dependencies = [ - "darling 0.13.4", + "darling", "itertools", "proc-macro2", "quote", @@ -8120,7 +7504,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b9e5728aa1a87141cefd4e7509903fc01fa0dcb108022b1e841a67c5159fc5" dependencies = [ - "darling 0.13.4", + "darling", "itertools", "proc-macro2", "quote", @@ -8654,7 +8038,6 @@ checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", "pin-project-lite 0.2.9", "slab", @@ -8861,7 +8244,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84303a9c7cda5f085a3ed9cd241d1e95e04d88aab1d679b02f212e653537ba86" dependencies = [ - "darling 0.13.4", + "darling", "quote", "syn 1.0.109", ] @@ -8968,25 +8351,6 @@ dependencies = [ "webpki 0.22.0", ] -[[package]] -name = "turn" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" -dependencies = [ - "async-trait", - "base64 0.13.1", - "futures", - "log", - "md-5", - "rand 0.8.5", - "ring", - "stun", - "thiserror", - "tokio", - "webrtc-util", -] - [[package]] name = "twoway" version = "0.1.8" @@ -9124,16 +8488,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - [[package]] name = "unsigned-varint" version = "0.6.0" @@ -9196,15 +8550,6 @@ dependencies = [ "serde", ] -[[package]] -name = "uuid" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81" -dependencies = [ - "getrandom 0.2.10", -] - [[package]] name = "validator_client" version = "0.3.5" @@ -9308,15 +8653,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -[[package]] -name = "waitgroup" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1f50000a783467e6c0200f9d10642f4bc424e39efc1b770203e88b488f79292" -dependencies = [ - "atomic-waker", -] - [[package]] name = "waker-fn" version = "1.1.0" @@ -9610,215 +8946,6 @@ dependencies = [ "rustls-webpki", ] -[[package]] -name = "webrtc" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3bc9049bdb2cea52f5fd4f6f728184225bdb867ed0dc2410eab6df5bdd67bb" -dependencies = [ - "arc-swap", - "async-trait", - "bytes", - "hex", - "interceptor", - "lazy_static", - "log", - "rand 0.8.5", - "rcgen 0.9.3", - "regex", - "ring", - "rtcp", - "rtp", - "rustls 0.19.1", - "sdp", - "serde", - "serde_json", - "sha2 0.10.7", - "stun", - "thiserror", - "time 0.3.22", - "tokio", - "turn", - "url", - "waitgroup", - "webrtc-data", - "webrtc-dtls", - "webrtc-ice", - "webrtc-mdns", - "webrtc-media", - "webrtc-sctp", - "webrtc-srtp", - "webrtc-util", -] - -[[package]] -name = "webrtc-data" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef36a4d12baa6e842582fe9ec16a57184ba35e1a09308307b67d43ec8883100" -dependencies = [ - "bytes", - "derive_builder", - "log", - "thiserror", - "tokio", - "webrtc-sctp", - "webrtc-util", -] - -[[package]] -name = "webrtc-dtls" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942be5bd85f072c3128396f6e5a9bfb93ca8c1939ded735d177b7bcba9a13d05" -dependencies = [ - "aes 0.6.0", - "aes-gcm 0.10.2", - "async-trait", - "bincode", - "block-modes", - "byteorder", - "ccm", - "curve25519-dalek 3.2.0", - "der-parser 8.2.0", - "elliptic-curve 0.12.3", - "hkdf", - "hmac 0.12.1", - "log", - "oid-registry 0.6.1", - "p256 0.11.1", - "p384", - "rand 0.8.5", - "rand_core 0.6.4", - "rcgen 0.9.3", - "ring", - "rustls 0.19.1", - "sec1 0.3.0", - "serde", - "sha1", - "sha2 0.10.7", - "signature 1.6.4", - "subtle", - "thiserror", - "tokio", - "webpki 0.21.4", - "webrtc-util", - "x25519-dalek 2.0.0-pre.1", - "x509-parser 0.13.2", -] - -[[package]] -name = "webrtc-ice" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465a03cc11e9a7d7b4f9f99870558fe37a102b65b93f8045392fef7c67b39e80" -dependencies = [ - "arc-swap", - "async-trait", - "crc", - "log", - "rand 0.8.5", - "serde", - "serde_json", - "stun", - "thiserror", - "tokio", - "turn", - "url", - "uuid 1.3.4", - "waitgroup", - "webrtc-mdns", - "webrtc-util", -] - -[[package]] -name = "webrtc-mdns" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" -dependencies = [ - "log", - "socket2 0.4.9", - "thiserror", - "tokio", - "webrtc-util", -] - -[[package]] -name = "webrtc-media" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f72e1650a8ae006017d1a5280efb49e2610c19ccc3c0905b03b648aee9554991" -dependencies = [ - "byteorder", - "bytes", - "rand 0.8.5", - "rtp", - "thiserror", -] - -[[package]] -name = "webrtc-sctp" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d47adcd9427eb3ede33d5a7f3424038f63c965491beafcc20bc650a2f6679c0" -dependencies = [ - "arc-swap", - "async-trait", - "bytes", - "crc", - "log", - "rand 0.8.5", - "thiserror", - "tokio", - "webrtc-util", -] - -[[package]] -name = "webrtc-srtp" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6183edc4c1c6c0175f8812eefdce84dfa0aea9c3ece71c2bf6ddd3c964de3da5" -dependencies = [ - "aead 0.4.3", - "aes 0.7.5", - "aes-gcm 0.9.4", - "async-trait", - "byteorder", - "bytes", - "ctr 0.8.0", - "hmac 0.11.0", - "log", - "rtcp", - "rtp", - "sha-1 0.9.8", - "subtle", - "thiserror", - "tokio", - "webrtc-util", -] - -[[package]] -name = "webrtc-util" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" -dependencies = [ - "async-trait", - "bitflags 1.3.2", - "bytes", - "cc", - "ipnet", - "lazy_static", - "libc", - "log", - "nix 0.24.3", - "rand 0.8.5", - "thiserror", - "tokio", - "winapi", -] - [[package]] name = "which" version = "4.4.0" @@ -10139,53 +9266,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "x25519-dalek" -version = "2.0.0-pre.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" -dependencies = [ - "curve25519-dalek 3.2.0", - "rand_core 0.6.4", - "zeroize", -] - -[[package]] -name = "x509-parser" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" -dependencies = [ - "asn1-rs 0.3.1", - "base64 0.13.1", - "data-encoding", - "der-parser 7.0.0", - "lazy_static", - "nom 7.1.3", - "oid-registry 0.4.0", - "ring", - "rusticata-macros", - "thiserror", - "time 0.3.22", -] - -[[package]] -name = "x509-parser" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab0c2f54ae1d92f4fcb99c0b7ccf0b1e3451cbd395e5f115ccbdbcb18d4f634" -dependencies = [ - "asn1-rs 0.5.2", - "data-encoding", - "der-parser 8.2.0", - "lazy_static", - "nom 7.1.3", - "oid-registry 0.6.1", - "rusticata-macros", - "thiserror", - "time 0.3.22", -] - [[package]] name = "xml-rs" version = "0.8.14" @@ -10224,15 +9304,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "yasna" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" -dependencies = [ - "time 0.3.22", -] - [[package]] name = "zeroize" version = "1.6.0" diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index d995d9eba6b..32f225e619c 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "09d04fa35c6e774458347dd5f285b8946905e940" +rev = "61128713eb2612344baa0db897a82ea9e57616e9" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/peer_manager/mod.rs b/beacon_node/lighthouse_network/src/peer_manager/mod.rs index c6c737caed0..2c8dd5a9709 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/mod.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/mod.rs @@ -21,7 +21,8 @@ use std::{ use strum::IntoEnumIterator; use types::{EthSpec, SyncSubnetId}; -pub use libp2p::core::{identity::Keypair, Multiaddr}; +pub use libp2p::core::Multiaddr; +pub use libp2p::identity::Keypair; #[allow(clippy::mutable_key_type)] // PeerId in hashmaps are no longer permitted by clippy pub mod peerdb; @@ -2330,4 +2331,4 @@ mod tests { }) } } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index 85bb92eadc0..dca2856b988 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -5,10 +5,9 @@ use crate::types::{ }; use crate::{GossipTopic, NetworkConfig}; use libp2p::bandwidth::BandwidthSinks; -use libp2p::core::{ - identity::Keypair, multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed, -}; +use libp2p::core::{multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed}; use libp2p::gossipsub; +use libp2p::identity::{self, Keypair}; use libp2p::{core, noise, yamux, PeerId, Transport, TransportExt}; use prometheus_client::registry::Registry; use slog::{debug, warn}; @@ -82,9 +81,9 @@ fn keypair_from_hex(hex_bytes: &str) -> error::Result { #[allow(dead_code)] fn keypair_from_bytes(mut bytes: Vec) -> error::Result { - libp2p::identity::secp256k1::SecretKey::try_from_bytes(&mut bytes) + identity::secp256k1::SecretKey::try_from_bytes(&mut bytes) .map(|secret| { - let keypair: libp2p::identity::secp256k1::Keypair = secret.into(); + let keypair: identity::secp256k1::Keypair = secret.into(); keypair.into() }) .map_err(|e| format!("Unable to parse p2p secret key: {:?}", e).into()) @@ -104,9 +103,9 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { Ok(_) => { // only accept secp256k1 keys for now if let Ok(secret_key) = - libp2p::identity::secp256k1::SecretKey::try_from_bytes(&mut key_bytes) + identity::secp256k1::SecretKey::try_from_bytes(&mut key_bytes) { - let kp: libp2p::identity::secp256k1::Keypair = secret_key.into(); + let kp: identity::secp256k1::Keypair = secret_key.into(); debug!(log, "Loaded network key from disk."); return kp.into(); } else { From 4fa7762f7b4f8e25aa6ec7fbaeb6e25bad20e47b Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 16:59:25 -0500 Subject: [PATCH 060/102] multiaddr can no longer produce invalid peer ids --- Cargo.lock | 126 +++++++++--------- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/discovery/mod.rs | 3 +- 3 files changed, 68 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f4fb0c00a32..a397e4e4c9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -735,6 +735,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "tinyvec", +] + [[package]] name = "buf_redux" version = "0.8.4" @@ -1453,6 +1462,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" dependencies = [ "const-oid", + "pem-rfc7468", "zeroize", ] @@ -1663,18 +1673,6 @@ dependencies = [ "signature 1.6.4", ] -[[package]] -name = "ecdsa" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12844141594ad74185a926d030f3b605f6a903b4e3fec351f3ea338ac5b7637e" -dependencies = [ - "der 0.6.1", - "elliptic-curve 0.12.3", - "rfc6979 0.3.1", - "signature 2.0.0", -] - [[package]] name = "ecdsa" version = "0.16.7" @@ -1805,6 +1803,7 @@ dependencies = [ "ff 0.13.0", "generic-array", "group 0.13.0", + "pem-rfc7468", "pkcs8 0.10.2", "rand_core 0.6.4", "sec1 0.7.2", @@ -1828,7 +1827,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26fa0a0be8915790626d5759eb51fe47435a8eac92c2f212bd2da9aa7f30ea56" dependencies = [ "base64 0.13.1", - "bs58", + "bs58 0.4.0", "bytes", "hex", "k256 0.11.6", @@ -2189,7 +2188,7 @@ source = "git+https://github.com/ralexstokes//ethereum-consensus?rev=9b0ee0a8a45 dependencies = [ "async-stream", "blst", - "bs58", + "bs58 0.4.0", "enr 0.6.2", "hex", "integer-sqrt", @@ -3217,7 +3216,7 @@ name = "http_api" version = "0.1.0" dependencies = [ "beacon_chain", - "bs58", + "bs58 0.4.0", "directory", "environment", "eth1", @@ -3858,7 +3857,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "bytes", "futures", @@ -3880,14 +3879,14 @@ dependencies = [ "libp2p-tcp", "libp2p-websocket", "libp2p-yamux", - "multiaddr 0.17.1", + "multiaddr 0.18.0", "pin-project", ] [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -3898,7 +3897,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -3913,7 +3912,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1fff5bd889c82a0aec668f2045edd066f559d4e5c40354e5a4c77ac00caac38" dependencies = [ "asn1_der", - "bs58", + "bs58 0.4.0", "ed25519-dalek 1.0.1", "either", "fnv", @@ -3944,7 +3943,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "either", "fnv", @@ -3953,8 +3952,8 @@ dependencies = [ "instant", "libp2p-identity", "log", - "multiaddr 0.17.1", - "multihash 0.17.0", + "multiaddr 0.18.0", + "multihash 0.19.0", "multistream-select 0.13.0", "once_cell", "parking_lot 0.12.1", @@ -3971,7 +3970,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -3985,7 +3984,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4016,7 +4015,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "asynchronous-codec", "either", @@ -4036,21 +4035,20 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e2d584751cecb2aabaa56106be6be91338a60a0f4e420cf2af639204f596fc1" +checksum = "93a7b3534b84fe89985d8076246806c845e716d0cdac50925dcf65caf49ab3c0" dependencies = [ "asn1_der", - "bs58", + "bs58 0.5.0", "ed25519-dalek 1.0.1", "libsecp256k1", "log", - "multiaddr 0.17.1", - "multihash 0.17.0", - "p256 0.12.0", + "multihash 0.19.0", + "p256 0.13.2", "quick-protobuf", "rand 0.8.5", - "sec1 0.3.0", + "sec1 0.7.2", "sha2 0.10.7", "thiserror", "void", @@ -4060,7 +4058,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "data-encoding", "futures", @@ -4080,7 +4078,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "instant", "libp2p-core 0.40.0", @@ -4095,7 +4093,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4117,7 +4115,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "asynchronous-codec", "bytes", @@ -4132,7 +4130,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "either", "fnv", @@ -4154,7 +4152,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "heck", "proc-macro-warning", @@ -4166,7 +4164,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "futures", "futures-timer", @@ -4182,7 +4180,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "either", "futures", @@ -4201,7 +4199,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4771,7 +4769,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c580bfdd8803cce319b047d239559a22f809094aaea4ac13902a1fdcfcd4261" dependencies = [ "arrayref", - "bs58", + "bs58 0.4.0", "byteorder", "data-encoding", "multihash 0.16.3", @@ -4784,16 +4782,16 @@ dependencies = [ [[package]] name = "multiaddr" -version = "0.17.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b36f567c7099511fa8612bbbb52dda2419ce0bdbacf31714e3a5ffdb766d3bd" +checksum = "92a651988b3ed3ad1bc8c87d016bb92f6f395b84ed1db9b926b32b1fc5a2c8b5" dependencies = [ "arrayref", "byteorder", "data-encoding", - "log", + "libp2p-identity", "multibase", - "multihash 0.17.0", + "multihash 0.19.0", "percent-encoding", "serde", "static_assertions", @@ -4827,12 +4825,11 @@ dependencies = [ [[package]] name = "multihash" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" +checksum = "2fd59dcc2bbe70baabeac52cd22ae52c55eefe6c38ff11a9439f16a350a939f2" dependencies = [ "core2", - "multihash-derive", "unsigned-varint 0.7.1", ] @@ -4891,7 +4888,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "bytes", "futures", @@ -5358,12 +5355,12 @@ dependencies = [ [[package]] name = "p256" -version = "0.12.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c124b3cbce43bcbac68c58ec181d98ed6cc7e6d0aa7c3ba97b2563410b0e55" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "ecdsa 0.15.1", - "elliptic-curve 0.12.3", + "ecdsa 0.16.7", + "elliptic-curve 0.13.5", "primeorder", "sha2 0.10.7", ] @@ -5523,6 +5520,15 @@ dependencies = [ "base64 0.13.1", ] +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.0" @@ -5766,11 +5772,11 @@ dependencies = [ [[package]] name = "primeorder" -version = "0.12.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b54f7131b3dba65a2f414cf5bd25b66d4682e4608610668eae785750ba4c5b2" +checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" dependencies = [ - "elliptic-curve 0.12.3", + "elliptic-curve 0.13.5", ] [[package]] @@ -6021,7 +6027,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "asynchronous-codec", "bytes", @@ -6551,7 +6557,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=61128713eb2612344baa0db897a82ea9e57616e9#61128713eb2612344baa0db897a82ea9e57616e9" +source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 32f225e619c..c80b481051e 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "61128713eb2612344baa0db897a82ea9e57616e9" +rev = "4532302917ed2b7254837629d1b0b8da39b4c359" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 4ee5a18d8b9..0e09c5b4e3e 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -1118,7 +1118,6 @@ impl Discovery { if let Some(peer_id) = peer_id { match error { DialError::LocalPeerId { .. } - | DialError::InvalidPeerId(_) | DialError::Denied { .. } | DialError::NoAddresses | DialError::Transport(_) @@ -1274,4 +1273,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} +} \ No newline at end of file From 1dd04209dfd14764f394f915a656cb12c72ca929 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 17:01:48 -0500 Subject: [PATCH 061/102] checkpoint --- Cargo.lock | 38 +++++++++++------------ beacon_node/lighthouse_network/Cargo.toml | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a397e4e4c9b..c1e1061a996 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3857,7 +3857,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "bytes", "futures", @@ -3886,7 +3886,7 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -3897,7 +3897,7 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -3943,7 +3943,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "either", "fnv", @@ -3970,7 +3970,7 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -3984,7 +3984,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4015,7 +4015,7 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "asynchronous-codec", "either", @@ -4058,7 +4058,7 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "data-encoding", "futures", @@ -4078,7 +4078,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "instant", "libp2p-core 0.40.0", @@ -4093,7 +4093,7 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4115,7 +4115,7 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "asynchronous-codec", "bytes", @@ -4130,7 +4130,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "either", "fnv", @@ -4152,7 +4152,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "heck", "proc-macro-warning", @@ -4164,7 +4164,7 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "futures", "futures-timer", @@ -4180,7 +4180,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "either", "futures", @@ -4199,7 +4199,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4888,7 +4888,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "bytes", "futures", @@ -6027,7 +6027,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "asynchronous-codec", "bytes", @@ -6557,7 +6557,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=4532302917ed2b7254837629d1b0b8da39b4c359#4532302917ed2b7254837629d1b0b8da39b4c359" +source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index c80b481051e..e8546b110be 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,7 @@ void = "1" [dependencies.libp2p] # version = "0.51.3" git = "https://github.com/libp2p/rust-libp2p" -rev = "4532302917ed2b7254837629d1b0b8da39b4c359" +rev = "c2230f99481ddee2537c13cfd90c4349f4ee2515" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] From eeb9232cbd5ce4a28900088fdc3affacd4a8f73e Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 17:06:14 -0500 Subject: [PATCH 062/102] v0.52. Finally --- Cargo.lock | 59 +++++++++++++++-------- beacon_node/lighthouse_network/Cargo.toml | 4 +- 2 files changed, 41 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c1e1061a996..b234470a9f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3857,7 +3857,8 @@ dependencies = [ [[package]] name = "libp2p" version = "0.52.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "265b12faeb6ea2e770644ed98ba0e563d326088f8ba5a31080be772cb2800513" dependencies = [ "bytes", "futures", @@ -3886,7 +3887,8 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55b46558c5c0bf99d3e2a1a38fd54ff5476ca66dd1737b12466a1824dd219311" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -3897,7 +3899,8 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d45dd90e8f0e1fa59e85ff5316dd4d1ac41a9a507e79cda1b0e9b7be43ad1a56" dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", @@ -3943,7 +3946,8 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef7dd7b09e71aac9271c60031d0e558966cdb3253ba0308ab369bb2de80630d0" dependencies = [ "either", "fnv", @@ -3970,7 +3974,8 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd4394c81c0c06d7b4a60f3face7e8e8a9b246840f98d2c80508d0721b032147" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -3984,7 +3989,8 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e378da62e8c9251f6e885ed173a561663f29b251e745586cf6ae6150b295c37" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4015,7 +4021,8 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a29675a32dbcc87790db6cf599709e64308f1ae9d5ecea2d259155889982db8" dependencies = [ "asynchronous-codec", "either", @@ -4058,7 +4065,8 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a2567c305232f5ef54185e9604579a894fd0674819402bb0ac0246da82f52a" dependencies = [ "data-encoding", "futures", @@ -4078,7 +4086,8 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3787ea81798dcc5bf1d8b40a8e8245cf894b168d04dd70aa48cb3ff2fff141d2" dependencies = [ "instant", "libp2p-core 0.40.0", @@ -4093,7 +4102,8 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87945db2b3f977af09b62b9aa0a5f3e4870995a577ecd845cdeba94cdf6bbca7" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -4101,6 +4111,8 @@ dependencies = [ "libp2p-core 0.40.0", "libp2p-identity", "log", + "multiaddr 0.18.0", + "multihash 0.19.0", "once_cell", "quick-protobuf", "rand 0.8.5", @@ -4115,7 +4127,8 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37266c683a757df713f7dcda0cdcb5ad4681355ffa1b37b77c113c176a531195" dependencies = [ "asynchronous-codec", "bytes", @@ -4130,7 +4143,8 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6f1fe3817492f88c5298c8b5fbaa5ff3a0c802ecf4e79be4e341cf07abfa82f" dependencies = [ "either", "fnv", @@ -4152,7 +4166,8 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4d5ec2a3df00c7836d7696c136274c9c59705bac69133253696a6c932cd1d74" dependencies = [ "heck", "proc-macro-warning", @@ -4164,7 +4179,8 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09bfdfb6f945c5c014b87872a0bdb6e0aef90e92f380ef57cd9013f118f9289d" dependencies = [ "futures", "futures-timer", @@ -4180,7 +4196,8 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956d981ebc84abc3377e5875483c06d94ff57bc6b25f725047f9fd52592f72d4" dependencies = [ "either", "futures", @@ -4199,7 +4216,8 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0a9b42ab6de15c6f076d8fb11dc5f48d899a10b55a2e16b12be9012a05287b0" dependencies = [ "futures", "libp2p-core 0.40.0", @@ -4888,7 +4906,8 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea0df8e5eec2298a62b326ee4f0d7fe1a6b90a09dfcf9df37b38f947a8c42f19" dependencies = [ "bytes", "futures", @@ -6027,7 +6046,8 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ededb1cd78531627244d51dd0c7139fbe736c7d57af0092a76f0ffb2f56e98" dependencies = [ "asynchronous-codec", "bytes", @@ -6557,7 +6577,8 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=c2230f99481ddee2537c13cfd90c4349f4ee2515#c2230f99481ddee2537c13cfd90c4349f4ee2515" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8c9026ff5d2f23da5e45bbc283f156383001bfb09c4e44256d02c1a685fe9a1" dependencies = [ "futures", "pin-project", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index e8546b110be..0f9edf9fbce 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -46,9 +46,7 @@ delay_map = "0.3.0" void = "1" [dependencies.libp2p] -# version = "0.51.3" -git = "https://github.com/libp2p/rust-libp2p" -rev = "c2230f99481ddee2537c13cfd90c4349f4ee2515" +version = "0.52.0" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] From e62db42e73ad04ad747aa3718d57d463350d969a Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 24 Jun 2023 17:06:56 -0500 Subject: [PATCH 063/102] cargo update --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b234470a9f3..ffea821588d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1683,7 +1683,7 @@ dependencies = [ "digest 0.10.7", "elliptic-curve 0.13.5", "rfc6979 0.4.0", - "signature 2.0.0", + "signature 2.1.0", "spki 0.7.2", ] @@ -1703,7 +1703,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" dependencies = [ "pkcs8 0.10.2", - "signature 2.0.0", + "signature 2.1.0", ] [[package]] @@ -3693,7 +3693,7 @@ dependencies = [ "elliptic-curve 0.13.5", "once_cell", "sha2 0.10.7", - "signature 2.0.0", + "signature 2.1.0", ] [[package]] @@ -7028,9 +7028,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", From 63a0cf03521c3804330da5c74d9b7a75fd4a72ee Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 28 Jun 2023 17:10:51 -0500 Subject: [PATCH 064/102] update identity --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ffea821588d..4b805648d83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4042,9 +4042,9 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a7b3534b84fe89985d8076246806c845e716d0cdac50925dcf65caf49ab3c0" +checksum = "d2874d9c6575f1d7a151022af5c42bb0ffdcdfbafe0a6fd039de870b384835a2" dependencies = [ "asn1_der", "bs58 0.5.0", From 4167cf523187d89b0a8c65b4acd4129a2e4dc102 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 29 Jun 2023 21:08:19 -0500 Subject: [PATCH 065/102] ignore pending inbound connection accept/reject in discovery --- beacon_node/lighthouse_network/src/discovery/mod.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 0e09c5b4e3e..75512e0ceba 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -928,15 +928,6 @@ impl NetworkBehaviour for Discovery { type ConnectionHandler = ConnectionHandler; type ToSwarm = DiscoveredPeers; - fn handle_pending_inbound_connection( - &mut self, - _connection_id: ConnectionId, - _local_addr: &Multiaddr, - _remote_addr: &Multiaddr, - ) -> Result<(), libp2p::swarm::ConnectionDenied> { - todo!() - } - fn handle_pending_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -1273,4 +1264,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} \ No newline at end of file +} From 373303282ee88e332a982f51ae7d55cc3676ab66 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 29 Jun 2023 21:12:53 -0500 Subject: [PATCH 066/102] fix workflows --- .github/workflows/test-suite.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 8a330c960ef..02c4a18b4c3 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -255,6 +255,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Get latest version of stable Rust + clippy: name: clippy runs-on: ubuntu-latest needs: cargo-fmt @@ -333,4 +334,4 @@ jobs: - name: Use Rust beta run: rustup override set beta - name: Run make - run: make \ No newline at end of file + run: make From eeda936b55500c70e943f613ed5cb27ea7d41e50 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 29 Jun 2023 21:15:27 -0500 Subject: [PATCH 067/102] more workflow fixes --- .github/workflows/test-suite.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 02c4a18b4c3..1dd63d095cd 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -255,6 +255,9 @@ jobs: steps: - uses: actions/checkout@v3 - name: Get latest version of stable Rust + run: rustup update stable + - name: Typecheck benchmark code without running it + run: make check-benches clippy: name: clippy runs-on: ubuntu-latest From 2c68cb46df5edd2b59a4697be1609612d4ef5472 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 29 Jun 2023 21:33:59 -0500 Subject: [PATCH 068/102] partially address discovery todos --- .../lighthouse_network/src/discovery/mod.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 75512e0ceba..96ff88269ec 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -947,26 +947,27 @@ impl NetworkBehaviour for Discovery { Ok(vec![]) } - #[allow(unused)] fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, - peer: PeerId, - local_addr: &Multiaddr, - remote_addr: &Multiaddr, + _peer: PeerId, + _local_addr: &Multiaddr, + _remote_addr: &Multiaddr, ) -> Result, libp2p::swarm::ConnectionDenied> { - todo!() + // TODO(@divma): we might want to check discovery's banned ips here. + Ok(ConnectionHandler) } #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, - peer: PeerId, - addr: &Multiaddr, - role_override: libp2p::core::Endpoint, + _peer: PeerId, + _addr: &Multiaddr, + _role_override: libp2p::core::Endpoint, ) -> Result, libp2p::swarm::ConnectionDenied> { - todo!() + // TODO(@divma): trust that the dialed address is not banned? + Ok(ConnectionHandler) } fn on_swarm_event(&mut self, event: FromSwarm) { From b97af5ea4a9a74b24d9763345b2ef04c8b4c5979 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 29 Jun 2023 22:05:18 -0500 Subject: [PATCH 069/102] address todos in rpc; improving logging in the handler --- .../lighthouse_network/src/rpc/handler.rs | 20 +++-- beacon_node/lighthouse_network/src/rpc/mod.rs | 75 ++++++++++--------- 2 files changed, 55 insertions(+), 40 deletions(-) diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index b483adeb2ec..df58f8b77e6 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -212,7 +212,7 @@ where pub fn new( listen_protocol: SubstreamProtocol, ()>, fork_context: Arc, - log: &slog::Logger, + log: slog::Logger, ) -> Self { RPCHandler { listen_protocol, @@ -230,7 +230,7 @@ where outbound_io_error_retries: 0, fork_context, waker: None, - log: log.clone(), + log, } } @@ -384,7 +384,9 @@ where } // return any events that need to be reported if !self.events_out.is_empty() { - return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(self.events_out.remove(0))); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + self.events_out.remove(0), + )); } else { self.events_out.shrink_to_fit(); } @@ -448,7 +450,9 @@ where error: RPCError::StreamTimeout, }; // notify the user - return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err(outbound_err))); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err( + outbound_err, + ))); } else { crit!(self.log, "timed out substream not in the books"; "stream_id" => outbound_id.get_ref()); } @@ -734,7 +738,9 @@ where proto: request.versioned_protocol().protocol(), error: RPCError::IncompleteStream, }; - return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err(outbound_err))); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err( + outbound_err, + ))); } Poll::Pending => { entry.get_mut().state = @@ -750,7 +756,9 @@ where error: e, }; entry.remove_entry(); - return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err(outbound_err))); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err( + outbound_err, + ))); } }, OutboundSubstreamState::Closing(mut substream) => { diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index fa8af0d5c48..f331f95ef41 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -10,10 +10,11 @@ use libp2p::swarm::{ handler::ConnectionHandler, ConnectionId, NetworkBehaviour, NotifyHandler, PollParameters, ToSwarm, }; -use libp2p::swarm::{FromSwarm, THandlerInEvent}; +use libp2p::swarm::{FromSwarm, SubstreamProtocol, THandlerInEvent}; use libp2p::PeerId; use rate_limiter::{RPCRateLimiter as RateLimiter, RateLimitedErr}; use slog::{crit, debug, o}; +use std::marker::PhantomData; use std::sync::Arc; use std::task::{Context, Poll}; use types::{EthSpec, ForkContext}; @@ -31,6 +32,7 @@ pub(crate) use outbound::OutboundRequest; pub use protocol::{max_rpc_size, Protocol, RPCError}; use self::config::{InboundRateLimiterConfig, OutboundRateLimiterConfig}; +use self::protocol::RPCProtocol; use self::self_limiter::SelfRateLimiter; pub(crate) mod codec; @@ -107,7 +109,6 @@ type BehaviourAction = ToSwarm, RPCSend { /// Rate limiter limiter: Option, @@ -224,7 +225,7 @@ where | FromSwarm::NewExternalAddrCandidate(_) | FromSwarm::ExternalAddrExpired(_) | FromSwarm::ExternalAddrConfirmed(_) => { - // Rpc Bheaviour does not act on these swarm events. We use a comprehensive match + // Rpc Behaviour does not act on these swarm events. We use a comprehensive match // statement tu ensure future events are dealt with appropiately. } } @@ -322,47 +323,53 @@ where Poll::Pending } - #[allow(unused)] - fn handle_pending_inbound_connection( + fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, + peer_id: PeerId, _local_addr: &libp2p::Multiaddr, _remote_addr: &libp2p::Multiaddr, - ) -> Result<(), libp2p::swarm::ConnectionDenied> { - todo!() - } - - #[allow(unused)] - fn handle_established_inbound_connection( - &mut self, - _connection_id: ConnectionId, - peer: PeerId, - local_addr: &libp2p::Multiaddr, - remote_addr: &libp2p::Multiaddr, ) -> Result, libp2p::swarm::ConnectionDenied> { - todo!() - } - - #[allow(unused)] - fn handle_pending_outbound_connection( - &mut self, - _connection_id: ConnectionId, - maybe_peer: Option, - _addresses: &[libp2p::Multiaddr], - _effective_role: libp2p::core::Endpoint, - ) -> Result, libp2p::swarm::ConnectionDenied> { - todo!() + let protocol = SubstreamProtocol::new( + RPCProtocol { + fork_context: self.fork_context.clone(), + max_rpc_size: max_rpc_size(&self.fork_context), + enable_light_client_server: self.enable_light_client_server, + phantom: PhantomData, + }, + (), + ); + // NOTE: this is needed because PeerIds have interior mutability. + let peer_repr = peer_id.to_string(); + let log = self.log.new(slog::o!("peer_id" => peer_repr)); + let handler = RPCHandler::new(protocol, self.fork_context.clone(), log); + + Ok(handler) } - #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, - peer: PeerId, - addr: &libp2p::Multiaddr, - role_override: libp2p::core::Endpoint, + peer_id: PeerId, + _addr: &libp2p::Multiaddr, + _role_override: libp2p::core::Endpoint, ) -> Result, libp2p::swarm::ConnectionDenied> { - todo!() + let protocol = SubstreamProtocol::new( + RPCProtocol { + fork_context: self.fork_context.clone(), + max_rpc_size: max_rpc_size(&self.fork_context), + enable_light_client_server: self.enable_light_client_server, + phantom: PhantomData, + }, + (), + ); + + // NOTE: this is needed because PeerIds have interior mutability. + let peer_repr = peer_id.to_string(); + let log = self.log.new(slog::o!("peer_id" => peer_repr)); + let handler = RPCHandler::new(protocol, self.fork_context.clone(), log); + + Ok(handler) } } @@ -399,4 +406,4 @@ where slog::Result::Ok(()) } -} +} \ No newline at end of file From 9f1afc68f3c24c30d32b3ab3fa081d5086584eb1 Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 29 Jun 2023 22:17:06 -0500 Subject: [PATCH 070/102] one todo! out, three in :sigh: --- .../lighthouse_network/src/rpc/handler.rs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index df58f8b77e6..86edbe78a60 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -855,8 +855,25 @@ where ConnectionEvent::DialUpgradeError(DialUpgradeError { info, error }) => { self.on_dial_upgrade_error(info, error) } - // TODO(@divma): placeholders - _ => todo!(), + ConnectionEvent::ListenUpgradeError(libp2p::swarm::handler::ListenUpgradeError { + info: _, + error: _, /* RPCError */ + }) => { + // TODO(@divma): why would this fail.... + todo!() + } + ConnectionEvent::LocalProtocolsChange(_) => { + // TODO(@divma): fork boundary is the only thing that comes to mind + todo!() + } + ConnectionEvent::RemoteProtocolsChange(_) => { + // TODO(@divma): unclear how this is done/happens, but: most likely can happen across a fork + // boundary. need to read more + todo!(); + } + ConnectionEvent::AddressChange(_) => { + // don't care about these + } } } } From 8a9697bffd1f031925b56b752e7736dfe421498c Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 29 Jun 2023 22:25:02 -0500 Subject: [PATCH 071/102] more todos --- .../src/peer_manager/network_behaviour.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 7c0b3e139bd..429b18bee8b 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -26,6 +26,8 @@ impl NetworkBehaviour for PeerManager { fn on_swarm_event(&mut self, event: FromSwarm) { match event { + // TODO(@divma): what's the difference between this event and the + // handle_established_inbound/outbound_connection ? FromSwarm::ConnectionEstablished(ConnectionEstablished { peer_id, endpoint, @@ -48,6 +50,8 @@ impl NetworkBehaviour for PeerManager { | FromSwarm::NewExternalAddrCandidate(_) | FromSwarm::ExternalAddrExpired(_) | FromSwarm::ExternalAddrConfirmed(_) => { + // TODO(@divma): need to think about all these + todo!() // The rest of the events we ignore since they are handled in their associated // `SwarmEvent` } @@ -102,7 +106,7 @@ impl NetworkBehaviour for PeerManager { _connection_id: ConnectionId, _event: libp2p::swarm::THandlerOutEvent, ) { - todo!() + // no events from the dummy handler } fn poll( @@ -319,4 +323,4 @@ impl PeerManager { } } } -} \ No newline at end of file +} From afee9a7445272c067f8d632a75ea73351f9b9060 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sun, 2 Jul 2023 22:19:40 -0500 Subject: [PATCH 072/102] remove unnecesary clones --- .../src/discovery/enr_ext.rs | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 8e4b701f598..f72b8e50e56 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -220,20 +220,24 @@ impl CombinedKeyPublicExt for CombinedPublicKey { impl CombinedKeyExt for CombinedKey { fn from_libp2p(key: Keypair) -> Result { - // TODO: more clones that should not be happening. - if let Ok(key) = key.clone().try_into_secp256k1() { - let secret = discv5::enr::k256::ecdsa::SigningKey::from_slice(&key.secret().to_bytes()) - .expect("libp2p key must be valid"); - Ok(CombinedKey::Secp256k1(secret)) - } else if let Ok(key) = key.try_into_ed25519() { - let ed_keypair = discv5::enr::ed25519_dalek::SigningKey::from_bytes( - &(key.to_bytes()[..32]) - .try_into() - .expect("libp2p key must be valid"), - ); - Ok(CombinedKey::from(ed_keypair)) - } else { - Err("Unsupported keypair kind") + match key.key_type() { + libp2p::identity::KeyType::Secp256k1 => { + let key = key.try_into_secp256k1().expect("right key type"); + let secret = + discv5::enr::k256::ecdsa::SigningKey::from_slice(&key.secret().to_bytes()) + .expect("libp2p key must be valid"); + Ok(CombinedKey::Secp256k1(secret)) + } + libp2p::identity::KeyType::Ed25519 => { + let key = key.try_into_ed25519().expect("right key type"); + let ed_keypair = discv5::enr::ed25519_dalek::SigningKey::from_bytes( + &(key.to_bytes()[..32]) + .try_into() + .expect("libp2p key must be valid"), + ); + Ok(CombinedKey::from(ed_keypair)) + } + _ => Err("Unsupported keypair kind"), } } } From 49965a7423c839bd4cc960664a67a17c04431c66 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sun, 2 Jul 2023 22:27:02 -0500 Subject: [PATCH 073/102] remove more unnecesary clones --- .../src/discovery/enr_ext.rs | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index f72b8e50e56..6c895f9de18 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -255,23 +255,34 @@ pub fn peer_id_to_node_id(peer_id: &PeerId) -> Result { + let pk = public_key + .clone() + .try_into_secp256k1() + .expect("right key type"); + let uncompressed_key_bytes = &pk.to_bytes_uncompressed()[1..]; + let mut output = [0_u8; 32]; + let mut hasher = Keccak::v256(); + hasher.update(uncompressed_key_bytes); + hasher.finalize(&mut output); + Ok(discv5::enr::NodeId::parse(&output).expect("Must be correct length")) + } + libp2p::identity::KeyType::Ed25519 => { + let pk = public_key + .clone() + .try_into_secp256k1() + .expect("right key type"); + let uncompressed_key_bytes = pk.to_bytes(); + let mut output = [0_u8; 32]; + let mut hasher = Keccak::v256(); + hasher.update(&uncompressed_key_bytes); + hasher.finalize(&mut output); + Ok(discv5::enr::NodeId::parse(&output).expect("Must be correct length")) + } + + _ => Err(format!("Unsupported public key from peer {}", peer_id)), } } From 63b93f38743e442496685c829ddeed877c646c6f Mon Sep 17 00:00:00 2001 From: Diva M Date: Sun, 2 Jul 2023 22:29:56 -0500 Subject: [PATCH 074/102] fix style --- .../src/discovery/enr_ext.rs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 6c895f9de18..4fd85aa831f 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -3,7 +3,7 @@ use crate::{Enr, Multiaddr, PeerId}; use discv5::enr::{CombinedKey, CombinedPublicKey}; use libp2p::core::multiaddr::Protocol; -use libp2p::identity::{Keypair, PublicKey}; +use libp2p::identity::{ed25519, secp256k1, KeyType, Keypair, PublicKey}; use tiny_keccak::{Hasher, Keccak}; /// Extend ENR for libp2p types. @@ -198,7 +198,6 @@ impl CombinedKeyPublicExt for CombinedPublicKey { /// /// This is only available with the `libp2p` feature flag. fn as_peer_id(&self) -> PeerId { - use libp2p::identity::{ed25519, secp256k1}; match self { Self::Secp256k1(pk) => { let pk_bytes = pk.to_sec1_bytes(); @@ -221,14 +220,14 @@ impl CombinedKeyPublicExt for CombinedPublicKey { impl CombinedKeyExt for CombinedKey { fn from_libp2p(key: Keypair) -> Result { match key.key_type() { - libp2p::identity::KeyType::Secp256k1 => { + KeyType::Secp256k1 => { let key = key.try_into_secp256k1().expect("right key type"); let secret = discv5::enr::k256::ecdsa::SigningKey::from_slice(&key.secret().to_bytes()) .expect("libp2p key must be valid"); Ok(CombinedKey::Secp256k1(secret)) } - libp2p::identity::KeyType::Ed25519 => { + KeyType::Ed25519 => { let key = key.try_into_ed25519().expect("right key type"); let ed_keypair = discv5::enr::ed25519_dalek::SigningKey::from_bytes( &(key.to_bytes()[..32]) @@ -257,7 +256,7 @@ pub fn peer_id_to_node_id(peer_id: &PeerId) -> Result { + KeyType::Secp256k1 => { let pk = public_key .clone() .try_into_secp256k1() @@ -269,7 +268,7 @@ pub fn peer_id_to_node_id(peer_id: &PeerId) -> Result { + KeyType::Ed25519 => { let pk = public_key .clone() .try_into_secp256k1() @@ -288,6 +287,7 @@ pub fn peer_id_to_node_id(peer_id: &PeerId) -> Result Date: Sun, 2 Jul 2023 22:43:20 -0500 Subject: [PATCH 075/102] prepare handover --- beacon_node/lighthouse_network/src/discovery/mod.rs | 1 + .../src/peer_manager/network_behaviour.rs | 11 +++++++---- beacon_node/lighthouse_network/src/rpc/mod.rs | 3 ++- beacon_node/lighthouse_network/src/service/mod.rs | 4 +++- beacon_node/lighthouse_network/src/service/utils.rs | 2 +- beacon_node/network/src/service.rs | 4 ++-- lcli/src/generate_bootnode_enr.rs | 4 ++-- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 96ff88269ec..037c146f4fc 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -971,6 +971,7 @@ impl NetworkBehaviour for Discovery { } fn on_swarm_event(&mut self, event: FromSwarm) { + // TODO(@divma): check this match event { FromSwarm::DialFailure(DialFailure { peer_id, error, .. }) => { self.on_dial_failure(peer_id, error) diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 429b18bee8b..6ca960f2a3e 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -28,6 +28,8 @@ impl NetworkBehaviour for PeerManager { match event { // TODO(@divma): what's the difference between this event and the // handle_established_inbound/outbound_connection ? + // just checked the libp2p code. These happen at the same time. + // We just need to pick which one is more benefitial to handle FromSwarm::ConnectionEstablished(ConnectionEstablished { peer_id, endpoint, @@ -64,7 +66,7 @@ impl NetworkBehaviour for PeerManager { _local_addr: &libp2p::Multiaddr, _remote_addr: &libp2p::Multiaddr, ) -> Result<(), libp2p::swarm::ConnectionDenied> { - // TODO... is it guaranteed that the ip the peer is connecting from is in the _remote_addr? + // TODO(@divma) is it guaranteed that the ip the peer is connecting from is in the _remote_addr? todo!() } @@ -76,7 +78,7 @@ impl NetworkBehaviour for PeerManager { _addresses: &[libp2p::Multiaddr], _effective_role: libp2p::core::Endpoint, ) -> Result, libp2p::swarm::ConnectionDenied> { - // TODO: + // TODO(@divma) tired // - _effective_role: will probably be needed once we get quic // - _addresses: check if addresses to dial contain any banned ip @@ -182,6 +184,7 @@ impl NetworkBehaviour for PeerManager { Poll::Pending } + #[allow(unused)] fn handle_established_inbound_connection( &mut self, @@ -190,7 +193,7 @@ impl NetworkBehaviour for PeerManager { local_addr: &libp2p::Multiaddr, remote_addr: &libp2p::Multiaddr, ) -> Result, libp2p::swarm::ConnectionDenied> { - todo!() + // TODO(@divma) pick either this or the swarm event } #[allow(unused)] @@ -201,7 +204,7 @@ impl NetworkBehaviour for PeerManager { addr: &libp2p::Multiaddr, role_override: libp2p::core::Endpoint, ) -> Result, libp2p::swarm::ConnectionDenied> { - todo!() + // TODO(@divma) pick either this or the swarm event } } diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index f331f95ef41..f520308ad3b 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -225,6 +225,7 @@ where | FromSwarm::NewExternalAddrCandidate(_) | FromSwarm::ExternalAddrExpired(_) | FromSwarm::ExternalAddrConfirmed(_) => { + // TODO(@divma) check this // Rpc Behaviour does not act on these swarm events. We use a comprehensive match // statement tu ensure future events are dealt with appropiately. } @@ -406,4 +407,4 @@ where slog::Result::Ok(()) } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 48313b050c8..e44d18daea9 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -360,6 +360,8 @@ impl Network { ) .notify_handler_buffer_size(std::num::NonZeroUsize::new(7).expect("Not zero")) .per_connection_event_buffer_size(4) + // TODO(@divma) lower than the default but still higher than the prev val. + // check this .build(), bandwidth, ) @@ -1530,4 +1532,4 @@ impl Network { pub async fn next_event(&mut self) -> NetworkEvent { futures::future::poll_fn(|cx| self.poll_network(cx)).await } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index dca2856b988..ad7d24f8a32 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -117,7 +117,7 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { // if a key could not be loaded from disk, generate a new one and save it let local_private_key = Keypair::generate_secp256k1(); - // TODO: generate the spcific key type first and then convert it to the wrapper type. This + // TODO(@divma): generate the spcific key type first and then convert it to the wrapper type. This // avoids the clone and the awkward double conversion if let Ok(key) = local_private_key.clone().try_into_secp256k1() { let _ = std::fs::create_dir_all(&config.network_dir); diff --git a/beacon_node/network/src/service.rs b/beacon_node/network/src/service.rs index a4b65d20b5b..8ae341f39c4 100644 --- a/beacon_node/network/src/service.rs +++ b/beacon_node/network/src/service.rs @@ -483,7 +483,7 @@ impl NetworkService { self.send_to_router(RouterMessage::StatusPeer(peer_id)); } NetworkEvent::PeerConnectedIncoming(_) => { - // No action required for these events. + // No action required for this event. } NetworkEvent::PeerDisconnected(peer_id) => { self.send_to_router(RouterMessage::PeerDisconnected(peer_id)); @@ -987,4 +987,4 @@ impl Drop for NetworkService { info!(self.log, "Network service shutdown"); } -} \ No newline at end of file +} diff --git a/lcli/src/generate_bootnode_enr.rs b/lcli/src/generate_bootnode_enr.rs index 48d1790ef14..3a8f7ef9022 100644 --- a/lcli/src/generate_bootnode_enr.rs +++ b/lcli/src/generate_bootnode_enr.rs @@ -47,7 +47,7 @@ pub fn run(matches: &ArgMatches) -> Result<(), String> { .write_all(enr.to_base64().as_bytes()) .map_err(|e| format!("Unable to write ENR to {}: {:?}", ENR_FILENAME, e))?; - // TODO: this error should be unreachable. + // TODO(@divma): this error can be made unreachable. let secret_bytes = match local_keypair.try_into_secp256k1() { Ok(key) => key.secret().to_bytes(), _ => return Err("Key is not a secp256k1 key".into()), @@ -60,4 +60,4 @@ pub fn run(matches: &ArgMatches) -> Result<(), String> { .map_err(|e| format!("Unable to write key to {}: {:?}", NETWORK_KEY_FILENAME, e))?; Ok(()) -} \ No newline at end of file +} From b97cfee7cf37057eadba80bfd5ffe927d5d2de72 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 8 Jul 2023 21:36:48 -0500 Subject: [PATCH 076/102] reduce diff, avoid new features for now --- .../src/peer_manager/network_behaviour.rs | 113 ++++++------------ 1 file changed, 35 insertions(+), 78 deletions(-) diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 6ca960f2a3e..df68ac9cea7 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -24,84 +24,6 @@ impl NetworkBehaviour for PeerManager { /* Required trait members */ - fn on_swarm_event(&mut self, event: FromSwarm) { - match event { - // TODO(@divma): what's the difference between this event and the - // handle_established_inbound/outbound_connection ? - // just checked the libp2p code. These happen at the same time. - // We just need to pick which one is more benefitial to handle - FromSwarm::ConnectionEstablished(ConnectionEstablished { - peer_id, - endpoint, - other_established, - .. - }) => self.on_connection_established(peer_id, endpoint, other_established), - FromSwarm::ConnectionClosed(ConnectionClosed { - peer_id, - remaining_established, - .. - }) => self.on_connection_closed(peer_id, remaining_established), - FromSwarm::DialFailure(DialFailure { peer_id, .. }) => self.on_dial_failure(peer_id), - FromSwarm::AddressChange(_) - | FromSwarm::ListenFailure(_) - | FromSwarm::NewListener(_) - | FromSwarm::NewListenAddr(_) - | FromSwarm::ExpiredListenAddr(_) - | FromSwarm::ListenerError(_) - | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddrCandidate(_) - | FromSwarm::ExternalAddrExpired(_) - | FromSwarm::ExternalAddrConfirmed(_) => { - // TODO(@divma): need to think about all these - todo!() - // The rest of the events we ignore since they are handled in their associated - // `SwarmEvent` - } - } - } - - fn handle_pending_inbound_connection( - &mut self, - _connection_id: ConnectionId, - _local_addr: &libp2p::Multiaddr, - _remote_addr: &libp2p::Multiaddr, - ) -> Result<(), libp2p::swarm::ConnectionDenied> { - // TODO(@divma) is it guaranteed that the ip the peer is connecting from is in the _remote_addr? - todo!() - } - - #[allow(unused)] - fn handle_pending_outbound_connection( - &mut self, - _connection_id: ConnectionId, - maybe_peer: Option, - _addresses: &[libp2p::Multiaddr], - _effective_role: libp2p::core::Endpoint, - ) -> Result, libp2p::swarm::ConnectionDenied> { - // TODO(@divma) tired - // - _effective_role: will probably be needed once we get quic - // - _addresses: check if addresses to dial contain any banned ip - - // Check to make sure the peer is not supposed to be banned - todo!() - // if let Some(peer_id) = maybe_peer { - // match self.ban_status(&peer_id) { - // BanResult::BadScore | BanResult::BannedIp(_) => { - // // TODO: need to create an error type for this - // Err(libp2p::swarm::ConnectionDenied::new(())) - // } - // BanResult::NotBanned => { - // // TODO: do stuff. - // // check if the peer is being dialed (so this behaviour dialed) - // // if not, check if we want the peer, prevent the dial attempt otherwise - // // - // // What happens if another behaviour prevents our dial attempt? do we get any - // // notification to get the peer out of dialing state? dial failed? - // } - // } - // } - } - fn on_connection_handler_event( &mut self, _peer_id: PeerId, @@ -184,6 +106,41 @@ impl NetworkBehaviour for PeerManager { Poll::Pending } + fn on_swarm_event(&mut self, event: FromSwarm) { + match event { + // TODO(@divma): what's the difference between this event and the + // handle_established_inbound/outbound_connection ? + // just checked the libp2p code. These happen at the same time. + // We just need to pick which one is more benefitial to handle + FromSwarm::ConnectionEstablished(ConnectionEstablished { + peer_id, + endpoint, + other_established, + .. + }) => self.on_connection_established(peer_id, endpoint, other_established), + FromSwarm::ConnectionClosed(ConnectionClosed { + peer_id, + remaining_established, + .. + }) => self.on_connection_closed(peer_id, remaining_established), + FromSwarm::DialFailure(DialFailure { peer_id, .. }) => self.on_dial_failure(peer_id), + FromSwarm::AddressChange(_) + | FromSwarm::ListenFailure(_) + | FromSwarm::NewListener(_) + | FromSwarm::NewListenAddr(_) + | FromSwarm::ExpiredListenAddr(_) + | FromSwarm::ListenerError(_) + | FromSwarm::ListenerClosed(_) + | FromSwarm::NewExternalAddrCandidate(_) + | FromSwarm::ExternalAddrExpired(_) + | FromSwarm::ExternalAddrConfirmed(_) => { + // TODO(@divma): need to think about all these + todo!() + // The rest of the events we ignore since they are handled in their associated + // `SwarmEvent` + } + } + } #[allow(unused)] fn handle_established_inbound_connection( From 3e06b8b84631443fdb19e6cfa1da530369f0c0b2 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 8 Jul 2023 22:38:05 -0500 Subject: [PATCH 077/102] restore PM behaviour --- .../src/peer_manager/network_behaviour.rs | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index df68ac9cea7..6aaa63d006d 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -1,3 +1,5 @@ +//! Implementation of [`NetworkBehaviour`] for the [`PeerManager`]. + use std::task::{Context, Poll}; use futures::StreamExt; @@ -108,22 +110,29 @@ impl NetworkBehaviour for PeerManager { fn on_swarm_event(&mut self, event: FromSwarm) { match event { - // TODO(@divma): what's the difference between this event and the - // handle_established_inbound/outbound_connection ? - // just checked the libp2p code. These happen at the same time. - // We just need to pick which one is more benefitial to handle FromSwarm::ConnectionEstablished(ConnectionEstablished { peer_id, endpoint, other_established, .. - }) => self.on_connection_established(peer_id, endpoint, other_established), + }) => { + // NOTE: We still need to handle the [`ConnectionEstablished`] because the + // [`NetworkBehaviour::handle_established_inbound_connection`] and + // [`NetworkBehaviour::handle_established_outbound_connection`] are fallible. This + // means another behaviour can kill the connection early, and we can't assume a + // peer as connected until this event is received. + self.on_connection_established(peer_id, endpoint, other_established) + } FromSwarm::ConnectionClosed(ConnectionClosed { peer_id, remaining_established, .. }) => self.on_connection_closed(peer_id, remaining_established), FromSwarm::DialFailure(DialFailure { peer_id, .. }) => self.on_dial_failure(peer_id), + FromSwarm::ExternalAddrConfirmed(_) => { + // TODO(@divma): we likely want to check this against our assumed external tcp + // address + } FromSwarm::AddressChange(_) | FromSwarm::ListenFailure(_) | FromSwarm::NewListener(_) @@ -132,25 +141,22 @@ impl NetworkBehaviour for PeerManager { | FromSwarm::ListenerError(_) | FromSwarm::ListenerClosed(_) | FromSwarm::NewExternalAddrCandidate(_) - | FromSwarm::ExternalAddrExpired(_) - | FromSwarm::ExternalAddrConfirmed(_) => { - // TODO(@divma): need to think about all these - todo!() + | FromSwarm::ExternalAddrExpired(_) => { // The rest of the events we ignore since they are handled in their associated // `SwarmEvent` } } } - #[allow(unused)] fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, - peer: PeerId, - local_addr: &libp2p::Multiaddr, - remote_addr: &libp2p::Multiaddr, + _peer: PeerId, + _local_addr: &libp2p::Multiaddr, + _remote_addr: &libp2p::Multiaddr, ) -> Result, libp2p::swarm::ConnectionDenied> { - // TODO(@divma) pick either this or the swarm event + // TODO(@divma): we might want to check if we accept this peer or not in the future. + Ok(ConnectionHandler) } #[allow(unused)] @@ -161,7 +167,8 @@ impl NetworkBehaviour for PeerManager { addr: &libp2p::Multiaddr, role_override: libp2p::core::Endpoint, ) -> Result, libp2p::swarm::ConnectionDenied> { - // TODO(@divma) pick either this or the swarm event + // TODO(@divma): we might want to check if we accept this peer or not in the future. + Ok(ConnectionHandler) } } From c437a4b62a725c985bf7c3aa499409b2e28ccb59 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 8 Jul 2023 22:46:08 -0500 Subject: [PATCH 078/102] cleanup pm's network behaviour --- .../src/peer_manager/network_behaviour.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 6aaa63d006d..01c9741eb47 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -130,7 +130,7 @@ impl NetworkBehaviour for PeerManager { }) => self.on_connection_closed(peer_id, remaining_established), FromSwarm::DialFailure(DialFailure { peer_id, .. }) => self.on_dial_failure(peer_id), FromSwarm::ExternalAddrConfirmed(_) => { - // TODO(@divma): we likely want to check this against our assumed external tcp + // TODO: we likely want to check this against our assumed external tcp // address } FromSwarm::AddressChange(_) @@ -155,19 +155,18 @@ impl NetworkBehaviour for PeerManager { _local_addr: &libp2p::Multiaddr, _remote_addr: &libp2p::Multiaddr, ) -> Result, libp2p::swarm::ConnectionDenied> { - // TODO(@divma): we might want to check if we accept this peer or not in the future. + // TODO: we might want to check if we accept this peer or not in the future. Ok(ConnectionHandler) } - #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, - peer: PeerId, - addr: &libp2p::Multiaddr, - role_override: libp2p::core::Endpoint, + _peer: PeerId, + _addr: &libp2p::Multiaddr, + _role_override: libp2p::core::Endpoint, ) -> Result, libp2p::swarm::ConnectionDenied> { - // TODO(@divma): we might want to check if we accept this peer or not in the future. + // TODO: we might want to check if we accept this peer or not in the future. Ok(ConnectionHandler) } } From 64fc9dcb9310cd95652ee85465825bee3b86fd5b Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 8 Jul 2023 23:02:11 -0500 Subject: [PATCH 079/102] cleanup discovery --- .../lighthouse_network/src/discovery/mod.rs | 85 +++++++++---------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index 037c146f4fc..8b091bc7bbb 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -928,25 +928,6 @@ impl NetworkBehaviour for Discovery { type ConnectionHandler = ConnectionHandler; type ToSwarm = DiscoveredPeers; - fn handle_pending_outbound_connection( - &mut self, - _connection_id: ConnectionId, - maybe_peer: Option, - _addresses: &[Multiaddr], - _effective_role: libp2p::core::Endpoint, - ) -> Result, libp2p::swarm::ConnectionDenied> { - if let Some(peer_id) = maybe_peer { - if let Some(enr) = self.enr_of_peer(&peer_id) { - // ENR's may have multiple Multiaddrs. The multi-addr associated with the UDP - // port is removed, which is assumed to be associated with the discv5 protocol (and - // therefore irrelevant for other libp2p components). - return Ok(enr.multiaddr_tcp()); - } - } - - Ok(vec![]) - } - fn handle_established_inbound_connection( &mut self, _connection_id: ConnectionId, @@ -954,11 +935,10 @@ impl NetworkBehaviour for Discovery { _local_addr: &Multiaddr, _remote_addr: &Multiaddr, ) -> Result, libp2p::swarm::ConnectionDenied> { - // TODO(@divma): we might want to check discovery's banned ips here. + // TODO: we might want to check discovery's banned ips here in the future. Ok(ConnectionHandler) } - #[allow(unused)] fn handle_established_outbound_connection( &mut self, _connection_id: ConnectionId, @@ -966,33 +946,9 @@ impl NetworkBehaviour for Discovery { _addr: &Multiaddr, _role_override: libp2p::core::Endpoint, ) -> Result, libp2p::swarm::ConnectionDenied> { - // TODO(@divma): trust that the dialed address is not banned? Ok(ConnectionHandler) } - fn on_swarm_event(&mut self, event: FromSwarm) { - // TODO(@divma): check this - match event { - FromSwarm::DialFailure(DialFailure { peer_id, error, .. }) => { - self.on_dial_failure(peer_id, error) - } - FromSwarm::ConnectionEstablished(_) - | FromSwarm::ConnectionClosed(_) - | FromSwarm::AddressChange(_) - | FromSwarm::ListenFailure(_) - | FromSwarm::NewListener(_) - | FromSwarm::NewListenAddr(_) - | FromSwarm::ExpiredListenAddr(_) - | FromSwarm::ListenerError(_) - | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddrCandidate(_) - | FromSwarm::ExternalAddrExpired(_) - | FromSwarm::ExternalAddrConfirmed(_) => { - // Ignore events not relevant to discovery - } - } - } - fn on_connection_handler_event( &mut self, _peer_id: PeerId, @@ -1001,6 +957,23 @@ impl NetworkBehaviour for Discovery { ) { } + fn handle_pending_outbound_connection( + &mut self, + _connection_id: ConnectionId, + maybe_peer: Option, + _addresses: &[Multiaddr], + _effective_role: libp2p::core::Endpoint, + ) -> Result, libp2p::swarm::ConnectionDenied> { + if let Some(enr) = maybe_peer.and_then(|peer_id| self.enr_of_peer(&peer_id)) { + // ENR's may have multiple Multiaddrs. The multi-addr associated with the UDP + // port is removed, which is assumed to be associated with the discv5 protocol (and + // therefore irrelevant for other libp2p components). + Ok(enr.multiaddr_tcp()) + } else { + Ok(vec![]) + } + } + // Main execution loop to drive the behaviour fn poll( &mut self, @@ -1104,6 +1077,28 @@ impl NetworkBehaviour for Discovery { } Poll::Pending } + + fn on_swarm_event(&mut self, event: FromSwarm) { + match event { + FromSwarm::DialFailure(DialFailure { peer_id, error, .. }) => { + self.on_dial_failure(peer_id, error) + } + FromSwarm::ConnectionEstablished(_) + | FromSwarm::ConnectionClosed(_) + | FromSwarm::AddressChange(_) + | FromSwarm::ListenFailure(_) + | FromSwarm::NewListener(_) + | FromSwarm::NewListenAddr(_) + | FromSwarm::ExpiredListenAddr(_) + | FromSwarm::ListenerError(_) + | FromSwarm::ListenerClosed(_) + | FromSwarm::NewExternalAddrCandidate(_) + | FromSwarm::ExternalAddrExpired(_) + | FromSwarm::ExternalAddrConfirmed(_) => { + // Ignore events not relevant to discovery + } + } + } } impl Discovery { From ec36293eebacfb22f780d34ba0a21c585f07b362 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 8 Jul 2023 23:08:05 -0500 Subject: [PATCH 080/102] cleanup service --- beacon_node/lighthouse_network/src/service/mod.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index e44d18daea9..bf4c493c4b1 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -360,8 +360,6 @@ impl Network { ) .notify_handler_buffer_size(std::num::NonZeroUsize::new(7).expect("Not zero")) .per_connection_event_buffer_size(4) - // TODO(@divma) lower than the default but still higher than the prev val. - // check this .build(), bandwidth, ) From c736daf852018c5fc98c6f7a41372f2477e05644 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 8 Jul 2023 23:14:21 -0500 Subject: [PATCH 081/102] cleanup rpc/mod --- beacon_node/lighthouse_network/src/rpc/mod.rs | 103 +++++++++--------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index f520308ad3b..fcb3f446626 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -210,10 +210,61 @@ where type ConnectionHandler = RPCHandler; type ToSwarm = RPCMessage; + fn handle_established_inbound_connection( + &mut self, + _connection_id: ConnectionId, + peer_id: PeerId, + _local_addr: &libp2p::Multiaddr, + _remote_addr: &libp2p::Multiaddr, + ) -> Result, libp2p::swarm::ConnectionDenied> { + let protocol = SubstreamProtocol::new( + RPCProtocol { + fork_context: self.fork_context.clone(), + max_rpc_size: max_rpc_size(&self.fork_context), + enable_light_client_server: self.enable_light_client_server, + phantom: PhantomData, + }, + (), + ); + // NOTE: this is needed because PeerIds have interior mutability. + let peer_repr = peer_id.to_string(); + let log = self.log.new(slog::o!("peer_id" => peer_repr)); + let handler = RPCHandler::new(protocol, self.fork_context.clone(), log); + + Ok(handler) + } + + fn handle_established_outbound_connection( + &mut self, + _connection_id: ConnectionId, + peer_id: PeerId, + _addr: &libp2p::Multiaddr, + _role_override: libp2p::core::Endpoint, + ) -> Result, libp2p::swarm::ConnectionDenied> { + let protocol = SubstreamProtocol::new( + RPCProtocol { + fork_context: self.fork_context.clone(), + max_rpc_size: max_rpc_size(&self.fork_context), + enable_light_client_server: self.enable_light_client_server, + phantom: PhantomData, + }, + (), + ); + + // NOTE: this is needed because PeerIds have interior mutability. + let peer_repr = peer_id.to_string(); + let log = self.log.new(slog::o!("peer_id" => peer_repr)); + let handler = RPCHandler::new(protocol, self.fork_context.clone(), log); + + Ok(handler) + } + fn on_swarm_event(&mut self, event: FromSwarm) { match event { + FromSwarm::ConnectionClosed(_) => { + // TODO(@divma): do we want to initiate a shutdown here? + } FromSwarm::ConnectionEstablished(_) - | FromSwarm::ConnectionClosed(_) | FromSwarm::AddressChange(_) | FromSwarm::DialFailure(_) | FromSwarm::ListenFailure(_) @@ -225,7 +276,6 @@ where | FromSwarm::NewExternalAddrCandidate(_) | FromSwarm::ExternalAddrExpired(_) | FromSwarm::ExternalAddrConfirmed(_) => { - // TODO(@divma) check this // Rpc Behaviour does not act on these swarm events. We use a comprehensive match // statement tu ensure future events are dealt with appropiately. } @@ -323,55 +373,6 @@ where Poll::Pending } - - fn handle_established_inbound_connection( - &mut self, - _connection_id: ConnectionId, - peer_id: PeerId, - _local_addr: &libp2p::Multiaddr, - _remote_addr: &libp2p::Multiaddr, - ) -> Result, libp2p::swarm::ConnectionDenied> { - let protocol = SubstreamProtocol::new( - RPCProtocol { - fork_context: self.fork_context.clone(), - max_rpc_size: max_rpc_size(&self.fork_context), - enable_light_client_server: self.enable_light_client_server, - phantom: PhantomData, - }, - (), - ); - // NOTE: this is needed because PeerIds have interior mutability. - let peer_repr = peer_id.to_string(); - let log = self.log.new(slog::o!("peer_id" => peer_repr)); - let handler = RPCHandler::new(protocol, self.fork_context.clone(), log); - - Ok(handler) - } - - fn handle_established_outbound_connection( - &mut self, - _connection_id: ConnectionId, - peer_id: PeerId, - _addr: &libp2p::Multiaddr, - _role_override: libp2p::core::Endpoint, - ) -> Result, libp2p::swarm::ConnectionDenied> { - let protocol = SubstreamProtocol::new( - RPCProtocol { - fork_context: self.fork_context.clone(), - max_rpc_size: max_rpc_size(&self.fork_context), - enable_light_client_server: self.enable_light_client_server, - phantom: PhantomData, - }, - (), - ); - - // NOTE: this is needed because PeerIds have interior mutability. - let peer_repr = peer_id.to_string(); - let log = self.log.new(slog::o!("peer_id" => peer_repr)); - let handler = RPCHandler::new(protocol, self.fork_context.clone(), log); - - Ok(handler) - } } impl slog::KV for RPCMessage From 5d277a203bb5b3c4ce7dd21a919ecfbaba51c9d0 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 18 Jul 2023 21:57:54 -0500 Subject: [PATCH 082/102] one todo less --- .../lighthouse_network/src/service/utils.rs | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index ad7d24f8a32..36eb10e51aa 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -7,7 +7,7 @@ use crate::{GossipTopic, NetworkConfig}; use libp2p::bandwidth::BandwidthSinks; use libp2p::core::{multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed}; use libp2p::gossipsub; -use libp2p::identity::{self, Keypair}; +use libp2p::identity::{secp256k1, Keypair}; use libp2p::{core, noise, yamux, PeerId, Transport, TransportExt}; use prometheus_client::registry::Registry; use slog::{debug, warn}; @@ -81,9 +81,9 @@ fn keypair_from_hex(hex_bytes: &str) -> error::Result { #[allow(dead_code)] fn keypair_from_bytes(mut bytes: Vec) -> error::Result { - identity::secp256k1::SecretKey::try_from_bytes(&mut bytes) + secp256k1::SecretKey::try_from_bytes(&mut bytes) .map(|secret| { - let keypair: identity::secp256k1::Keypair = secret.into(); + let keypair: secp256k1::Keypair = secret.into(); keypair.into() }) .map_err(|e| format!("Unable to parse p2p secret key: {:?}", e).into()) @@ -102,10 +102,8 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { Err(_) => debug!(log, "Could not read network key file"), Ok(_) => { // only accept secp256k1 keys for now - if let Ok(secret_key) = - identity::secp256k1::SecretKey::try_from_bytes(&mut key_bytes) - { - let kp: identity::secp256k1::Keypair = secret_key.into(); + if let Ok(secret_key) = secp256k1::SecretKey::try_from_bytes(&mut key_bytes) { + let kp: secp256k1::Keypair = secret_key.into(); debug!(log, "Loaded network key from disk."); return kp.into(); } else { @@ -116,26 +114,24 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { } // if a key could not be loaded from disk, generate a new one and save it - let local_private_key = Keypair::generate_secp256k1(); + let local_private_key = secp256k1::Keypair::generate(); // TODO(@divma): generate the spcific key type first and then convert it to the wrapper type. This // avoids the clone and the awkward double conversion - if let Ok(key) = local_private_key.clone().try_into_secp256k1() { - let _ = std::fs::create_dir_all(&config.network_dir); - match File::create(network_key_f.clone()) - .and_then(|mut f| f.write_all(&key.secret().to_bytes())) - { - Ok(_) => { - debug!(log, "New network key generated and written to disk"); - } - Err(e) => { - warn!( - log, - "Could not write node key to file: {:?}. error: {}", network_key_f, e - ); - } + let _ = std::fs::create_dir_all(&config.network_dir); + match File::create(network_key_f.clone()) + .and_then(|mut f| f.write_all(&local_private_key.secret().to_bytes())) + { + Ok(_) => { + debug!(log, "New network key generated and written to disk"); + } + Err(e) => { + warn!( + log, + "Could not write node key to file: {:?}. error: {}", network_key_f, e + ); } } - local_private_key + local_private_key.into() } /// Generate authenticated XX Noise config from identity keys From e806b1842311d743b5c918997a38a35f01da62c2 Mon Sep 17 00:00:00 2001 From: Diva M Date: Tue, 18 Jul 2023 21:58:58 -0500 Subject: [PATCH 083/102] fix test --- beacon_node/lighthouse_network/src/discovery/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/mod.rs b/beacon_node/lighthouse_network/src/discovery/mod.rs index f7cf12bb917..0f8ddc53c1b 100644 --- a/beacon_node/lighthouse_network/src/discovery/mod.rs +++ b/beacon_node/lighthouse_network/src/discovery/mod.rs @@ -1164,7 +1164,7 @@ mod tests { &log, ); let keypair = keypair.into(); - Discovery::new(&keypair, &config, Arc::new(globals), &log) + Discovery::new(keypair, &config, Arc::new(globals), &log) .await .unwrap() } @@ -1263,4 +1263,4 @@ mod tests { // when a peer belongs to multiple subnet ids, we use the highest ttl. assert_eq!(results.get(&enr1.peer_id()).unwrap(), &instant1); } -} \ No newline at end of file +} From 52354c97916f8b4c821c7869430575549f2d950d Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 19 Jul 2023 21:25:59 -0500 Subject: [PATCH 084/102] fmt --- beacon_node/lighthouse_network/src/config.rs | 2 +- beacon_node/lighthouse_network/src/discovery/enr.rs | 2 +- beacon_node/lighthouse_network/src/peer_manager/mod.rs | 2 +- beacon_node/lighthouse_network/src/rpc/protocol.rs | 2 +- beacon_node/lighthouse_network/src/types/pubsub.rs | 2 +- beacon_node/lighthouse_network/tests/common.rs | 2 +- boot_node/src/config.rs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/beacon_node/lighthouse_network/src/config.rs b/beacon_node/lighthouse_network/src/config.rs index 5b82de5906b..6c8f20a24b9 100644 --- a/beacon_node/lighthouse_network/src/config.rs +++ b/beacon_node/lighthouse_network/src/config.rs @@ -560,4 +560,4 @@ pub const fn is_global_ipv6(addr: &Ipv6Addr) -> bool { || is_documentation(addr) || is_unique_local(addr) || is_unicast_link_local(addr)) -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/discovery/enr.rs b/beacon_node/lighthouse_network/src/discovery/enr.rs index 429490d9454..ef22f816a77 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr.rs @@ -258,4 +258,4 @@ pub fn save_enr_to_disk(dir: &Path, enr: &Enr, log: &slog::Logger) { ); } } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/peer_manager/mod.rs b/beacon_node/lighthouse_network/src/peer_manager/mod.rs index 2c8dd5a9709..4f3454f4033 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/mod.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/mod.rs @@ -2331,4 +2331,4 @@ mod tests { }) } } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/rpc/protocol.rs b/beacon_node/lighthouse_network/src/rpc/protocol.rs index bc445f98070..22f9f19d680 100644 --- a/beacon_node/lighthouse_network/src/rpc/protocol.rs +++ b/beacon_node/lighthouse_network/src/rpc/protocol.rs @@ -660,4 +660,4 @@ impl RPCError { e => e.into(), } } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/src/types/pubsub.rs b/beacon_node/lighthouse_network/src/types/pubsub.rs index fac89c7ccc6..06732ac99fd 100644 --- a/beacon_node/lighthouse_network/src/types/pubsub.rs +++ b/beacon_node/lighthouse_network/src/types/pubsub.rs @@ -319,4 +319,4 @@ impl std::fmt::Display for PubsubMessage { } } } -} \ No newline at end of file +} diff --git a/beacon_node/lighthouse_network/tests/common.rs b/beacon_node/lighthouse_network/tests/common.rs index 99eea04d1ad..b48891335cc 100644 --- a/beacon_node/lighthouse_network/tests/common.rs +++ b/beacon_node/lighthouse_network/tests/common.rs @@ -197,4 +197,4 @@ pub async fn build_linear( }; } nodes -} \ No newline at end of file +} diff --git a/boot_node/src/config.rs b/boot_node/src/config.rs index 60f74dc86d8..d006156bf9d 100644 --- a/boot_node/src/config.rs +++ b/boot_node/src/config.rs @@ -190,4 +190,4 @@ impl BootNodeConfigSerialization { enable_enr_auto_update: discv5_config.enr_update, } } -} \ No newline at end of file +} From 006d0e1f3b7f8facbca0380d854409c1f2f0af1d Mon Sep 17 00:00:00 2001 From: Age Manning Date: Thu, 20 Jul 2023 12:30:14 +1000 Subject: [PATCH 085/102] Age version --- beacon_node/lighthouse_network/src/rpc/mod.rs | 10 ++--- .../lighthouse_network/src/service/utils.rs | 39 +++++++++---------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index fcb3f446626..01afa98a3d3 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -261,10 +261,8 @@ where fn on_swarm_event(&mut self, event: FromSwarm) { match event { - FromSwarm::ConnectionClosed(_) => { - // TODO(@divma): do we want to initiate a shutdown here? - } - FromSwarm::ConnectionEstablished(_) + FromSwarm::ConnectionClosed(_) + | FromSwarm::ConnectionEstablished(_) | FromSwarm::AddressChange(_) | FromSwarm::DialFailure(_) | FromSwarm::ListenFailure(_) @@ -277,7 +275,7 @@ where | FromSwarm::ExternalAddrExpired(_) | FromSwarm::ExternalAddrConfirmed(_) => { // Rpc Behaviour does not act on these swarm events. We use a comprehensive match - // statement tu ensure future events are dealt with appropiately. + // statement to ensure future events are dealt with appropriately. } } } @@ -408,4 +406,4 @@ where slog::Result::Ok(()) } -} +} \ No newline at end of file diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index 36eb10e51aa..bd5ff3852a7 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -102,36 +102,33 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { Err(_) => debug!(log, "Could not read network key file"), Ok(_) => { // only accept secp256k1 keys for now - if let Ok(secret_key) = secp256k1::SecretKey::try_from_bytes(&mut key_bytes) { - let kp: secp256k1::Keypair = secret_key.into(); + if let Ok(kp) = Keypair::from_protobuf_encoding(&key_bytes) { debug!(log, "Loaded network key from disk."); - return kp.into(); + return kp; } else { - debug!(log, "Network key file is not a valid secp256k1 key"); + debug!( + log, + "Network key file is not a valid protobuf encoded secp256k1 key" + ); } } } } // if a key could not be loaded from disk, generate a new one and save it - let local_private_key = secp256k1::Keypair::generate(); - // TODO(@divma): generate the spcific key type first and then convert it to the wrapper type. This - // avoids the clone and the awkward double conversion + let local_private_key = Keypair::generate_secp256k1(); let _ = std::fs::create_dir_all(&config.network_dir); - match File::create(network_key_f.clone()) - .and_then(|mut f| f.write_all(&local_private_key.secret().to_bytes())) - { - Ok(_) => { - debug!(log, "New network key generated and written to disk"); - } - Err(e) => { - warn!( - log, - "Could not write node key to file: {:?}. error: {}", network_key_f, e - ); - } + match File::create(network_key_f.clone()) { + Ok(mut file) => match local_private_key.to_protobuf_encoding() { + Ok(mut private_key_bytes) => match file.write_all(&mut private_key_bytes) { + Ok(_) => debug!(log, "New network key generated and written to disk"), + Err(e) => warn!(log, "Failed to write network key to disk"; "error" =>e), + }, + Err(e) => warn!(log, "Failed to encode network key"; "error" => ?e), + }, + Err(e) => warn!(log, "Failed to open network key file"; "error" => e), } - local_private_key.into() + local_private_key } /// Generate authenticated XX Noise config from identity keys @@ -269,4 +266,4 @@ pub(crate) fn save_metadata_to_disk( ); } } -} +} \ No newline at end of file From 9543a0a2e9aa2ff707c8412115784d9ea75186e9 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 19 Jul 2023 21:56:02 -0500 Subject: [PATCH 086/102] @AgeManning says my version is better :shrug: so.. --- .../lighthouse_network/src/service/utils.rs | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index bd5ff3852a7..21fd09b6b0f 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -102,33 +102,34 @@ pub fn load_private_key(config: &NetworkConfig, log: &slog::Logger) -> Keypair { Err(_) => debug!(log, "Could not read network key file"), Ok(_) => { // only accept secp256k1 keys for now - if let Ok(kp) = Keypair::from_protobuf_encoding(&key_bytes) { + if let Ok(secret_key) = secp256k1::SecretKey::try_from_bytes(&mut key_bytes) { + let kp: secp256k1::Keypair = secret_key.into(); debug!(log, "Loaded network key from disk."); - return kp; + return kp.into(); } else { - debug!( - log, - "Network key file is not a valid protobuf encoded secp256k1 key" - ); + debug!(log, "Network key file is not a valid secp256k1 key"); } } } } // if a key could not be loaded from disk, generate a new one and save it - let local_private_key = Keypair::generate_secp256k1(); + let local_private_key = secp256k1::Keypair::generate(); let _ = std::fs::create_dir_all(&config.network_dir); - match File::create(network_key_f.clone()) { - Ok(mut file) => match local_private_key.to_protobuf_encoding() { - Ok(mut private_key_bytes) => match file.write_all(&mut private_key_bytes) { - Ok(_) => debug!(log, "New network key generated and written to disk"), - Err(e) => warn!(log, "Failed to write network key to disk"; "error" =>e), - }, - Err(e) => warn!(log, "Failed to encode network key"; "error" => ?e), - }, - Err(e) => warn!(log, "Failed to open network key file"; "error" => e), + match File::create(network_key_f.clone()) + .and_then(|mut f| f.write_all(&local_private_key.secret().to_bytes())) + { + Ok(_) => { + debug!(log, "New network key generated and written to disk"); + } + Err(e) => { + warn!( + log, + "Could not write node key to file: {:?}. error: {}", network_key_f, e + ); + } } - local_private_key + local_private_key.into() } /// Generate authenticated XX Noise config from identity keys @@ -266,4 +267,4 @@ pub(crate) fn save_metadata_to_disk( ); } } -} \ No newline at end of file +} From d46b1aa38ea2553a51d4bacbb64bc123e8c6e901 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 19 Jul 2023 21:56:20 -0500 Subject: [PATCH 087/102] fmt --- beacon_node/lighthouse_network/src/rpc/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 01afa98a3d3..4fd9b516d4c 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -406,4 +406,4 @@ where slog::Result::Ok(()) } -} \ No newline at end of file +} From 63a14ab74a008d30787cc9e7a0a329830e4d6f9a Mon Sep 17 00:00:00 2001 From: Age Manning Date: Thu, 20 Jul 2023 13:13:59 +1000 Subject: [PATCH 088/102] Handler modifications --- .../lighthouse_network/src/rpc/handler.rs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index 86edbe78a60..85b8b7145a9 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -859,20 +859,20 @@ where info: _, error: _, /* RPCError */ }) => { - // TODO(@divma): why would this fail.... - todo!() + // This is going to be removed in the next libp2p release. I think its fine to do + // nothing. } ConnectionEvent::LocalProtocolsChange(_) => { - // TODO(@divma): fork boundary is the only thing that comes to mind - todo!() + // This shouldn't effect this handler, we will still negotiate streams if we support + // the protocol as usual. } ConnectionEvent::RemoteProtocolsChange(_) => { - // TODO(@divma): unclear how this is done/happens, but: most likely can happen across a fork - // boundary. need to read more - todo!(); + // This shouldn't effect this handler, we will still negotiate streams if we support + // the protocol as usual. } ConnectionEvent::AddressChange(_) => { - // don't care about these + // We dont care about these changes as they have no bearing on our RPC internal + // logic. } } } @@ -943,6 +943,9 @@ where (id, request): (Id, OutboundRequest), ) { self.dial_negotiated -= 1; + // Reset any io-retries counter. + self.outbound_io_error_retries = 0; + let proto = request.versioned_protocol().protocol(); // accept outbound connections only if the handler is not deactivated @@ -1002,7 +1005,6 @@ where let error = match error { StreamUpgradeError::Timeout => RPCError::NegotiationTimeout, StreamUpgradeError::Apply(RPCError::IoError(e)) => { - // TODO(@divma): we should revisit this logic self.outbound_io_error_retries += 1; if self.outbound_io_error_retries < IO_ERROR_RETRIES { self.send_request(id, req); @@ -1010,7 +1012,6 @@ where } RPCError::IoError(e) } - // TODO(@divma): this might be wrong. A shame this info was lost. StreamUpgradeError::NegotiationFailed => RPCError::UnsupportedProtocol, StreamUpgradeError::Io(io_err) => { self.outbound_io_error_retries += 1; @@ -1078,4 +1079,4 @@ async fn send_message_to_inbound_substream( // Everything worked as expected return the result. send_result.map(|_| (substream, false)) } -} +} \ No newline at end of file From a1f128639ff0b11fb6e74dee14e261fb06914b2c Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 19 Jul 2023 22:17:30 -0500 Subject: [PATCH 089/102] add banner peers behaviour --- beacon_node/lighthouse_network/src/service/behaviour.rs | 6 ++++-- beacon_node/lighthouse_network/src/service/mod.rs | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/behaviour.rs b/beacon_node/lighthouse_network/src/service/behaviour.rs index a830a9c1efd..6c52a07c14a 100644 --- a/beacon_node/lighthouse_network/src/service/behaviour.rs +++ b/beacon_node/lighthouse_network/src/service/behaviour.rs @@ -20,6 +20,10 @@ where AppReqId: ReqId, TSpec: EthSpec, { + /// Peers banned. + pub banned_peers: libp2p::allow_block_list::Behaviour, + /// Keep track of active and pending connections to enforce hard limits. + pub connection_limits: libp2p::connection_limits::Behaviour, /// The routing pub-sub mechanism for eth2. pub gossipsub: Gossipsub, /// The Eth2 RPC specified in the wire-0 protocol. @@ -32,6 +36,4 @@ where pub identify: identify::Behaviour, /// The peer manager that keeps track of peer's reputation and status. pub peer_manager: PeerManager, - /// Keep track of active and pending connections to enforce hard limits. - pub connection_limits: libp2p::connection_limits::Behaviour, } diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index bf4c493c4b1..11242bd3813 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -325,8 +325,11 @@ impl Network { libp2p::connection_limits::Behaviour::new(limits) }; + let banned_peers = libp2p::allow_block_list::Behaviour::default(); + let behaviour = { Behaviour { + banned_peers, gossipsub, eth2_rpc, discovery, @@ -1384,10 +1387,15 @@ impl Network { Some(NetworkEvent::PeerDisconnected(peer_id)) } PeerManagerEvent::Banned(peer_id, associated_ips) => { + self.swarm.behaviour_mut().banned_peers.block_peer(peer_id); self.discovery_mut().ban_peer(&peer_id, associated_ips); None } PeerManagerEvent::UnBanned(peer_id, associated_ips) => { + self.swarm + .behaviour_mut() + .banned_peers + .unblock_peer(peer_id); self.discovery_mut().unban_peer(&peer_id, associated_ips); None } @@ -1436,6 +1444,7 @@ impl Network { let maybe_event = match swarm_event { SwarmEvent::Behaviour(behaviour_event) => match behaviour_event { // Handle sub-behaviour events. + BehaviourEvent::BannedPeers(void) => void::unreachable(void), BehaviourEvent::Gossipsub(ge) => self.inject_gs_event(ge), BehaviourEvent::Eth2Rpc(re) => self.inject_rpc_event(re), BehaviourEvent::Discovery(de) => self.inject_discovery_event(de), From 72ae2b58e2b682895841606032ffe2b2964ca803 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 19 Jul 2023 22:36:27 -0500 Subject: [PATCH 090/102] fmt --- beacon_node/lighthouse_network/src/rpc/handler.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index 85b8b7145a9..d42248ad5f6 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -1079,4 +1079,4 @@ async fn send_message_to_inbound_substream( // Everything worked as expected return the result. send_result.map(|_| (substream, false)) } -} \ No newline at end of file +} From 50356e4f64cb93f8bc84bea2a7a65e179118bbbd Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 19 Jul 2023 22:52:16 -0500 Subject: [PATCH 091/102] upgrade discv5 to get rid of protoc --- Cargo.lock | 306 +++++++--------------- beacon_node/lighthouse_network/Cargo.toml | 2 +- common/eth2_network_config/Cargo.toml | 2 +- 3 files changed, 98 insertions(+), 212 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0b82e81f7e7..344d089467c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,6 +210,15 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +[[package]] +name = "array-init" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23589ecb866b460d3a0f1278834750268c607e8e28a1b982c907219f3178cd72" +dependencies = [ + "nodrop", +] + [[package]] name = "arrayref" version = "0.3.7" @@ -525,7 +534,7 @@ dependencies = [ "slog", "sloggers", "slot_clock", - "smallvec", + "smallvec 1.11.0", "ssz_types", "state_processing", "store", @@ -861,7 +870,7 @@ dependencies = [ "ethereum_ssz_derive", "quickcheck", "quickcheck_macros", - "smallvec", + "smallvec 1.11.0", "ssz_types", "tree_hash", ] @@ -1658,28 +1667,29 @@ dependencies = [ [[package]] name = "discv5" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77f32d27968ba86689e3f0eccba0383414348a6fc5918b0a639c98dd81e20ed6" +checksum = "98c05fa26996c6141f78ac4fafbe297a7fa69690565ba4e0d1f2e60bde5ce501" dependencies = [ "aes", "aes-gcm", "arrayvec", "delay_map", - "enr 0.8.1", + "enr 0.9.0", "fnv", "futures", "hashlink 0.7.0", "hex", "hkdf", "lazy_static", - "libp2p-core 0.36.0", + "libp2p-core", + "libp2p-identity", "lru 0.7.8", "more-asserts", "parking_lot 0.11.2", "rand 0.8.5", "rlp", - "smallvec", + "smallvec 1.11.0", "socket2 0.4.9", "tokio", "tracing", @@ -1880,11 +1890,11 @@ dependencies = [ [[package]] name = "enr" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf56acd72bb22d2824e66ae8e9e5ada4d0de17a69c7fd35569dde2ada8ec9116" +checksum = "0be7b2ac146c1f99fe245c02d16af0696450d8e06c135db75e10eeb9e642c20d" dependencies = [ - "base64 0.13.1", + "base64 0.21.2", "bytes", "ed25519-dalek 2.0.0-pre.0", "hex", @@ -1893,6 +1903,7 @@ dependencies = [ "rand 0.8.5", "rlp", "serde", + "serde-hex", "sha3 0.10.8", "zeroize", ] @@ -2310,7 +2321,7 @@ checksum = "e61ffea29f26e8249d35128a82ec8d3bd4fbc80179ea5f5e5e3daafef6a80fcb" dependencies = [ "ethereum-types 0.14.1", "itertools", - "smallvec", + "smallvec 1.11.0", ] [[package]] @@ -2646,12 +2657,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - [[package]] name = "flate2" version = "1.0.26" @@ -3897,7 +3902,7 @@ dependencies = [ "instant", "libp2p-allow-block-list", "libp2p-connection-limits", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", @@ -3920,7 +3925,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55b46558c5c0bf99d3e2a1a38fd54ff5476ca66dd1737b12466a1824dd219311" dependencies = [ - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "void", @@ -3932,47 +3937,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d45dd90e8f0e1fa59e85ff5316dd4d1ac41a9a507e79cda1b0e9b7be43ad1a56" dependencies = [ - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "void", ] -[[package]] -name = "libp2p-core" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fff5bd889c82a0aec668f2045edd066f559d4e5c40354e5a4c77ac00caac38" -dependencies = [ - "asn1_der", - "bs58 0.4.0", - "ed25519-dalek 1.0.1", - "either", - "fnv", - "futures", - "futures-timer", - "instant", - "lazy_static", - "libsecp256k1", - "log", - "multiaddr 0.14.0", - "multihash 0.16.3", - "multistream-select 0.11.0", - "p256 0.11.1", - "parking_lot 0.12.1", - "pin-project", - "prost", - "prost-build", - "rand 0.8.5", - "rw-stream-sink 0.3.0", - "sha2 0.10.7", - "smallvec", - "thiserror", - "unsigned-varint 0.7.1", - "void", - "zeroize", -] - [[package]] name = "libp2p-core" version = "0.40.0" @@ -3988,14 +3958,14 @@ dependencies = [ "log", "multiaddr 0.18.0", "multihash 0.19.0", - "multistream-select 0.13.0", + "multistream-select", "once_cell", "parking_lot 0.12.1", "pin-project", "quick-protobuf", "rand 0.8.5", - "rw-stream-sink 0.4.0", - "smallvec", + "rw-stream-sink", + "smallvec 1.11.0", "thiserror", "unsigned-varint 0.7.1", "void", @@ -4008,11 +3978,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd4394c81c0c06d7b4a60f3face7e8e8a9b246840f98d2c80508d0721b032147" dependencies = [ "futures", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "log", "parking_lot 0.12.1", - "smallvec", + "smallvec 1.11.0", "trust-dns-resolver", ] @@ -4033,7 +4003,7 @@ dependencies = [ "getrandom 0.2.10", "hex_fmt", "instant", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "log", @@ -4043,7 +4013,7 @@ dependencies = [ "rand 0.8.5", "regex", "sha2 0.10.7", - "smallvec", + "smallvec 1.11.0", "unsigned-varint 0.7.1", "void", ] @@ -4058,14 +4028,14 @@ dependencies = [ "either", "futures", "futures-timer", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "log", "lru 0.10.1", "quick-protobuf", "quick-protobuf-codec", - "smallvec", + "smallvec 1.11.0", "thiserror", "void", ] @@ -4082,7 +4052,7 @@ dependencies = [ "libsecp256k1", "log", "multihash 0.19.0", - "p256 0.13.2", + "p256", "quick-protobuf", "rand 0.8.5", "sec1 0.7.3", @@ -4101,12 +4071,12 @@ dependencies = [ "data-encoding", "futures", "if-watch", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "log", "rand 0.8.5", - "smallvec", + "smallvec 1.11.0", "socket2 0.5.3", "tokio", "trust-dns-proto", @@ -4120,7 +4090,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3787ea81798dcc5bf1d8b40a8e8245cf894b168d04dd70aa48cb3ff2fff141d2" dependencies = [ "instant", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", @@ -4138,7 +4108,7 @@ dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "log", "multiaddr 0.18.0", @@ -4163,7 +4133,7 @@ dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "log", "quick-protobuf", @@ -4181,14 +4151,14 @@ dependencies = [ "futures", "futures-timer", "instant", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "libp2p-swarm-derive", "log", - "multistream-select 0.13.0", + "multistream-select", "once_cell", "rand 0.8.5", - "smallvec", + "smallvec 1.11.0", "tokio", "void", ] @@ -4216,7 +4186,7 @@ dependencies = [ "futures-timer", "if-watch", "libc", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "log", "socket2 0.5.3", @@ -4232,12 +4202,12 @@ dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.40.0", + "libp2p-core", "libp2p-identity", "log", "parking_lot 0.12.1", "quicksink", - "rw-stream-sink 0.4.0", + "rw-stream-sink", "soketto", "url", "webpki-roots 0.23.1", @@ -4250,7 +4220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0a9b42ab6de15c6f076d8fb11dc5f48d899a10b55a2e16b12be9012a05287b0" dependencies = [ "futures", - "libp2p-core 0.40.0", + "libp2p-core", "log", "thiserror", "yamux", @@ -4407,7 +4377,7 @@ dependencies = [ "slog", "slog-async", "slog-term", - "smallvec", + "smallvec 1.11.0", "snap", "ssz_types", "strum", @@ -4598,6 +4568,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + [[package]] name = "md-5" version = "0.10.5" @@ -4679,7 +4655,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "smallvec", + "smallvec 1.11.0", "syn 1.0.109", ] @@ -4890,12 +4866,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "multimap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" - [[package]] name = "multipart" version = "0.18.0" @@ -4914,20 +4884,6 @@ dependencies = [ "twoway", ] -[[package]] -name = "multistream-select" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" -dependencies = [ - "bytes", - "futures", - "log", - "pin-project", - "smallvec", - "unsigned-varint 0.7.1", -] - [[package]] name = "multistream-select" version = "0.13.0" @@ -4938,7 +4894,7 @@ dependencies = [ "futures", "log", "pin-project", - "smallvec", + "smallvec 1.11.0", "unsigned-varint 0.7.1", ] @@ -5063,7 +5019,7 @@ dependencies = [ "slog-term", "sloggers", "slot_clock", - "smallvec", + "smallvec 1.11.0", "ssz_types", "store", "strum", @@ -5126,6 +5082,12 @@ dependencies = [ "validator_dir", ] +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + [[package]] name = "nohash-hasher" version = "0.2.0" @@ -5193,7 +5155,7 @@ dependencies = [ "num-traits", "rand 0.7.3", "serde", - "smallvec", + "smallvec 1.11.0", "zeroize", ] @@ -5389,17 +5351,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "p256" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" -dependencies = [ - "ecdsa 0.14.8", - "elliptic-curve 0.12.3", - "sha2 0.10.7", -] - [[package]] name = "p256" version = "0.13.2" @@ -5511,7 +5462,7 @@ dependencies = [ "instant", "libc", "redox_syscall 0.2.16", - "smallvec", + "smallvec 1.11.0", "winapi", ] @@ -5524,7 +5475,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall 0.3.5", - "smallvec", + "smallvec 1.11.0", "windows-targets", ] @@ -5582,16 +5533,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" -[[package]] -name = "petgraph" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" -dependencies = [ - "fixedbitset", - "indexmap 1.9.3", -] - [[package]] name = "pharos" version = "0.5.3" @@ -5815,16 +5756,6 @@ dependencies = [ "sensitive_url", ] -[[package]] -name = "prettyplease" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "primeorder" version = "0.13.2" @@ -5971,60 +5902,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "prost" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" -dependencies = [ - "bytes", - "heck", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prettyplease", - "prost", - "prost-types", - "regex", - "syn 1.0.109", - "tempfile", - "which", -] - -[[package]] -name = "prost-derive" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "prost-types" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" -dependencies = [ - "prost", -] - [[package]] name = "proto_array" version = "0.2.0" @@ -6496,7 +6373,7 @@ dependencies = [ "fallible-streaming-iterator", "hashlink 0.8.3", "libsqlite3-sys", - "smallvec", + "smallvec 1.11.0", ] [[package]] @@ -6621,17 +6498,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" -[[package]] -name = "rw-stream-sink" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" -dependencies = [ - "futures", - "pin-project", - "static_assertions", -] - [[package]] name = "rw-stream-sink" version = "0.4.0" @@ -6861,6 +6727,17 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-hex" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca37e3e4d1b39afd7ff11ee4e947efae85adfddf4841787bfa47c470e96dc26d" +dependencies = [ + "array-init", + "serde", + "smallvec 0.6.14", +] + [[package]] name = "serde_array_query" version = "0.1.0" @@ -7327,6 +7204,15 @@ dependencies = [ "types", ] +[[package]] +name = "smallvec" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +dependencies = [ + "maybe-uninit", +] + [[package]] name = "smallvec" version = "1.11.0" @@ -7455,7 +7341,7 @@ dependencies = [ "itertools", "serde", "serde_derive", - "smallvec", + "smallvec 1.11.0", "tree_hash", "typenum", ] @@ -7480,7 +7366,7 @@ dependencies = [ "merkle_proof", "rayon", "safe_arith", - "smallvec", + "smallvec 1.11.0", "ssz_types", "tokio", "tree_hash", @@ -7590,7 +7476,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "smallvec", + "smallvec 1.11.0", "syn 1.0.109", ] @@ -7604,7 +7490,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "smallvec", + "smallvec 1.11.0", "syn 1.0.109", ] @@ -8279,7 +8165,7 @@ dependencies = [ "once_cell", "regex", "sharded-slab", - "smallvec", + "smallvec 1.11.0", "thread_local", "tracing", "tracing-core", @@ -8313,7 +8199,7 @@ checksum = "5c998ac5fe2b07c025444bdd522e6258110b63861c6698eedc610c071980238d" dependencies = [ "ethereum-types 0.14.1", "ethereum_hashing", - "smallvec", + "smallvec 1.11.0", ] [[package]] @@ -8354,7 +8240,7 @@ dependencies = [ "ipnet", "lazy_static", "rand 0.8.5", - "smallvec", + "smallvec 1.11.0", "socket2 0.4.9", "thiserror", "tinyvec", @@ -8376,7 +8262,7 @@ dependencies = [ "lru-cache", "parking_lot 0.12.1", "resolv-conf", - "smallvec", + "smallvec 1.11.0", "thiserror", "tokio", "tracing", @@ -8483,7 +8369,7 @@ dependencies = [ "serde_with", "serde_yaml", "slog", - "smallvec", + "smallvec 1.11.0", "ssz_types", "state_processing", "strum", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 6624b19f071..cc141c939ad 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Sigma Prime "] edition = "2021" [dependencies] -discv5 = { version = "0.3.0", features = ["libp2p"]} +discv5 = { version = "0.3.1", features = ["libp2p"] } unsigned-varint = { version = "0.6.0", features = ["codec"] } types = { path = "../../consensus/types" } ssz_types = "0.5.3" diff --git a/common/eth2_network_config/Cargo.toml b/common/eth2_network_config/Cargo.toml index 296d43b1a2e..338a2d243bc 100644 --- a/common/eth2_network_config/Cargo.toml +++ b/common/eth2_network_config/Cargo.toml @@ -18,4 +18,4 @@ serde_yaml = "0.8.13" types = { path = "../../consensus/types"} ethereum_ssz = "0.5.0" eth2_config = { path = "../eth2_config"} -discv5 = "0.3.0" \ No newline at end of file +discv5 = "0.3.1" \ No newline at end of file From 7d85736f710442416bbe85b4a7f26e35c6bc9218 Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 19 Jul 2023 22:59:51 -0500 Subject: [PATCH 092/102] make clippy happy --- .../lighthouse_network/src/discovery/enr_ext.rs | 16 ++++++++-------- .../lighthouse_network/src/service/mod.rs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 6460d87b5c7..7900ad74879 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -93,14 +93,14 @@ impl EnrExt for Enr { if let Some(udp) = self.udp4() { let mut multiaddr: Multiaddr = ip.into(); multiaddr.push(Protocol::Udp(udp)); - multiaddr.push(Protocol::P2p(peer_id.into())); + multiaddr.push(Protocol::P2p(peer_id)); multiaddrs.push(multiaddr); } if let Some(tcp) = self.tcp4() { let mut multiaddr: Multiaddr = ip.into(); multiaddr.push(Protocol::Tcp(tcp)); - multiaddr.push(Protocol::P2p(peer_id.into())); + multiaddr.push(Protocol::P2p(peer_id)); multiaddrs.push(multiaddr); } } @@ -108,14 +108,14 @@ impl EnrExt for Enr { if let Some(udp6) = self.udp6() { let mut multiaddr: Multiaddr = ip6.into(); multiaddr.push(Protocol::Udp(udp6)); - multiaddr.push(Protocol::P2p(peer_id.into())); + multiaddr.push(Protocol::P2p(peer_id)); multiaddrs.push(multiaddr); } if let Some(tcp6) = self.tcp6() { let mut multiaddr: Multiaddr = ip6.into(); multiaddr.push(Protocol::Tcp(tcp6)); - multiaddr.push(Protocol::P2p(peer_id.into())); + multiaddr.push(Protocol::P2p(peer_id)); multiaddrs.push(multiaddr); } } @@ -133,7 +133,7 @@ impl EnrExt for Enr { if let Some(tcp) = self.tcp4() { let mut multiaddr: Multiaddr = ip.into(); multiaddr.push(Protocol::Tcp(tcp)); - multiaddr.push(Protocol::P2p(peer_id.into())); + multiaddr.push(Protocol::P2p(peer_id)); multiaddrs.push(multiaddr); } } @@ -141,7 +141,7 @@ impl EnrExt for Enr { if let Some(tcp6) = self.tcp6() { let mut multiaddr: Multiaddr = ip6.into(); multiaddr.push(Protocol::Tcp(tcp6)); - multiaddr.push(Protocol::P2p(peer_id.into())); + multiaddr.push(Protocol::P2p(peer_id)); multiaddrs.push(multiaddr); } } @@ -159,7 +159,7 @@ impl EnrExt for Enr { if let Some(udp) = self.udp4() { let mut multiaddr: Multiaddr = ip.into(); multiaddr.push(Protocol::Udp(udp)); - multiaddr.push(Protocol::P2p(peer_id.into())); + multiaddr.push(Protocol::P2p(peer_id)); multiaddrs.push(multiaddr); } } @@ -167,7 +167,7 @@ impl EnrExt for Enr { if let Some(udp6) = self.udp6() { let mut multiaddr: Multiaddr = ip6.into(); multiaddr.push(Protocol::Udp(udp6)); - multiaddr.push(Protocol::P2p(peer_id.into())); + multiaddr.push(Protocol::P2p(peer_id)); multiaddrs.push(multiaddr); } } diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 11242bd3813..5082cdf220b 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -403,7 +403,7 @@ impl Network { match self.swarm.listen_on(listen_multiaddr.clone()) { Ok(_) => { let mut log_address = listen_multiaddr; - log_address.push(MProtocol::P2p(enr.peer_id().into())); + log_address.push(MProtocol::P2p(enr.peer_id())); info!(self.log, "Listening established"; "address" => %log_address); } Err(err) => { From 8dff926c70b7c7558e7c41316770d22608dbba4c Mon Sep 17 00:00:00 2001 From: Diva M Date: Thu, 20 Jul 2023 00:31:59 -0500 Subject: [PATCH 093/102] fix key conversion --- beacon_node/lighthouse_network/src/discovery/enr_ext.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs index 7900ad74879..753da6292ca 100644 --- a/beacon_node/lighthouse_network/src/discovery/enr_ext.rs +++ b/beacon_node/lighthouse_network/src/discovery/enr_ext.rs @@ -279,7 +279,7 @@ pub fn peer_id_to_node_id(peer_id: &PeerId) -> Result { let pk = public_key .clone() - .try_into_secp256k1() + .try_into_ed25519() .expect("right key type"); let uncompressed_key_bytes = pk.to_bytes(); let mut output = [0_u8; 32]; From b5128527ad340681894464399b1d04058a9d0acf Mon Sep 17 00:00:00 2001 From: Diva M Date: Sun, 23 Jul 2023 22:41:11 -0500 Subject: [PATCH 094/102] fix workflow double install --- .github/workflows/test-suite.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index cac748ea1cb..6e69486d4f4 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -136,8 +136,6 @@ jobs: - name: Get latest version of stable Rust if: env.SELF_HOSTED_RUNNERS == false run: rustup update stable - - name: Install anvil - run: cargo install --git https://github.com/foundry-rs/foundry --locked anvil - name: Install Foundry (anvil) uses: foundry-rs/foundry-toolchain@v1 - name: Run tests in debug @@ -352,4 +350,4 @@ jobs: - name: Use Rust beta run: rustup override set beta - name: Run make - run: make \ No newline at end of file + run: make From ae658c410d9a2a89966d42f716c43c2f35b5dfa0 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sun, 23 Jul 2023 22:41:40 -0500 Subject: [PATCH 095/102] point to fork with better error msgs --- Cargo.lock | 177 ++++++++++++---------- beacon_node/lighthouse_network/Cargo.toml | 2 + 2 files changed, 98 insertions(+), 81 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 344d089467c..20a9ca84cd7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1682,7 +1682,7 @@ dependencies = [ "hex", "hkdf", "lazy_static", - "libp2p-core", + "libp2p-core 0.40.0 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p-identity", "lru 0.7.8", "more-asserts", @@ -3059,15 +3059,6 @@ dependencies = [ "ahash 0.7.6", ] -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.3", -] - [[package]] name = "hashbrown" version = "0.14.0" @@ -3891,9 +3882,8 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.52.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38039ba2df4f3255842050845daef4a004cc1f26da03dbc645535088b51910ef" +version = "0.52.2" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "bytes", "futures", @@ -3902,7 +3892,7 @@ dependencies = [ "instant", "libp2p-allow-block-list", "libp2p-connection-limits", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", @@ -3922,10 +3912,9 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55b46558c5c0bf99d3e2a1a38fd54ff5476ca66dd1737b12466a1824dd219311" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "libp2p-swarm", "void", @@ -3934,10 +3923,9 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d45dd90e8f0e1fa59e85ff5316dd4d1ac41a9a507e79cda1b0e9b7be43ad1a56" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "libp2p-swarm", "void", @@ -3958,13 +3946,40 @@ dependencies = [ "log", "multiaddr 0.18.0", "multihash 0.19.0", - "multistream-select", + "multistream-select 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell", "parking_lot 0.12.1", "pin-project", "quick-protobuf", "rand 0.8.5", - "rw-stream-sink", + "rw-stream-sink 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.11.0", + "thiserror", + "unsigned-varint 0.7.1", + "void", +] + +[[package]] +name = "libp2p-core" +version = "0.40.0" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-identity", + "log", + "multiaddr 0.18.0", + "multihash 0.19.0", + "multistream-select 0.13.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "once_cell", + "parking_lot 0.12.1", + "pin-project", + "quick-protobuf", + "rand 0.8.5", + "rw-stream-sink 0.4.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "smallvec 1.11.0", "thiserror", "unsigned-varint 0.7.1", @@ -3974,11 +3989,10 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd4394c81c0c06d7b4a60f3face7e8e8a9b246840f98d2c80508d0721b032147" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "futures", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "log", "parking_lot 0.12.1", @@ -3989,8 +4003,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e378da62e8c9251f6e885ed173a561663f29b251e745586cf6ae6150b295c37" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4003,7 +4016,7 @@ dependencies = [ "getrandom 0.2.10", "hex_fmt", "instant", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "libp2p-swarm", "log", @@ -4021,18 +4034,17 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a29675a32dbcc87790db6cf599709e64308f1ae9d5ecea2d259155889982db8" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "asynchronous-codec", "either", "futures", "futures-timer", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "libp2p-swarm", "log", - "lru 0.10.1", + "lru 0.11.0", "quick-protobuf", "quick-protobuf-codec", "smallvec 1.11.0", @@ -4065,13 +4077,12 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a2567c305232f5ef54185e9604579a894fd0674819402bb0ac0246da82f52a" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "data-encoding", "futures", "if-watch", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "libp2p-swarm", "log", @@ -4085,12 +4096,11 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3787ea81798dcc5bf1d8b40a8e8245cf894b168d04dd70aa48cb3ff2fff141d2" +version = "0.13.1" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "instant", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", @@ -4102,13 +4112,12 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87945db2b3f977af09b62b9aa0a5f3e4870995a577ecd845cdeba94cdf6bbca7" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "log", "multiaddr 0.18.0", @@ -4127,13 +4136,12 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37266c683a757df713f7dcda0cdcb5ad4681355ffa1b37b77c113c176a531195" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "log", "quick-protobuf", @@ -4143,19 +4151,18 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.43.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de15b2097fc3bde063df8c202803538ff467fedb18f01c13bc5da55913d246c" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "libp2p-swarm-derive", "log", - "multistream-select", + "multistream-select 0.13.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "once_cell", "rand 0.8.5", "smallvec 1.11.0", @@ -4166,8 +4173,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d5ec2a3df00c7836d7696c136274c9c59705bac69133253696a6c932cd1d74" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "heck", "proc-macro-warning", @@ -4179,14 +4185,13 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bfdfb6f945c5c014b87872a0bdb6e0aef90e92f380ef57cd9013f118f9289d" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "futures", "futures-timer", "if-watch", "libc", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "log", "socket2 0.5.3", @@ -4196,31 +4201,29 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956d981ebc84abc3377e5875483c06d94ff57bc6b25f725047f9fd52592f72d4" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "libp2p-identity", "log", "parking_lot 0.12.1", "quicksink", - "rw-stream-sink", + "rw-stream-sink 0.4.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "soketto", "url", - "webpki-roots 0.23.1", + "webpki-roots 0.24.0", ] [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a9b42ab6de15c6f076d8fb11dc5f48d899a10b55a2e16b12be9012a05287b0" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "futures", - "libp2p-core", + "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", "log", "thiserror", "yamux", @@ -4491,11 +4494,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" +checksum = "eedb2bdbad7e0634f83989bf596f497b070130daaa398ab22d84c39e266deec5" dependencies = [ - "hashbrown 0.13.2", + "hashbrown 0.14.0", ] [[package]] @@ -4898,6 +4901,19 @@ dependencies = [ "unsigned-varint 0.7.1", ] +[[package]] +name = "multistream-select" +version = "0.13.0" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +dependencies = [ + "bytes", + "futures", + "log", + "pin-project", + "smallvec 1.11.0", + "unsigned-varint 0.7.1", +] + [[package]] name = "native-tls" version = "0.2.11" @@ -5959,8 +5975,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ededb1cd78531627244d51dd0c7139fbe736c7d57af0092a76f0ffb2f56e98" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" dependencies = [ "asynchronous-codec", "bytes", @@ -6459,7 +6474,7 @@ checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" dependencies = [ "log", "ring", - "rustls-webpki 0.101.1", + "rustls-webpki", "sct 0.7.0", ] @@ -6472,16 +6487,6 @@ dependencies = [ "base64 0.21.2", ] -[[package]] -name = "rustls-webpki" -version = "0.100.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "rustls-webpki" version = "0.101.1" @@ -6509,6 +6514,16 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "rw-stream-sink" +version = "0.4.0" +source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + [[package]] name = "ryu" version = "1.0.15" @@ -8904,11 +8919,11 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" dependencies = [ - "rustls-webpki 0.100.1", + "rustls-webpki", ] [[package]] diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index cc141c939ad..48190fd0e25 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -46,6 +46,8 @@ delay_map = "0.3.0" void = "1" [dependencies.libp2p] +git = "https://github.com/divagant-martian/rust-libp2p" +rev = "973e4d1b9ae85f9c3edaaf523906747a95c2e929" version = "0.52.0" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] From 8ea043228018f0791c5e2cfebd3bc93bead331a7 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Mon, 24 Jul 2023 15:22:41 +1000 Subject: [PATCH 096/102] Cargo update --- Cargo.lock | 142 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 83 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 20a9ca84cd7..a8cd7a79df3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -251,7 +251,7 @@ dependencies = [ "log", "parking", "polling", - "rustix", + "rustix 0.37.23", "slab", "socket2 0.4.9", "waker-fn", @@ -285,18 +285,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] name = "async-trait" -version = "0.1.71" +version = "0.1.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -312,9 +312,9 @@ dependencies = [ [[package]] name = "asynchronous-codec" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" +checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" dependencies = [ "bytes", "futures-sink", @@ -1571,7 +1571,7 @@ dependencies = [ "diesel_table_macro_syntax", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -1591,7 +1591,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" dependencies = [ - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -1724,9 +1724,9 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.7" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ "der 0.7.7", "digest 0.10.7", @@ -1816,9 +1816,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -2582,6 +2582,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + [[package]] name = "ff" version = "0.12.1" @@ -2790,7 +2796,7 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", @@ -2807,7 +2813,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -3715,7 +3721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", - "ecdsa 0.16.7", + "ecdsa 0.16.8", "elliptic-curve 0.13.5", "once_cell", "sha2 0.10.7", @@ -4179,7 +4185,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -4290,9 +4296,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "24e6ab01971eb092ffe6a7d42f49f9ff42662f17604681e2843ad65077ba47dc" dependencies = [ "cc", "pkg-config", @@ -4420,6 +4426,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" + [[package]] name = "lmdb-rkv" version = "0.14.0" @@ -5198,9 +5210,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg 1.1.0", ] @@ -5306,7 +5318,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -5373,7 +5385,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "ecdsa 0.16.7", + "ecdsa 0.16.8", "elliptic-curve 0.13.5", "primeorder", "sha2 0.10.7", @@ -5594,7 +5606,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -5856,7 +5868,7 @@ checksum = "70550716265d1ec349c41f70dd4f964b4fd88394efe4405f0c1da679c4799a07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -6020,9 +6032,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -6437,7 +6449,20 @@ dependencies = [ "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.8", + "windows-sys", +] + +[[package]] +name = "rustix" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys 0.4.3", "windows-sys", ] @@ -6674,9 +6699,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -6687,9 +6712,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -6735,9 +6760,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.171" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" dependencies = [ "serde_derive", ] @@ -6775,13 +6800,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -6807,13 +6832,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" +checksum = "e168eaaf71e8f9bd6037feb05190485708e019f4fd87d161b3c0a0d37daf85e5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -7531,9 +7556,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.26" +version = "2.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" dependencies = [ "proc-macro2", "quote", @@ -7647,15 +7672,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" dependencies = [ - "autocfg 1.1.0", "cfg-if", - "fastrand", + "fastrand 2.0.0", "redox_syscall 0.3.5", - "rustix", + "rustix 0.38.4", "windows-sys", ] @@ -7723,22 +7747,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -7902,7 +7926,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -8135,7 +8159,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -8745,7 +8769,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", "wasm-bindgen-shared", ] @@ -8779,7 +8803,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -9191,9 +9215,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a56c84a8ccd4258aed21c92f70c0f6dea75356b6892ae27c24139da456f9336" +checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" [[package]] name = "xmltree" @@ -9244,7 +9268,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] From 63d85ed0155cc00e21b6dabc699dd21262c28f06 Mon Sep 17 00:00:00 2001 From: Diva M Date: Mon, 24 Jul 2023 12:41:09 -0500 Subject: [PATCH 097/102] fix point to workspace --- beacon_node/lighthouse_network/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 48190fd0e25..62b428ddecc 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -48,7 +48,6 @@ void = "1" [dependencies.libp2p] git = "https://github.com/divagant-martian/rust-libp2p" rev = "973e4d1b9ae85f9c3edaaf523906747a95c2e929" -version = "0.52.0" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] From 1232e6edb099d2f5781cc2551474e286e1578c11 Mon Sep 17 00:00:00 2001 From: Diva M Date: Mon, 24 Jul 2023 22:34:37 -0500 Subject: [PATCH 098/102] aggressively printing errors --- .../lighthouse_network/src/service/mod.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 5082cdf220b..6ab5279b8be 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -1468,7 +1468,19 @@ impl Network { error, connection_id: _, } => { - debug!(self.log, "Failed incoming connection"; "our_addr" => %local_addr, "from" => %send_back_addr, "error" => %error); + let error_repr = match error { + libp2p::swarm::ListenError::Aborted => "incoming connection aborted".to_string(), + libp2p::swarm::ListenError::WrongPeerId { obtained, endpoint } => format!("wrong peer id, obtained {obtained}, endpoint {endpoint:?}"), + libp2p::swarm::ListenError::LocalPeerId { endpoint } => format!("dialing local peer id {endpoint:?}"), + libp2p::swarm::ListenError::Denied { cause } => format!("connection was denied with cause {cause}"), + libp2p::swarm::ListenError::Transport(t) => { + match t { + libp2p::TransportError::MultiaddrNotSupported(m) => format!("transport error: multiaddr not supported: {m}"), + libp2p::TransportError::Other(e) => format!("transport error: other: {e}"), + } + }, + }; + debug!(self.log, "Failed incoming connection"; "our_addr" => %local_addr, "from" => %send_back_addr, "error" => error_repr); None } SwarmEvent::OutgoingConnectionError { @@ -1539,4 +1551,4 @@ impl Network { pub async fn next_event(&mut self) -> NetworkEvent { futures::future::poll_fn(|cx| self.poll_network(cx)).await } -} +} \ No newline at end of file From 28e4ecf5e8bb5d8e35ec251ffc1e63169ae7c30e Mon Sep 17 00:00:00 2001 From: Diva M Date: Mon, 24 Jul 2023 22:37:41 -0500 Subject: [PATCH 099/102] fmt --- .../lighthouse_network/src/service/mod.rs | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 6ab5279b8be..9023e7c8e70 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -1469,14 +1469,24 @@ impl Network { connection_id: _, } => { let error_repr = match error { - libp2p::swarm::ListenError::Aborted => "incoming connection aborted".to_string(), - libp2p::swarm::ListenError::WrongPeerId { obtained, endpoint } => format!("wrong peer id, obtained {obtained}, endpoint {endpoint:?}"), - libp2p::swarm::ListenError::LocalPeerId { endpoint } => format!("dialing local peer id {endpoint:?}"), - libp2p::swarm::ListenError::Denied { cause } => format!("connection was denied with cause {cause}"), - libp2p::swarm::ListenError::Transport(t) => { - match t { - libp2p::TransportError::MultiaddrNotSupported(m) => format!("transport error: multiaddr not supported: {m}"), - libp2p::TransportError::Other(e) => format!("transport error: other: {e}"), + libp2p::swarm::ListenError::Aborted => { + "incoming connection aborted".to_string() + } + libp2p::swarm::ListenError::WrongPeerId { obtained, endpoint } => { + format!("wrong peer id, obtained {obtained}, endpoint {endpoint:?}") + } + libp2p::swarm::ListenError::LocalPeerId { endpoint } => { + format!("dialing local peer id {endpoint:?}") + } + libp2p::swarm::ListenError::Denied { cause } => { + format!("connection was denied with cause {cause}") + } + libp2p::swarm::ListenError::Transport(t) => match t { + libp2p::TransportError::MultiaddrNotSupported(m) => { + format!("transport error: multiaddr not supported: {m}") + } + libp2p::TransportError::Other(e) => { + format!("transport error: other: {e}") } }, }; @@ -1551,4 +1561,4 @@ impl Network { pub async fn next_event(&mut self) -> NetworkEvent { futures::future::poll_fn(|cx| self.poll_network(cx)).await } -} \ No newline at end of file +} From edb0f1e74c1bb45befdf19eef42ce2c927263ddc Mon Sep 17 00:00:00 2001 From: Age Manning Date: Tue, 25 Jul 2023 17:13:47 +1000 Subject: [PATCH 100/102] Fix libp2p --- Cargo.lock | 121 ++++++++++-------- beacon_node/lighthouse_network/Cargo.toml | 4 +- .../src/peer_manager/network_behaviour.rs | 10 +- .../lighthouse_network/src/service/mod.rs | 28 ++-- 4 files changed, 98 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a8cd7a79df3..b148a4997bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3065,6 +3065,15 @@ dependencies = [ "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", +] + [[package]] name = "hashbrown" version = "0.14.0" @@ -3888,8 +3897,8 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.52.2" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +version = "0.52.0" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "bytes", "futures", @@ -3898,7 +3907,7 @@ dependencies = [ "instant", "libp2p-allow-block-list", "libp2p-connection-limits", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", @@ -3918,9 +3927,9 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "libp2p-swarm", "void", @@ -3929,9 +3938,9 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" version = "0.2.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "libp2p-swarm", "void", @@ -3968,7 +3977,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.40.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "either", "fnv", @@ -3979,13 +3988,13 @@ dependencies = [ "log", "multiaddr 0.18.0", "multihash 0.19.0", - "multistream-select 0.13.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "multistream-select 0.13.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "once_cell", "parking_lot 0.12.1", "pin-project", "quick-protobuf", "rand 0.8.5", - "rw-stream-sink 0.4.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "rw-stream-sink 0.4.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "smallvec 1.11.0", "thiserror", "unsigned-varint 0.7.1", @@ -3995,10 +4004,10 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "futures", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "log", "parking_lot 0.12.1", @@ -4009,7 +4018,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4022,7 +4031,7 @@ dependencies = [ "getrandom 0.2.10", "hex_fmt", "instant", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "libp2p-swarm", "log", @@ -4040,17 +4049,17 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "asynchronous-codec", "either", "futures", "futures-timer", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "libp2p-swarm", "log", - "lru 0.11.0", + "lru 0.10.1", "quick-protobuf", "quick-protobuf-codec", "smallvec 1.11.0", @@ -4083,12 +4092,12 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "data-encoding", "futures", "if-watch", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "libp2p-swarm", "log", @@ -4102,11 +4111,11 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.13.1" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +version = "0.13.0" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "instant", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", @@ -4118,12 +4127,12 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "log", "multiaddr 0.18.0", @@ -4142,12 +4151,12 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "log", "quick-protobuf", @@ -4156,19 +4165,19 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.43.1" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +version = "0.43.0" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "libp2p-swarm-derive", "log", - "multistream-select 0.13.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "multistream-select 0.13.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "once_cell", "rand 0.8.5", "smallvec 1.11.0", @@ -4179,7 +4188,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "heck", "proc-macro-warning", @@ -4191,13 +4200,13 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "futures", "futures-timer", "if-watch", "libc", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "log", "socket2 0.5.3", @@ -4207,29 +4216,29 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "libp2p-identity", "log", "parking_lot 0.12.1", "quicksink", - "rw-stream-sink 0.4.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "rw-stream-sink 0.4.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "soketto", "url", - "webpki-roots 0.24.0", + "webpki-roots 0.23.1", ] [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "futures", - "libp2p-core 0.40.0 (git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929)", + "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", "log", "thiserror", "yamux", @@ -4506,11 +4515,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.11.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eedb2bdbad7e0634f83989bf596f497b070130daaa398ab22d84c39e266deec5" +checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" dependencies = [ - "hashbrown 0.14.0", + "hashbrown 0.13.2", ] [[package]] @@ -4916,7 +4925,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "bytes", "futures", @@ -5987,7 +5996,7 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "asynchronous-codec", "bytes", @@ -6499,7 +6508,7 @@ checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.1", "sct 0.7.0", ] @@ -6512,6 +6521,16 @@ dependencies = [ "base64 0.21.2", ] +[[package]] +name = "rustls-webpki" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustls-webpki" version = "0.101.1" @@ -6542,7 +6561,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/divagant-martian/rust-libp2p?rev=973e4d1b9ae85f9c3edaaf523906747a95c2e929#973e4d1b9ae85f9c3edaaf523906747a95c2e929" +source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" dependencies = [ "futures", "pin-project", @@ -8943,11 +8962,11 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.24.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" dependencies = [ - "rustls-webpki", + "rustls-webpki 0.100.1", ] [[package]] @@ -9142,9 +9161,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" +checksum = "25b5872fa2e10bd067ae946f927e726d7d603eaeb6e02fa6a350e0722d2b8c11" dependencies = [ "memchr", ] diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 62b428ddecc..b8bae3b4cef 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -46,8 +46,8 @@ delay_map = "0.3.0" void = "1" [dependencies.libp2p] -git = "https://github.com/divagant-martian/rust-libp2p" -rev = "973e4d1b9ae85f9c3edaaf523906747a95c2e929" +git = "https://github.com/sigp/rust-libp2p" +rev = "58e2afa50da8de9abb28cc96eb76e2753074514a" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"] diff --git a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs index 01c9741eb47..ce374bb9ab4 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/network_behaviour.rs @@ -21,7 +21,6 @@ use super::{ConnectingType, PeerManager, PeerManagerEvent, ReportSource}; impl NetworkBehaviour for PeerManager { type ConnectionHandler = ConnectionHandler; - type ToSwarm = PeerManagerEvent; /* Required trait members */ @@ -128,7 +127,14 @@ impl NetworkBehaviour for PeerManager { remaining_established, .. }) => self.on_connection_closed(peer_id, remaining_established), - FromSwarm::DialFailure(DialFailure { peer_id, .. }) => self.on_dial_failure(peer_id), + FromSwarm::DialFailure(DialFailure { + peer_id, + error, + connection_id: _, + }) => { + debug!(self.log, "Failed to dial peer"; "peer_id"=> ?peer_id, "error" => %error); + self.on_dial_failure(peer_id); + } FromSwarm::ExternalAddrConfirmed(_) => { // TODO: we likely want to check this against our assumed external tcp // address diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index 9023e7c8e70..1a25beee0a7 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -1470,23 +1470,23 @@ impl Network { } => { let error_repr = match error { libp2p::swarm::ListenError::Aborted => { - "incoming connection aborted".to_string() + "Incoming connection aborted".to_string() } libp2p::swarm::ListenError::WrongPeerId { obtained, endpoint } => { - format!("wrong peer id, obtained {obtained}, endpoint {endpoint:?}") + format!("Wrong peer id, obtained {obtained}, endpoint {endpoint:?}") } libp2p::swarm::ListenError::LocalPeerId { endpoint } => { - format!("dialing local peer id {endpoint:?}") + format!("Dialing local peer id {endpoint:?}") } libp2p::swarm::ListenError::Denied { cause } => { - format!("connection was denied with cause {cause}") + format!("Connection was denied with cause {cause}") } libp2p::swarm::ListenError::Transport(t) => match t { libp2p::TransportError::MultiaddrNotSupported(m) => { - format!("transport error: multiaddr not supported: {m}") + format!("Transport error: Multiaddr not supported: {m}") } libp2p::TransportError::Other(e) => { - format!("transport error: other: {e}") + format!("Transport error: other: {e}") } }, }; @@ -1494,11 +1494,13 @@ impl Network { None } SwarmEvent::OutgoingConnectionError { - peer_id, - error, + peer_id: _, + error: _, connection_id: _, } => { - debug!(self.log, "Failed to dial address"; "peer_id" => ?peer_id, "error" => %error); + // The Behaviour event is more general than the swarm event here. It includes + // connection failures. So we use that log for now, in the peer manager + // behaviour implementation. None } SwarmEvent::NewListenAddr { address, .. } => { @@ -1527,7 +1529,13 @@ impl Network { None } } - SwarmEvent::Dialing { .. } => None, + SwarmEvent::Dialing { + peer_id, + connection_id: _, + } => { + debug!(self.log, "Swarm Dialing"; "peer_id" => ?peer_id); + None + } }; if let Some(ev) = maybe_event { From ebf3536ae1062e64488a973b92a19eb99ec6f1aa Mon Sep 17 00:00:00 2001 From: Akihito Nakano Date: Thu, 27 Jul 2023 08:04:28 +0900 Subject: [PATCH 101/102] Remove protobuf-compiler installation for Pi --- .github/workflows/test-suite.yml | 2 +- book/src/pi.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 6e69486d4f4..ab31b3a92bc 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -346,7 +346,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install dependencies - run: sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang protobuf-compiler + run: sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang - name: Use Rust beta run: rustup override set beta - name: Run make diff --git a/book/src/pi.md b/book/src/pi.md index d8d154d765a..550415240b4 100644 --- a/book/src/pi.md +++ b/book/src/pi.md @@ -22,7 +22,7 @@ terminal and an Internet connection are necessary. Install the Ubuntu dependencies: ```bash -sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang protobuf-compiler +sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang ``` > Tips: From 6d7fd0473ef15acc8b6e1485a872967c6bb5824b Mon Sep 17 00:00:00 2001 From: Diva M Date: Wed, 26 Jul 2023 18:15:28 -0500 Subject: [PATCH 102/102] restore libp2p version to published crates + cargo update for bug fixes --- Cargo.lock | 168 +++++++++------------- beacon_node/lighthouse_network/Cargo.toml | 3 +- 2 files changed, 68 insertions(+), 103 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b148a4997bd..db8ffaaa8c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1682,7 +1682,7 @@ dependencies = [ "hex", "hkdf", "lazy_static", - "libp2p-core 0.40.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core", "libp2p-identity", "lru 0.7.8", "more-asserts", @@ -3897,8 +3897,9 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.52.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +version = "0.52.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38039ba2df4f3255842050845daef4a004cc1f26da03dbc645535088b51910ef" dependencies = [ "bytes", "futures", @@ -3907,7 +3908,7 @@ dependencies = [ "instant", "libp2p-allow-block-list", "libp2p-connection-limits", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", @@ -3927,9 +3928,10 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" version = "0.2.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55b46558c5c0bf99d3e2a1a38fd54ff5476ca66dd1737b12466a1824dd219311" dependencies = [ - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "void", @@ -3937,10 +3939,11 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" -version = "0.2.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f5107ad45cb20b2f6c3628c7b6014b996fcb13a88053f4569c872c6e30abf58" dependencies = [ - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "void", @@ -3961,40 +3964,13 @@ dependencies = [ "log", "multiaddr 0.18.0", "multihash 0.19.0", - "multistream-select 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "multistream-select", "once_cell", "parking_lot 0.12.1", "pin-project", "quick-protobuf", "rand 0.8.5", - "rw-stream-sink 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 1.11.0", - "thiserror", - "unsigned-varint 0.7.1", - "void", -] - -[[package]] -name = "libp2p-core" -version = "0.40.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" -dependencies = [ - "either", - "fnv", - "futures", - "futures-timer", - "instant", - "libp2p-identity", - "log", - "multiaddr 0.18.0", - "multihash 0.19.0", - "multistream-select 0.13.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", - "once_cell", - "parking_lot 0.12.1", - "pin-project", - "quick-protobuf", - "rand 0.8.5", - "rw-stream-sink 0.4.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "rw-stream-sink", "smallvec 1.11.0", "thiserror", "unsigned-varint 0.7.1", @@ -4004,10 +3980,11 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.40.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd4394c81c0c06d7b4a60f3face7e8e8a9b246840f98d2c80508d0721b032147" dependencies = [ "futures", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "log", "parking_lot 0.12.1", @@ -4018,7 +3995,8 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" version = "0.45.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e378da62e8c9251f6e885ed173a561663f29b251e745586cf6ae6150b295c37" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -4031,7 +4009,7 @@ dependencies = [ "getrandom 0.2.10", "hex_fmt", "instant", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "log", @@ -4049,13 +4027,14 @@ dependencies = [ [[package]] name = "libp2p-identify" version = "0.43.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a29675a32dbcc87790db6cf599709e64308f1ae9d5ecea2d259155889982db8" dependencies = [ "asynchronous-codec", "either", "futures", "futures-timer", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "log", @@ -4069,9 +4048,9 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2874d9c6575f1d7a151022af5c42bb0ffdcdfbafe0a6fd039de870b384835a2" +checksum = "a38d6012784fe4cc14e6d443eb415b11fc7c456dc15d9f0d90d9b70bc7ac3ec1" dependencies = [ "asn1_der", "bs58 0.5.0", @@ -4092,12 +4071,13 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.44.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a2567c305232f5ef54185e9604579a894fd0674819402bb0ac0246da82f52a" dependencies = [ "data-encoding", "futures", "if-watch", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "libp2p-swarm", "log", @@ -4112,10 +4092,11 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.13.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3787ea81798dcc5bf1d8b40a8e8245cf894b168d04dd70aa48cb3ff2fff141d2" dependencies = [ "instant", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", @@ -4127,12 +4108,13 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.43.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87945db2b3f977af09b62b9aa0a5f3e4870995a577ecd845cdeba94cdf6bbca7" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "log", "multiaddr 0.18.0", @@ -4151,12 +4133,13 @@ dependencies = [ [[package]] name = "libp2p-plaintext" version = "0.40.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37266c683a757df713f7dcda0cdcb5ad4681355ffa1b37b77c113c176a531195" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "log", "quick-protobuf", @@ -4165,19 +4148,20 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.43.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +version = "0.43.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43106820057e0f65c77b01a3873593f66e676da4e40c70c3a809b239109f1d30" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "libp2p-swarm-derive", "log", - "multistream-select 0.13.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "multistream-select", "once_cell", "rand 0.8.5", "smallvec 1.11.0", @@ -4188,7 +4172,8 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.33.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4d5ec2a3df00c7836d7696c136274c9c59705bac69133253696a6c932cd1d74" dependencies = [ "heck", "proc-macro-warning", @@ -4200,13 +4185,14 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.40.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09bfdfb6f945c5c014b87872a0bdb6e0aef90e92f380ef57cd9013f118f9289d" dependencies = [ "futures", "futures-timer", "if-watch", "libc", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "log", "socket2 0.5.3", @@ -4216,17 +4202,18 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.42.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956d981ebc84abc3377e5875483c06d94ff57bc6b25f725047f9fd52592f72d4" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "libp2p-identity", "log", "parking_lot 0.12.1", "quicksink", - "rw-stream-sink 0.4.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "rw-stream-sink", "soketto", "url", "webpki-roots 0.23.1", @@ -4235,10 +4222,11 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.44.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0a9b42ab6de15c6f076d8fb11dc5f48d899a10b55a2e16b12be9012a05287b0" dependencies = [ "futures", - "libp2p-core 0.40.0 (git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a)", + "libp2p-core", "log", "thiserror", "yamux", @@ -4305,9 +4293,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.10" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e6ab01971eb092ffe6a7d42f49f9ff42662f17604681e2843ad65077ba47dc" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "pkg-config", @@ -4922,19 +4910,6 @@ dependencies = [ "unsigned-varint 0.7.1", ] -[[package]] -name = "multistream-select" -version = "0.13.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" -dependencies = [ - "bytes", - "futures", - "log", - "pin-project", - "smallvec 1.11.0", - "unsigned-varint 0.7.1", -] - [[package]] name = "native-tls" version = "0.2.11" @@ -5996,7 +5971,8 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ededb1cd78531627244d51dd0c7139fbe736c7d57af0092a76f0ffb2f56e98" dependencies = [ "asynchronous-codec", "bytes", @@ -6508,7 +6484,7 @@ checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" dependencies = [ "log", "ring", - "rustls-webpki 0.101.1", + "rustls-webpki 0.101.2", "sct 0.7.0", ] @@ -6533,9 +6509,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.1" +version = "0.101.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" +checksum = "513722fd73ad80a71f72b61009ea1b584bcfa1483ca93949c8f290298837fa59" dependencies = [ "ring", "untrusted", @@ -6558,16 +6534,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "rw-stream-sink" -version = "0.4.0" -source = "git+https://github.com/sigp/rust-libp2p?rev=58e2afa50da8de9abb28cc96eb76e2753074514a#58e2afa50da8de9abb28cc96eb76e2753074514a" -dependencies = [ - "futures", - "pin-project", - "static_assertions", -] - [[package]] name = "ryu" version = "1.0.15" @@ -6779,9 +6745,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.175" +version = "1.0.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" +checksum = "76dc28c9523c5d70816e393136b86d48909cfb27cecaa902d338c19ed47164dc" dependencies = [ "serde_derive", ] @@ -6819,9 +6785,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.175" +version = "1.0.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" +checksum = "a4e7b8c5dc823e3b90651ff1d3808419cd14e5ad76de04feaf37da114e7a306f" dependencies = [ "proc-macro2", "quote", @@ -6830,9 +6796,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" +checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" dependencies = [ "itoa", "ryu", diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index b8bae3b4cef..f71845fed25 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -46,8 +46,7 @@ delay_map = "0.3.0" void = "1" [dependencies.libp2p] -git = "https://github.com/sigp/rust-libp2p" -rev = "58e2afa50da8de9abb28cc96eb76e2753074514a" +version = "0.52" default-features = false features = ["websocket", "identify", "yamux", "noise", "gossipsub", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa"]