Fix data column rpc request (#8247)

Fixes an issue mentioned in this comment regarding data column rpc requests:
https://github.com/sigp/lighthouse/issues/6572#issuecomment-3400076236


  


Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Michael Sproul <micsproul@gmail.com>
This commit is contained in:
Eitan Seri-Levi
2025-10-21 16:54:35 -07:00
committed by GitHub
parent 21bab0899a
commit 46dde9afee
3 changed files with 130 additions and 22 deletions

View File

@@ -6946,9 +6946,49 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
pub fn update_data_column_custody_info(&self, slot: Option<Slot>) {
self.store
.put_data_column_custody_info(slot)
.unwrap_or_else(
|e| tracing::error!(error = ?e, "Failed to update data column custody info"),
);
.unwrap_or_else(|e| error!(error = ?e, "Failed to update data column custody info"));
}
/// Get the earliest epoch in which the node has met its custody requirements.
/// A `None` response indicates that we've met our custody requirements up to the
/// column data availability window
pub fn earliest_custodied_data_column_epoch(&self) -> Option<Epoch> {
self.store
.get_data_column_custody_info()
.inspect_err(
|e| error!(error=?e, "Failed to get data column custody info from the store"),
)
.ok()
.flatten()
.and_then(|info| info.earliest_data_column_slot)
.map(|slot| {
let mut epoch = slot.epoch(T::EthSpec::slots_per_epoch());
// If the earliest custodied slot isn't the first slot in the epoch
// The node has only met its custody requirements for the next epoch.
if slot > epoch.start_slot(T::EthSpec::slots_per_epoch()) {
epoch += 1;
}
epoch
})
}
/// The data availability boundary for custodying columns. It will just be the
/// regular data availability boundary unless we are near the Fulu fork epoch.
pub fn column_data_availability_boundary(&self) -> Option<Epoch> {
match self.data_availability_boundary() {
Some(da_boundary_epoch) => {
if let Some(fulu_fork_epoch) = self.spec.fulu_fork_epoch {
if da_boundary_epoch < fulu_fork_epoch {
Some(fulu_fork_epoch)
} else {
Some(da_boundary_epoch)
}
} else {
None // Fulu hasn't been enabled
}
}
None => None, // Deneb hasn't been enabled
}
}
/// This method serves to get a sense of the current chain health. It is used in block proposal