diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 9544e045d0..abb183d847 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -2178,6 +2178,8 @@ impl BeaconChain { .await .map_err(|e| Error::ExecutionLayerGetInclusionListFailed(Box::new(e)))?; + debug!(self.log, "Inclusion list fetched from EL"; "tx_count" => inclusion_list.len()); + Ok(Some(inclusion_list)) } @@ -2373,11 +2375,8 @@ impl BeaconChain { }) } - /// Accepts some `Attestation` from the network and attempts to verify it, returning `Ok(_)` if + /// Accepts some `inclusion_list` from the network and attempts to verify it, returning `Ok(_)` if /// it is valid to be (re)broadcast on the gossip network. - /// - /// The attestation must be "unaggregated", that is it must have exactly one - /// aggregation bit set. pub fn verify_inclusion_list_for_gossip( &self, inclusion_list: &SignedInclusionList, @@ -7393,9 +7392,10 @@ impl BeaconChain { } pub fn on_verified_inclusion_list(&self, signed_il: SignedInclusionList) { + debug!(self.log, "Adding verified inclusion list to the cache"); self.inclusion_list_cache .write() - .on_inclusion_list(signed_il); + .on_inclusion_list(signed_il, &self.log); } pub fn metrics(&self) -> BeaconChainMetrics { diff --git a/beacon_node/beacon_chain/src/execution_payload.rs b/beacon_node/beacon_chain/src/execution_payload.rs index 9b44c47eeb..3408bf8a95 100644 --- a/beacon_node/beacon_chain/src/execution_payload.rs +++ b/beacon_node/beacon_chain/src/execution_payload.rs @@ -103,11 +103,21 @@ impl PayloadNotifier { Some(PayloadVerificationStatus::Irrelevant) }; - let inclusion_list_transactions = chain - .inclusion_list_cache - .read() - .get_inclusion_list_transactions(block.slot()) - .unwrap_or(vec![].into()); + let inclusion_list_transactions = if chain + .spec + .is_focil_enabled_for_epoch(block.slot().epoch(T::EthSpec::slots_per_epoch())) + { + let inclusion_list_transactions = chain + .inclusion_list_cache + .read() + .get_inclusion_list_transactions(block.slot()) + .unwrap_or(vec![].into()); + + debug!(chain.log, "Adding inclusion list transactions in the Payload Notifier"; "count" => inclusion_list_transactions.len()); + inclusion_list_transactions + } else { + vec![].into() + }; Ok(Self { chain, diff --git a/beacon_node/http_api/src/publish_inclusion_lists.rs b/beacon_node/http_api/src/publish_inclusion_lists.rs index 5437b1f4de..c961ea4a88 100644 --- a/beacon_node/http_api/src/publish_inclusion_lists.rs +++ b/beacon_node/http_api/src/publish_inclusion_lists.rs @@ -64,8 +64,14 @@ pub async fn publish_inclusion_lists( &network_tx, &inner_log, ) { - Ok(()) => PublishInclusionListResult::Success, - Err(e) => PublishInclusionListResult::Failure(e), + Ok(()) => { + debug!(inner_log, "Successfully verified gossip inclusion list"); + PublishInclusionListResult::Success + }, + Err(e) => { + debug!(inner_log, "Failed to verify gossip inclusion list"; "error" => format!("{:?}", e)); + PublishInclusionListResult::Failure(e) + }, } }) .map(Some) diff --git a/beacon_node/lighthouse_network/src/service/utils.rs b/beacon_node/lighthouse_network/src/service/utils.rs index 72c2b29102..41ddba7188 100644 --- a/beacon_node/lighthouse_network/src/service/utils.rs +++ b/beacon_node/lighthouse_network/src/service/utils.rs @@ -257,6 +257,7 @@ pub(crate) fn create_whitelist_filter( add(BlsToExecutionChange); add(LightClientFinalityUpdate); add(LightClientOptimisticUpdate); + add(InclusionList); for id in 0..spec.attestation_subnet_count { add(Attestation(SubnetId::new(id))); } diff --git a/beacon_node/lighthouse_network/src/types/topics.rs b/beacon_node/lighthouse_network/src/types/topics.rs index a61da2e8fb..cd956e3bf1 100644 --- a/beacon_node/lighthouse_network/src/types/topics.rs +++ b/beacon_node/lighthouse_network/src/types/topics.rs @@ -42,6 +42,8 @@ pub const LIGHT_CLIENT_GOSSIP_TOPICS: [GossipKind; 2] = [ GossipKind::LightClientOptimisticUpdate, ]; +pub const FULU_CORE_TOPICS: [GossipKind; 1] = [GossipKind::InclusionList]; + /// Returns the core topics associated with each fork that are new to the previous fork pub fn fork_core_topics(fork_name: &ForkName, spec: &ChainSpec) -> Vec { match fork_name { @@ -63,13 +65,9 @@ pub fn fork_core_topics(fork_name: &ForkName, spec: &ChainSpec) -> V for i in 0..spec.blob_sidecar_subnet_count(ForkName::Electra) { electra_blob_topics.push(GossipKind::BlobSidecar(i)); } - - if spec.is_focil_scheduled() { - electra_blob_topics.push(GossipKind::InclusionList) - } electra_blob_topics } - ForkName::Fulu => vec![], + ForkName::Fulu => FULU_CORE_TOPICS.to_vec(), } } diff --git a/consensus/types/src/beacon_state/inclusion_list_cache.rs b/consensus/types/src/beacon_state/inclusion_list_cache.rs index fb4fc675f8..c28de6cc2a 100644 --- a/consensus/types/src/beacon_state/inclusion_list_cache.rs +++ b/consensus/types/src/beacon_state/inclusion_list_cache.rs @@ -1,6 +1,6 @@ -use std::collections::{HashMap, HashSet}; - use super::{EthSpec, InclusionListTransactions, SignedInclusionList, Slot, Transaction}; +use slog::{debug, Logger}; +use std::collections::{HashMap, HashSet}; /// Map from slot to inclusion lists #[derive(Debug, Default, Clone, PartialEq)] @@ -34,7 +34,7 @@ impl InclusionListCache { self.inner_map.remove(&slot); } - pub fn on_inclusion_list(&mut self, inclusion_list: SignedInclusionList) { + pub fn on_inclusion_list(&mut self, inclusion_list: SignedInclusionList, log: &Logger) { let Some(inner) = self.inner_map.get_mut(&inclusion_list.message.slot) else { return; }; @@ -75,6 +75,11 @@ impl InclusionListCache { .inclusion_lists_seen .insert(inclusion_list.message.validator_index); inner.inclusion_lists.insert(inclusion_list); + + debug!( + log, + "Successfully added inclusion list transactions to the cache" + ); } pub fn get_inclusion_list_transactions( diff --git a/validator_client/validator_services/src/inclusion_list_service.rs b/validator_client/validator_services/src/inclusion_list_service.rs index 31adbc12c7..d7155f9a76 100644 --- a/validator_client/validator_services/src/inclusion_list_service.rs +++ b/validator_client/validator_services/src/inclusion_list_service.rs @@ -118,9 +118,9 @@ impl InclusionListService { _slot_duration: Duration, spec: &ChainSpec, ) -> Result<(), String> { - let slot = self.slot_clock.now().ok_or("Failed to read slot clock")?; + let next_slot = self.slot_clock.now().ok_or("Failed to read slot clock")? + 1; - if !spec.is_focil_enabled_for_epoch(slot.epoch(E::slots_per_epoch())) { + if !spec.is_focil_enabled_for_epoch(next_slot.epoch(E::slots_per_epoch())) { return Ok(()); } @@ -130,10 +130,10 @@ impl InclusionListService { .duration_to_next_slot() .ok_or("Unable to determine duration to next slot")?; - let inclusion_list_duties = self.duties_service.inclusion_list_duties(slot); + let inclusion_list_duties = self.duties_service.inclusion_list_duties(next_slot); self.inner.context.executor.spawn_ignoring_error( self.clone() - .produce_and_publish_inclusion_lists(slot, inclusion_list_duties), + .produce_and_publish_inclusion_lists(next_slot, inclusion_list_duties), "inclusion list publish", );