Skip to content

Instantly share code, notes, and snippets.

@AshwinSekar
Created October 31, 2025 22:51
Show Gist options
  • Select an option

  • Save AshwinSekar/77007e4a352e261c5daf56d93e0e59cc to your computer and use it in GitHub Desktop.

Select an option

Save AshwinSekar/77007e4a352e261c5daf56d93e0e59cc to your computer and use it in GitHub Desktop.
if migration_status.is_ready_to_enable() && bank_forks.read().unwrap().is_bank_frozen(migration_status.genesis_block()) {
let genesis_bank = bank_forks.read().unwrap().get(migration_status.genesis_slot());
// Reset poh to the genesis block. This has to be done first before we can clear banks to
// avoid any inflight issues with transaction recording.
Self::reset_poh_recorder(
my_pubkey,
blockstore,
genesis_bank,
poh_controller,
leader_schedule_cache,
);
while poh_controller.has_pending_message() || shared_poh_bank.load().is_some() {
std::hint::spin_loop();
}
// Purge all slots greater than the genesis slot from AccountsDB & blockstore
let slots_to_purge: Vec<Slot> = bank_forks
.read()
.unwrap()
.banks()
.iter()
.filter_map(|(slot, _)| (*slot > genesis_slot).then_some(*slot))
.collect();
for slot in slots_to_purge.into_iter() {
warn!("{my_pubkey}: Purging poh block in slot {slot}");
Self::purge_unconfirmed_duplicate_slot(
slot,
ancestors,
descendants,
progress,
root_bank.as_ref(),
bank_forks,
blockstore,
migration_status,
);
}
// Purge any partial shreds greater than the genesis slot
let start_slot = genesis_slot + 1;
let end_slot = blockstore
.highest_slot()
.unwrap()
.expect("Highest slot must be present as blockstore is non-empty");
if end_slot >= start_slot {
warn!("{my_pubkey}: Purging shreds {start_slot} to {end_slot} from blockstore");
blockstore.purge_from_next_slots(start_slot, end_slot);
blockstore.purge_slots(start_slot, end_slot, PurgeType::Exact);
}
migration_status.enable_alpenglow();
assert!(migration_status.is_alpenglow_enabled());
datapoint_info!(
"migration-complete",
("one", 1, i64),
(
"migration_slot",
migration_status.migration_slot().unwrap() as i64,
i64
),
(
"genesis_slot",
migration_status.genesis_slot().unwrap() as i64,
i64
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment