aboutsummaryrefslogtreecommitdiffstats
path: root/integration_test/round-event_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integration_test/round-event_test.go')
-rw-r--r--integration_test/round-event_test.go32
1 files changed, 19 insertions, 13 deletions
diff --git a/integration_test/round-event_test.go b/integration_test/round-event_test.go
index 8201bfe..9bdce7a 100644
--- a/integration_test/round-event_test.go
+++ b/integration_test/round-event_test.go
@@ -71,13 +71,16 @@ func (s *RoundEventTestSuite) prepareGov() *test.Governance {
return gov
}
-func (s *RoundEventTestSuite) proposeMPK(gov *test.Governance, round uint64,
+func (s *RoundEventTestSuite) proposeMPK(
+ gov *test.Governance,
+ round, reset uint64,
count int) {
for idx, pubKey := range s.pubKeys[:count] {
_, pubShare := dkg.NewPrivateKeyShares(utils.GetDKGThreshold(
gov.Configuration(round)))
mpk := &typesDKG.MasterPublicKey{
Round: round,
+ Reset: reset,
DKGID: typesDKG.NewID(types.NewNodeID(pubKey)),
PublicKeyShares: *pubShare,
}
@@ -86,12 +89,15 @@ func (s *RoundEventTestSuite) proposeMPK(gov *test.Governance, round uint64,
}
}
-func (s *RoundEventTestSuite) proposeFinalize(gov *test.Governance,
- round uint64, count int) {
+func (s *RoundEventTestSuite) proposeFinalize(
+ gov *test.Governance,
+ round, reset uint64,
+ count int) {
for idx, pubKey := range s.pubKeys[:count] {
final := &typesDKG.Finalize{
ProposerID: types.NewNodeID(pubKey),
Round: round,
+ Reset: reset,
}
s.Require().NoError(s.signers[idx].SignDKGFinalize(final))
gov.AddDKGFinalize(round, final)
@@ -128,8 +134,8 @@ func (s *RoundEventTestSuite) TestFromRound0() {
// Reset round#1 twice, then make it ready.
gov.ResetDKG([]byte("DKG round 1 reset 1"))
gov.ResetDKG([]byte("DKG round 1 reset 2"))
- s.proposeMPK(gov, 1, 3)
- s.proposeFinalize(gov, 1, 3)
+ s.proposeMPK(gov, 1, 2, 3)
+ s.proposeFinalize(gov, 1, 2, 3)
rEvt.ValidateNextRound(80)
// Check collected events.
s.Require().Len(evts, 3)
@@ -150,17 +156,17 @@ func (s *RoundEventTestSuite) TestFromRoundN() {
// Reset round#20 twice, then make it done DKG preparation.
gov.ResetDKG(getCRS(20, 1))
gov.ResetDKG(getCRS(20, 2))
- s.proposeMPK(gov, 20, 3)
- s.proposeFinalize(gov, 20, 3)
+ s.proposeMPK(gov, 20, 2, 3)
+ s.proposeFinalize(gov, 20, 2, 3)
s.Require().Equal(gov.DKGResetCount(20), uint64(2))
// Propose CRS for round#21, and it works without reset.
gov.ProposeCRS(21, getCRS(21, 0))
- s.proposeMPK(gov, 21, 3)
- s.proposeFinalize(gov, 21, 3)
+ s.proposeMPK(gov, 21, 0, 3)
+ s.proposeFinalize(gov, 21, 0, 3)
// Propose CRS for round#22, and it works without reset.
gov.ProposeCRS(22, getCRS(22, 0))
- s.proposeMPK(gov, 22, 3)
- s.proposeFinalize(gov, 22, 3)
+ s.proposeMPK(gov, 22, 0, 3)
+ s.proposeFinalize(gov, 22, 0, 3)
// Prepare utils.RoundEvent, starts from round#19, reset(for round#20)#1.
rEvt, err := utils.NewRoundEvent(context.Background(), gov, s.logger, 19,
1900, 2019, core.ConfigRoundShift)
@@ -213,8 +219,8 @@ func (s *RoundEventTestSuite) TestLastPeriod() {
begin, length = rEvt.LastPeriod()
s.Require().Equal(begin, uint64(200))
s.Require().Equal(length, uint64(100))
- s.proposeMPK(gov, 1, 3)
- s.proposeFinalize(gov, 1, 3)
+ s.proposeMPK(gov, 1, 2, 3)
+ s.proposeFinalize(gov, 1, 2, 3)
rEvt.ValidateNextRound(80)
begin, length = rEvt.LastPeriod()
s.Require().Equal(begin, uint64(300))