aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-17 22:52:40 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:58 +0800
commit829d04922ade426eee1302753fe1bbf34abc11db (patch)
tree89ae0e8a05714dc27d01aae2bbe35f8191dda3b0 /core/vm
parent1dd5b9705268cc22bf70ba16a8becb02b4148e86 (diff)
downloaddexon-829d04922ade426eee1302753fe1bbf34abc11db.tar
dexon-829d04922ade426eee1302753fe1bbf34abc11db.tar.gz
dexon-829d04922ade426eee1302753fe1bbf34abc11db.tar.bz2
dexon-829d04922ade426eee1302753fe1bbf34abc11db.tar.lz
dexon-829d04922ade426eee1302753fe1bbf34abc11db.tar.xz
dexon-829d04922ade426eee1302753fe1bbf34abc11db.tar.zst
dexon-829d04922ade426eee1302753fe1bbf34abc11db.zip
core: check reset of dkg types when adding (#268)
* vendor: sync to latest core * core: check dkg reset
Diffstat (limited to 'core/vm')
-rw-r--r--core/vm/oracle_contracts.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go
index 56e82f7df..e58133990 100644
--- a/core/vm/oracle_contracts.go
+++ b/core/vm/oracle_contracts.go
@@ -1242,6 +1242,10 @@ func (g *GovernanceContract) addDKGComplaint(round *big.Int, comp []byte) ([]byt
return g.penalize()
}
+ if dkgComplaint.Reset != g.state.DKGResetCount(round).Uint64() {
+ return g.penalize()
+ }
+
// DKGComplaint must belongs to someone in DKG set.
if !g.inDKGSet(round, dkgComplaint.ProposerID) {
return g.penalize()
@@ -1324,6 +1328,10 @@ func (g *GovernanceContract) addDKGMasterPublicKey(round *big.Int, mpk []byte) (
return g.penalize()
}
+ if dkgMasterPK.Reset != g.state.DKGResetCount(round).Uint64() {
+ return g.penalize()
+ }
+
// DKGMasterPublicKey must belongs to someone in DKG set.
if !g.inDKGSet(round, dkgMasterPK.ProposerID) {
return g.penalize()
@@ -1350,6 +1358,10 @@ func (g *GovernanceContract) addDKGMPKReady(round *big.Int, ready []byte) ([]byt
return g.penalize()
}
+ if dkgReady.Reset != g.state.DKGResetCount(round).Uint64() {
+ return g.penalize()
+ }
+
// DKGFInalize must belongs to someone in DKG set.
if !g.inDKGSet(round, dkgReady.ProposerID) {
return g.penalize()
@@ -1380,6 +1392,10 @@ func (g *GovernanceContract) addDKGFinalize(round *big.Int, finalize []byte) ([]
return g.penalize()
}
+ if dkgFinalize.Reset != g.state.DKGResetCount(round).Uint64() {
+ return g.penalize()
+ }
+
// DKGFInalize must belongs to someone in DKG set.
if !g.inDKGSet(round, dkgFinalize.ProposerID) {
return g.penalize()