28 Commits

Author SHA1 Message Date
Phil Salant
04d13d9945 fix linter errors thrown by unconvert, goconst, and nakedret (#3960)
* Remove unnecessary type conversions

* Consolidate repeated strings into consts

* Clothe return statements

* Update blockchain/v1/reactor_fsm_test.go

Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>

This PR repairs linter errors seen when running the following commands:
golangci-lint run --no-config --disable-all=true --enable=unconvert
golangci-lint run --no-config --disable-all=true --enable=goconst
golangci-lint run --no-config --disable-all=true --enable=nakedret

Contributes to #3262
2019-09-10 11:31:44 +04:00
Marko
98cb8c9783 add staticcheck linting (#3828)
cleanup to add linter

    grpc change:
        https://godoc.org/google.golang.org/grpc#WithContextDialer
        https://godoc.org/google.golang.org/grpc#WithDialer
        grpc/grpc-go#2627
    prometheous change:
        due to UninstrumentedHandler, being deprecated in the future
    empty branch = empty if or else statement
        didn't delete them entirely but commented
        couldn't find a reason to have them
    could not replicate the issue #3406
        but if want to keep it commented then we should comment out the if statement as well
2019-07-25 09:35:30 +04:00
Anton Kaliaev
b6a510a3e7
make ineffassign linter pass (#3386)
Refs #3262

This fixes two small bugs:

1) lite/dbprovider: return `ok` instead of true in parse* functions. It's weird that we're ignoring `ok` value before.
2) consensus/state: previously because of the shadowing we almost never output "Error with msg". Now we declare both `added` and `err` in the beginning of the function, so there's no shadowing.
2019-03-08 09:46:09 +04:00
Anton Kaliaev
d470945503
update gometalinter to 3.0.0 (#3233)
in the attempt to fix https://circleci.com/gh/tendermint/tendermint/43165

also

    code is simplified by running gofmt -s .
    remove unused vars
    enable linters we're currently passing
    remove deprecated linters
2019-01-30 12:24:26 +04:00
Ethan Buchman
0d5e0d2f13
p2p/conn: FlushStop. Use in pex. Closes #2092 (#2802)
* p2p/conn: FlushStop. Use in pex. Closes #2092

In seed mode, we call StopPeer immediately after Send.
Since flushing msgs to the peer happens in the background,
the peer connection is often closed before the messages are
actually sent out. The new FlushStop method allows all msgs
to first be written and flushed out on the conn before it is closed.

* fix dummy peer

* typo

* fixes from review

* more comments

* ensure pex doesn't call FlushStop more than once

FlushStop is not safe to call more than once,
but we call it from Receive in a go-routine so Receive
doesn't block.

To ensure we only call it once, we use the lastReceivedRequests
map - if an entry already exists, then FlushStop should already have
been called and we can return.
2018-11-16 17:44:19 -05:00
Ismail Khoffi
6643c5dd11 Catch up with amino 0.13.0 (#2690)
* catch up with amino changes in
https://github.com/tendermint/go-amino/pull/222

* WIP: update to amino v0.13.0

* update to fixed amino release
2018-10-24 21:34:01 -04:00
Ethan Buchman
087b657008 speed up some tests. ref #2038 2018-08-05 16:59:23 -04:00
Ethan Buchman
d55243f0e6 fix import paths 2018-07-01 22:36:49 -04:00
Anton Kaliaev
61c5791fa3
revert back to Jae's original payload size limit
except now we calculate the max size using the maxPacketMsgSize()
function, which frees developers from having to know amino encoding
details.

plus, 10 additional bytes are added to leave the room for amino upgrades
(both making it more efficient / less efficient)
2018-06-29 12:57:17 +04:00
Anton Kaliaev
ab04201c3d
fix empty packet size calculation
Fixes #1762#issuecomment-398940107
2018-06-29 12:40:32 +04:00
Liamsi
d2c05bc5b9 Revert "delete everything" (includes everything non-go-crypto)
This reverts commit 96a3502
2018-06-20 17:35:30 -07:00
Liamsi
96a3502126 delete everything 2018-06-20 15:19:08 -07:00
Anton Kaliaev
b8c076ca79
do not drain the channel because there is no channel, duh
Fixes https://github.com/cosmos/cosmos-sdk/issues/1045
2018-06-05 14:57:20 +04:00
Jae Kwon
fb64314d1c Review from Anton 2018-04-06 13:46:40 -07:00
Jae Kwon
901b456151 P2P now works with Amino 2018-03-26 06:40:02 +02:00
Jae Kwon
6c345f9fa2 First stab: p2p/conn 2018-03-21 02:27:10 +01:00
Anton Kaliaev
22b038810a
do not block in recvRoutine 2018-02-09 23:03:26 +04:00
Anton Kaliaev
26419fba28
refactor code plus add one more test
* extract stopPongTimer method
* TestMConnectionMultiplePings
2018-02-09 21:32:29 +04:00
Anton Kaliaev
f4ff66de30
rewrite pong timer to use time.AfterFunc 2018-02-09 21:32:29 +04:00
Anton Kaliaev
747b73cb95
fix merge conflicts 2018-02-09 21:32:29 +04:00
Anton Kaliaev
3ae738f453
increase timeouts 2018-02-09 21:32:29 +04:00
Anton Kaliaev
860da464df
remove weird concurrency testing 2018-02-09 21:32:28 +04:00
Anton Kaliaev
4e2000abfe
control order by sending msgs from one goroutine 2018-02-09 21:32:28 +04:00
Anton Kaliaev
5834a59816
read ping 2018-02-09 21:32:28 +04:00
Anton Kaliaev
b28b76ddf7
rename pingTimeout to pingInterval, pongTimer is now time.Timer 2018-02-09 21:32:28 +04:00
zbo14
91e4f4b786
ping/pong timeout in config 2018-02-09 21:32:28 +04:00
zbo14
1d16df6a92
add test, TrySend in broadcast 2018-02-09 21:32:27 +04:00
Ethan Buchman
44e967184a p2p: tmconn->conn and types->p2p 2018-01-21 00:34:41 -05:00