From 30136ad571ff4f955bc79a3cdaa4e421c8731787 Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Mon, 10 Feb 2025 00:36:54 +0200 Subject: [PATCH] Add gossip verified il test coverage --- beacon_node/beacon_chain/src/beacon_chain.rs | 4 +--- beacon_node/http_api/tests/tests.rs | 2 +- .../validator_services/src/inclusion_list_service.rs | 10 +++++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index e0898f3491..9544e045d0 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -1728,10 +1728,8 @@ impl BeaconChain { })?; let dependent_root = shuffling_id.shuffling_decision_block; - let head_beacon_state = self.get_state(&head_block.root, Some(head_block.slot))?; + let head_beacon_state = self.get_state(&head_block.state_root, Some(head_block.slot))?; let Some(head_beacon_state) = head_beacon_state else { - // TODO(focil) missing beacon state - println!("WEVE FAILED HERE"); return Err(Error::MissingBeaconState(head_block.root)); }; let duties = validator_indices diff --git a/beacon_node/http_api/tests/tests.rs b/beacon_node/http_api/tests/tests.rs index 1e97146fd4..b316f2a690 100644 --- a/beacon_node/http_api/tests/tests.rs +++ b/beacon_node/http_api/tests/tests.rs @@ -2675,7 +2675,7 @@ impl ApiTester { self.harness.extend_to_slot(slot).await; for validator_indices in self.interesting_validator_indices() { let res = self.client.post_validator_duties_inclusion_list(current_epoch, &validator_indices).await.unwrap(); - println!("{:?}", res); + println!("{:?}", res) } self } diff --git a/validator_client/validator_services/src/inclusion_list_service.rs b/validator_client/validator_services/src/inclusion_list_service.rs index 329a94d10d..6b59f77f95 100644 --- a/validator_client/validator_services/src/inclusion_list_service.rs +++ b/validator_client/validator_services/src/inclusion_list_service.rs @@ -77,7 +77,7 @@ impl InclusionListService { ); let executor = self.context.executor.clone(); - + let chain_spec = spec.clone(); let interval_fut = async move { loop { if let Some(duration_to_next_slot) = self.slot_clock.duration_to_next_slot() { @@ -85,7 +85,7 @@ impl InclusionListService { sleep(duration_to_next_slot + (slot_duration * 3 / 4)).await; let log = self.context.log(); - if let Err(e) = self.spawn_inclusion_list_task(slot_duration) { + if let Err(e) = self.spawn_inclusion_list_task(slot_duration, &chain_spec) { crit!( log, "Failed to spawn inclusion list task"; @@ -113,9 +113,13 @@ impl InclusionListService { /// Spawn a new task that downloads, signs and uploads the inclusion lists to the beacon node. // TODO(focil) I don't think we need `slot_duration` here, unless we need to make some calculation // related to the freeze deadline. - fn spawn_inclusion_list_task(&self, _slot_duration: Duration) -> Result<(), String> { + fn spawn_inclusion_list_task(&self, _slot_duration: Duration, spec: &ChainSpec) -> Result<(), String> { let slot = self.slot_clock.now().ok_or("Failed to read slot clock")?; + if !spec.is_focil_enabled_for_epoch(slot.epoch(E::slots_per_epoch())) { + return Ok(()) + } + // TODO(focil) unused variable let _duration_to_next_slot = self .slot_clock