mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +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(),
|
!blocks_pending.is_empty(),
|
||||||
"should have blocks for pending replay"
|
"should have blocks for pending replay"
|
||||||
);
|
);
|
||||||
// For Pending, no envelope for the last block; envelopes for intermediate blocks
|
// For Pending, no envelope for the first block (slot 0) or last block; envelopes for
|
||||||
// whose payloads are canonical.
|
// intermediate blocks whose payloads are canonical.
|
||||||
let expected_pending_envelopes = blocks_pending.len().saturating_sub(1);
|
let expected_pending_envelopes = blocks_pending.len().saturating_sub(2);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
envelopes_pending.len(),
|
envelopes_pending.len(),
|
||||||
expected_pending_envelopes,
|
expected_pending_envelopes,
|
||||||
"pending replay should have envelopes for all blocks except the last"
|
"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).
|
// Load blocks for Full replay (envelopes for all blocks including the last).
|
||||||
let (blocks_full, envelopes_full) = store
|
let (blocks_full, envelopes_full) = store
|
||||||
|
|||||||
@@ -320,8 +320,8 @@ where
|
|||||||
.block_hash;
|
.block_hash;
|
||||||
|
|
||||||
// Similar to `is_parent_block_full`, but reading the block hash from the
|
// Similar to `is_parent_block_full`, but reading the block hash from the
|
||||||
// not-yet-applied `block`.
|
// not-yet-applied `block`. The 0x0 case covers genesis (no block replay reqd).
|
||||||
if block.is_parent_block_full(latest_bid_block_hash) {
|
if self.state.slot() != 0 && block.is_parent_block_full(latest_bid_block_hash) {
|
||||||
let envelope = next_envelope_at_slot(self.state.slot())?;
|
let envelope = next_envelope_at_slot(self.state.slot())?;
|
||||||
// State root for the next slot processing is now the envelope's state root.
|
// State root for the next slot processing is now the envelope's state root.
|
||||||
self.apply_payload_envelope(&envelope, state_root)?
|
self.apply_payload_envelope(&envelope, state_root)?
|
||||||
|
|||||||
Reference in New Issue
Block a user