diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-05-06 12:21:47 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-09-17 16:57:29 +0800 |
commit | 9e0d88fbbfd0aee142615ae1d8a51367ac231187 (patch) | |
tree | 68db52e0ab0e938908540a4964c019201adb8691 | |
parent | fd5fe8ff4b792bfdeead046297bbf7919c0a0361 (diff) | |
download | go-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.tar.gz go-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.tar.zst go-tangerine-9e0d88fbbfd0aee142615ae1d8a51367ac231187.zip |
vendor: sync to latest core (#413)
5 files changed, 47 insertions, 42 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 } diff --git a/vendor/vendor.json b/vendor/vendor.json index 15a210812..ff47da121 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -141,16 +141,16 @@ { "checksumSHA1": "In6vBHYUsX7DUIGiFN2hQggBgvI=", "path": "github.com/dexon-foundation/dexon-consensus/common", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "ae/4yvDJ4EIe4hHn2GbHD/40mZ4=", + "checksumSHA1": "3/fzuY8PZ1Fd1dw6Fol6hbvZXWk=", "path": "github.com/dexon-foundation/dexon-consensus/core", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, @@ -165,64 +165,64 @@ { "checksumSHA1": "tQSbYCu5P00lUhKsx3IbBZCuSLY=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, { "checksumSHA1": "4besQaa0rm8jRUAJjpEaLZ/ZOYs=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, { "checksumSHA1": "BhLKK8RveoLaeXc9UyUKMwQqchU=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/ecdsa", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, { "checksumSHA1": "3Ludp/1V4dMBZH/c1oIVjHj0CqY=", "path": "github.com/dexon-foundation/dexon-consensus/core/db", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, { - "checksumSHA1": "sO5twEFTdLvkMuQo+I3vyzm9T3o=", + "checksumSHA1": "oi/m368rTLcDsKxpP3RnYLnHVqg=", "path": "github.com/dexon-foundation/dexon-consensus/core/syncer", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, { "checksumSHA1": "0BY+E0E2cM7IHIMqunXwoolDS5Y=", "path": "github.com/dexon-foundation/dexon-consensus/core/types", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, { "checksumSHA1": "yEPSfn48GaJmDbd2OFY+QRhjJ0w=", "path": "github.com/dexon-foundation/dexon-consensus/core/types/dkg", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, { "checksumSHA1": "51hQ5Wl/n9A5cu8t2yNIqfUuIR8=", "path": "github.com/dexon-foundation/dexon-consensus/core/utils", - "revision": "306d416fc794ddf803a1edc322ad7c7271743c9d", - "revisionTime": "2019-04-25T03:48:02Z", + "revision": "42d585f1e5c9420f15b1d7333e7874a04345cc36", + "revisionTime": "2019-05-06T04:02:43Z", "version": "master", "versionExact": "master" }, |