Skip to content

Commit 6887ad7

Browse files
committed
Tweak comments in v24 migration
1 parent b73cb1e commit 6887ad7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

beacon_node/beacon_chain/src/schema_change/migration_schema_v24.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,31 +311,29 @@ pub fn downgrade_from_v24<T: BeaconChainTypes>(
311311
};
312312
migrate_ops.push(pruning_checkpoint.as_kv_store_op(PRUNING_CHECKPOINT_KEY));
313313

314-
// TODO(tree-states): What about the anchor_slot? Is it safe to run the prior version of
315-
// Lighthouse with an a higher anchor_slot than expected?
316-
314+
// Convert state summaries back to the old format.
317315
for (state_root, summary) in state_summaries_dag
318316
.summaries_by_slot_ascending()
319317
.into_iter()
320318
.flat_map(|(_, summaries)| summaries)
321319
{
322-
// If boundary state persist.
320+
// If boundary state: persist.
323321
// Do not cache these states as they are unlikely to be relevant later.
324322
let update_cache = false;
325323
if summary.slot % T::EthSpec::slots_per_epoch() == 0 {
326324
let (state, _) = db
327325
.load_hot_state(&state_root, update_cache)?
328326
.ok_or(Error::MissingState(state_root))?;
329327

330-
// Immediately commit the state. Otherwise we will OOM and it's stored in a different
331-
// column. So if the migration crashes we just get extra harmless junk in the DB.
328+
// Immediately commit the state, so we don't OOM. It's stored in a different
329+
// column so if the migration crashes we'll just store extra harmless junk in the DB.
332330
let mut state_write_ops = vec![];
333331
store_full_state_v22(&state_root, &state, &mut state_write_ops)?;
334332
db.hot_db.do_atomically(state_write_ops)?;
335333
states_written += 1;
336334
}
337335

338-
// Persist old summary
336+
// Persist old summary.
339337
let epoch_boundary_state_slot = summary.slot - summary.slot % T::EthSpec::slots_per_epoch();
340338
let old_summary = HotStateSummaryV22 {
341339
slot: summary.slot,

0 commit comments

Comments
 (0)