From 28523a47f34a383fac23574ea59eaf28f3125bb5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 17 Nov 2024 11:51:00 +0100 Subject: [PATCH 1/4] commented out currently unused fields for hbbft peers management. peers management does not report a connected peer now, if connecting to it fails. (this COULD be a breaking change, requires testing) --- .../engines/hbbft/hbbft_peers_management.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs b/crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs index d219ad4f7..1b172f273 100644 --- a/crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs +++ b/crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs @@ -16,9 +16,9 @@ use ethereum_types::Address; #[derive(Clone, Debug)] struct ValidatorConnectionData { // mining_address: Address, - staking_address: Address, - socket_addr: SocketAddr, - public_key: NodeId, + // staking_address: Address, + // socket_addr: SocketAddr, + // public_key: NodeId, peer_string: String, mining_address: Address, } @@ -40,7 +40,9 @@ impl HbbftPeersManagement { } } - /// connections are not always required + /// connections are not always required. + /// - during syncing + /// - if not validator address specified. fn should_not_connect(&self, client: &dyn BlockChainClient) -> bool { // don't do any connections while the network is syncing. // the connection is not required yet, and might be outdated. @@ -62,6 +64,8 @@ impl HbbftPeersManagement { client_arc: &Arc, pending_validators: &Vec
, ) -> Result { + + let block_chain_client = client_arc .as_full_client() .ok_or("reserverd peers: could not retrieve BlockChainClient for connect_to_pending_validators")?; @@ -542,14 +546,15 @@ fn connect_to_validator_core( info!(target: "engine", "adding reserved peer: {}", peer_string); if let Err(err) = peers_management.add_reserved_peer(&peer_string) { warn!(target: "engine", "failed to adding reserved: {} : {}", peer_string, err); + return None; } return Some(ValidatorConnectionData { - staking_address: staking_address, + //staking_address: staking_address, //mining_address: *address, - socket_addr: socket_addr, + //socket_addr: socket_addr, peer_string, - public_key: node_id.clone(), + //public_key: node_id.clone(), mining_address: Address::zero(), // all caller of this function will set this value. }); } else { From 3b38650a6fd799ff8a65ea39f40f13e8bf211f0a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 17 Nov 2024 11:51:23 +0100 Subject: [PATCH 2/4] cargo fmt --all -- --config imports_granularity=Crate --- crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs b/crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs index 1b172f273..2bc56f91b 100644 --- a/crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs +++ b/crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs @@ -64,8 +64,6 @@ impl HbbftPeersManagement { client_arc: &Arc, pending_validators: &Vec
, ) -> Result { - - let block_chain_client = client_arc .as_full_client() .ok_or("reserverd peers: could not retrieve BlockChainClient for connect_to_pending_validators")?; From 0db8cade08d726982218dba779088db89e59b547 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 20 Nov 2024 12:06:19 +0100 Subject: [PATCH 3/4] for the sake of faster CI tests, and not overshooting the github quotas, long running tests are commented out at the moment. --- .github/workflows/build-test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ee7e5709b..94429019f 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -15,13 +15,14 @@ jobs: - ubuntu-latest # - macos-latest toolchain: - - 1.72 + - 1.75 runs-on: ${{ matrix.platform }} steps: - name: Checkout sources uses: actions/checkout@main with: - submodules: true + submodules: false + # submodules: true // we do not need submodules, if we are not running the JSON tests. - name: Install toolchain uses: actions-rs/toolchain@v1 with: @@ -32,7 +33,8 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --locked --all --release --features "json-tests" --verbose --no-run + #args: deactivated JSON Tests, so we do not run out of quota on CI tests for merge intesive time. --locked --all --release --features "json-tests" --verbose --no-run + args: --locked --all --release --verbose --no-run - name: Run tests for ${{ matrix.platform }} uses: actions-rs/cargo@v1 with: From a112e6a271a9beda9d5e2ae151cdf5ebd60f9f29 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 22 Nov 2024 11:38:06 +0100 Subject: [PATCH 4/4] build tests: include submodules again, since it leads to compile errors of tests --- .github/workflows/build-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 94429019f..d0af0afda 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -21,8 +21,7 @@ jobs: - name: Checkout sources uses: actions/checkout@main with: - submodules: false - # submodules: true // we do not need submodules, if we are not running the JSON tests. + submodules: true - name: Install toolchain uses: actions-rs/toolchain@v1 with: