mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Trigger backfill on startup if user switches to a supernode or semi-supernode (#8265)
This PR adds backfill functionality to nodes switching to become a supernode or semi-supernode. Please note that we currently only support a CGC increase, i.e. if the node's already custodying 67 columns, switching to semi-supernode (64) will have no effect. From @eserilev > if a node's cgc increases on start up, we just need two things for custody backfill to do its thing > > - data column custody info needs to be updated to reflect the cgc change > - `CustodyContext::validator_registrations::epoch_validator_custody_requirements` needs to be updated to reflect the cgc change - [x] Add tests - [x] Test on devnet-3 - [x] switch to supernode - [x] switch to semisupernode - [x] Test on live testnets - [x] Update docs (functions) Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -931,18 +931,26 @@ where
|
||||
|
||||
// Load the persisted custody context from the db and initialize
|
||||
// the context for this run
|
||||
let custody_context = if let Some(custody) =
|
||||
let (custody_context, cgc_changed_opt) = if let Some(custody) =
|
||||
load_custody_context::<E, THotStore, TColdStore>(store.clone())
|
||||
{
|
||||
Arc::new(CustodyContext::new_from_persisted_custody_context(
|
||||
let head_epoch = canonical_head
|
||||
.cached_head()
|
||||
.head_slot()
|
||||
.epoch(E::slots_per_epoch());
|
||||
CustodyContext::new_from_persisted_custody_context(
|
||||
custody,
|
||||
self.node_custody_type,
|
||||
head_epoch,
|
||||
&self.spec,
|
||||
))
|
||||
)
|
||||
} else {
|
||||
Arc::new(CustodyContext::new(self.node_custody_type, &self.spec))
|
||||
(
|
||||
CustodyContext::new(self.node_custody_type, &self.spec),
|
||||
None,
|
||||
)
|
||||
};
|
||||
debug!(?custody_context, "Loading persisted custody context");
|
||||
debug!(?custody_context, "Loaded persisted custody context");
|
||||
|
||||
let beacon_chain = BeaconChain {
|
||||
spec: self.spec.clone(),
|
||||
@@ -1019,7 +1027,7 @@ where
|
||||
slot_clock,
|
||||
self.kzg.clone(),
|
||||
store,
|
||||
custody_context,
|
||||
Arc::new(custody_context),
|
||||
self.spec,
|
||||
)
|
||||
.map_err(|e| format!("Error initializing DataAvailabilityChecker: {:?}", e))?,
|
||||
@@ -1062,6 +1070,14 @@ where
|
||||
return Err(format!("Weak subjectivity verification failed: {:?}", e));
|
||||
}
|
||||
|
||||
if let Some(cgc_changed) = cgc_changed_opt {
|
||||
// Update data column custody info if there's a CGC change from CLI flags.
|
||||
// This will trigger column backfill.
|
||||
let cgc_change_effective_slot =
|
||||
cgc_changed.effective_epoch.start_slot(E::slots_per_epoch());
|
||||
beacon_chain.update_data_column_custody_info(Some(cgc_change_effective_slot));
|
||||
}
|
||||
|
||||
info!(
|
||||
head_state = %head.beacon_state_root(),
|
||||
head_block = %head.beacon_block_root,
|
||||
|
||||
Reference in New Issue
Block a user