From 201267199aa563bd10a001a7d98f4e6945346d6a Mon Sep 17 00:00:00 2001 From: ackintosh Date: Thu, 31 Aug 2023 07:18:00 +0900 Subject: [PATCH] debug --- .github/workflows/test-suite.yml | 625 +++++++++--------- beacon_node/network/src/service/tests.rs | 18 +- .../src/subnet_service/attestation_subnets.rs | 2 + consensus/types/src/subnet_id.rs | 2 + 4 files changed, 333 insertions(+), 314 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 91a0b734537..22adca563f1 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -2,13 +2,13 @@ name: test-suite on: push: - branches: - - stable - - staging - - trying - - 'pr/*' - pull_request: - merge_group: +# branches: +# - stable +# - staging +# - trying +# - 'pr/*' +# pull_request: +# merge_group: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -27,13 +27,13 @@ env: # Self-hosted runners need to reference a different host for `./watch` tests. WATCH_HOST: ${{ github.repository == 'sigp/lighthouse' && 'host.docker.internal' || 'localhost' }} jobs: - target-branch-check: - name: target-branch-check - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' || github.event_name == 'merge_group' - steps: - - name: Check that the pull request is not targeting the stable branch - run: test ${{ github.base_ref }} != "stable" +# target-branch-check: +# name: target-branch-check +# runs-on: ubuntu-latest +# if: github.event_name == 'pull_request' || github.event_name == 'merge_group' +# steps: +# - name: Check that the pull request is not targeting the stable branch +# run: test ${{ github.base_ref }} != "stable" extract-msrv: runs-on: ubuntu-latest steps: @@ -46,20 +46,20 @@ jobs: id: extract_msrv outputs: MSRV: ${{ steps.extract_msrv.outputs.MSRV }} - cargo-fmt: - name: cargo-fmt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Check formatting with cargo fmt - run: make cargo-fmt +# cargo-fmt: +# name: cargo-fmt +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Check formatting with cargo fmt +# run: make cargo-fmt release-tests-ubuntu: name: release-tests-ubuntu # Use self-hosted runners only on the sigp repo. runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "large"]') || 'ubuntu-latest' }} - needs: cargo-fmt +# needs: cargo-fmt steps: - uses: actions/checkout@v3 - name: Get latest version of stable Rust @@ -68,291 +68,292 @@ jobs: - name: Install Foundry (anvil) uses: foundry-rs/foundry-toolchain@v1 - name: Run tests in release - run: make test-release - release-tests-windows: - name: release-tests-windows - runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "windows"]') || 'windows-2019' }} - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - if: env.SELF_HOSTED_RUNNERS == false - run: rustup update stable - - name: Use Node.js - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Install windows build tools - run: | - choco install python visualstudio2019-workload-vctools -y - npm config set msvs_version 2019 - - name: Install Foundry (anvil) - uses: foundry-rs/foundry-toolchain@v1 - - name: Install make - run: choco install -y make - - uses: KyleMayes/install-llvm-action@v1 - if: env.SELF_HOSTED_RUNNERS == false - with: - version: "15.0" - directory: ${{ runner.temp }}/llvm - - name: Set LIBCLANG_PATH - run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - - name: Run tests in release - run: make test-release - beacon-chain-tests: - name: beacon-chain-tests - # Use self-hosted runners only on the sigp repo. - runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "large"]') || 'ubuntu-latest' }} - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - if: env.SELF_HOSTED_RUNNERS == false - run: rustup update stable - - name: Run beacon_chain tests for all known forks - run: make test-beacon-chain - op-pool-tests: - name: op-pool-tests - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Run operation_pool tests for all known forks - run: make test-op-pool - slasher-tests: - name: slasher-tests - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Run slasher tests for all supported backends - run: make test-slasher - debug-tests-ubuntu: - name: debug-tests-ubuntu - # Use self-hosted runners only on the sigp repo. - runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "large"]') || 'ubuntu-latest' }} - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - if: env.SELF_HOSTED_RUNNERS == false - run: rustup update stable - - name: Install Foundry (anvil) - uses: foundry-rs/foundry-toolchain@v1 - - name: Run tests in debug - run: make test-debug - state-transition-vectors-ubuntu: - name: state-transition-vectors-ubuntu - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Run state_transition_vectors in release. - run: make run-state-transition-tests - ef-tests-ubuntu: - name: ef-tests-ubuntu - # Use self-hosted runners only on the sigp repo. - runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "small"]') || 'ubuntu-latest' }} - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - if: env.SELF_HOSTED_RUNNERS == false - run: rustup update stable - - name: Run consensus-spec-tests with blst, milagro and fake_crypto - run: make test-ef - dockerfile-ubuntu: - name: dockerfile-ubuntu - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Build the root Dockerfile - run: docker build --build-arg FEATURES=portable -t lighthouse:local . - - name: Test the built image - run: docker run -t lighthouse:local lighthouse --version - eth1-simulator-ubuntu: - name: eth1-simulator-ubuntu - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Install Foundry (anvil) - uses: foundry-rs/foundry-toolchain@v1 - - name: Run the beacon chain sim that starts from an eth1 contract - run: cargo run --release --bin simulator eth1-sim - merge-transition-ubuntu: - name: merge-transition-ubuntu - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Install Foundry (anvil) - uses: foundry-rs/foundry-toolchain@v1 - - name: Run the beacon chain sim and go through the merge transition - run: cargo run --release --bin simulator eth1-sim --post-merge - no-eth1-simulator-ubuntu: - name: no-eth1-simulator-ubuntu - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Run the beacon chain sim without an eth1 connection - run: cargo run --release --bin simulator no-eth1-sim - syncing-simulator-ubuntu: - name: syncing-simulator-ubuntu - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Install Foundry (anvil) - uses: foundry-rs/foundry-toolchain@v1 - - name: Run the syncing simulator - run: cargo run --release --bin simulator syncing-sim - doppelganger-protection-test: - name: doppelganger-protection-test - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Install geth - run: | - sudo add-apt-repository -y ppa:ethereum/ethereum - sudo apt-get update - sudo apt-get install ethereum - - name: Install lighthouse and lcli - run: | - make - make install-lcli - - name: Run the doppelganger protection failure test script - run: | - cd scripts/tests - ./doppelganger_protection.sh failure genesis.json - - name: Run the doppelganger protection success test script - run: | - cd scripts/tests - ./doppelganger_protection.sh success genesis.json - execution-engine-integration-ubuntu: - name: execution-engine-integration-ubuntu - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: '1.20' - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.201' - - name: Get latest version of stable Rust - run: rustup update stable - - name: Run exec engine integration tests in release - run: make test-exec-engine - check-benchmarks: - name: check-benchmarks - runs-on: ubuntu-latest - needs: cargo-fmt - 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 - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Lint code for quality and style with Clippy - run: make lint - - name: Certify Cargo.lock freshness - run: git diff --exit-code Cargo.lock - check-msrv: - name: check-msrv - runs-on: ubuntu-latest - needs: [cargo-fmt, extract-msrv] - steps: - - uses: actions/checkout@v3 - - name: Install Rust @ MSRV (${{ needs.extract-msrv.outputs.MSRV }}) - run: rustup override set ${{ needs.extract-msrv.outputs.MSRV }} - - name: Run cargo check - run: cargo check --workspace - arbitrary-check: - name: arbitrary-check - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Validate state_processing feature arbitrary-fuzz - run: make arbitrary-fuzz - cargo-audit: - name: cargo-audit - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Run cargo audit to identify known security vulnerabilities reported to the RustSec Advisory Database - run: make audit - cargo-vendor: - name: cargo-vendor - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Run cargo vendor to make sure dependencies can be vendored for packaging, reproducibility and archival purpose - run: CARGO_HOME=$(readlink -f $HOME) make vendor - cargo-udeps: - name: cargo-udeps - runs-on: ubuntu-latest - needs: cargo-fmt - steps: - - uses: actions/checkout@v3 - - name: Install Rust (${{ env.PINNED_NIGHTLY }}) - run: rustup toolchain install $PINNED_NIGHTLY - - name: Install cargo-udeps - run: cargo install cargo-udeps --locked --force - - name: Create Cargo config dir - run: mkdir -p .cargo - - name: Install custom Cargo config - run: cp -f .github/custom/config.toml .cargo/config.toml - - name: Run cargo udeps to identify unused crates in the dependency graph - run: make udeps - env: - # Allow warnings on Nightly - RUSTFLAGS: "" - compile-with-beta-compiler: - name: compile-with-beta-compiler - runs-on: ubuntu-latest - 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 - - name: Use Rust beta - run: rustup override set beta - - name: Run make - run: make + run: cargo test --workspace --lib service::tests::tests::test_removing_topic_weight_on_old_topics --release --exclude ef_tests --exclude beacon_chain --exclude slasher +# run: make test-release +# release-tests-windows: +# name: release-tests-windows +# runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "windows"]') || 'windows-2019' }} +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# if: env.SELF_HOSTED_RUNNERS == false +# run: rustup update stable +# - name: Use Node.js +# uses: actions/setup-node@v2 +# with: +# node-version: '14' +# - name: Install windows build tools +# run: | +# choco install python visualstudio2019-workload-vctools -y +# npm config set msvs_version 2019 +# - name: Install Foundry (anvil) +# uses: foundry-rs/foundry-toolchain@v1 +# - name: Install make +# run: choco install -y make +# - uses: KyleMayes/install-llvm-action@v1 +# if: env.SELF_HOSTED_RUNNERS == false +# with: +# version: "15.0" +# directory: ${{ runner.temp }}/llvm +# - name: Set LIBCLANG_PATH +# run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV +# - name: Run tests in release +# run: make test-release +# beacon-chain-tests: +# name: beacon-chain-tests +# # Use self-hosted runners only on the sigp repo. +# runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "large"]') || 'ubuntu-latest' }} +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# if: env.SELF_HOSTED_RUNNERS == false +# run: rustup update stable +# - name: Run beacon_chain tests for all known forks +# run: make test-beacon-chain +# op-pool-tests: +# name: op-pool-tests +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Run operation_pool tests for all known forks +# run: make test-op-pool +# slasher-tests: +# name: slasher-tests +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Run slasher tests for all supported backends +# run: make test-slasher +# debug-tests-ubuntu: +# name: debug-tests-ubuntu +# # Use self-hosted runners only on the sigp repo. +# runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "large"]') || 'ubuntu-latest' }} +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# if: env.SELF_HOSTED_RUNNERS == false +# run: rustup update stable +# - name: Install Foundry (anvil) +# uses: foundry-rs/foundry-toolchain@v1 +# - name: Run tests in debug +# run: make test-debug +# state-transition-vectors-ubuntu: +# name: state-transition-vectors-ubuntu +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Run state_transition_vectors in release. +# run: make run-state-transition-tests +# ef-tests-ubuntu: +# name: ef-tests-ubuntu +# # Use self-hosted runners only on the sigp repo. +# runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "small"]') || 'ubuntu-latest' }} +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# if: env.SELF_HOSTED_RUNNERS == false +# run: rustup update stable +# - name: Run consensus-spec-tests with blst, milagro and fake_crypto +# run: make test-ef +# dockerfile-ubuntu: +# name: dockerfile-ubuntu +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Build the root Dockerfile +# run: docker build --build-arg FEATURES=portable -t lighthouse:local . +# - name: Test the built image +# run: docker run -t lighthouse:local lighthouse --version +# eth1-simulator-ubuntu: +# name: eth1-simulator-ubuntu +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Install Foundry (anvil) +# uses: foundry-rs/foundry-toolchain@v1 +# - name: Run the beacon chain sim that starts from an eth1 contract +# run: cargo run --release --bin simulator eth1-sim +# merge-transition-ubuntu: +# name: merge-transition-ubuntu +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Install Foundry (anvil) +# uses: foundry-rs/foundry-toolchain@v1 +# - name: Run the beacon chain sim and go through the merge transition +# run: cargo run --release --bin simulator eth1-sim --post-merge +# no-eth1-simulator-ubuntu: +# name: no-eth1-simulator-ubuntu +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Run the beacon chain sim without an eth1 connection +# run: cargo run --release --bin simulator no-eth1-sim +# syncing-simulator-ubuntu: +# name: syncing-simulator-ubuntu +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Install Foundry (anvil) +# uses: foundry-rs/foundry-toolchain@v1 +# - name: Run the syncing simulator +# run: cargo run --release --bin simulator syncing-sim +# doppelganger-protection-test: +# name: doppelganger-protection-test +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Install geth +# run: | +# sudo add-apt-repository -y ppa:ethereum/ethereum +# sudo apt-get update +# sudo apt-get install ethereum +# - name: Install lighthouse and lcli +# run: | +# make +# make install-lcli +# - name: Run the doppelganger protection failure test script +# run: | +# cd scripts/tests +# ./doppelganger_protection.sh failure genesis.json +# - name: Run the doppelganger protection success test script +# run: | +# cd scripts/tests +# ./doppelganger_protection.sh success genesis.json +# execution-engine-integration-ubuntu: +# name: execution-engine-integration-ubuntu +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-go@v3 +# with: +# go-version: '1.20' +# - uses: actions/setup-dotnet@v3 +# with: +# dotnet-version: '6.0.201' +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Run exec engine integration tests in release +# run: make test-exec-engine +# check-benchmarks: +# name: check-benchmarks +# runs-on: ubuntu-latest +# needs: cargo-fmt +# 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 +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Lint code for quality and style with Clippy +# run: make lint +# - name: Certify Cargo.lock freshness +# run: git diff --exit-code Cargo.lock +# check-msrv: +# name: check-msrv +# runs-on: ubuntu-latest +# needs: [cargo-fmt, extract-msrv] +# steps: +# - uses: actions/checkout@v3 +# - name: Install Rust @ MSRV (${{ needs.extract-msrv.outputs.MSRV }}) +# run: rustup override set ${{ needs.extract-msrv.outputs.MSRV }} +# - name: Run cargo check +# run: cargo check --workspace +# arbitrary-check: +# name: arbitrary-check +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Validate state_processing feature arbitrary-fuzz +# run: make arbitrary-fuzz +# cargo-audit: +# name: cargo-audit +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Get latest version of stable Rust +# run: rustup update stable +# - name: Run cargo audit to identify known security vulnerabilities reported to the RustSec Advisory Database +# run: make audit +# cargo-vendor: +# name: cargo-vendor +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Run cargo vendor to make sure dependencies can be vendored for packaging, reproducibility and archival purpose +# run: CARGO_HOME=$(readlink -f $HOME) make vendor +# cargo-udeps: +# name: cargo-udeps +# runs-on: ubuntu-latest +# needs: cargo-fmt +# steps: +# - uses: actions/checkout@v3 +# - name: Install Rust (${{ env.PINNED_NIGHTLY }}) +# run: rustup toolchain install $PINNED_NIGHTLY +# - name: Install cargo-udeps +# run: cargo install cargo-udeps --locked --force +# - name: Create Cargo config dir +# run: mkdir -p .cargo +# - name: Install custom Cargo config +# run: cp -f .github/custom/config.toml .cargo/config.toml +# - name: Run cargo udeps to identify unused crates in the dependency graph +# run: make udeps +# env: +# # Allow warnings on Nightly +# RUSTFLAGS: "" +# compile-with-beta-compiler: +# name: compile-with-beta-compiler +# runs-on: ubuntu-latest +# 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 +# - name: Use Rust beta +# run: rustup override set beta +# - name: Run make +# run: make diff --git a/beacon_node/network/src/service/tests.rs b/beacon_node/network/src/service/tests.rs index 985005fe85d..a38668adfcd 100644 --- a/beacon_node/network/src/service/tests.rs +++ b/beacon_node/network/src/service/tests.rs @@ -1,4 +1,4 @@ -#[cfg(not(debug_assertions))] +// #[cfg(not(debug_assertions))] #[cfg(test)] mod tests { use crate::persisted_dht::load_dht; @@ -118,7 +118,7 @@ mod tests { // Build beacon chain. let beacon_chain = BeaconChainHarness::builder(MinimalEthSpec) - .spec(spec) + .spec(spec.clone()) .deterministic_keypairs(8) .fresh_ephemeral_store() .mock_execution_layer() @@ -161,6 +161,16 @@ mod tests { // Topics the service should be subscribed to during the current epoch (before the fork) are: // - /eth2/(old_fork_digest)/beacon_attestation_1/ssz_snappy // - /eth2/(old_fork_digest)/beacon_attestation_2/ssz_snappy + let subnets = SubnetId::compute_subnets_for_epoch::( + network_globals.local_enr().node_id().raw().into(), + beacon_chain.epoch().unwrap(), + &spec + ).unwrap(); + println!("subnets: {:?}", subnets.0.collect::>()); + println!("node_id: {:?}", network_globals.local_enr().node_id()); + println!("epoch: {:?}", beacon_chain.epoch().unwrap()); + println!("spec: {:?}", spec); + let old_fork_digest = beacon_chain.enr_fork_id().fork_digest; let old_topic1 = GossipTopic::new( GossipKind::Attestation(SubnetId::new(1)), @@ -175,11 +185,15 @@ mod tests { runtime.block_on(async { while network_globals.gossipsub_subscriptions.read().len() < 2 { if let Some(msg) = network_service.attestation_service.next().await { + println!("msg: {msg:?}"); network_service.on_attestation_service_msg(msg); } } }); let subscriptions = network_globals.gossipsub_subscriptions.read().clone(); + println!("old_topic1: {old_topic1:?}"); + println!("old_topic2: {old_topic2:?}"); + println!("subscriptions: {subscriptions:?}"); assert_eq!(2, subscriptions.len()); assert!(subscriptions.contains(&old_topic1)); assert!(subscriptions.contains(&old_topic2)); diff --git a/beacon_node/network/src/subnet_service/attestation_subnets.rs b/beacon_node/network/src/subnet_service/attestation_subnets.rs index 1cae6299e1c..3685277d9cd 100644 --- a/beacon_node/network/src/subnet_service/attestation_subnets.rs +++ b/beacon_node/network/src/subnet_service/attestation_subnets.rs @@ -313,6 +313,7 @@ impl AttestationService { } })?; + println!("before compute_subnets_for_epoch"); let (subnets, next_subscription_epoch) = SubnetId::compute_subnets_for_epoch::( self.node_id.raw().into(), current_epoch, @@ -343,6 +344,7 @@ impl AttestationService { /// New subnets are registered as subscribed, removed subnets as unsubscribed and the Enr /// updated accordingly. fn update_long_lived_subnets(&mut self, mut subnets: HashSet) { + println!("update_long_lived_subnets: {:?}", subnets); info!(self.log, "Subscribing to long-lived subnets"; "subnets" => ?subnets.iter().collect::>()); for subnet in &subnets { // Add the events for those subnets that are new as long lived subscriptions. diff --git a/consensus/types/src/subnet_id.rs b/consensus/types/src/subnet_id.rs index 415d6a14040..9b3cee03cbb 100644 --- a/consensus/types/src/subnet_id.rs +++ b/consensus/types/src/subnet_id.rs @@ -61,6 +61,7 @@ impl SubnetId { committee_count_at_slot: u64, spec: &ChainSpec, ) -> Result { + println!("compute_subnet"); let slots_since_epoch_start: u64 = slot.as_u64().safe_rem(T::slots_per_epoch())?; let committees_since_epoch_start = @@ -80,6 +81,7 @@ impl SubnetId { epoch: Epoch, spec: &ChainSpec, ) -> Result<(impl Iterator, Epoch), &'static str> { + println!("compute_subnets_for_epoch"); // Simplify the variable name let subscription_duration = spec.epochs_per_subnet_subscription;