diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 11b0d6af2..59d29298a 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -3029,7 +3029,7 @@ impl BeaconChain { blob_info.last_pruned_epoch + *MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS; if current_epoch > next_epoch_to_prune { - blob_info.availability_breakpoint = block_root; + blob_info.data_availability_breakpoint = block_root; self.store.compare_and_set_blob_info_with_write( self.store.get_blob_info(), Some(blob_info), diff --git a/beacon_node/store/src/hot_cold_store.rs b/beacon_node/store/src/hot_cold_store.rs index bbb74ef5c..54e4132a4 100644 --- a/beacon_node/store/src/hot_cold_store.rs +++ b/beacon_node/store/src/hot_cold_store.rs @@ -1696,25 +1696,24 @@ impl, Cold: ItemStore> HotColdDB return Ok(()); } - if blob_info.availability_breakpoint == blob_info.oldest_blob_parent { + if blob_info.data_availability_breakpoint == blob_info.oldest_blob_parent { return Ok(()); } // Load the state from which to prune blobs so we can backtrack. let erase_state = self .get_state( - &blob_info.availability_breakpoint, + &blob_info.data_availability_breakpoint, Some(blob_info.last_pruned_epoch.end_slot(E::slots_per_epoch())), )? .ok_or(HotColdDBError::MissingStateToPruneBlobs( - blob_info.availability_breakpoint, + blob_info.data_availability_breakpoint, blob_info.oldest_blob_slot, ))?; // The data availability breakpoint is set at the start of an epoch indicating the epoch // before can be pruned. let erase_epoch = erase_state.current_epoch() - 1; - let erase_slot = erase_epoch.end_slot(E::slots_per_epoch()); // The finalized block may or may not have its blobs sidecar stored, depending on // whether it was at a skipped slot. However for a fully pruned database its parent @@ -1724,18 +1723,14 @@ impl, Cold: ItemStore> HotColdDB let already_pruned = process_results( BlockRootsIter::new(&erase_state, blob_info.oldest_blob_slot), |mut iter| { - iter.find(|(slot, block_root)| { + iter.find(|(_, block_root)| { move || -> bool { - if *slot <= erase_slot { - if let Ok(Some(erase_parent_block)) = - self.get_blinded_block(&block_root) + if let Ok(Some(erase_parent_block)) = self.get_blinded_block(&block_root) { + if let Ok(expected_kzg_commitments) = + erase_parent_block.message().body().blob_kzg_commitments() { - if let Ok(expected_kzg_commitments) = - erase_parent_block.message().body().blob_kzg_commitments() - { - if expected_kzg_commitments.len() > 0 { - return true; - } + if expected_kzg_commitments.len() > 0 { + return true; } } } @@ -1790,10 +1785,10 @@ impl, Cold: ItemStore> HotColdDB ops.push(StoreOp::DeleteBlobs(block_root)); } - if slot <= erase_slot { + if block_root == blob_info.oldest_blob_parent { info!( self.log, - "Blobs sidecar pruning reached earliest available blob state"; + "Blobs sidecar pruning reached earliest available blobs sidecar"; "slot" => slot ); break; @@ -1809,7 +1804,7 @@ impl, Cold: ItemStore> HotColdDB ); blob_info.last_pruned_epoch = erase_epoch; - blob_info.oldest_blob_parent = blob_info.availability_breakpoint; + blob_info.oldest_blob_parent = blob_info.data_availability_breakpoint; self.compare_and_set_blob_info_with_write(self.get_blob_info(), Some(blob_info))?; Ok(()) diff --git a/beacon_node/store/src/metadata.rs b/beacon_node/store/src/metadata.rs index c2e72fac3..803b75b98 100644 --- a/beacon_node/store/src/metadata.rs +++ b/beacon_node/store/src/metadata.rs @@ -125,7 +125,7 @@ pub struct BlobInfo { /// The latest epoch that blobs were pruned. pub last_pruned_epoch: Epoch, /// The block root of the next blobs to prune from. - pub availability_breakpoint: Hash256, + pub data_availability_breakpoint: Hash256, /// The block root of the next blob that needs to be added to fill in the history. pub oldest_blob_parent: Hash256, /// The slot before which blobs are available.