mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
Improve get_custody_columns validation, caching and error handling (#6308)
* Improve `get_custody_columns` validation, caching and error handling. * Merge branch 'unstable' into get-custody-columns-error-handing * Fix failing test and add more test. * Fix failing test and add more test. * Merge branch 'unstable' into get-custody-columns-error-handing # Conflicts: # beacon_node/lighthouse_network/src/discovery/subnet_predicate.rs # beacon_node/lighthouse_network/src/peer_manager/peerdb.rs # beacon_node/lighthouse_network/src/peer_manager/peerdb/peer_info.rs # beacon_node/lighthouse_network/src/types/globals.rs # beacon_node/network/src/service.rs # consensus/types/src/data_column_subnet_id.rs * Add unit test to make sure the default specs won't panic on the `compute_custody_requirement_subnets` function. * Add condition when calling `compute_custody_subnets_from_metadata` and update logs. * Validate `csc` when returning from enr. Remove `csc` computation on connection since we get them on metadata anyway. * Add `peers_per_custody_subnet_count` to track peer csc and supernodes. * Disconnect peers with invalid metadata and find other peers instead. * Fix sampling tests. * Merge branch 'unstable' into get-custody-columns-error-handing * Merge branch 'unstable' into get-custody-columns-error-handing
This commit is contained in:
@@ -389,7 +389,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
|
||||
let (expects_custody_columns, num_of_custody_column_req) =
|
||||
if matches!(batch_type, ByRangeRequestType::BlocksAndColumns) {
|
||||
let custody_indexes = self.network_globals().custody_columns();
|
||||
let custody_indexes = self.network_globals().custody_columns.clone();
|
||||
let mut num_of_custody_column_req = 0;
|
||||
|
||||
for (peer_id, columns_by_range_request) in
|
||||
@@ -758,10 +758,11 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
.imported_custody_column_indexes(&block_root)
|
||||
.unwrap_or_default();
|
||||
|
||||
let custody_indexes_duty = self.network_globals().custody_columns();
|
||||
|
||||
// Include only the blob indexes not yet imported (received through gossip)
|
||||
let custody_indexes_to_fetch = custody_indexes_duty
|
||||
let custody_indexes_to_fetch = self
|
||||
.network_globals()
|
||||
.custody_columns
|
||||
.clone()
|
||||
.into_iter()
|
||||
.filter(|index| !custody_indexes_imported.contains(index))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -1112,25 +1112,25 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
fn good_peers_on_custody_subnets(&self, epoch: Epoch, network: &SyncNetworkContext<T>) -> bool {
|
||||
if network.chain.spec.is_peer_das_enabled_for_epoch(epoch) {
|
||||
// Require peers on all custody column subnets before sending batches
|
||||
let peers_on_all_custody_subnets =
|
||||
network
|
||||
.network_globals()
|
||||
.custody_subnets()
|
||||
.all(|subnet_id| {
|
||||
let peer_count = network
|
||||
.network_globals()
|
||||
.peers
|
||||
.read()
|
||||
.good_custody_subnet_peer(subnet_id)
|
||||
.count();
|
||||
let peers_on_all_custody_subnets = network
|
||||
.network_globals()
|
||||
.custody_subnets
|
||||
.iter()
|
||||
.all(|subnet_id| {
|
||||
let peer_count = network
|
||||
.network_globals()
|
||||
.peers
|
||||
.read()
|
||||
.good_custody_subnet_peer(*subnet_id)
|
||||
.count();
|
||||
|
||||
set_int_gauge(
|
||||
&PEERS_PER_COLUMN_SUBNET,
|
||||
&[&subnet_id.to_string()],
|
||||
peer_count as i64,
|
||||
);
|
||||
peer_count > 0
|
||||
});
|
||||
set_int_gauge(
|
||||
&PEERS_PER_COLUMN_SUBNET,
|
||||
&[&subnet_id.to_string()],
|
||||
peer_count as i64,
|
||||
);
|
||||
peer_count > 0
|
||||
});
|
||||
peers_on_all_custody_subnets
|
||||
} else {
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user