summaryrefslogtreecommitdiff
path: root/agreement/player_permutation_test.go
blob: 2c598ff779021c791ca1d4af412e6d7dc266df17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
// Copyright (C) 2019-2023 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// go-algorand is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with go-algorand.  If not, see <https://www.gnu.org/licenses/>.

package agreement

import (
	"fmt"
	"testing"

	"github.com/stretchr/testify/require"

	"github.com/algorand/go-algorand/config"
	"github.com/algorand/go-algorand/crypto"
	"github.com/algorand/go-algorand/data/basics"
	"github.com/algorand/go-algorand/protocol"
	"github.com/algorand/go-algorand/test/partitiontest"
)

func makeRandomProposalPayload(r round) *proposal {
	f := testBlockFactory{Owner: 1}
	ve, _ := f.AssembleBlock(r)

	var payload unauthenticatedProposal
	payload.Block = ve.Block()
	payload.SeedProof = crypto.VRFProof{}

	return &proposal{unauthenticatedProposal: payload, ve: ve}
}

var errTestVerifyFailed = makeSerErrStr("test error")

type playerPermutation int

const (
	playerSameRound = iota
	playerNextRound
	playerPrevRoundPendingPayloadPresent
	playerSameRoundProcessedProposalVote
	playerSameRoundReachedSoftThreshold
	playerSameRoundReachedCertThreshold
	playerSameRoundProcessedProposal
)

func getPlayerPermutation(t *testing.T, n int) (plyr *player, pMachine ioAutomata, helper *voteMakerHelper) {
	const r = round(209)
	const p = period(0)
	var payload = makeRandomProposalPayload(r)
	var pV = payload.value()
	switch n {
	case playerSameRound: // same round and period as proposal
		return setupP(t, r, p, soft)
	case playerNextRound: // one round ahead of proposal
		return setupP(t, r+1, p, soft)
	case playerPrevRoundPendingPayloadPresent:
		plyr, pMachine, helper = setupP(t, r-1, p, soft)
		plyr.Pending.push(&messageEvent{
			T: payloadPresent,
			Input: message{
				messageHandle:           "uniquemessage",
				UnauthenticatedProposal: payload.u(),
			},
		})
	case playerSameRoundProcessedProposalVote: // already processed proposal vote
		plyr, pMachine, helper = setupP(t, r, p, soft)
		pM := pMachine.(*ioAutomataConcretePlayer)
		pM.update(*plyr, r, true)
		pM.Children[r].ProposalStore.Assemblers = make(map[proposalValue]blockAssembler)
		pM.Children[r].ProposalStore.Assemblers[pV] = blockAssembler{}
		pM.Children[r].update(*plyr, p, true)
		pM.Children[r].Children[p].ProposalTracker.Duplicate = make(map[basics.Address]bool)
		helper.addresses[0] = basics.Address(randomBlockHash())
		pM.Children[r].Children[p].ProposalTracker.Duplicate[helper.addresses[0]] = true
		pM.Children[r].Children[p].ProposalTrackerContract.SawOneVote = true
		pM.Children[r].Children[p].update(0)
	case playerSameRoundReachedSoftThreshold: // already reached soft threshold
		plyr, pMachine, helper = setupP(t, r, p, soft)
		pM := pMachine.(*ioAutomataConcretePlayer)
		pM.update(*plyr, r, true)
		pM.Children[r].ProposalStore.Assemblers = make(map[proposalValue]blockAssembler)
		pM.Children[r].ProposalStore.Assemblers[pV] = blockAssembler{}
		pM.Children[r].update(*plyr, p, true)
		pM.Children[r].Children[p].ProposalTracker.Duplicate = make(map[basics.Address]bool)
		helper.addresses[0] = basics.Address(randomBlockHash())
		pM.Children[r].Children[p].ProposalTracker.Duplicate[helper.addresses[0]] = true
		pM.Children[r].Children[p].ProposalTracker.Staging = pV
		pM.Children[r].Children[p].ProposalTrackerContract.SawOneVote = true
		pM.Children[r].Children[p].update(0)
	case playerSameRoundReachedCertThreshold: // already reached cert threshold
		plyr, pMachine, helper = setupP(t, r, p, soft)
		pM := pMachine.(*ioAutomataConcretePlayer)
		pM.update(*plyr, r, true)
		pM.Children[r].ProposalStore.Assemblers = make(map[proposalValue]blockAssembler)
		pM.Children[r].ProposalStore.Assemblers[pV] = blockAssembler{}
		pM.Children[r].VoteTrackerRound.Freshest = thresholdEvent{T: certThreshold, Proposal: pV, Round: r, Period: p, Bundle: unauthenticatedBundle{Round: r}}
		pM.Children[r].VoteTrackerRound.Ok = true
		pM.Children[r].update(*plyr, p, true)
		pM.Children[r].Children[p].ProposalTracker.Duplicate = make(map[basics.Address]bool)
		helper.addresses[0] = basics.Address(randomBlockHash())
		pM.Children[r].Children[p].ProposalTracker.Duplicate[helper.addresses[0]] = true
		pM.Children[r].Children[p].ProposalTracker.Staging = pV
		pM.Children[r].Children[p].ProposalTrackerContract.SawOneVote = true
		pM.Children[r].Children[p].update(0)
	case playerSameRoundProcessedProposal: // already processed proposal
		plyr, pMachine, helper = setupP(t, r, p, soft)
		pM := pMachine.(*ioAutomataConcretePlayer)
		pM.update(*plyr, r, true)
		pM.Children[r].ProposalStore.Assemblers = make(map[proposalValue]blockAssembler)
		pM.Children[r].ProposalStore.Assemblers[pV] = blockAssembler{Assembled: true, Payload: *payload}
		pM.Children[r].update(*plyr, p, true)
		pM.Children[r].Children[p].ProposalTracker.Duplicate = make(map[basics.Address]bool)
		helper.addresses[0] = basics.Address(randomBlockHash())
		pM.Children[r].Children[p].ProposalTracker.Duplicate[helper.addresses[0]] = true
		pM.Children[r].Children[p].ProposalTrackerContract.SawOneVote = true
		pM.Children[r].Children[p].update(0)
	default:
		require.Fail(t, "player permutation %v does not exist", n)
	}
	return
}

type messageEventPermutation int

const (
	softVoteVerifiedEventSamePeriod = iota
	softVotePresentEventSamePeriod
	proposeVoteVerifiedEventNextPeriod
	proposeVoteVerifiedEventSamePeriod
	proposeVotePresentEventSamePeriod
	payloadPresentEvent
	payloadVerifiedEvent
	payloadVerifiedEventNoMessageHandle
	bundleVerifiedEventSamePeriod
	bundlePresentEventSamePeriod
	softVoteVerifiedErrorEventSamePeriod
	proposeVoteVerifiedErrorEventSamePeriod
	bundleVerifiedErrorEvent
	payloadVerifiedErrorEvent
)

func getMessageEventPermutation(t *testing.T, n int, helper *voteMakerHelper) (e messageEvent) {
	const r = round(209)
	const p = period(0)
	var payload = makeRandomProposalPayload(r)
	var pV = payload.value()
	switch n {
	case softVoteVerifiedEventSamePeriod:
		vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
		e = messageEvent{
			T: voteVerified,
			Input: message{
				messageHandle:       "uniquemessage",
				Vote:                vvote,
				UnauthenticatedVote: vvote.u(),
			},
			Proto: ConsensusVersionView{Version: protocol.ConsensusCurrentVersion},
		}
	case softVotePresentEventSamePeriod:
		vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
		e = messageEvent{
			T: votePresent,
			Input: message{
				messageHandle:       "uniquemessage",
				UnauthenticatedVote: vvote.u(),
			},
			Proto: ConsensusVersionView{Version: protocol.ConsensusCurrentVersion},
		}
	case proposeVoteVerifiedEventNextPeriod:
		vvote := helper.MakeVerifiedVote(t, 0, r, p+1, propose, pV)
		e = messageEvent{
			T: voteVerified,
			Input: message{
				messageHandle:       "uniquemessage",
				Vote:                vvote,
				UnauthenticatedVote: vvote.u(),
			},
			Proto: ConsensusVersionView{Version: protocol.ConsensusCurrentVersion},
		}
	case proposeVoteVerifiedEventSamePeriod:
		vvote := helper.MakeVerifiedVote(t, 0, r, p, propose, pV)
		e = messageEvent{
			T: voteVerified,
			Input: message{
				messageHandle:       "uniquemessage",
				Vote:                vvote,
				UnauthenticatedVote: vvote.u(),
			},
			TaskIndex: 1,
			Proto:     ConsensusVersionView{Version: protocol.ConsensusCurrentVersion},
		}
	case proposeVotePresentEventSamePeriod:
		vvote := helper.MakeVerifiedVote(t, 0, r, p, propose, pV)
		e = messageEvent{
			T: votePresent,
			Input: message{
				messageHandle:       "uniquemessage",
				UnauthenticatedVote: vvote.u(),
			},
			Proto: ConsensusVersionView{Version: protocol.ConsensusCurrentVersion},
		}
	case payloadPresentEvent:
		e = messageEvent{
			T: payloadPresent,
			Input: message{
				messageHandle:           "uniquemessage",
				UnauthenticatedProposal: payload.u(),
			},
		}
	case payloadVerifiedEvent:
		e = messageEvent{
			T: payloadVerified,
			Input: message{
				messageHandle:           "uniquemessage",
				UnauthenticatedProposal: payload.u(),
				Proposal:                *payload,
			},
		}
	case payloadVerifiedEventNoMessageHandle:
		e = messageEvent{
			T: payloadVerified,
			Input: message{
				UnauthenticatedProposal: payload.u(),
				Proposal:                *payload,
			},
		}
	case bundleVerifiedEventSamePeriod:
		votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
		for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
			votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
		}
		bun := unauthenticatedBundle{
			Round:    r,
			Period:   p,
			Proposal: pV,
		}
		e = messageEvent{
			T: bundleVerified,
			Input: message{
				Bundle: bundle{
					U:     bun,
					Votes: votes,
				},
				UnauthenticatedBundle: bun,
			},
			Proto: ConsensusVersionView{Version: protocol.ConsensusCurrentVersion},
		}
	case bundlePresentEventSamePeriod:
		votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
		for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
			votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
		}
		bun := unauthenticatedBundle{
			Round:    r,
			Period:   p,
			Step:     cert,
			Proposal: pV,
		}
		e = messageEvent{
			T: bundlePresent,
			Input: message{
				UnauthenticatedBundle: bun,
			},
			Proto: ConsensusVersionView{Version: protocol.ConsensusCurrentVersion},
		}
	case softVoteVerifiedErrorEventSamePeriod:
		vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
		e = messageEvent{
			T: voteVerified,
			Input: message{
				messageHandle:       "uniquemessage",
				Vote:                vvote,
				UnauthenticatedVote: vvote.u(),
			},
			Err:   errTestVerifyFailed,
			Proto: ConsensusVersionView{Version: protocol.ConsensusCurrentVersion},
		}
	case proposeVoteVerifiedErrorEventSamePeriod:
		vvote := helper.MakeVerifiedVote(t, 0, r, p, propose, pV)
		e = messageEvent{
			T: voteVerified,
			Input: message{
				messageHandle:       "uniquemessage",
				Vote:                vvote,
				UnauthenticatedVote: vvote.u(),
			},
			Err:   errTestVerifyFailed,
			Proto: ConsensusVersionView{Version: protocol.ConsensusCurrentVersion},
		}
	case bundleVerifiedErrorEvent:
		e = messageEvent{
			T: bundleVerified,
			Input: message{
				Bundle:                bundle{},
				UnauthenticatedBundle: unauthenticatedBundle{},
				messageHandle:         "uniquemalformedBundle",
			},
			Err: errTestVerifyFailed,
		}
	case payloadVerifiedErrorEvent:
		e = messageEvent{
			T: payloadVerified,
			Input: message{
				UnauthenticatedProposal: payload.u(),
				Proposal:                *payload,
			},
			Err: errTestVerifyFailed,
		}
	default:
		require.Fail(t, "messageEvent permutation %v does not exist", n)
	}
	return
}

func expectIgnore(t *testing.T, trace ioTrace, errMsg string, playerN int, eventN int) {
	require.Truef(t, trace.ContainsFn(func(b event) bool {
		if b.t() != wrappedAction {
			return false
		}
		wrapper := b.(wrappedActionEvent)
		if wrapper.action.t() != ignore {
			return false
		}
		act := wrapper.action.(networkAction)
		if act.T == ignore && act.Err != nil {
			return true
		}
		return false
	}), errMsg, playerN, eventN)
}

func expectRelay(t *testing.T, trace ioTrace, errMsg string, playerN int, eventN int) {
	require.Truef(t, trace.ContainsFn(func(b event) bool {
		if b.t() != wrappedAction {
			return false
		}

		wrapper := b.(wrappedActionEvent)
		if wrapper.action.t() != relay {
			return false
		}
		act := wrapper.action.(networkAction)
		if act.T == relay && act.Err == nil {
			return true
		}
		return false
	}), errMsg, playerN, eventN)
}

func expectDisconnect(t *testing.T, trace ioTrace, errMsg string, playerN int, eventN int) {
	require.Truef(t, trace.ContainsFn(func(b event) bool {
		if b.t() != wrappedAction {
			return false
		}
		wrapper := b.(wrappedActionEvent)
		if wrapper.action.t() != disconnect {
			return false
		}
		act := wrapper.action.(networkAction)
		if act.T == disconnect && act.Err != nil {
			return true
		}
		return false
	}), errMsg, playerN, eventN)
}

func expectVerify(t *testing.T, trace ioTrace, errMsg string, playerN int, eventN int) {
	require.Truef(t, trace.ContainsFn(func(b event) bool {
		if b.t() != wrappedAction {
			return false
		}

		wrapper := b.(wrappedActionEvent)
		if wrapper.action.t() != verifyVote {
			return false
		}
		act := wrapper.action.(cryptoAction)
		if act.T == verifyVote {
			return true
		}
		return false
	}), errMsg, playerN, eventN)
}

func requireActionCount(t *testing.T, trace ioTrace, expectedCount, playerN, eventN int) {
	require.Equalf(t, trace.countAction(), expectedCount, "Player should not emit extra actions, player: %v, event: %v", playerN, eventN)
}

func requireTraceContains(t *testing.T, trace ioTrace, expected event, playerN, eventN int) {
	if !trace.Contains(expected) {
		t.Log("expected:", expected.ComparableStr())
		t.Log("trace:", trace.String())
	}
	require.Truef(t, trace.Contains(expected), "Player should emit action, player: %v, event: %v", playerN, eventN)
}

func verifyPermutationExpectedActions(t *testing.T, playerN int, eventN int, helper *voteMakerHelper, trace ioTrace, dynamicFilterTimeoutEnabled bool) {
	const r = round(209)
	const p = period(0)
	var payload = makeRandomProposalPayload(r)
	var pV = payload.value()
	switch playerN {
	case playerSameRound:
		switch eventN {
		case softVoteVerifiedEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case softVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := verifyVoteAction(messageEvent{Input: message{UnauthenticatedVote: vvote.u()}}, r, p, 0)
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventNextPeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p+1, propose, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, propose, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, propose, pV)
			a := verifyVoteAction(messageEvent{Input: message{UnauthenticatedVote: vvote.u()}}, r, p, 1)
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case payloadPresentEvent, payloadVerifiedEvent, payloadVerifiedEventNoMessageHandle:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore proposal with no vvote, player: %v, event: %v", playerN, eventN)
		case bundleVerifiedEventSamePeriod:
			requireActionCount(t, trace, 2, playerN, eventN)
			votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
			for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
				votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
			}
			bun := unauthenticatedBundle{Round: r, Period: p, Proposal: pV}
			ra := networkAction{T: relay, Tag: protocol.VoteBundleTag, UnauthenticatedBundle: bun}
			requireTraceContains(t, trace, ev(ra), playerN, eventN)
			sa := stageDigestAction{Certificate: Certificate(bun)}
			requireTraceContains(t, trace, ev(sa), playerN, eventN)
		case bundlePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
			for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
				votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
			}
			bun := unauthenticatedBundle{Round: r, Period: p, Step: cert, Proposal: pV}
			ca := verifyBundleAction(messageEvent{Input: message{Bundle: bundle{U: bun, Votes: votes}, UnauthenticatedBundle: bun}}, r, p, cert)
			requireTraceContains(t, trace, ev(ca), playerN, eventN)
		case softVoteVerifiedErrorEventSamePeriod, proposeVoteVerifiedErrorEventSamePeriod, bundleVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectDisconnect(t, trace, "Player should disconnect malformed vote/bundle, player: %v, event: %v", playerN, eventN)
		case payloadVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore malformed proposal, player: %v, event: %v", playerN, eventN)
		default:
			require.Fail(t, "event permutation %v does not exist", eventN)
		}
	case playerNextRound:
		switch eventN {
		case proposeVoteVerifiedEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			// This case should never happen -- player is on R+1 and the voteVerified event is for R.
			// Player will not queue up a verifyVoteAction for this vote (without DynamicFilterTimeout enabled).
			// We are asserting the relay behavior player currently implements, but it is not possible given current
			// code -- you would have filtered the votePresent for this vote.
			if dynamicFilterTimeoutEnabled && p == 0 {
				expectRelay(t, trace, "Player should relay period 0 msg from past rounds, player: %v, event: %v", playerN, eventN)
			} else {
				expectIgnore(t, trace, "Player should ignore msg from past rounds, player: %v, event: %v", playerN, eventN)
			}
		case proposeVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			if dynamicFilterTimeoutEnabled && p == 0 {
				expectVerify(t, trace, "Player should verify period 0 msg from past rounds, player: %v, event: %v", playerN, eventN)
			} else {
				expectIgnore(t, trace, "Player should ignore msg from past rounds, player: %v, event: %v", playerN, eventN)
			}
		case softVoteVerifiedEventSamePeriod, softVotePresentEventSamePeriod, proposeVoteVerifiedEventNextPeriod, payloadPresentEvent, payloadVerifiedEvent, payloadVerifiedEventNoMessageHandle, bundleVerifiedEventSamePeriod, bundlePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore msg from past rounds, player: %v, event: %v", playerN, eventN)
		case softVoteVerifiedErrorEventSamePeriod, proposeVoteVerifiedErrorEventSamePeriod, bundleVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectDisconnect(t, trace, "Player should disconnect malformed vote/bundle, player: %v, event: %v", playerN, eventN)
		case payloadVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore malformed proposal, player: %v, event: %v", playerN, eventN)
		default:
			require.Fail(t, "event permutation %v does not exist", eventN)
		}
	case playerPrevRoundPendingPayloadPresent:
		switch eventN {
		case softVoteVerifiedEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case softVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := verifyVoteAction(messageEvent{Input: message{UnauthenticatedVote: vvote.u()}}, r, p, 0)
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventNextPeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore future msg from bad period, player: %v, event: %v", playerN, eventN)
		case proposeVoteVerifiedEventSamePeriod:
			requireActionCount(t, trace, 2, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, propose, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
			na := networkAction{T: relay, Tag: protocol.ProposalPayloadTag, CompoundMessage: compoundMessage{Proposal: payload.u()}}
			requireTraceContains(t, trace, ev(na), playerN, eventN)
		case proposeVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, propose, pV)
			a := verifyVoteAction(messageEvent{Input: message{UnauthenticatedVote: vvote.u()}, TaskIndex: 0}, r, p, 2)
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case payloadPresentEvent, payloadVerifiedEvent, payloadVerifiedEventNoMessageHandle:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore proposal with no vvote, player: %v, event: %v", playerN, eventN)
		case bundleVerifiedEventSamePeriod, bundlePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore bundle from different round, player: %v, event: %v", playerN, eventN)
		case softVoteVerifiedErrorEventSamePeriod, proposeVoteVerifiedErrorEventSamePeriod, bundleVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectDisconnect(t, trace, "Player should disconnect malformed vote/bundle, player: %v, event: %v", playerN, eventN)
		case payloadVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore malformed proposal, player: %v, event: %v", playerN, eventN)
		default:
			require.Fail(t, "event permutation %v does not exist", eventN)
		}
	case playerSameRoundProcessedProposalVote:
		switch eventN {
		case softVoteVerifiedEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case softVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := verifyVoteAction(messageEvent{Input: message{UnauthenticatedVote: vvote.u()}}, r, p, 0)
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventNextPeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p+1, propose, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventSamePeriod, proposeVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore proposalvvote already received: %v, event: %v", playerN, eventN)
		case payloadPresentEvent:
			requireActionCount(t, trace, 2, playerN, eventN)
			ca := verifyPayloadAction(messageEvent{Input: message{UnauthenticatedProposal: payload.u()}}, r, p, false)
			requireTraceContains(t, trace, ev(ca), playerN, eventN)
			na := networkAction{T: relay, Tag: protocol.ProposalPayloadTag, CompoundMessage: compoundMessage{Proposal: payload.u()}}
			requireTraceContains(t, trace, ev(na), playerN, eventN)
		case payloadVerifiedEvent:
			requireActionCount(t, trace, 0, playerN, eventN)
		case payloadVerifiedEventNoMessageHandle:
			requireActionCount(t, trace, 1, playerN, eventN)
			na := networkAction{T: relay, Tag: protocol.ProposalPayloadTag, CompoundMessage: compoundMessage{Proposal: payload.u()}}
			requireTraceContains(t, trace, ev(na), playerN, eventN)
		case bundleVerifiedEventSamePeriod:
			requireActionCount(t, trace, 2, playerN, eventN)
			votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
			for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
				votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
			}
			bun := unauthenticatedBundle{Round: r, Period: p, Proposal: pV}
			ra := networkAction{T: relay, Tag: protocol.VoteBundleTag, UnauthenticatedBundle: bun}
			requireTraceContains(t, trace, ev(ra), playerN, eventN)
			sa := stageDigestAction{Certificate: Certificate(bun)}
			requireTraceContains(t, trace, ev(sa), playerN, eventN)
		case bundlePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
			for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
				votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
			}
			bun := unauthenticatedBundle{Round: r, Period: p, Step: cert, Proposal: pV}
			ca := verifyBundleAction(messageEvent{Input: message{Bundle: bundle{U: bun, Votes: votes}, UnauthenticatedBundle: bun}}, r, p, cert)
			requireTraceContains(t, trace, ev(ca), playerN, eventN)
		case softVoteVerifiedErrorEventSamePeriod, proposeVoteVerifiedErrorEventSamePeriod, bundleVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectDisconnect(t, trace, "Player should disconnect malformed vote/bundle, player: %v, event: %v", playerN, eventN)
		case payloadVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore malformed proposal, player: %v, event: %v", playerN, eventN)

		default:
			require.Fail(t, "event permutation %v does not exist", eventN)
		}
	case playerSameRoundReachedSoftThreshold:
		switch eventN {
		case softVoteVerifiedEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case softVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := verifyVoteAction(messageEvent{Input: message{UnauthenticatedVote: vvote.u()}}, r, p, 0)
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventNextPeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p+1, propose, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventSamePeriod, proposeVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore proposalvvote already received: %v, event: %v", playerN, eventN)
		case payloadPresentEvent:
			requireActionCount(t, trace, 2, playerN, eventN)
			ca := verifyPayloadAction(messageEvent{Input: message{UnauthenticatedProposal: payload.u()}}, r, p, false)
			requireTraceContains(t, trace, ev(ca), playerN, eventN)
			na := networkAction{T: relay, Tag: protocol.ProposalPayloadTag, CompoundMessage: compoundMessage{Proposal: payload.u()}}
			requireTraceContains(t, trace, ev(na), playerN, eventN)
		case payloadVerifiedEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			pa := pseudonodeAction{T: attest, Round: r, Period: p, Step: cert, Proposal: pV}
			requireTraceContains(t, trace, ev(pa), playerN, eventN)
		case payloadVerifiedEventNoMessageHandle:
			requireActionCount(t, trace, 2, playerN, eventN)
			na := networkAction{T: relay, Tag: protocol.ProposalPayloadTag, CompoundMessage: compoundMessage{Proposal: payload.u()}}
			requireTraceContains(t, trace, ev(na), playerN, eventN)
			pa := pseudonodeAction{T: attest, Round: r, Period: p, Step: cert, Proposal: pV}
			requireTraceContains(t, trace, ev(pa), playerN, eventN)
		case bundleVerifiedEventSamePeriod:
			requireActionCount(t, trace, 2, playerN, eventN)
			votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
			for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
				votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
			}
			bun := unauthenticatedBundle{Round: r, Period: p, Proposal: pV}
			ra := networkAction{T: relay, Tag: protocol.VoteBundleTag, UnauthenticatedBundle: bun}
			requireTraceContains(t, trace, ev(ra), playerN, eventN)
			sa := stageDigestAction{Certificate: Certificate(bun)}
			requireTraceContains(t, trace, ev(sa), playerN, eventN)
		case bundlePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
			for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
				votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
			}
			bun := unauthenticatedBundle{Round: r, Period: p, Step: cert, Proposal: pV}
			ca := verifyBundleAction(messageEvent{Input: message{Bundle: bundle{U: bun, Votes: votes}, UnauthenticatedBundle: bun}}, r, p, cert)
			requireTraceContains(t, trace, ev(ca), playerN, eventN)
		case softVoteVerifiedErrorEventSamePeriod, proposeVoteVerifiedErrorEventSamePeriod, bundleVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectDisconnect(t, trace, "Player should disconnect malformed vote/bundle, player: %v, event: %v", playerN, eventN)
		case payloadVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore malformed proposal, player: %v, event: %v", playerN, eventN)

		default:
			require.Fail(t, "event permutation %v does not exist", eventN)
		}
	case playerSameRoundReachedCertThreshold:
		switch eventN {
		case softVoteVerifiedEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case softVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := verifyVoteAction(messageEvent{Input: message{UnauthenticatedVote: vvote.u()}}, r, p, 0)
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventNextPeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p+1, propose, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventSamePeriod, proposeVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore proposalvvote already received: %v, event: %v", playerN, eventN)
		case payloadPresentEvent:
			requireActionCount(t, trace, 2, playerN, eventN)
			ca := verifyPayloadAction(messageEvent{Input: message{UnauthenticatedProposal: payload.u()}}, r, p, false)
			requireTraceContains(t, trace, ev(ca), playerN, eventN)
			na := networkAction{T: relay, Tag: protocol.ProposalPayloadTag, CompoundMessage: compoundMessage{Proposal: payload.u()}}
			requireTraceContains(t, trace, ev(na), playerN, eventN)
		case payloadVerifiedEvent:
			requireActionCount(t, trace, 3, playerN, eventN)
			ea := ensureAction{Certificate: Certificate(unauthenticatedBundle{Round: r}), Payload: *payload}
			requireTraceContains(t, trace, ev(ea), playerN, eventN)
			ra := rezeroAction{Round: r + 1}
			requireTraceContains(t, trace, ev(ra), playerN, eventN)
			pa := pseudonodeAction{T: assemble, Round: r + 1, Period: 0, Step: 0}
			requireTraceContains(t, trace, ev(pa), playerN, eventN)
		case payloadVerifiedEventNoMessageHandle:
			requireActionCount(t, trace, 4, playerN, eventN)
			na := networkAction{T: relay, Tag: protocol.ProposalPayloadTag, CompoundMessage: compoundMessage{Proposal: payload.u()}}
			requireTraceContains(t, trace, ev(na), playerN, eventN)
			ea := ensureAction{Certificate: Certificate(unauthenticatedBundle{Round: r}), Payload: *payload}
			requireTraceContains(t, trace, ev(ea), playerN, eventN)
			ra := rezeroAction{Round: r + 1}
			requireTraceContains(t, trace, ev(ra), playerN, eventN)
			pa := pseudonodeAction{T: assemble, Round: r + 1, Period: 0, Step: 0}
			requireTraceContains(t, trace, ev(pa), playerN, eventN)
		case bundleVerifiedEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore, already hit thresh, player: %v, event: %v", playerN, eventN)
		case bundlePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
			for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
				votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
			}
			bun := unauthenticatedBundle{Round: r, Period: p, Step: cert, Proposal: pV}
			ca := verifyBundleAction(messageEvent{Input: message{Bundle: bundle{U: bun, Votes: votes}, UnauthenticatedBundle: bun}}, r, p, cert)
			requireTraceContains(t, trace, ev(ca), playerN, eventN)
		case softVoteVerifiedErrorEventSamePeriod, proposeVoteVerifiedErrorEventSamePeriod, bundleVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectDisconnect(t, trace, "Player should disconnect malformed vote/bundle, player: %v, event: %v", playerN, eventN)
		case payloadVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore malformed proposal, player: %v, event: %v", playerN, eventN)

		default:
			require.Fail(t, "event permutation %v does not exist", eventN)
		}
	case playerSameRoundProcessedProposal:
		switch eventN {
		case softVoteVerifiedEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := networkAction{T: relay, Tag: protocol.AgreementVoteTag, UnauthenticatedVote: vvote.u()}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case softVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p, soft, pV)
			a := verifyVoteAction(messageEvent{Input: message{UnauthenticatedVote: vvote.u()}}, r, p, 0)
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventNextPeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			vvote := helper.MakeVerifiedVote(t, 0, r, p+1, propose, pV)
			a := networkAction{T: broadcast, Tag: protocol.ProposalPayloadTag, CompoundMessage: compoundMessage{Proposal: payload.u(), Vote: vvote.u()}}
			requireTraceContains(t, trace, ev(a), playerN, eventN)
		case proposeVoteVerifiedEventSamePeriod, proposeVotePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore proposalvvote already received: %v, event: %v", playerN, eventN)
		case payloadPresentEvent, payloadVerifiedEvent, payloadVerifiedEventNoMessageHandle:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore proposal already assembled: %v, event: %v", playerN, eventN)
		case bundleVerifiedEventSamePeriod:
			requireActionCount(t, trace, 4, playerN, eventN)
			votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
			for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
				votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
			}
			bun := unauthenticatedBundle{Round: r, Period: p, Proposal: pV}
			na := networkAction{T: relay, Tag: protocol.VoteBundleTag, UnauthenticatedBundle: bun}
			requireTraceContains(t, trace, ev(na), playerN, eventN)
			ea := ensureAction{Certificate: Certificate(bun), Payload: *payload}
			requireTraceContains(t, trace, ev(ea), playerN, eventN)
			ra := rezeroAction{Round: r + 1}
			requireTraceContains(t, trace, ev(ra), playerN, eventN)
			pa := pseudonodeAction{T: assemble, Round: r + 1, Period: 0, Step: 0}
			requireTraceContains(t, trace, ev(pa), playerN, eventN)
		case bundlePresentEventSamePeriod:
			requireActionCount(t, trace, 1, playerN, eventN)
			votes := make([]vote, int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])))
			for i := 0; i < int(cert.threshold(config.Consensus[protocol.ConsensusCurrentVersion])); i++ {
				votes[i] = helper.MakeVerifiedVote(t, i, r, p, cert, pV)
			}
			bun := unauthenticatedBundle{Round: r, Period: p, Step: cert, Proposal: pV}
			ca := verifyBundleAction(messageEvent{Input: message{Bundle: bundle{U: bun, Votes: votes}, UnauthenticatedBundle: bun}}, r, p, cert)
			requireTraceContains(t, trace, ev(ca), playerN, eventN)
		case softVoteVerifiedErrorEventSamePeriod, proposeVoteVerifiedErrorEventSamePeriod, bundleVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectDisconnect(t, trace, "Player should disconnect malformed vote/bundle, player: %v, event: %v", playerN, eventN)
		case payloadVerifiedErrorEvent:
			requireActionCount(t, trace, 1, playerN, eventN)
			expectIgnore(t, trace, "Player should ignore malformed proposal, player: %v, event: %v", playerN, eventN)

		default:
			require.Fail(t, "event permutation %v does not exist", eventN)
		}
	default:
		require.Fail(t, "player permutation %v does not exist", playerN)
	}
	return
}

// Generates a set of player states, router states, and messageEvents and tests all permutations of them
func TestPlayerPermutation(t *testing.T) {
	partitiontest.PartitionTest(t)
	// check with current consensus params and with consensus params that
	// explicitly enable dynamic filter timeout
	playerPermutationCheck(t, false)
	playerPermutationCheck(t, true)
}

func playerPermutationCheck(t *testing.T, enableDynamicFilterTimeout bool) {
	// create a protocol where dynamic filter is set based on the enableDynamicFilterTimeout flag
	dynamicFilterOverriddenProtocol, _, configCleanup := overrideConfigWithDynamicFilterParam(enableDynamicFilterTimeout)
	defer configCleanup()

	for i := 0; i < 7; i++ {
		for j := 0; j < 14; j++ {
			_, pMachine, helper := getPlayerPermutation(t, i)
			inMsg := getMessageEventPermutation(t, j, helper)
			inMsg.Proto = ConsensusVersionView{Version: dynamicFilterOverriddenProtocol}

			err, panicErr := pMachine.transition(inMsg)
			fmt.Println(pMachine.getTrace().events)
			fmt.Println("")
			require.NoErrorf(t, err, "player: %v, event: %v", i, j)
			require.NoErrorf(t, panicErr, "player: %v, event: %v", i, j)

			verifyPermutationExpectedActions(t, i, j, helper, pMachine.getTrace(), enableDynamicFilterTimeout)
		}
	}
}