Skip to content

Commit

Permalink
Merge pull request #3120 from massalabs/correct_sequencer_cursor
Browse files Browse the repository at this point in the history
Debug sequencer
  • Loading branch information
damip authored Oct 5, 2022
2 parents acede28 + 4ffc3d1 commit ffa2c23
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions massa-execution-worker/src/slot_sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ impl SlotSequencer {
return (prev_slot_info, false);
}

// There is a new blockclique: check whether new slot content matches the old one
// There is a new blockclique: check whether the new slot content matches the old one
if new_blockclique_block.as_ref() == prev_slot_info.get_block_id() {
// Contents match => simply return the old slot state
return (prev_slot_info, false);
Expand All @@ -473,6 +473,10 @@ impl SlotSequencer {

// Check if the new slot is CSS-final.
if new_css_final {
// The slot was absent (or considered a miss) before.
// So, if there is a new block there, consider that it caused a mismatch at this slot.
let mismatch = new_css_final_block.is_some();

// Generate the new CSS-final slot state.
let slot_info = SlotInfo {
slot,
Expand All @@ -491,11 +495,15 @@ impl SlotSequencer {
};

// Return the newly created CSS-final slot.
return (slot_info, false);
return (slot_info, mismatch);
}

// Here we know that the slot was absent from the old sequence and that it is not CSS-final.

// The slot was absent (or considered a miss) before.
// So, if there is a new block there, consider that it caused a mismatch at this slot.
let mismatch = new_blockclique_block.is_some();

// Generate a new speculative slot state for that slot.
let slot_info = SlotInfo {
slot,
Expand All @@ -512,7 +520,7 @@ impl SlotSequencer {
};

// Return the newly created speculative slot state.
(slot_info, false)
(slot_info, mismatch)
}

/// Get the index of a slot in the sequence, if present, otherwise None
Expand Down

0 comments on commit ffa2c23

Please sign in to comment.