|
6 | 6 | //! The `DutiesService` is also responsible for sending events to the `BlockService` which trigger
|
7 | 7 | //! block production.
|
8 | 8 |
|
9 |
| -mod sync; |
| 9 | +pub mod sync; |
10 | 10 |
|
11 | 11 | use crate::beacon_node_fallback::{ApiTopic, BeaconNodeFallback, OfflineOnFailure, RequireSynced};
|
12 | 12 | use crate::http_metrics::metrics::{get_int_gauge, set_int_gauge, ATTESTATION_DUTY};
|
@@ -42,6 +42,9 @@ const HISTORICAL_DUTIES_EPOCHS: u64 = 2;
|
42 | 42 | /// At start-up selection proofs will be computed with less lookahead out of necessity.
|
43 | 43 | const SELECTION_PROOF_SLOT_LOOKAHEAD: u64 = 8;
|
44 | 44 |
|
| 45 | +/// The attestation selection proof lookahead for those running with the --distributed flag. |
| 46 | +const SELECTION_PROOF_SLOT_LOOKAHEAD_DVT: u64 = 1; |
| 47 | + |
45 | 48 | /// Fraction of a slot at which selection proof signing should happen (2 means half way).
|
46 | 49 | const SELECTION_PROOF_SCHEDULE_DENOM: u32 = 2;
|
47 | 50 |
|
@@ -211,16 +214,21 @@ pub struct DutiesService<T, E: EthSpec> {
|
211 | 214 | /// proposals for any validators which are not registered locally.
|
212 | 215 | pub proposers: RwLock<ProposerMap>,
|
213 | 216 | /// Map from validator index to sync committee duties.
|
214 |
| - pub sync_duties: SyncDutiesMap, |
| 217 | + pub sync_duties: SyncDutiesMap<E>, |
215 | 218 | /// Provides the canonical list of locally-managed validators.
|
216 | 219 | pub validator_store: Arc<ValidatorStore<T, E>>,
|
217 | 220 | /// Tracks the current slot.
|
218 | 221 | pub slot_clock: T,
|
219 | 222 | /// Provides HTTP access to remote beacon nodes.
|
220 | 223 | pub beacon_nodes: Arc<BeaconNodeFallback<T, E>>,
|
221 |
| - pub enable_high_validator_count_metrics: bool, |
| 224 | + /// The runtime for spawning tasks. |
222 | 225 | pub context: RuntimeContext<E>,
|
| 226 | + /// The current chain spec. |
223 | 227 | pub spec: ChainSpec,
|
| 228 | + //// Whether we permit large validator counts in the metrics. |
| 229 | + pub enable_high_validator_count_metrics: bool, |
| 230 | + /// If this validator is running in distributed mode. |
| 231 | + pub distributed: bool, |
224 | 232 | }
|
225 | 233 |
|
226 | 234 | impl<T: SlotClock + 'static, E: EthSpec> DutiesService<T, E> {
|
@@ -997,7 +1005,13 @@ async fn fill_in_selection_proofs<T: SlotClock + 'static, E: EthSpec>(
|
997 | 1005 | continue;
|
998 | 1006 | };
|
999 | 1007 |
|
1000 |
| - let lookahead_slot = current_slot + SELECTION_PROOF_SLOT_LOOKAHEAD; |
| 1008 | + let selection_lookahead = if duties_service.distributed { |
| 1009 | + SELECTION_PROOF_SLOT_LOOKAHEAD_DVT |
| 1010 | + } else { |
| 1011 | + SELECTION_PROOF_SLOT_LOOKAHEAD |
| 1012 | + }; |
| 1013 | + |
| 1014 | + let lookahead_slot = current_slot + selection_lookahead; |
1001 | 1015 |
|
1002 | 1016 | let mut relevant_duties = duties_by_slot.split_off(&lookahead_slot);
|
1003 | 1017 | std::mem::swap(&mut relevant_duties, &mut duties_by_slot);
|
|
0 commit comments