Browse Source

Merge pull request #3261 from tendermint/anton/circle

Revert "quick fix for CircleCI (#2279)"
pull/3268/head
Anton Kaliaev 6 years ago
committed by GitHub
parent
commit
fcebdf6720
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 133 additions and 252 deletions
  1. +23
    -135
      .circleci/config.yml
  2. +61
    -0
      .golangci.yml
  3. +4
    -39
      Makefile
  4. +1
    -1
      Vagrantfile
  5. +2
    -1
      blockchain/pool.go
  6. +1
    -2
      consensus/byzantine_test.go
  7. +0
    -30
      consensus/common_test.go
  8. +1
    -1
      consensus/state.go
  9. +0
    -4
      consensus/state_test.go
  10. +1
    -1
      crypto/merkle/proof.go
  11. +1
    -0
      crypto/merkle/proof_test.go
  12. +12
    -10
      libs/clist/clist_test.go
  13. +1
    -1
      libs/common/colors.go
  14. +1
    -1
      libs/events/events.go
  15. +1
    -1
      libs/test.sh
  16. +2
    -0
      lite/proxy/query_test.go
  17. +0
    -9
      p2p/conn/secret_connection_test.go
  18. +1
    -2
      p2p/pex/pex_reactor.go
  19. +3
    -5
      p2p/switch.go
  20. +1
    -0
      p2p/trust/metric_test.go
  21. +16
    -5
      scripts/get_tools.sh
  22. +0
    -4
      state/state_test.go

+ 23
- 135
.circleci/config.yml View File

@ -48,10 +48,10 @@ jobs:
key: v3-pkg-cache key: v3-pkg-cache
paths: paths:
- /go/pkg - /go/pkg
# - save_cache:
# key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
# paths:
# - /go/src/github.com/tendermint/tendermint
- save_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
paths:
- /go/src/github.com/tendermint/tendermint
build_slate: build_slate:
<<: *defaults <<: *defaults
@ -60,23 +60,8 @@ jobs:
at: /tmp/workspace at: /tmp/workspace
- restore_cache: - restore_cache:
key: v3-pkg-cache key: v3-pkg-cache
# https://discuss.circleci.com/t/saving-cache-stopped-working-warning-skipping-this-step-disabled-in-configuration/24423/2
# - restore_cache:
# key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- checkout
- run:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
- run:
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
- run: mkdir -p $GOPATH/src/github.com/tendermint
- run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
- restore_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: - run:
name: slate docs name: slate docs
command: | command: |
@ -91,29 +76,14 @@ jobs:
at: /tmp/workspace at: /tmp/workspace
- restore_cache: - restore_cache:
key: v3-pkg-cache key: v3-pkg-cache
# - restore_cache:
# key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- checkout
- run:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
make get_dev_tools
- run:
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
- run: mkdir -p $GOPATH/src/github.com/tendermint
- run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
- restore_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: - run:
name: metalinter name: metalinter
command: | command: |
set -ex set -ex
export PATH="$GOBIN:$PATH" export PATH="$GOBIN:$PATH"
make metalinter
make lint
- run: - run:
name: check_dep name: check_dep
command: | command: |
@ -128,22 +98,8 @@ jobs:
at: /tmp/workspace at: /tmp/workspace
- restore_cache: - restore_cache:
key: v3-pkg-cache key: v3-pkg-cache
# - restore_cache:
# key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- checkout
- run:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
- run:
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
- run: mkdir -p $GOPATH/src/github.com/tendermint
- run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
- restore_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: - run:
name: Run abci apps tests name: Run abci apps tests
command: | command: |
@ -159,22 +115,8 @@ jobs:
at: /tmp/workspace at: /tmp/workspace
- restore_cache: - restore_cache:
key: v3-pkg-cache key: v3-pkg-cache
# - restore_cache:
# key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- checkout
- run:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
- run:
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
- run: mkdir -p $GOPATH/src/github.com/tendermint
- run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
- restore_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: - run:
name: Run abci-cli tests name: Run abci-cli tests
command: | command: |
@ -188,22 +130,8 @@ jobs:
at: /tmp/workspace at: /tmp/workspace
- restore_cache: - restore_cache:
key: v3-pkg-cache key: v3-pkg-cache
# - restore_cache:
# key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- checkout
- run:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
- run:
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
- run: mkdir -p $GOPATH/src/github.com/tendermint
- run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
- restore_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends bsdmainutils - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends bsdmainutils
- run: - run:
name: Run tests name: Run tests
@ -217,22 +145,8 @@ jobs:
at: /tmp/workspace at: /tmp/workspace
- restore_cache: - restore_cache:
key: v3-pkg-cache key: v3-pkg-cache
# - restore_cache:
# key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- checkout
- run:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
- run:
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
- run: mkdir -p $GOPATH/src/github.com/tendermint
- run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
- restore_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: mkdir -p /tmp/logs - run: mkdir -p /tmp/logs
- run: - run:
name: Run tests name: Run tests
@ -256,22 +170,8 @@ jobs:
at: /tmp/workspace at: /tmp/workspace
- restore_cache: - restore_cache:
key: v3-pkg-cache key: v3-pkg-cache
# - restore_cache:
# key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- checkout
- run:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
- run:
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
- run: mkdir -p $GOPATH/src/github.com/tendermint
- run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
- restore_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: - run:
name: Run tests name: Run tests
command: bash test/persist/test_failure_indices.sh command: bash test/persist/test_failure_indices.sh
@ -317,22 +217,10 @@ jobs:
steps: steps:
- attach_workspace: - attach_workspace:
at: /tmp/workspace at: /tmp/workspace
# - restore_cache:
# key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- checkout
- run:
name: tools
command: |
export PATH="$GOBIN:$PATH"
make get_tools
- run:
name: dependencies
command: |
export PATH="$GOBIN:$PATH"
make get_vendor_deps
- run: mkdir -p $GOPATH/src/github.com/tendermint
- run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint
- restore_cache:
key: v3-pkg-cache
- restore_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- run: - run:
name: gather name: gather
command: | command: |


+ 61
- 0
.golangci.yml View File

@ -0,0 +1,61 @@
run:
deadline: 1m
linters:
enable-all: true
disable:
- gocyclo
- golint
- maligned
- errcheck
- staticcheck
- dupl
- ineffassign
- interfacer
- unconvert
- goconst
- unparam
- nakedret
- lll
- gochecknoglobals
- govet
- gocritic
- gosec
- gochecknoinits
- scopelint
- stylecheck
# linters-settings:
# govet:
# check-shadowing: true
# golint:
# min-confidence: 0
# gocyclo:
# min-complexity: 10
# maligned:
# suggest-new: true
# dupl:
# threshold: 100
# goconst:
# min-len: 2
# min-occurrences: 2
# depguard:
# list-type: blacklist
# packages:
# # logging is allowed only by logutils.Log, logrus
# # is allowed to use only in logutils package
# - github.com/sirupsen/logrus
# misspell:
# locale: US
# lll:
# line-length: 140
# goimports:
# local-prefixes: github.com/golangci/golangci-lint
# gocritic:
# enabled-tags:
# - performance
# - style
# - experimental
# disabled-checks:
# - wrapperFunc
# - commentFormatting # https://github.com/go-critic/go-critic/issues/755

+ 4
- 39
Makefile View File

@ -1,7 +1,7 @@
GOTOOLS = \ GOTOOLS = \
github.com/mitchellh/gox \ github.com/mitchellh/gox \
github.com/golang/dep/cmd/dep \ github.com/golang/dep/cmd/dep \
github.com/alecthomas/gometalinter \
github.com/golangci/golangci-lint/cmd/golangci-lint \
github.com/gogo/protobuf/protoc-gen-gogo \ github.com/gogo/protobuf/protoc-gen-gogo \
github.com/square/certstrap github.com/square/certstrap
GOBIN?=${GOPATH}/bin GOBIN?=${GOPATH}/bin
@ -11,8 +11,6 @@ INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protob
BUILD_TAGS?='tendermint' BUILD_TAGS?='tendermint'
BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short=8 HEAD`" BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short=8 HEAD`"
LINT_FLAGS = --exclude '.*\.pb\.go' --exclude 'vendor/*' --vendor --deadline=600s
all: check build test install all: check build test install
check: check_tools get_vendor_deps check: check_tools get_vendor_deps
@ -82,10 +80,6 @@ get_tools:
@echo "--> Installing tools" @echo "--> Installing tools"
./scripts/get_tools.sh ./scripts/get_tools.sh
get_dev_tools:
@echo "--> Downloading linters (this may take awhile)"
$(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN)
update_tools: update_tools:
@echo "--> Updating tools" @echo "--> Updating tools"
./scripts/get_tools.sh ./scripts/get_tools.sh
@ -249,38 +243,9 @@ cleanup_after_test_with_deadlock:
fmt: fmt:
@go fmt ./... @go fmt ./...
metalinter:
lint:
@echo "--> Running linter" @echo "--> Running linter"
@gometalinter $(LINT_FLAGS) --disable-all \
--enable=vet \
--enable=vetshadow \
--enable=deadcode \
--enable=varcheck \
--enable=structcheck \
--enable=misspell \
--enable=safesql \
--enable=gosec \
--enable=goimports \
--enable=gofmt \
./...
#--enable=gotype \
#--enable=gotypex \
#--enable=gocyclo \
#--enable=golint \
#--enable=maligned \
#--enable=errcheck \
#--enable=staticcheck \
#--enable=dupl \
#--enable=ineffassign \
#--enable=interfacer \
#--enable=unconvert \
#--enable=goconst \
#--enable=unparam \
#--enable=nakedret \
metalinter_all:
@echo "--> Running linter (all)"
gometalinter $(LINT_FLAGS) --enable-all --disable=lll ./...
@golangci-lint run
DESTINATION = ./index.html.md DESTINATION = ./index.html.md
@ -346,4 +311,4 @@ build-slate:
# To avoid unintended conflicts with file names, always add to .PHONY # To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to. # unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: check build build_race build_abci dist install install_abci check_dep check_tools get_tools get_dev_tools update_tools get_vendor_deps draw_deps get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test fmt rpc-docs build-linux localnet-start localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop build-slate protoc_grpc protoc_all build_c install_c test_with_deadlock cleanup_after_test_with_deadlock metalinter metalinter_all
.PHONY: check build build_race build_abci dist install install_abci check_dep check_tools get_tools update_tools get_vendor_deps draw_deps get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test fmt rpc-docs build-linux localnet-start localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop build-slate protoc_grpc protoc_all build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint

+ 1
- 1
Vagrantfile View File

@ -53,6 +53,6 @@ Vagrant.configure("2") do |config|
# get all deps and tools, ready to install/test # get all deps and tools, ready to install/test
su - vagrant -c 'source /home/vagrant/.bash_profile' su - vagrant -c 'source /home/vagrant/.bash_profile'
su - vagrant -c 'cd /home/vagrant/go/src/github.com/tendermint/tendermint && make get_tools && make get_dev_tools && make get_vendor_deps'
su - vagrant -c 'cd /home/vagrant/go/src/github.com/tendermint/tendermint && make get_tools && make get_vendor_deps'
SHELL SHELL
end end

+ 2
- 1
blockchain/pool.go View File

@ -363,7 +363,8 @@ func (pool *BlockPool) sendError(err error, peerID p2p.ID) {
pool.errorsCh <- peerError{err, peerID} pool.errorsCh <- peerError{err, peerID}
} }
// unused by tendermint; left for debugging purposes
// for debugging purposes
//nolint:unused
func (pool *BlockPool) debug() string { func (pool *BlockPool) debug() string {
pool.mtx.Lock() pool.mtx.Lock()
defer pool.mtx.Unlock() defer pool.mtx.Unlock()


+ 1
- 2
consensus/byzantine_test.go View File

@ -76,8 +76,7 @@ func TestByzantine(t *testing.T) {
conR.SetLogger(logger.With("validator", i)) conR.SetLogger(logger.With("validator", i))
conR.SetEventBus(eventBus) conR.SetEventBus(eventBus)
var conRI p2p.Reactor // nolint: gotype, gosimple
conRI = conR
var conRI p2p.Reactor = conR
// make first val byzantine // make first val byzantine
if i == 0 { if i == 0 {


+ 0
- 30
consensus/common_test.go View File

@ -378,36 +378,6 @@ func ensureNewEvent(
} }
} }
func ensureNewRoundStep(stepCh <-chan interface{}, height int64, round int) {
ensureNewEvent(
stepCh,
height,
round,
ensureTimeout,
"Timeout expired while waiting for NewStep event")
}
func ensureNewVote(voteCh <-chan interface{}, height int64, round int) {
select {
case <-time.After(ensureTimeout):
break
case v := <-voteCh:
edv, ok := v.(types.EventDataVote)
if !ok {
panic(fmt.Sprintf("expected a *types.Vote, "+
"got %v. wrong subscription channel?",
reflect.TypeOf(v)))
}
vote := edv.Vote
if vote.Height != height {
panic(fmt.Sprintf("expected height %v, got %v", height, vote.Height))
}
if vote.Round != round {
panic(fmt.Sprintf("expected round %v, got %v", round, vote.Round))
}
}
}
func ensureNewRound(roundCh <-chan interface{}, height int64, round int) { func ensureNewRound(roundCh <-chan interface{}, height int64, round int) {
select { select {
case <-time.After(ensureTimeout): case <-time.After(ensureTimeout):


+ 1
- 1
consensus/state.go View File

@ -454,7 +454,7 @@ func (cs *ConsensusState) updateRoundStep(round int, step cstypes.RoundStepType)
// enterNewRound(height, 0) at cs.StartTime. // enterNewRound(height, 0) at cs.StartTime.
func (cs *ConsensusState) scheduleRound0(rs *cstypes.RoundState) { func (cs *ConsensusState) scheduleRound0(rs *cstypes.RoundState) {
//cs.Logger.Info("scheduleRound0", "now", tmtime.Now(), "startTime", cs.StartTime) //cs.Logger.Info("scheduleRound0", "now", tmtime.Now(), "startTime", cs.StartTime)
sleepDuration := rs.StartTime.Sub(tmtime.Now()) // nolint: gotype, gosimple
sleepDuration := rs.StartTime.Sub(tmtime.Now())
cs.scheduleTimeout(sleepDuration, rs.Height, 0, cstypes.RoundStepNewHeight) cs.scheduleTimeout(sleepDuration, rs.Height, 0, cstypes.RoundStepNewHeight)
} }


+ 0
- 4
consensus/state_test.go View File

@ -22,10 +22,6 @@ func init() {
config = ResetConfig("consensus_state_test") config = ResetConfig("consensus_state_test")
} }
func ensureProposeTimeout(timeoutPropose time.Duration) time.Duration {
return time.Duration(timeoutPropose.Nanoseconds()*2) * time.Nanosecond
}
/* /*
ProposeSuite ProposeSuite


+ 1
- 1
crypto/merkle/proof.go View File

@ -98,7 +98,7 @@ func (prt *ProofRuntime) Decode(pop ProofOp) (ProofOperator, error) {
} }
func (prt *ProofRuntime) DecodeProof(proof *Proof) (ProofOperators, error) { func (prt *ProofRuntime) DecodeProof(proof *Proof) (ProofOperators, error) {
var poz ProofOperators
poz := make(ProofOperators, 0, len(proof.Ops))
for _, pop := range proof.Ops { for _, pop := range proof.Ops {
operator, err := prt.Decode(pop) operator, err := prt.Decode(pop)
if err != nil { if err != nil {


+ 1
- 0
crypto/merkle/proof_test.go View File

@ -26,6 +26,7 @@ func NewDominoOp(key, input, output string) DominoOp {
} }
} }
//nolint:unused
func DominoOpDecoder(pop ProofOp) (ProofOperator, error) { func DominoOpDecoder(pop ProofOp) (ProofOperator, error) {
if pop.Type != ProofOpDomino { if pop.Type != ProofOpDomino {
panic("unexpected proof op type") panic("unexpected proof op type")


+ 12
- 10
libs/clist/clist_test.go View File

@ -65,12 +65,13 @@ func TestSmall(t *testing.T) {
} }
/*
This test is quite hacky because it relies on SetFinalizer
which isn't guaranteed to run at all.
*/
// nolint: megacheck
// This test is quite hacky because it relies on SetFinalizer
// which isn't guaranteed to run at all.
//nolint:unused,deadcode
func _TestGCFifo(t *testing.T) { func _TestGCFifo(t *testing.T) {
if runtime.GOARCH != "amd64" {
t.Skipf("Skipping on non-amd64 machine")
}
const numElements = 1000000 const numElements = 1000000
l := New() l := New()
@ -113,12 +114,13 @@ func _TestGCFifo(t *testing.T) {
} }
} }
/*
This test is quite hacky because it relies on SetFinalizer
which isn't guaranteed to run at all.
*/
// nolint: megacheck
// This test is quite hacky because it relies on SetFinalizer
// which isn't guaranteed to run at all.
//nolint:unused,deadcode
func _TestGCRandom(t *testing.T) { func _TestGCRandom(t *testing.T) {
if runtime.GOARCH != "amd64" {
t.Skipf("Skipping on non-amd64 machine")
}
const numElements = 1000000 const numElements = 1000000
l := New() l := New()


+ 1
- 1
libs/common/colors.go View File

@ -43,7 +43,7 @@ func treat(s string, color string) string {
} }
func treatAll(color string, args ...interface{}) string { func treatAll(color string, args ...interface{}) string {
var parts []string
parts := make([]string, 0, len(args))
for _, arg := range args { for _, arg := range args {
parts = append(parts, treat(fmt.Sprintf("%v", arg), color)) parts = append(parts, treat(fmt.Sprintf("%v", arg), color))
} }


+ 1
- 1
libs/events/events.go View File

@ -188,7 +188,7 @@ func (cell *eventCell) RemoveListener(listenerID string) int {
func (cell *eventCell) FireEvent(data EventData) { func (cell *eventCell) FireEvent(data EventData) {
cell.mtx.RLock() cell.mtx.RLock()
var eventCallbacks []EventCallback
eventCallbacks := make([]EventCallback, 0, len(cell.listeners))
for _, cb := range cell.listeners { for _, cb := range cell.listeners {
eventCallbacks = append(eventCallbacks, cb) eventCallbacks = append(eventCallbacks, cb)
} }


+ 1
- 1
libs/test.sh View File

@ -2,7 +2,7 @@
set -e set -e
# run the linter # run the linter
# make metalinter_test
# make lint
# setup certs # setup certs
make gen_certs make gen_certs


+ 2
- 0
lite/proxy/query_test.go View File

@ -21,6 +21,7 @@ import (
var node *nm.Node var node *nm.Node
var chainID = "tendermint_test" // TODO use from config. var chainID = "tendermint_test" // TODO use from config.
//nolint:unused
var waitForEventTimeout = 5 * time.Second var waitForEventTimeout = 5 * time.Second
// TODO fix tests!! // TODO fix tests!!
@ -42,6 +43,7 @@ func kvstoreTx(k, v []byte) []byte {
// TODO: enable it after general proof format has been adapted // TODO: enable it after general proof format has been adapted
// in abci/examples/kvstore.go // in abci/examples/kvstore.go
//nolint:unused,deadcode
func _TestAppProofs(t *testing.T) { func _TestAppProofs(t *testing.T) {
assert, require := assert.New(t), require.New(t) assert, require := assert.New(t), require.New(t)


+ 0
- 9
p2p/conn/secret_connection_test.go View File

@ -398,12 +398,3 @@ func BenchmarkSecretConnection(b *testing.B) {
} }
//barSecConn.Close() race condition //barSecConn.Close() race condition
} }
func fingerprint(bz []byte) []byte {
const fbsize = 40
if len(bz) < fbsize {
return bz
} else {
return bz[:fbsize]
}
}

+ 1
- 2
p2p/pex/pex_reactor.go View File

@ -616,10 +616,9 @@ func (of oldestFirst) Less(i, j int) bool { return of[i].LastAttempt.Before(of[j
// getPeersToCrawl returns addresses of potential peers that we wish to validate. // getPeersToCrawl returns addresses of potential peers that we wish to validate.
// NOTE: The status information is ordered as described above. // NOTE: The status information is ordered as described above.
func (r *PEXReactor) getPeersToCrawl() []crawlPeerInfo { func (r *PEXReactor) getPeersToCrawl() []crawlPeerInfo {
var of oldestFirst
// TODO: be more selective // TODO: be more selective
addrs := r.book.ListOfKnownAddresses() addrs := r.book.ListOfKnownAddresses()
of := make(oldestFirst, 0, len(addrs))
for _, addr := range addrs { for _, addr := range addrs {
if len(addr.ID()) == 0 { if len(addr.ID()) == 0 {
continue // dont use peers without id continue // dont use peers without id


+ 3
- 5
p2p/switch.go View File

@ -480,14 +480,12 @@ func (sw *Switch) acceptRoutine() {
metrics: sw.metrics, metrics: sw.metrics,
}) })
if err != nil { if err != nil {
switch err.(type) {
switch err := err.(type) {
case ErrRejected: case ErrRejected:
rErr := err.(ErrRejected)
if rErr.IsSelf() {
if err.IsSelf() {
// Remove the given address from the address book and add to our addresses // Remove the given address from the address book and add to our addresses
// to avoid dialing in the future. // to avoid dialing in the future.
addr := rErr.Addr()
addr := err.Addr()
sw.addrBook.RemoveAddress(&addr) sw.addrBook.RemoveAddress(&addr)
sw.addrBook.AddOurAddress(&addr) sw.addrBook.AddOurAddress(&addr)
} }


+ 1
- 0
p2p/trust/metric_test.go View File

@ -65,6 +65,7 @@ func TestTrustMetricCopyNilPointer(t *testing.T) {
} }
// XXX: This test fails non-deterministically // XXX: This test fails non-deterministically
//nolint:unused,deadcode
func _TestTrustMetricStopPause(t *testing.T) { func _TestTrustMetricStopPause(t *testing.T) {
// The TestTicker will provide manual control over // The TestTicker will provide manual control over
// the passing of time within the metric // the passing of time within the metric


+ 16
- 5
scripts/get_tools.sh View File

@ -5,11 +5,14 @@ set -e
# specific git hash. # specific git hash.
# #
# repos it installs: # repos it installs:
# github.com/mitchellh/gox
# github.com/golang/dep/cmd/dep # github.com/golang/dep/cmd/dep
# gopkg.in/alecthomas/gometalinter.v2
# github.com/gogo/protobuf/protoc-gen-gogo # github.com/gogo/protobuf/protoc-gen-gogo
# github.com/square/certstrap # github.com/square/certstrap
# github.com/mitchellh/gox
# github.com/golangci/golangci-lint
# github.com/petermattis/goid
# github.com/sasha-s/go-deadlock
# goimports
## check if GOPATH is set ## check if GOPATH is set
if [ -z ${GOPATH+x} ]; then if [ -z ${GOPATH+x} ]; then
@ -45,14 +48,22 @@ installFromGithub() {
echo "" echo ""
} }
installFromGithub mitchellh/gox 51ed453898ca5579fea9ad1f08dff6b121d9f2e8
######################## COMMON TOOLS ########################################
installFromGithub golang/dep 22125cfaa6ddc71e145b1535d4b7ee9744fefff2 cmd/dep installFromGithub golang/dep 22125cfaa6ddc71e145b1535d4b7ee9744fefff2 cmd/dep
## gometalinter v3.0.0
installFromGithub alecthomas/gometalinter df395bfa67c5d0630d936c0044cf07ff05086655
######################## DEVELOPER TOOLS #####################################
installFromGithub gogo/protobuf 61dbc136cf5d2f08d68a011382652244990a53a9 protoc-gen-gogo installFromGithub gogo/protobuf 61dbc136cf5d2f08d68a011382652244990a53a9 protoc-gen-gogo
installFromGithub square/certstrap e27060a3643e814151e65b9807b6b06d169580a7 installFromGithub square/certstrap e27060a3643e814151e65b9807b6b06d169580a7
# used to build tm-monitor & tm-bench binaries
installFromGithub mitchellh/gox 51ed453898ca5579fea9ad1f08dff6b121d9f2e8
## golangci-lint v1.13.2
installFromGithub golangci/golangci-lint 7b2421d55194c9dc385eff7720a037aa9244ca3c cmd/golangci-lint
## make test_with_deadlock ## make test_with_deadlock
## XXX: https://github.com/tendermint/tendermint/issues/3242
installFromGithub petermattis/goid b0b1615b78e5ee59739545bb38426383b2cda4c9 installFromGithub petermattis/goid b0b1615b78e5ee59739545bb38426383b2cda4c9
installFromGithub sasha-s/go-deadlock d68e2bc52ae3291765881b9056f2c1527f245f1e installFromGithub sasha-s/go-deadlock d68e2bc52ae3291765881b9056f2c1527f245f1e
go get golang.org/x/tools/cmd/goimports go get golang.org/x/tools/cmd/goimports

+ 0
- 4
state/state_test.go View File

@ -938,10 +938,6 @@ func makeParams(blockBytes, blockGas, evidenceAge int64) types.ConsensusParams {
} }
} }
func pk() []byte {
return ed25519.GenPrivKey().PubKey().Bytes()
}
func TestApplyUpdates(t *testing.T) { func TestApplyUpdates(t *testing.T) {
initParams := makeParams(1, 2, 3) initParams := makeParams(1, 2, 3)


Loading…
Cancel
Save