Skip to content

Commit 52d19be

Browse files
committed
remove get_uninitialized_ptc_validators
1 parent a15df6e commit 52d19be

File tree

1 file changed

+6
-30
lines changed

1 file changed

+6
-30
lines changed

validator_client/validator_services/src/duties_service.rs

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,25 +1242,6 @@ fn get_uninitialized_validators<S: ValidatorStore, T: SlotClock + 'static>(
12421242
.collect::<Vec<_>>()
12431243
}
12441244

1245-
/// Get a filtered list of local validators for which we don't already know their PTC duties for that epoch
1246-
fn get_uninitialized_ptc_validators<S: ValidatorStore, T: SlotClock + 'static>(
1247-
duties_service: &Arc<DutiesService<S, T>>,
1248-
epoch: &Epoch,
1249-
local_pubkeys: &HashSet<PublicKeyBytes>,
1250-
) -> Vec<u64> {
1251-
let ptc_duties = duties_service.ptc_duties.read();
1252-
1253-
local_pubkeys
1254-
.iter()
1255-
.filter(|pubkey| {
1256-
ptc_duties
1257-
.get(epoch)
1258-
.map_or(true, |(_, duties)| !duties.contains_key(pubkey))
1259-
})
1260-
.filter_map(|pubkey| duties_service.validator_store.validator_index(pubkey))
1261-
.collect::<Vec<_>>()
1262-
}
1263-
12641245
fn update_per_validator_duty_metrics<S: ValidatorStore, T: SlotClock + 'static>(
12651246
duties_service: &Arc<DutiesService<S, T>>,
12661247
epoch: Epoch,
@@ -1806,17 +1787,12 @@ async fn poll_beacon_ptc_attesters_for_epoch<
18061787
&[validator_metrics::UPDATE_PTC_FETCH],
18071788
);
18081789

1809-
// Request duties for all uninitialized validators. If there isn't any, we will just request for
1810-
// `INITIAL_PTC_DUTIES_QUERY_SIZE` validators. We use the `dependent_root` in the response to
1811-
// determine whether validator duties need to be updated. This is to ensure that we don't
1812-
// request for extra data unless necessary in order to save on network bandwidth.
1813-
let uninitialized_validators =
1814-
get_uninitialized_ptc_validators(duties_service, &epoch, local_pubkeys);
1815-
let initial_indices_to_request = if !uninitialized_validators.is_empty() {
1816-
uninitialized_validators.as_slice()
1817-
} else {
1818-
&local_indices[0..min(INITIAL_PTC_DUTIES_QUERY_SIZE, local_indices.len())]
1819-
};
1790+
// Make a small initial request to check the dependent_root and determine if we need to fetch
1791+
// all duties. We use the `dependent_root` in the response to determine whether validator
1792+
// duties need to be updated. This is to ensure that we don't request for extra data unless
1793+
// necessary in order to save on network bandwidth.
1794+
let initial_indices_to_request =
1795+
&local_indices[0..min(INITIAL_PTC_DUTIES_QUERY_SIZE, local_indices.len())];
18201796

18211797
let response =
18221798
post_validator_duties_ptc(duties_service, epoch, initial_indices_to_request).await?;

0 commit comments

Comments
 (0)