Skip to content

Commit 9b46ba5

Browse files
committed
test(mbt): Reset timeout events after a failure
Once the node crashes or restarts, it should have no knowledge of past timeouts that occurred. We missed this detail in the original specification. This patch makes sure to reset local events for the failing node.
1 parent 542662e commit 9b46ba5

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

specs/emerald.qnt

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -593,35 +593,31 @@ module emerald {
593593
}
594594
}
595595
| RecordAction(action_taken) =>
596-
val ext = {
596+
val ext0 = {
597597
...ctx.extensions,
598598
action_taken: action_taken
599599
}
600-
601-
val ext0 = match action_taken {
600+
match action_taken {
602601
| Failure(args) =>
603602
val { node, height, mode } = args
604603
val s = ctx.system.get(node)
605604
{
606-
...ext,
607-
failures: ext.failures.setAdd(args),
608-
// Note that during a node crash, the node loses track of its
609-
// last decided height and restarts from genesis.
610-
last_decided_height:
611-
if (mode == NodeCrash)
612-
ext.last_decided_height.put(node, 0)
613-
else
614-
ext.last_decided_height
605+
...ctx,
606+
extensions: {
607+
...ext0,
608+
failures: ext0.failures.setAdd(args),
609+
// Note that during a node crash, the node loses track of its
610+
// last decided height and restarts from genesis.
611+
last_decided_height:
612+
if (mode == NodeCrash) ext0.last_decided_height.put(node, 0)
613+
else ext0.last_decided_height
614+
},
615+
// Note that after a crash/restart the node loses its timeouts.
616+
events:
617+
if (mode != ConsensusTimeout) ctx.events.put(node, Set())
618+
else ctx.events
615619
}
616-
| _ => ext
617-
}
618-
619-
{
620-
...ctx,
621-
extensions: {
622-
...ext0,
623-
action_taken: action_taken
624-
}
620+
| _ => { ...ctx, extensions: ext0 }
625621
}
626622
}
627623
}

0 commit comments

Comments
 (0)