diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-04-08 15:32:32 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-15 22:09:55 +0800 |
commit | 1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec (patch) | |
tree | a3a7ce90940fdf7e0eeb2003e9b078da50fc7904 | |
parent | 586574e39d8e7a057f0092bdb8374a130384a531 (diff) | |
download | go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.gz go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.bz2 go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.lz go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.xz go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.zst go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.zip |
vendor: sync to latest core
5 files changed, 43 insertions, 28 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go index 4e6f230dc..af0adf259 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go @@ -257,6 +257,7 @@ func (mgr *agreementMgr) processVote(v *types.Vote) (err error) { } if err = mgr.baModule.processVote(v); err == nil { mgr.baModule.updateFilter(mgr.voteFilter) + mgr.voteFilter.AddVote(v) } return } diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go index fbd504d24..4a99d3dcc 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go @@ -662,7 +662,7 @@ func (cc *configurationChain) untouchTSigHash(hash common.Hash) { } func (cc *configurationChain) runTSig( - round uint64, hash common.Hash) ( + round uint64, hash common.Hash, wait time.Duration) ( crypto.Signature, error) { npks, _, _ := cc.getDKGInfo(round, false) if npks == nil { @@ -687,8 +687,7 @@ func (cc *configurationChain) runTSig( }() timeout := make(chan struct{}, 1) go func() { - // TODO(jimmy-dexon): make timeout configurable. - time.Sleep(5 * time.Second) + time.Sleep(wait) timeout <- struct{}{} cc.tsigReady.Broadcast() }() @@ -714,7 +713,7 @@ func (cc *configurationChain) runTSig( func (cc *configurationChain) runCRSTSig( round uint64, crs common.Hash) ([]byte, error) { - sig, err := cc.runTSig(round, crs) + sig, err := cc.runTSig(round, crs, cc.gov.Configuration(round).LambdaDKG*5) cc.logger.Info("CRS", "nodeID", cc.ID, "round", round+1, 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 adaf51d62..ca7d10f2e 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go @@ -1084,7 +1084,11 @@ func (con *Consensus) generateBlockRandomness(blocks []*types.Block) { "proposer", psig.ProposerID, "block", block) con.network.BroadcastDKGPartialSignature(psig) - sig, err := con.cfgModule.runTSig(block.Position.Round, block.Hash) + sig, err := con.cfgModule.runTSig( + block.Position.Round, + block.Hash, + 60*time.Minute, + ) if err != nil { con.logger.Error("Failed to run Block Tsig", "block", block, diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go index a19902758..2fc18bb34 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go @@ -24,6 +24,7 @@ import ( // VoteFilter filters votes that are useless for now. // To maximize performance, this structure is not thread-safe and will never be. type VoteFilter struct { + Voted map[types.VoteHeader]struct{} Height uint64 LockIter uint64 Period uint64 @@ -32,7 +33,9 @@ type VoteFilter struct { // NewVoteFilter creates a new vote filter instance. func NewVoteFilter() *VoteFilter { - return &VoteFilter{} + return &VoteFilter{ + Voted: make(map[types.VoteHeader]struct{}), + } } // Filter checks if the vote should be filtered out. @@ -57,5 +60,13 @@ func (vf *VoteFilter) Filter(vote *types.Vote) bool { vote.BlockHash == types.SkipBlockHash { return true } + if _, exist := vf.Voted[vote.VoteHeader]; exist { + return true + } return false } + +// AddVote to the filter so the same vote will be filtered. +func (vf *VoteFilter) AddVote(vote *types.Vote) { + vf.Voted[vote.VoteHeader] = struct{}{} +} diff --git a/vendor/vendor.json b/vendor/vendor.json index 1b9700655..bfad63954 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -141,16 +141,16 @@ { "checksumSHA1": "In6vBHYUsX7DUIGiFN2hQggBgvI=", "path": "github.com/dexon-foundation/dexon-consensus/common", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, { - "checksumSHA1": "RYHOTUhiRTYj3z6lXRP5Z1BHbso=", + "checksumSHA1": "kUp9PP8aT6Gw6BP2tXaPWcSrqLw=", "path": "github.com/dexon-foundation/dexon-consensus/core", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, @@ -165,64 +165,64 @@ { "checksumSHA1": "tQSbYCu5P00lUhKsx3IbBZCuSLY=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "m5lUT04qSHKtFukvxjnFX5Jo2hI=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "BhLKK8RveoLaeXc9UyUKMwQqchU=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/ecdsa", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "hj/KetWUHp+1CX+50V0QnCthfWc=", "path": "github.com/dexon-foundation/dexon-consensus/core/db", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "DILLD61kp1c3JZnyLZK84mMK9Jw=", "path": "github.com/dexon-foundation/dexon-consensus/core/syncer", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "zIgCdN4FJiAuPGMhB+/9YGK/Wgk=", "path": "github.com/dexon-foundation/dexon-consensus/core/types", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "lbG7yqVgzo2CV/CQPYjG78xp5jg=", "path": "github.com/dexon-foundation/dexon-consensus/core/types/dkg", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, { - "checksumSHA1": "YooeNHTYxH05Ky5vnoyZsQR4/08=", + "checksumSHA1": "Ht0TdiYL3/nJ0nV91rTgponeCPg=", "path": "github.com/dexon-foundation/dexon-consensus/core/utils", - "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", - "revisionTime": "2019-04-06T09:04:11Z", + "revision": "337b5729c1cea837ac5ee8e1646dca587f52ebbd", + "revisionTime": "2019-04-08T07:31:25Z", "version": "single-chain", "versionExact": "single-chain" }, |