mirror of
https://github.com/logos-storage/nim-mysticeti.git
synced 2026-01-04 06:33:11 +00:00
check that validators emit blocks in the same sequence
This commit is contained in:
parent
edc81ba568
commit
a4b1510663
@ -2,7 +2,7 @@ import ./basics
|
||||
import ./simulator
|
||||
|
||||
proc scenarioFigure4*(simulator: NetworkSimulator): ?!seq[seq[SignedBlock]] =
|
||||
# replays scenario from Figure 4 in the Mysticeti paper
|
||||
# replays scenario from figure 4 in the Mysticeti paper
|
||||
# https://arxiv.org/pdf/2310.14821v4
|
||||
# note: round robin is not applied correctly in the figure from
|
||||
# the Mysticeti paper, so this simulation uses different proposer
|
||||
@ -44,9 +44,9 @@ proc scenarioFigure4*(simulator: NetworkSimulator): ?!seq[seq[SignedBlock]] =
|
||||
})
|
||||
simulator.nextRound()
|
||||
proposals.add(? simulator.exchangeProposals {
|
||||
2: @[2, 3, 0],
|
||||
3: @[2, 3, 0],
|
||||
0: @[2, 3, 0]
|
||||
2: @[2, 3, 0, 1],
|
||||
3: @[2, 3, 0, 1],
|
||||
0: @[2, 3, 0, 1]
|
||||
|
||||
})
|
||||
success proposals
|
||||
|
||||
@ -270,11 +270,23 @@ suite "Validator Network":
|
||||
check toSeq(simulator.validators[0].committed()) == second
|
||||
|
||||
test "commits blocks using the indirect decision rule":
|
||||
let proposals = !scenarioFigure4(simulator)
|
||||
let proposals = !simulator.scenarioFigure4()
|
||||
let committed = toSeq(simulator.validators[0].committed())
|
||||
check committed.contains(proposals[0][3].blck)
|
||||
|
||||
test "skips blocks using the indirect decision rule":
|
||||
let proposals = !scenarioFigure4(simulator)
|
||||
let proposals = !simulator.scenarioFigure4()
|
||||
let committed = toSeq(simulator.validators[0].committed())
|
||||
check not committed.contains(proposals[0][1].blck)
|
||||
|
||||
test "all validators emit blocks in the same sequence":
|
||||
let proposals = !simulator.scenarioFigure4()
|
||||
# commit sequence from appendix A of the Mysticeti paper:
|
||||
let expected = @[
|
||||
proposals[0][0].blck,
|
||||
proposals[0][2].blck,
|
||||
proposals[0][3].blck,
|
||||
proposals[1][1].blck
|
||||
]
|
||||
for validator in simulator.validators:
|
||||
check toSeq(validator.committed()) == expected
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user