Connect up DB replay_blocks/load_blocks

This commit is contained in:
Michael Sproul
2026-02-23 15:43:19 +11:00
parent a959c5f640
commit afc6fb137c
6 changed files with 99 additions and 27 deletions

View File

@@ -159,7 +159,8 @@ pub fn reset_fork_choice_to_finalization<E: EthSpec, Hot: ItemStore<E>, Cold: It
// Replay blocks from finalized checkpoint back to head.
// We do not replay attestations presently, relying on the absence of other blocks
// to guarantee `head_block_root` as the head.
let blocks = store
// TODO(gloas): this code doesn't work anyway, could just delete all of it
let (blocks, _envelopes) = store
.load_blocks_to_replay(finalized_slot + 1, head_state.slot(), head_block_root)
.map_err(|e| format!("Error loading blocks to replay for fork choice: {:?}", e))?;

View File

@@ -688,7 +688,7 @@ async fn block_replayer_hooks() {
.add_attested_blocks_at_slots(state.clone(), state_root, &block_slots, &all_validators)
.await;
let blocks = store
let (blocks, envelopes) = store
.load_blocks_to_replay(Slot::new(0), max_slot, end_block_root.into())
.unwrap();
@@ -697,7 +697,6 @@ async fn block_replayer_hooks() {
let mut pre_block_slots = vec![];
let mut post_block_slots = vec![];
// TODO(gloas): handle payloads?
let mut replay_state = BlockReplayer::<MinimalEthSpec>::new(state, &chain.spec)
.pre_slot_hook(Box::new(|_, state| {
pre_slots.push(state.slot());
@@ -725,7 +724,7 @@ async fn block_replayer_hooks() {
post_block_slots.push(block.slot());
Ok(())
}))
.apply_blocks(blocks, vec![], None)
.apply_blocks(blocks, envelopes, None)
.unwrap()
.into_state();