Skip to content

Commit

Permalink
Add comment explain in execution
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-zinger committed Feb 15, 2022
1 parent 2604975 commit 2156f2b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion massa-execution/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,29 @@ impl VM {
/// See https://github.com/massalabs/massa/wiki/vm_ledger_interaction
///
/// Truncate the history by the number of slots between last added step in
/// `step_history` and the `step` in parameter. (todo: explain why)
/// `step_history` and the `step` in parameter. (See Optimization)
///
/// Call the internal `run_step_internal()` and push the `StepHistoryItem`
/// into `self.step_history`.
///
/// # Optimization
/// `step_history` contains the execution results of CONSECUTIVE active
/// slots that have been executed (front = oldest, back = most recent).
/// Therefore, if the VM gets a new active step (slot) to execute, and that
/// slot number breaks the slot-sorting of step_history when pushed back,
/// it means that there was a history rewrite (eg. clique change) and the
/// step_history needs to be truncated just before the incoming slot before
/// executing it and appending its result to step_history.
///
/// ```ascii
/// s1 s4
/// \ \
/// s2 s5
/// \ \ <--- input `step` to run is s6 so we can truncate 's7'
/// \ \
/// s3 s7
/// ```
///
/// # Parameters
/// * step: execution step to run
pub(crate) fn run_active_step(&mut self, step: ExecutionStep) {
Expand Down

0 comments on commit 2156f2b

Please sign in to comment.