diff --git a/beacon_node/beacon_chain/tests/store_tests.rs b/beacon_node/beacon_chain/tests/store_tests.rs index 8e10f0e85f..2c8db586b0 100644 --- a/beacon_node/beacon_chain/tests/store_tests.rs +++ b/beacon_node/beacon_chain/tests/store_tests.rs @@ -5671,14 +5671,25 @@ async fn test_gloas_block_replay_with_envelopes() { !blocks_pending.is_empty(), "should have blocks for pending replay" ); - // For Pending, no envelope for the last block; envelopes for intermediate blocks - // whose payloads are canonical. - let expected_pending_envelopes = blocks_pending.len().saturating_sub(1); + // For Pending, no envelope for the first block (slot 0) or last block; envelopes for + // intermediate blocks whose payloads are canonical. + let expected_pending_envelopes = blocks_pending.len().saturating_sub(2); assert_eq!( envelopes_pending.len(), expected_pending_envelopes, "pending replay should have envelopes for all blocks except the last" ); + assert!( + blocks_pending + .iter() + .skip(1) + .take(envelopes_pending.len()) + .map(|block| block.slot()) + .eq(envelopes_pending + .iter() + .map(|envelope| envelope.message.slot)), + "block and envelope slots should match" + ); // Load blocks for Full replay (envelopes for all blocks including the last). let (blocks_full, envelopes_full) = store diff --git a/consensus/state_processing/src/block_replayer.rs b/consensus/state_processing/src/block_replayer.rs index 22096293af..313a20da46 100644 --- a/consensus/state_processing/src/block_replayer.rs +++ b/consensus/state_processing/src/block_replayer.rs @@ -320,8 +320,8 @@ where .block_hash; // Similar to `is_parent_block_full`, but reading the block hash from the - // not-yet-applied `block`. - if block.is_parent_block_full(latest_bid_block_hash) { + // not-yet-applied `block`. The 0x0 case covers genesis (no block replay reqd). + if self.state.slot() != 0 && block.is_parent_block_full(latest_bid_block_hash) { let envelope = next_envelope_at_slot(self.state.slot())?; // State root for the next slot processing is now the envelope's state root. self.apply_payload_envelope(&envelope, state_root)?