aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-30 22:53:11 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-15 22:09:55 +0800
commit7db36faceacb33530dcce7c6bfb3893174bed69c (patch)
treef9b1198bb719364590089b3fc5d6cb17850771e1
parenta3977690641f136dcf2dbc183f77de3b3cdcca99 (diff)
downloadgo-tangerine-7db36faceacb33530dcce7c6bfb3893174bed69c.tar.gz
go-tangerine-7db36faceacb33530dcce7c6bfb3893174bed69c.tar.zst
go-tangerine-7db36faceacb33530dcce7c6bfb3893174bed69c.zip
core/vm: resetDKG if ttoo less qualified (#318)
-rw-r--r--core/vm/oracle_contracts.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go
index cf9164a5f..fbed2d48d 100644
--- a/core/vm/oracle_contracts.go
+++ b/core/vm/oracle_contracts.go
@@ -1966,7 +1966,15 @@ func (g *GovernanceContract) resetDKG(newSignedCRS []byte) ([]byte, error) {
// If 2f + 1 of DKG set is finalized, check if DKG succeeded.
if g.state.DKGFinalizedsCount().Uint64() >= threshold {
- _, err := g.coreDKGUtils.NewGroupPublicKey(&g.state, nextRound, tsigThreshold)
+ gpk, err := g.coreDKGUtils.NewGroupPublicKey(&g.state, nextRound, tsigThreshold)
+ if gpk, ok := gpk.(*dkgTypes.GroupPublicKey); ok {
+ nextRound := new(big.Int).Add(g.evm.Round, big.NewInt(1))
+ if len(gpk.QualifyNodeIDs) < coreUtils.GetDKGValidThreshold(&coreTypes.Config{
+ NotarySetSize: uint32(g.configNotarySetSize(nextRound).Uint64())}) {
+ err = dkgTypes.ErrNotReachThreshold
+ }
+ }
+
// DKG success.
if err == nil {
return nil, errExecutionReverted