aboutsummaryrefslogtreecommitdiffstats
path: root/core/test
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-19 16:53:34 +0800
committerGitHub <noreply@github.com>2019-03-19 16:53:34 +0800
commit448935829700500ecf512b9e0a6437cbb63504b3 (patch)
tree6a9eb7439f2e8caf60000a14215ce92cd078a518 /core/test
parent3785190d9154acb0492dd22b6d62e953a0bcf453 (diff)
downloadtangerine-consensus-448935829700500ecf512b9e0a6437cbb63504b3.tar
tangerine-consensus-448935829700500ecf512b9e0a6437cbb63504b3.tar.gz
tangerine-consensus-448935829700500ecf512b9e0a6437cbb63504b3.tar.bz2
tangerine-consensus-448935829700500ecf512b9e0a6437cbb63504b3.tar.lz
tangerine-consensus-448935829700500ecf512b9e0a6437cbb63504b3.tar.xz
tangerine-consensus-448935829700500ecf512b9e0a6437cbb63504b3.tar.zst
tangerine-consensus-448935829700500ecf512b9e0a6437cbb63504b3.zip
core: remove round from addDKG fuction (#501)
Diffstat (limited to 'core/test')
-rw-r--r--core/test/app_test.go4
-rw-r--r--core/test/governance.go22
-rw-r--r--core/test/governance_test.go6
3 files changed, 9 insertions, 23 deletions
diff --git a/core/test/app_test.go b/core/test/app_test.go
index 1579549..c83aaf6 100644
--- a/core/test/app_test.go
+++ b/core/test/app_test.go
@@ -85,7 +85,7 @@ func (s *AppTestSuite) proposeMPK(
PublicKeyShares: *pubShare,
}
s.Require().NoError(s.signers[idx].SignDKGMasterPublicKey(mpk))
- gov.AddDKGMasterPublicKey(round, mpk)
+ gov.AddDKGMasterPublicKey(mpk)
}
}
@@ -100,7 +100,7 @@ func (s *AppTestSuite) proposeFinalize(
Reset: reset,
}
s.Require().NoError(s.signers[idx].SignDKGFinalize(final))
- gov.AddDKGFinalize(round, final)
+ gov.AddDKGFinalize(final)
}
}
diff --git a/core/test/governance.go b/core/test/governance.go
index 42294fc..62bee70 100644
--- a/core/test/governance.go
+++ b/core/test/governance.go
@@ -145,14 +145,10 @@ func (g *Governance) ProposeCRS(round uint64, signedCRS []byte) {
}
// AddDKGComplaint add a DKGComplaint.
-func (g *Governance) AddDKGComplaint(
- round uint64, complaint *typesDKG.Complaint) {
+func (g *Governance) AddDKGComplaint(complaint *typesDKG.Complaint) {
if g.isProhibited(StateAddDKGComplaint) {
return
}
- if round != complaint.Round {
- return
- }
if g.IsDKGFinal(complaint.Round) {
return
}
@@ -169,14 +165,10 @@ func (g *Governance) DKGComplaints(round uint64) []*typesDKG.Complaint {
}
// AddDKGMasterPublicKey adds a DKGMasterPublicKey.
-func (g *Governance) AddDKGMasterPublicKey(
- round uint64, masterPublicKey *typesDKG.MasterPublicKey) {
+func (g *Governance) AddDKGMasterPublicKey(masterPublicKey *typesDKG.MasterPublicKey) {
if g.isProhibited(StateAddDKGMasterPublicKey) {
return
}
- if round != masterPublicKey.Round {
- return
- }
if g.IsDKGMPKReady(masterPublicKey.Round) {
return
}
@@ -194,10 +186,7 @@ func (g *Governance) DKGMasterPublicKeys(
}
// AddDKGMPKReady adds a DKG ready message.
-func (g *Governance) AddDKGMPKReady(round uint64, ready *typesDKG.MPKReady) {
- if round != ready.Round {
- return
- }
+func (g *Governance) AddDKGMPKReady(ready *typesDKG.MPKReady) {
if err := g.stateModule.RequestChange(StateAddDKGMPKReady, ready); err != nil {
panic(err)
}
@@ -220,13 +209,10 @@ func (g *Governance) IsDKGMPKReady(round uint64) bool {
}
// AddDKGFinalize adds a DKG finalize message.
-func (g *Governance) AddDKGFinalize(round uint64, final *typesDKG.Finalize) {
+func (g *Governance) AddDKGFinalize(final *typesDKG.Finalize) {
if g.isProhibited(StateAddDKGFinal) {
return
}
- if round != final.Round {
- return
- }
if err := g.stateModule.RequestChange(StateAddDKGFinal, final); err != nil {
panic(err)
}
diff --git a/core/test/governance_test.go b/core/test/governance_test.go
index cb280a8..36819a0 100644
--- a/core/test/governance_test.go
+++ b/core/test/governance_test.go
@@ -121,7 +121,7 @@ func (s *GovernanceTestSuite) TestProhibit() {
PublicKeyShares: *pubShare,
}
s.Require().NoError(signer.SignDKGMasterPublicKey(mpk))
- gov.AddDKGMasterPublicKey(round, mpk)
+ gov.AddDKGMasterPublicKey(mpk)
}
proposeMPK(prvKeys[0])
s.Require().Len(gov.DKGMasterPublicKeys(round), 1)
@@ -139,7 +139,7 @@ func (s *GovernanceTestSuite) TestProhibit() {
Round: round,
}
s.Require().NoError(signer.SignDKGComplaint(comp))
- gov.AddDKGComplaint(round, comp)
+ gov.AddDKGComplaint(comp)
}
proposeComplaint(prvKeys[0])
s.Require().Len(gov.DKGComplaints(round), 1)
@@ -157,7 +157,7 @@ func (s *GovernanceTestSuite) TestProhibit() {
ProposerID: types.NewNodeID(k.PublicKey()),
}
s.Require().NoError(signer.SignDKGFinalize(final))
- gov.AddDKGFinalize(round, final)
+ gov.AddDKGFinalize(final)
}
gov.Prohibit(StateAddDKGFinal)
for _, k := range prvKeys {