Commit Graph

89 Commits

Author SHA1 Message Date
Anton Kaliaev 9120fd5d14
unexport DecodeMessage functions
Refs #646
2018-07-09 13:01:23 +04:00
Ethan Buchman d55243f0e6 fix import paths 2018-07-01 22:36:49 -04:00
Anton Kaliaev ab04201c3d
fix empty packet size calculation
Fixes #1762#issuecomment-398940107
2018-06-29 12:40:32 +04:00
Ethan Buchman fa3bd05d44 mempool: log hashes, not whole tx 2018-06-27 18:14:45 +04:00
Alexander Simmerl a605b66c5a
Move abci imports 2018-06-22 07:28:07 +02:00
Anton Kaliaev 4f5492c831
add nopTxCache (Nil Object Pattern)
to better handle zero cache size
2018-06-19 11:59:07 +04:00
Anton Kaliaev 70d973016e
output msg only once during start 2018-06-19 11:40:40 +04:00
Ethan Buchman a519825bf8 consensus: fixes #1754
* updateToState exits early if the state isn't new, which happens after
* fast syncing. This results in not sending a NewRoundStep message. The mempool
* reactor depends on PeerState, which is updated by NewRoundStep
* messages. If the peer never sends a NewRoundStep, the mempool reactor
* will think they're behind, and never forward transactions. Note this
* only happens when `create_empty_blocks = false`, because otherwise
* peers will move through the consensus state and send a NewRoundStep
* for a new step soon anyways. Simple fix is just to send the
* NewRoundStep message during updateToState even if exit early
2018-06-18 17:08:09 -07:00
Ethan Buchman 1a1e4e767b check max msg size in DecodeMessage 2018-04-09 15:18:47 +03:00
Jae Kwon 35a1d747b0 Fix mempool 2018-03-31 11:51:32 +02:00
Anton Kaliaev 4242352852
stop peer on decoding error 2018-03-15 11:58:19 +04:00
Anton Kaliaev 2a24ae90c1
fixes from Jae's review
1. remove pointer
2. add Quit() method to Service interface
2018-02-12 14:32:09 +04:00
Anton Kaliaev 11b68f1934
rewrite broadcastTxRoutine to use channels
https://play.golang.org/p/gN21yO9IRs3

```
func waitWithCancel(f func() *clist.CElement, ctx context.Context) *clist.CElement {
	el := make(chan *clist.CElement, 1)
	select {
	case el <- f():
```
will just run f() blockingly, so this doesn't change much in terms of behavior.
2018-02-05 16:36:26 +04:00
Anton Kaliaev 202d9a2c0c
fix memory leak in mempool reactor
Leaking goroutine:
```
114 @ 0x42f2bc 0x42f3ae 0x440794 0x4403b9 0x468002 0x9fe32d 0x9ff78f 0xa025ed 0x45e571
```

Explanation:
it blocks on an empty clist forever. so unless theres txs coming in,
this go routine will just sit there, holding onto the peer too.
if we're constantly reconnecting to some peer, old instances are not
garbage collected, leading to memory leak.

Fixes https://github.com/cosmos/gaia/issues/108
Previous attempt https://github.com/tendermint/tendermint/pull/1156
2018-02-05 13:52:18 +04:00
Ethan Buchman ee674f919f StopPeerForError in blockchain and consensus 2018-01-21 13:32:04 -05:00
Ethan Buchman 5b1f987ed1 mempool: remove Peer interface. use p2p.Peer 2017-12-26 20:24:12 -05:00
Anton Kaliaev 922af7c405
int64 height
uint64 is considered dangerous. the details will follow in a blog post.
2017-12-01 19:04:53 -06:00
Anton Kaliaev b3492356e6 uint64 height (Refs #911) 2017-12-01 17:17:22 -05:00
Zach Ramsay 46ccbcbff6 linting: apply 'gofmt -s -w' throughout 2017-11-27 22:39:11 +00:00
Anton Kaliaev f6539737de
new pubsub package
comment out failing consensus tests for now

rewrite rpc httpclient to use new pubsub package

import pubsub as tmpubsub, query as tmquery

make event IDs constants
EventKey -> EventTypeKey

rename EventsPubsub to PubSub

mempool does not use pubsub

rename eventsSub to pubsub

new subscribe API

fix channel size issues and consensus tests bugs

refactor rpc client

add missing discardFromChan method

add mutex

rename pubsub to eventBus

remove IsRunning from WSRPCConnection interface (not needed)

add a comment in broadcastNewRoundStepsAndVotes

rename registerEventCallbacks to broadcastNewRoundStepsAndVotes

See https://dave.cheney.net/2014/03/19/channel-axioms

stop eventBuses after reactor tests

remove unnecessary Unsubscribe

return subscribe helper function

move discardFromChan to where it is used

subscribe now returns an err

this gives us ability to refuse to subscribe if pubsub is at its max
capacity.

use context for control overflow

cache queries

handle err when subscribing in replay_test

rename testClientID to testSubscriber

extract var

set channel buffer capacity to 1 in replay_file

fix byzantine_test

unsubscribe from single event, not all events

refactor httpclient to return events to appropriate channels

return failing testReplayCrashBeforeWriteVote test

fix TestValidatorSetChanges

refactor code a bit

fix testReplayCrashBeforeWriteVote

add comment

fix TestValidatorSetChanges

fixes from Bucky's review

update comment [ci skip]

test TxEventBuffer

update changelog

fix TestValidatorSetChanges (2nd attempt)

only do wg.Done when no errors

benchmark event bus

create pubsub server inside NewEventBus

only expose config params (later if needed)

set buffer capacity to 0 so we are not testing cache

new tx event format: key = "Tx" plus a tag {"tx.hash": XYZ}

This should allow to subscribe to all transactions! or a specific one
using a query: "tm.events.type = Tx and tx.hash = '013ABF99434...'"

use TimeoutCommit instead of afterPublishEventNewBlockTimeout

TimeoutCommit is the time a node waits after committing a block, before
it goes into the next height. So it will finish everything from the last
block, but then wait a bit. The idea is this gives it time to hear more
votes from other validators, to strengthen the commit it includes in the
next block. But it also gives it time to hear about new transactions.

waitForBlockWithUpdatedVals

rewrite WAL crash tests

Task:
test that we can recover from any WAL crash.

Solution:
the old tests were relying on event hub being run in the same thread (we
were injecting the private validator's last signature).

when considering a rewrite, we considered two possible solutions: write
a "fuzzy" testing system where WAL is crashing upon receiving a new
message, or inject failures and trigger them in tests using something
like https://github.com/coreos/gofail.

remove sleep

no cs.Lock around wal.Save

test different cases (empty block, non-empty block, ...)

comments

add comments

test 4 cases: empty block, non-empty block, non-empty block with smaller part size, many blocks

fixes as per Bucky's last review

reset subscriptions on UnsubscribeAll

use a simple counter to track message for which we panicked

also, set a smaller part size for all test cases
2017-10-30 00:32:22 -05:00
Ethan Buchman aea8629272 peer interface 2017-09-15 18:40:59 -04:00
Ethan Buchman 88138c38cf mempool: reactor test 2017-09-05 16:25:02 -04:00
Ethan Buchman 311f18bebf mempool: comments 2017-07-17 12:58:10 -04:00
Anton Kaliaev b4ece65726
standardize key for errors (should be "err") 2017-06-14 12:50:49 +04:00
Anton Kaliaev f803544195
new logging 2017-05-13 10:24:58 +02:00
Ethan Frey 604bf03f3a Pulled out all config structs (except p2p.PeerConfig) into config package 2017-05-04 22:46:40 -04:00
Ethan Buchman 75b6c5215f fewer structs. remove viper from consensus 2017-05-04 22:43:55 -04:00
Ethan Buchman 7c0f51e24b remove viper from mempool 2017-05-04 22:39:22 -04:00
Ethan Buchman fcf78a5da7 cleanup go-config/viper and some unnamed imports 2017-04-25 14:54:56 -04:00
Rigel Rozanski cefb2bede0 adding viper
int

int
2017-04-25 13:42:22 -04:00
Ethan Buchman 56c60fba23 go-p2p -> tendermint/p2p 2017-04-21 18:19:41 -04:00
Ethan Buchman d1926bcad1 use tmlibs 2017-04-21 18:12:54 -04:00
Anton Kaliaev 6dbe9febce
log warning if peer send failed (Refs #174)
make lint happy

remove dead code

remove not needed go-common dependency

check peer.Send failures (Refs #174)
2017-02-21 11:57:33 +04:00
Ethan Buchman c147b41013 TMSP -> ABCI 2017-01-12 15:53:32 -05:00
Jae Kwon a9d8039082 Fix peer memleak; stop goroutine when peer is offline 2016-10-17 11:29:43 -07:00
Ethan Buchman 7d493774c7 log: move some Info to Debug 2016-10-14 20:27:50 -04:00
Ethan Buchman 35d4cca8bb type safe events 2016-10-10 03:10:29 -04:00
Jae Kwon ad17090a0f No global config 2016-05-08 15:00:58 -07:00
Ethan Buchman 3891e4d66d config: cswal_light, mempool_broadcast, mempool_reap 2016-03-03 06:31:59 +00:00
Jae Kwon a4f57e164b BroadcastTx results 2016-02-08 00:48:58 -08:00
Ethan Buchman 0be13d1d27 move alert, events, rpc into own repos 2016-01-12 19:15:10 -05:00
Jae Kwon 3e3c0083c7 Make order be decided first; Remove TMSP Commit/Rollback 2016-01-08 16:51:20 -08:00
Jae Kwon dcc1caaf68 Make Receive() logging consistent 2015-12-31 14:27:05 -08:00
Jae Kwon 08d7980d80 Conform to go-wire new TypeByte behavior 2015-12-21 14:48:44 -08:00
Jae Kwon c95b89e98c Merge remote-tracking branch 'origin/consensus_refactor' into consensus_refactor_jae 2015-12-14 09:33:11 -08:00
Ethan Buchman b9e143d956 Fireable -> EventSwitch; rs in EventDataRoundState; fixes from review 2015-12-14 00:38:19 -05:00
Jae Kwon 15b751107e Tweak logging; allow consensus to bypass filter 2015-12-09 09:38:09 -08:00
Jae Kwon ef43af19ab Tendermint <-> Application refactor 2015-12-01 20:12:01 -08:00
Ethan Buchman df9ef1e733 check peerMempoolChan for nil on Reset 2015-11-10 13:41:54 -08:00
Jae Kwon d69b5c5ab6 Conform to go-wire 1.0 2015-11-10 13:10:43 -08:00