Skip to content

Commit 351dd6c

Browse files
authored
Set custody subnets on tests (#6382)
* Set custody subnets on tests * Enable sampling_with_retries test * Add another supernode to ensure the node can retry
1 parent e5a40fb commit 351dd6c

File tree

2 files changed

+14
-2
lines changed
  • beacon_node

2 files changed

+14
-2
lines changed

beacon_node/lighthouse_network/src/peer_manager/peerdb.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::discovery::enr::PEERDAS_CUSTODY_SUBNET_COUNT_ENR_KEY;
2-
use crate::discovery::CombinedKey;
2+
use crate::discovery::{peer_id_to_node_id, CombinedKey};
33
use crate::{metrics, multiaddr::Multiaddr, types::Subnet, Enr, EnrExt, Gossipsub, PeerId};
44
use peer_info::{ConnectionDirection, PeerConnectionStatus, PeerInfo};
55
use rand::seq::SliceRandom;
@@ -723,6 +723,17 @@ impl<E: EthSpec> PeerDB<E> {
723723
.map(|csc| csc.into())
724724
.collect();
725725
peer_info.set_custody_subnets(all_subnets);
726+
} else {
727+
let peer_info = self.peers.get_mut(&peer_id).expect("peer exists");
728+
let node_id = peer_id_to_node_id(&peer_id).expect("convert peer_id to node_id");
729+
let subnets = DataColumnSubnetId::compute_custody_subnets::<E>(
730+
node_id.raw(),
731+
spec.custody_requirement,
732+
spec,
733+
)
734+
.expect("should compute custody subnets")
735+
.collect();
736+
peer_info.set_custody_subnets(subnets);
726737
}
727738

728739
peer_id

beacon_node/network/src/sync/block_lookups/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,12 +1972,13 @@ fn sampling_happy_path() {
19721972
}
19731973

19741974
#[test]
1975-
#[ignore] // Ignoring due to flakiness https://github.com/sigp/lighthouse/issues/6319
19761975
fn sampling_with_retries() {
19771976
let Some(mut r) = TestRig::test_setup_after_peerdas() else {
19781977
return;
19791978
};
19801979
r.new_connected_peers_for_peerdas();
1980+
// Add another supernode to ensure that the node can retry.
1981+
r.new_connected_supernode_peer();
19811982
let (block, data_columns) = r.rand_block_and_data_columns();
19821983
let block_root = block.canonical_root();
19831984
r.trigger_sample_block(block_root, block.slot());

0 commit comments

Comments
 (0)