diff options
author | Jhih-Ming Huang <jm@byzantine-lab.io> | 2019-09-02 18:20:13 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-09-02 18:20:13 +0800 |
commit | f512ccb3c6a67216c064f719554f21b7ccea1a1e (patch) | |
tree | fad126975d5f2da8d2732e2364134e412a087f99 | |
parent | 5f001907a53deaeae7117617fbac5a203109902c (diff) | |
download | tangerine-consensus-f512ccb3c6a67216c064f719554f21b7ccea1a1e.tar.gz tangerine-consensus-f512ccb3c6a67216c064f719554f21b7ccea1a1e.tar.zst tangerine-consensus-f512ccb3c6a67216c064f719554f21b7ccea1a1e.zip |
core: syncer: recovery votes threshold should be the same as DKGThreshold
-rw-r--r-- | .gitlab-ci.yml | 80 | ||||
-rw-r--r-- | Gopkg.lock | 38 | ||||
-rw-r--r-- | Gopkg.toml | 4 | ||||
-rw-r--r-- | core/syncer/watch-cat.go | 7 | ||||
-rw-r--r-- | core/syncer/watch-cat_test.go | 2 |
5 files changed, 105 insertions, 26 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3509531 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,80 @@ +image: "golang:1.11" + +before_script: + - apt-get update + - apt-get install -y openssl libgmp3-dev git make bash gcc libc-dev g++ + - mkdir -p $GOPATH/src/gitlab.com/ + - mv /builds/byzantine-lab $GOPATH/src/gitlab.com + - mkdir -p /builds/byzantine-lab/tangerine-consensus + - cd $GOPATH/src/gitlab.com/byzantine-lab/tangerine-consensus + - bin/install_tools.sh + - dep ensure -v + - make dep + +stages: + - lint + - test + +lint: + tags: + - generic + stage: lint + script: + - make lint + - make vet + +test-integration-without-race: + tags: + - generic + stage: test + script: + - ONLY_INTEGRATION_TEST=true NO_TEST_RACE=true make test + only: + - master + +test-integration-with-race: + tags: + - generic + stage: test + script: + - ONLY_INTEGRATION_TEST=true make test + only: + - master + allow_failure: true + +test-no-integration: + tags: + - generic + stage: test + script: + - NO_INTEGRATION_TEST=true make test + only: + - master + +test-short-integration-without-race: + tags: + - generic + stage: test + script: + - ONLY_INTEGRATION_TEST=true NO_TEST_RACE=true make test-short + except: + - master + +test-short-integration-with-race: + tags: + - generic + stage: test + script: + - ONLY_INTEGRATION_TEST=true make test-short + except: + - master + allow_failure: true + +test-short-no-integration: + tags: + - generic + stage: test + script: + - NO_INTEGRATION_TEST=true make test-short + except: + - master @@ -10,25 +10,17 @@ revision = "9bfb2ca0346b57e246cc96fa31074df521175240" [[projects]] - digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec" - name = "github.com/davecgh/go-spew" - packages = ["spew"] - pruneopts = "UT" - revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" - version = "v1.1.1" - -[[projects]] - branch = "dev" - digest = "1:989ca7617ed87c5fa460e9f63414d797fd0d2dd07cdda0b6d6d3e7450e002b1f" - name = "github.com/dexon-foundation/bls" + branch = "master" + digest = "1:2459b6301dc545a036c458f08de757156be3d860cbaf9136d13bbcbfb91fe076" + name = "github.com/byzantine-lab/bls" packages = ["ffi/go/bls"] pruneopts = "UT" - revision = "b0a83abe7389df7f4c45adc3b52d957f3996322d" + revision = "5e8e1cd9adf37e993a5bea2ad116e107652f0301" [[projects]] branch = "master" - digest = "1:e42fe948f1217b0c47b482f08e99ebcb66d5eaf02a1048128708a0156edea8f5" - name = "github.com/dexon-foundation/dexon" + digest = "1:cebb704f755e322f2b3594a3d059749ca4736ae36fbfc6e895ae7a4366d7efe5" + name = "github.com/byzantine-lab/go-tangerine" packages = [ "common", "common/hexutil", @@ -38,7 +30,15 @@ "rlp", ] pruneopts = "UT" - revision = "31d2950d993b00d743fb61c887752d25adfd6703" + revision = "872c464cb12cf7ac6df7b9094994b043eeb228bc" + +[[projects]] + digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec" + name = "github.com/davecgh/go-spew" + packages = ["spew"] + pruneopts = "UT" + revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" + version = "v1.1.1" [[projects]] digest = "1:fed20bf7f0da387c96d4cfc140a95572e5aba4bb984beb7de910e090ae39849b" @@ -158,10 +158,10 @@ analyzer-name = "dep" analyzer-version = 1 input-imports = [ - "github.com/dexon-foundation/bls/ffi/go/bls", - "github.com/dexon-foundation/dexon/crypto", - "github.com/dexon-foundation/dexon/log", - "github.com/dexon-foundation/dexon/rlp", + "github.com/byzantine-lab/bls/ffi/go/bls", + "github.com/byzantine-lab/go-tangerine/crypto", + "github.com/byzantine-lab/go-tangerine/log", + "github.com/byzantine-lab/go-tangerine/rlp", "github.com/hashicorp/golang-lru", "github.com/naoina/toml", "github.com/stretchr/testify/suite", @@ -27,11 +27,11 @@ [[constraint]] branch = "dev" - name = "github.com/dexon-foundation/bls" + name = "gitlab.com/byzantine-lab/bls" [[constraint]] branch = "master" - name = "github.com/dexon-foundation/dexon" + name = "gitlab.com/byzantine-lab/dexon" [[constraint]] name = "github.com/naoina/toml" diff --git a/core/syncer/watch-cat.go b/core/syncer/watch-cat.go index ba385bc..5f06499 100644 --- a/core/syncer/watch-cat.go +++ b/core/syncer/watch-cat.go @@ -106,9 +106,8 @@ func (wc *WatchCat) Start() { }() defer wc.cancel() proposed := false - threshold := uint64( - utils.GetConfigWithPanic(wc.configReader, lastPos.Round, wc.logger). - NotarySetSize / 2) + threshold := uint64(utils.GetDKGThreshold( + utils.GetConfigWithPanic(wc.configReader, lastPos.Round, wc.logger))) wc.logger.Info("Threshold for recovery", "votes", threshold) ResetLoop: for { @@ -124,7 +123,7 @@ func (wc *WatchCat) Start() { votes, err := wc.recovery.Votes(lastPos.Height) if err != nil { wc.logger.Error("Failed to get recovery votes", "height", lastPos.Height, "error", err) - } else if votes > threshold { + } else if votes >= threshold { wc.logger.Info("Threshold for recovery reached!") wc.lastPosition = lastPos break ResetLoop diff --git a/core/syncer/watch-cat_test.go b/core/syncer/watch-cat_test.go index 8bb6d7b..1ceb620 100644 --- a/core/syncer/watch-cat_test.go +++ b/core/syncer/watch-cat_test.go @@ -107,7 +107,7 @@ func (s *WatchCatTestSuite) TestBasicUsage() { } rec.lock.Lock() - rec.votes[pos.Height] = uint64(notarySet/2 + 1) + rec.votes[pos.Height] = uint64((notarySet * 2 / 3) + 1) rec.lock.Unlock() time.Sleep(polling * 2) |