@@ -32,6 +32,43 @@ func TestProposalAndPolkaCurrent(t *testing.T) {
3232 assertState (t , stateMachine , types .Height (0 ), types .Round (0 ), types .StepPrecommit )
3333 })
3434
35+ t .Run ("Line 36: lock and broadcast precommit when step is precommit" , func (t * testing.T ) {
36+ stateMachine := setupStateMachine (t , 4 , 3 )
37+ currentRound := newTestRound (t , stateMachine , 0 , 0 )
38+ nextRound := newTestRound (t , stateMachine , 1 , 0 )
39+
40+ committedValue := value (42 )
41+
42+ // Initialise the round
43+ currentRound .start ()
44+
45+ // Proposal timeout
46+ currentRound .processTimeout (types .StepPropose ).expectActions (
47+ currentRound .action ().broadcastPrevote (nil ),
48+ )
49+
50+ // Prevotes are collected
51+ currentRound .validator (1 ).prevote (& committedValue ).expectActions ()
52+ currentRound .validator (2 ).prevote (& committedValue ).expectActions (
53+ currentRound .action ().scheduleTimeout (types .StepPrevote ),
54+ )
55+ currentRound .processTimeout (types .StepPrevote ).expectActions (
56+ currentRound .action ().broadcastPrecommit (nil ),
57+ )
58+ currentRound .validator (0 ).prevote (& committedValue ).expectActions ()
59+
60+ // Receives precommits, this rule shouldn't block the commit value rule
61+ currentRound .validator (1 ).precommit (& committedValue )
62+ currentRound .validator (2 ).precommit (& committedValue )
63+ currentRound .validator (0 ).precommit (& committedValue )
64+ currentRound .validator (0 ).proposal (committedValue , - 1 ).expectActions (
65+ currentRound .action ().commit (committedValue , - 1 , 0 ),
66+ nextRound .action ().scheduleTimeout (types .StepPropose ),
67+ )
68+
69+ assertState (t , stateMachine , types .Height (1 ), types .Round (0 ), types .StepPropose )
70+ })
71+
3572 t .Run ("Line 36: record valid value even if we don't prevote it" , func (t * testing.T ) {
3673 stateMachine := setupStateMachine (t , 4 , 1 )
3774 currentRound := newTestRound (t , stateMachine , 0 , 0 )
0 commit comments