@@ -327,7 +327,7 @@ func TestEpochNotarizeTwiceThenFinalize(t *testing.T) {
327327 wal .assertNotarization (0 )
328328
329329 // Round 1
330- emptyNote := newEmptyNotarization (nodes , 1 , 0 )
330+ emptyNote := newEmptyNotarization (nodes , 1 )
331331 err = e .HandleMessage (& Message {
332332 EmptyNotarization : emptyNote ,
333333 }, nodes [1 ])
@@ -542,7 +542,7 @@ func advanceRoundFromEmpty(t *testing.T, e *Epoch) {
542542 leader := LeaderForRound (e .Comm .Nodes (), e .Metadata ().Round )
543543 require .False (t , e .ID .Equals (leader ), "epoch cannot be the leader for the empty round" )
544544
545- emptyNote := newEmptyNotarization (e .Comm .Nodes (), e .Metadata ().Round , e . Metadata (). Seq )
545+ emptyNote := newEmptyNotarization (e .Comm .Nodes (), e .Metadata ().Round )
546546 err := e .HandleMessage (& Message {
547547 EmptyNotarization : emptyNote ,
548548 }, leader )
@@ -943,9 +943,9 @@ func TestEpochQCSignedByNonExistentNodes(t *testing.T) {
943943
944944 err = e .HandleMessage (& Message {
945945 EmptyNotarization : & EmptyNotarization {
946- Vote : ToBeSignedEmptyVote {ProtocolMetadata : ProtocolMetadata {
946+ Vote : ToBeSignedEmptyVote {EmptyVoteMetadata : EmptyVoteMetadata {
947947 Round : 0 ,
948- Seq : 0 ,
948+ Epoch : 0 ,
949949 }},
950950 QC : qc ,
951951 },
@@ -963,9 +963,9 @@ func TestEpochQCSignedByNonExistentNodes(t *testing.T) {
963963
964964 err = e .HandleMessage (& Message {
965965 EmptyNotarization : & EmptyNotarization {
966- Vote : ToBeSignedEmptyVote {ProtocolMetadata : ProtocolMetadata {
966+ Vote : ToBeSignedEmptyVote {EmptyVoteMetadata : EmptyVoteMetadata {
967967 Round : 0 ,
968- Seq : 0 ,
968+ Epoch : 0 ,
969969 }},
970970 QC : qc ,
971971 },
@@ -998,86 +998,6 @@ func TestEpochQCSignedByNonExistentNodes(t *testing.T) {
998998 })
999999}
10001000
1001- func TestEpochDiscardEmptyVotesWithParent (t * testing.T ) {
1002- loggedMessages := make (chan string , 100 )
1003- l := testutil .MakeLogger (t , 1 )
1004- l .Intercept (func (entry zapcore.Entry ) error {
1005- loggedMessages <- entry .Message
1006- return nil
1007- })
1008- hasLogged := func (msg string ) bool {
1009- for len (loggedMessages ) > 0 {
1010- loggedMsg := <- loggedMessages
1011- if loggedMsg == msg {
1012- return true
1013- }
1014- }
1015- return false
1016- }
1017-
1018- bb := & testBlockBuilder {out : make (chan * testBlock , 1 )}
1019- storage := newInMemStorage ()
1020-
1021- nodes := []NodeID {{1 }, {2 }, {3 }, {4 }}
1022- conf := EpochConfig {
1023- MaxProposalWait : DefaultMaxProposalWaitTime ,
1024- Logger : l ,
1025- ID : nodes [0 ],
1026- Signer : & testSigner {},
1027- WAL : newTestWAL (t ),
1028- Verifier : & testVerifier {},
1029- Storage : storage ,
1030- Comm : noopComm (nodes ),
1031- BlockBuilder : bb ,
1032- SignatureAggregator : & testSignatureAggregator {},
1033- }
1034-
1035- e , err := NewEpoch (conf )
1036- require .NoError (t , err )
1037-
1038- require .NoError (t , e .Start ())
1039-
1040- vb , _ := notarizeAndFinalizeRound (t , e , bb )
1041- require .NotNil (t , vb )
1042-
1043- emptyBlockMd := e .Metadata ()
1044- emptyBlockMd .Seq --
1045-
1046- // Receive empty votes from all nodes, but with a parent set to the last block.
1047- // While this is not a real scenario but an artificial one, we are testing it to ensure that we do not
1048- // collect an empty notarization.
1049- for i := 1 ; i <= 3 ; i ++ {
1050- emptyVote := createEmptyVote (emptyBlockMd , nodes [i ])
1051- emptyVote .Vote .Prev = vb .BlockHeader ().Digest
1052-
1053- require .False (t , hasLogged ("Empty vote has a parent but should not have one" ))
1054-
1055- e .HandleMessage (& Message {
1056- EmptyVoteMessage : emptyVote ,
1057- }, nodes [i ])
1058-
1059- require .True (t , hasLogged ("Empty vote has a parent but should not have one" ))
1060- }
1061-
1062- emptyNotarization := newEmptyNotarization (nodes , emptyBlockMd .Round , emptyBlockMd .Seq )
1063- emptyNotarization .Vote .Prev = vb .BlockHeader ().Digest
1064-
1065- require .False (t , hasLogged ("Empty notarization vote has a parent but should not have one" ))
1066-
1067- e .HandleMessage (& Message {
1068- EmptyNotarization : emptyNotarization ,
1069- }, nodes [1 ])
1070-
1071- require .True (t , hasLogged ("Empty notarization vote has a parent but should not have one" ))
1072-
1073- vb , _ = notarizeAndFinalizeRound (t , e , bb )
1074- require .NotNil (t , vb )
1075-
1076- // Ensure the previous empty votes and empty notarization did not have any effect.
1077- require .Equal (t , uint64 (1 ), vb .BlockHeader ().Round )
1078-
1079- }
1080-
10811001func TestEpochBlockSentFromNonLeader (t * testing.T ) {
10821002 l := testutil .MakeLogger (t , 1 )
10831003 nonLeaderMessage := false
0 commit comments