From fbab19d0998d9a2dc41ce8819a68e5e71e9ceb44 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Sun, 17 Mar 2019 22:52:40 +0800 Subject: core: check reset of dkg types when adding (#268) * vendor: sync to latest core * core: check dkg reset --- core/vm/oracle_contracts.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'core') 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() -- cgit v1.2.3