Skip to content

Commit e21a433

Browse files
Allow manual checkpoint sync without blobs (#8470)
Since merging this PR, we don't need `--checkpoint-blobs`, even prior to Fulu: - #8417 This PR removes the mandatory check for blobs prior to Fulu, enabling simpler manual checkpoint sync. Co-Authored-By: Michael Sproul <[email protected]> Co-Authored-By: Jimmy Chen <[email protected]>
1 parent d6cec0b commit e21a433

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

beacon_node/beacon_chain/tests/store_tests.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,15 +2705,15 @@ async fn weak_subjectivity_sync_easy() {
27052705
let num_initial_slots = E::slots_per_epoch() * 11;
27062706
let checkpoint_slot = Slot::new(E::slots_per_epoch() * 9);
27072707
let slots = (1..num_initial_slots).map(Slot::new).collect();
2708-
weak_subjectivity_sync_test(slots, checkpoint_slot, None).await
2708+
weak_subjectivity_sync_test(slots, checkpoint_slot, None, true).await
27092709
}
27102710

27112711
#[tokio::test]
27122712
async fn weak_subjectivity_sync_single_block_batches() {
27132713
let num_initial_slots = E::slots_per_epoch() * 11;
27142714
let checkpoint_slot = Slot::new(E::slots_per_epoch() * 9);
27152715
let slots = (1..num_initial_slots).map(Slot::new).collect();
2716-
weak_subjectivity_sync_test(slots, checkpoint_slot, Some(1)).await
2716+
weak_subjectivity_sync_test(slots, checkpoint_slot, Some(1), true).await
27172717
}
27182718

27192719
#[tokio::test]
@@ -2727,7 +2727,7 @@ async fn weak_subjectivity_sync_unaligned_advanced_checkpoint() {
27272727
slot <= checkpoint_slot - 3 || slot > checkpoint_slot
27282728
})
27292729
.collect();
2730-
weak_subjectivity_sync_test(slots, checkpoint_slot, None).await
2730+
weak_subjectivity_sync_test(slots, checkpoint_slot, None, true).await
27312731
}
27322732

27332733
#[tokio::test]
@@ -2741,7 +2741,7 @@ async fn weak_subjectivity_sync_unaligned_unadvanced_checkpoint() {
27412741
slot <= checkpoint_slot || slot > checkpoint_slot + 3
27422742
})
27432743
.collect();
2744-
weak_subjectivity_sync_test(slots, checkpoint_slot, None).await
2744+
weak_subjectivity_sync_test(slots, checkpoint_slot, None, true).await
27452745
}
27462746

27472747
// Regression test for https://github.com/sigp/lighthouse/issues/4817
@@ -2753,7 +2753,7 @@ async fn weak_subjectivity_sync_skips_at_genesis() {
27532753
let end_slot = E::slots_per_epoch() * 4;
27542754
let slots = (start_slot..end_slot).map(Slot::new).collect();
27552755
let checkpoint_slot = Slot::new(E::slots_per_epoch() * 2);
2756-
weak_subjectivity_sync_test(slots, checkpoint_slot, None).await
2756+
weak_subjectivity_sync_test(slots, checkpoint_slot, None, true).await
27572757
}
27582758

27592759
// Checkpoint sync from the genesis state.
@@ -2766,13 +2766,24 @@ async fn weak_subjectivity_sync_from_genesis() {
27662766
let end_slot = E::slots_per_epoch() * 2;
27672767
let slots = (start_slot..end_slot).map(Slot::new).collect();
27682768
let checkpoint_slot = Slot::new(0);
2769-
weak_subjectivity_sync_test(slots, checkpoint_slot, None).await
2769+
weak_subjectivity_sync_test(slots, checkpoint_slot, None, true).await
2770+
}
2771+
2772+
// Test checkpoint sync without providing blobs - backfill should fetch them.
2773+
#[tokio::test]
2774+
async fn weak_subjectivity_sync_without_blobs() {
2775+
let start_slot = 4;
2776+
let end_slot = E::slots_per_epoch() * 4;
2777+
let slots = (start_slot..end_slot).map(Slot::new).collect();
2778+
let checkpoint_slot = Slot::new(E::slots_per_epoch() * 2);
2779+
weak_subjectivity_sync_test(slots, checkpoint_slot, None, false).await
27702780
}
27712781

27722782
async fn weak_subjectivity_sync_test(
27732783
slots: Vec<Slot>,
27742784
checkpoint_slot: Slot,
27752785
backfill_batch_size: Option<usize>,
2786+
provide_blobs: bool,
27762787
) {
27772788
// Build an initial chain on one harness, representing a synced node with full history.
27782789
let num_final_blocks = E::slots_per_epoch() * 2;
@@ -2874,7 +2885,11 @@ async fn weak_subjectivity_sync_test(
28742885
.weak_subjectivity_state(
28752886
wss_state,
28762887
wss_block.clone(),
2877-
wss_blobs_opt.clone(),
2888+
if provide_blobs {
2889+
wss_blobs_opt.clone()
2890+
} else {
2891+
None
2892+
},
28782893
genesis_state,
28792894
)
28802895
.unwrap()

beacon_node/client/src/builder.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,10 @@ where
354354
let anchor_block = SignedBeaconBlock::from_ssz_bytes(&anchor_block_bytes, &spec)
355355
.map_err(|e| format!("Unable to parse weak subj block SSZ: {:?}", e))?;
356356

357-
// `BlobSidecar` is no longer used from Fulu onwards (superseded by `DataColumnSidecar`),
358-
// which will be fetched via rpc instead (unimplemented).
359-
let is_before_fulu = !spec
360-
.fork_name_at_slot::<E>(anchor_block.slot())
361-
.fulu_enabled();
362-
let anchor_blobs = if is_before_fulu && anchor_block.message().body().has_blobs() {
357+
// Providing blobs is optional now and not providing them is recommended.
358+
// Backfill can handle downloading the blobs or columns for the checkpoint block.
359+
let anchor_blobs = if let Some(anchor_blobs_bytes) = anchor_blobs_bytes {
363360
let max_blobs_len = spec.max_blobs_per_block(anchor_block.epoch()) as usize;
364-
let anchor_blobs_bytes = anchor_blobs_bytes
365-
.ok_or("Blobs for checkpoint must be provided using --checkpoint-blobs")?;
366361
Some(
367362
BlobSidecarList::from_ssz_bytes(&anchor_blobs_bytes, max_blobs_len)
368363
.map_err(|e| format!("Unable to parse weak subj blobs SSZ: {e:?}"))?,

0 commit comments

Comments
 (0)