aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-05-06 12:21:47 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-09-17 16:57:29 +0800
commit9e0d88fbbfd0aee142615ae1d8a51367ac231187 (patch)
tree68db52e0ab0e938908540a4964c019201adb8691 /vendor/github.com/dexon-foundation
parentfd5fe8ff4b792bfdeead046297bbf7919c0a0361 (diff)
downloadgo-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.tar
go-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.tar.gz
go-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.tar.bz2
go-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.tar.lz
go-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.tar.xz
go-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.tar.zst
go-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.zip
vendor: sync to latest core (#413)
Diffstat (limited to 'vendor/github.com/dexon-foundation')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go6
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go19
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/agreement.go14
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go6
4 files changed, 25 insertions, 20 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
index a1def58e0..fd8456487 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
@@ -1380,11 +1380,7 @@ func (con *Consensus) ProcessAgreementResult(
return nil
}
// Sanity Check.
- notarySet, err := con.nodeSetCache.GetNotarySet(rand.Position.Round)
- if err != nil {
- return err
- }
- if err := VerifyAgreementResult(rand, notarySet); err != nil {
+ if err := VerifyAgreementResult(rand, con.nodeSetCache); err != nil {
con.baMgr.untouchAgreementResult(rand)
return err
}
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go
index d4235a496..ce5c89c47 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go
@@ -391,6 +391,9 @@ func (d *dkgProtocol) processNackComplaints(complaints []*typesDKG.Complaint) (
}
func (d *dkgProtocol) enforceNackComplaints(complaints []*typesDKG.Complaint) {
+ complained := make(map[types.NodeID]struct{})
+ // Do not propose nack complaint to itself.
+ complained[d.ID] = struct{}{}
for _, complaint := range complaints {
if d.round != complaint.Round || d.reset != complaint.Reset {
continue
@@ -402,8 +405,7 @@ func (d *dkgProtocol) enforceNackComplaints(complaints []*typesDKG.Complaint) {
continue
}
to := complaint.PrivateShare.ProposerID
- // Do not propose nack complaint to itself.
- if to == d.ID {
+ if _, exist := complained[to]; exist {
continue
}
from := complaint.ProposerID
@@ -413,6 +415,7 @@ func (d *dkgProtocol) enforceNackComplaints(complaints []*typesDKG.Complaint) {
}
if _, exist :=
d.antiComplaintReceived[from][to]; !exist {
+ complained[to] = struct{}{}
d.recv.ProposeDKGComplaint(&typesDKG.Complaint{
Round: d.round,
Reset: d.reset,
@@ -461,6 +464,18 @@ func (d *dkgProtocol) processPrivateShare(
if !exist {
return nil
}
+ if prvShare.ReceiverID == d.ID {
+ if _, exist := d.prvSharesReceived[prvShare.ProposerID]; exist {
+ return nil
+ }
+ } else {
+ if _, exist := d.antiComplaintReceived[prvShare.ReceiverID]; exist {
+ if _, exist :=
+ d.antiComplaintReceived[prvShare.ReceiverID][prvShare.ProposerID]; exist {
+ return nil
+ }
+ }
+ }
if err := d.sanityCheck(prvShare); err != nil {
return err
}
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/agreement.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/agreement.go
index b414e1146..d39c24627 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/agreement.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/syncer/agreement.go
@@ -176,12 +176,7 @@ func (a *agreement) processAgreementResult(r *types.AgreementResult) {
a.logger.Trace("Agreement result cached", "result", r)
return
}
- notarySet, err := a.cache.GetNotarySet(r.Position.Round)
- if err != nil {
- a.logger.Error("unable to get notary set", "result", r, "error", err)
- return
- }
- if err := core.VerifyAgreementResult(r, notarySet); err != nil {
+ if err := core.VerifyAgreementResult(r, a.cache); err != nil {
a.logger.Error("Agreement result verification failed",
"result", r,
"error", err)
@@ -257,18 +252,13 @@ func (a *agreement) processNewCRS(round uint64) {
a.latestCRSRound = round
// Verify all pending results.
for r := prevRound; r <= a.latestCRSRound; r++ {
- notarySet, err := a.cache.GetNotarySet(r)
- if err != nil {
- a.logger.Error("Unable to get notary set", "round", r, "error", err)
- continue
- }
pendingsForRound := a.pendingAgrs[r]
if pendingsForRound == nil {
continue
}
delete(a.pendingAgrs, r)
for _, res := range pendingsForRound {
- if err := core.VerifyAgreementResult(res, notarySet); err != nil {
+ if err := core.VerifyAgreementResult(res, a.cache); err != nil {
a.logger.Error("Invalid agreement result",
"result", res,
"error", err)
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go
index c9d5f840f..c4d7b0fc3 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go
@@ -158,13 +158,17 @@ func HashConfigurationBlock(
// VerifyAgreementResult perform sanity check against a types.AgreementResult
// instance.
func VerifyAgreementResult(
- res *types.AgreementResult, notarySet map[types.NodeID]struct{}) error {
+ res *types.AgreementResult, cache *NodeSetCache) error {
if res.Position.Round >= DKGDelayRound {
if len(res.Randomness) == 0 {
return ErrMissingRandomness
}
return nil
}
+ notarySet, err := cache.GetNotarySet(res.Position.Round)
+ if err != nil {
+ return err
+ }
if len(res.Votes) < len(notarySet)*2/3+1 {
return ErrNotEnoughVotes
}