diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 81f09e0547..c19da15385 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -471,7 +471,7 @@ pub struct BeaconChain { /// A cache used when producing attestations whilst the head block is still being imported. pub early_attester_cache: EarlyAttesterCache, /// A cache used to store verified/equivocating inclusion lists. - pub inclusion_list_cache: InclusionListCache, + pub inclusion_list_cache: RwLock>, /// Cache gossip verified blocks to serve over ReqResp before they are imported pub reqresp_pre_import_cache: Arc>>, /// A cache used to keep track of various block timings. @@ -7293,6 +7293,10 @@ impl BeaconChain { Ok(()) } + pub fn on_verified_inclusion_list(&self, signed_il: SignedInclusionList) { + self.inclusion_list_cache.write().on_inclusion_list(signed_il); + } + pub fn metrics(&self) -> BeaconChainMetrics { BeaconChainMetrics { reqresp_pre_import_cache_len: self.reqresp_pre_import_cache.read().len(), diff --git a/beacon_node/beacon_chain/src/execution_payload.rs b/beacon_node/beacon_chain/src/execution_payload.rs index 28c55f97e8..e69d706be8 100644 --- a/beacon_node/beacon_chain/src/execution_payload.rs +++ b/beacon_node/beacon_chain/src/execution_payload.rs @@ -105,6 +105,7 @@ impl PayloadNotifier { let inclusion_list_transactions = chain .inclusion_list_cache + .read() .get_inclusion_list_transactions(block.slot()) .unwrap_or(vec![].into()); diff --git a/beacon_node/beacon_chain/src/inclusion_list_verification.rs b/beacon_node/beacon_chain/src/inclusion_list_verification.rs index dfa23ef709..584996a847 100644 --- a/beacon_node/beacon_chain/src/inclusion_list_verification.rs +++ b/beacon_node/beacon_chain/src/inclusion_list_verification.rs @@ -29,9 +29,7 @@ impl From for GossipInclusionListError { } pub struct GossipVerifiedInclusionList { - // TODO(focil) remove once this field is read - #[allow(dead_code)] - signed_il: SignedInclusionList, + pub signed_il: SignedInclusionList, } impl GossipVerifiedInclusionList { diff --git a/beacon_node/network/src/network_beacon_processor/gossip_methods.rs b/beacon_node/network/src/network_beacon_processor/gossip_methods.rs index 73359248b0..6c1ced94d1 100644 --- a/beacon_node/network/src/network_beacon_processor/gossip_methods.rs +++ b/beacon_node/network/src/network_beacon_processor/gossip_methods.rs @@ -2174,8 +2174,11 @@ impl NetworkBeaconProcessor { _seen_timestamp: Duration, ) { match GossipVerifiedInclusionList::verify(&il, &self.chain) { - Ok(_gossip_verified_il) => { + Ok(gossip_verified_il) => { debug!(self.log, "Successfully verified gossip inclusion list"); + // Store validated inclusion list in the IL cache. This also catches + // equivocating IL's and handles them accordingly. + self.chain.on_verified_inclusion_list(gossip_verified_il.signed_il); } Err(err) => match err { GossipInclusionListError::FutureSlot { .. }