mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
Small fixes relating to genesis
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)?
|
||||
|
||||
Reference in New Issue
Block a user