You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2109 lines
72 KiB

9 years ago
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
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
cs: reset triggered timeout precommit (#3310) * Reset TriggeredTimeoutPrecommit as part of updateToState * Add failing test and fix * fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight ``` WARNING: DATA RACE Read at 0x00c001691d28 by goroutine 691: github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c001691d28 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2 github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd Goroutine 691 (running) created at: testing.(*T).Run() /usr/local/go/src/testing/testing.go:878 +0x659 testing.runTests.func1() /usr/local/go/src/testing/testing.go:1119 +0xa8 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 testing.runTests() testing.(*M).Run() /usr/local/go/src/testing/testing.go:1034 +0x2ee main.main() _testmain.go:216 +0x332 ``` * fix another DATA RACE by locking consensus ``` WARNING: DATA RACE Read at 0x00c009b835a8 by goroutine 871: github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock() /go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c github.com/tendermint/tendermint/consensus.decideProposal() /go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53 github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight() /go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 Previous write at 0x00c009b835a8 by goroutine 931: github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight() /go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7 github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState() /go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1() /go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135 github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit() /go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote() /go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg() /go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948 github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine() /go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd ``` * Fix failing test * Delete profile.out * fix data races
6 years ago
9 years ago
9 years ago
lint: Enable Golint (#4212) * Fix many golint errors * Fix golint errors in the 'lite' package * Don't export Pool.store * Fix typo * Revert unwanted changes * Fix errors in counter package * Fix linter errors in kvstore package * Fix linter error in example package * Fix error in tests package * Fix linter errors in v2 package * Fix linter errors in consensus package * Fix linter errors in evidence package * Fix linter error in fail package * Fix linter errors in query package * Fix linter errors in core package * Fix linter errors in node package * Fix linter errors in mempool package * Fix linter error in conn package * Fix linter errors in pex package * Rename PEXReactor export to Reactor * Fix linter errors in trust package * Fix linter errors in upnp package * Fix linter errors in p2p package * Fix linter errors in proxy package * Fix linter errors in mock_test package * Fix linter error in client_test package * Fix linter errors in coretypes package * Fix linter errors in coregrpc package * Fix linter errors in rpcserver package * Fix linter errors in rpctypes package * Fix linter errors in rpctest package * Fix linter error in json2wal script * Fix linter error in wal2json script * Fix linter errors in kv package * Fix linter error in state package * Fix linter error in grpc_client * Fix linter errors in types package * Fix linter error in version package * Fix remaining errors * Address review comments * Fix broken tests * Reconcile package coregrpc * Fix golangci bot error * Fix new golint errors * Fix broken reference * Enable golint linter * minor changes to bring golint into line * fix failing test * fix pex reactor naming * address PR comments
5 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
lint: Enable Golint (#4212) * Fix many golint errors * Fix golint errors in the 'lite' package * Don't export Pool.store * Fix typo * Revert unwanted changes * Fix errors in counter package * Fix linter errors in kvstore package * Fix linter error in example package * Fix error in tests package * Fix linter errors in v2 package * Fix linter errors in consensus package * Fix linter errors in evidence package * Fix linter error in fail package * Fix linter errors in query package * Fix linter errors in core package * Fix linter errors in node package * Fix linter errors in mempool package * Fix linter error in conn package * Fix linter errors in pex package * Rename PEXReactor export to Reactor * Fix linter errors in trust package * Fix linter errors in upnp package * Fix linter errors in p2p package * Fix linter errors in proxy package * Fix linter errors in mock_test package * Fix linter error in client_test package * Fix linter errors in coretypes package * Fix linter errors in coregrpc package * Fix linter errors in rpcserver package * Fix linter errors in rpctypes package * Fix linter errors in rpctest package * Fix linter error in json2wal script * Fix linter error in wal2json script * Fix linter errors in kv package * Fix linter error in state package * Fix linter error in grpc_client * Fix linter errors in types package * Fix linter error in version package * Fix remaining errors * Address review comments * Fix broken tests * Reconcile package coregrpc * Fix golangci bot error * Fix new golint errors * Fix broken reference * Enable golint linter * minor changes to bring golint into line * fix failing test * fix pex reactor naming * address PR comments
5 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
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
8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
  1. package consensus
  2. import (
  3. "bytes"
  4. "context"
  5. "fmt"
  6. "testing"
  7. "time"
  8. "github.com/stretchr/testify/assert"
  9. "github.com/stretchr/testify/require"
  10. "github.com/tendermint/tendermint/abci/example/kvstore"
  11. "github.com/tendermint/tendermint/crypto/tmhash"
  12. cstypes "github.com/tendermint/tendermint/internal/consensus/types"
  13. "github.com/tendermint/tendermint/internal/eventbus"
  14. tmpubsub "github.com/tendermint/tendermint/internal/pubsub"
  15. tmquery "github.com/tendermint/tendermint/internal/pubsub/query"
  16. "github.com/tendermint/tendermint/libs/log"
  17. tmrand "github.com/tendermint/tendermint/libs/rand"
  18. tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
  19. "github.com/tendermint/tendermint/types"
  20. )
  21. /*
  22. ProposeSuite
  23. x * TestProposerSelection0 - round robin ordering, round 0
  24. x * TestProposerSelection2 - round robin ordering, round 2++
  25. x * TestEnterProposeNoValidator - timeout into prevote round
  26. x * TestEnterPropose - finish propose without timing out (we have the proposal)
  27. x * TestBadProposal - 2 vals, bad proposal (bad block state hash), should prevote and precommit nil
  28. x * TestOversizedBlock - block with too many txs should be rejected
  29. FullRoundSuite
  30. x * TestFullRound1 - 1 val, full successful round
  31. x * TestFullRoundNil - 1 val, full round of nil
  32. x * TestFullRound2 - 2 vals, both required for full round
  33. LockSuite
  34. x * TestLockNoPOL - 2 vals, 4 rounds. one val locked, precommits nil every round except first.
  35. x * TestLockPOLRelock - 4 vals, one precommits, other 3 polka at next round, so we unlock and precomit the polka
  36. x * TestLockPOLUnlock - 4 vals, one precommits, other 3 polka nil at next round, so we unlock and precomit nil
  37. x * TestLockPOLSafety1 - 4 vals. We shouldn't change lock based on polka at earlier round
  38. x * TestLockPOLSafety2 - 4 vals. After unlocking, we shouldn't relock based on polka at earlier round
  39. * TestNetworkLock - once +1/3 precommits, network should be locked
  40. * TestNetworkLockPOL - once +1/3 precommits, the block with more recent polka is committed
  41. SlashingSuite
  42. x * TestSlashingPrevotes - a validator prevoting twice in a round gets slashed
  43. x * TestSlashingPrecommits - a validator precomitting twice in a round gets slashed
  44. CatchupSuite
  45. * TestCatchup - if we might be behind and we've seen any 2/3 prevotes, round skip to new round, precommit, or prevote
  46. HaltSuite
  47. x * TestHalt1 - if we see +2/3 precommits after timing out into new round, we should still commit
  48. */
  49. //----------------------------------------------------------------------------------------------------
  50. // ProposeSuite
  51. func TestStateProposerSelection0(t *testing.T) {
  52. ctx, cancel := context.WithCancel(context.Background())
  53. defer cancel()
  54. config := configSetup(t)
  55. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  56. height, round := cs1.Height, cs1.Round
  57. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  58. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  59. startTestRound(ctx, cs1, height, round)
  60. // Wait for new round so proposer is set.
  61. ensureNewRound(t, newRoundCh, height, round)
  62. // Commit a block and ensure proposer for the next height is correct.
  63. prop := cs1.GetRoundState().Validators.GetProposer()
  64. pv, err := cs1.privValidator.GetPubKey(ctx)
  65. require.NoError(t, err)
  66. address := pv.Address()
  67. if !bytes.Equal(prop.Address, address) {
  68. t.Fatalf("expected proposer to be validator %d. Got %X", 0, prop.Address)
  69. }
  70. // Wait for complete proposal.
  71. ensureNewProposal(t, proposalCh, height, round)
  72. rs := cs1.GetRoundState()
  73. signAddVotes(
  74. ctx,
  75. t,
  76. config,
  77. cs1,
  78. tmproto.PrecommitType,
  79. rs.ProposalBlock.Hash(),
  80. rs.ProposalBlockParts.Header(),
  81. vss[1:]...,
  82. )
  83. // Wait for new round so next validator is set.
  84. ensureNewRound(t, newRoundCh, height+1, 0)
  85. prop = cs1.GetRoundState().Validators.GetProposer()
  86. pv1, err := vss[1].GetPubKey(ctx)
  87. require.NoError(t, err)
  88. addr := pv1.Address()
  89. require.True(t, bytes.Equal(prop.Address, addr), "expected proposer to be validator %d. Got %X", 1, prop.Address)
  90. }
  91. // Now let's do it all again, but starting from round 2 instead of 0
  92. func TestStateProposerSelection2(t *testing.T) {
  93. config := configSetup(t)
  94. ctx, cancel := context.WithCancel(context.Background())
  95. defer cancel()
  96. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4) // test needs more work for more than 3 validators
  97. height := cs1.Height
  98. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  99. // this time we jump in at round 2
  100. incrementRound(vss[1:]...)
  101. incrementRound(vss[1:]...)
  102. var round int32 = 2
  103. startTestRound(ctx, cs1, height, round)
  104. ensureNewRound(t, newRoundCh, height, round) // wait for the new round
  105. // everyone just votes nil. we get a new proposer each round
  106. for i := int32(0); int(i) < len(vss); i++ {
  107. prop := cs1.GetRoundState().Validators.GetProposer()
  108. pvk, err := vss[int(i+round)%len(vss)].GetPubKey(ctx)
  109. require.NoError(t, err)
  110. addr := pvk.Address()
  111. correctProposer := addr
  112. require.True(t, bytes.Equal(prop.Address, correctProposer),
  113. "expected RoundState.Validators.GetProposer() to be validator %d. Got %X",
  114. int(i+2)%len(vss),
  115. prop.Address)
  116. rs := cs1.GetRoundState()
  117. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, rs.ProposalBlockParts.Header(), vss[1:]...)
  118. ensureNewRound(t, newRoundCh, height, i+round+1) // wait for the new round event each round
  119. incrementRound(vss[1:]...)
  120. }
  121. }
  122. // a non-validator should timeout into the prevote round
  123. func TestStateEnterProposeNoPrivValidator(t *testing.T) {
  124. config := configSetup(t)
  125. ctx, cancel := context.WithCancel(context.Background())
  126. defer cancel()
  127. cs, _ := randState(ctx, t, config, log.TestingLogger(), 1)
  128. cs.SetPrivValidator(ctx, nil)
  129. height, round := cs.Height, cs.Round
  130. // Listen for propose timeout event
  131. timeoutCh := subscribe(ctx, t, cs.eventBus, types.EventQueryTimeoutPropose)
  132. startTestRound(ctx, cs, height, round)
  133. // if we're not a validator, EnterPropose should timeout
  134. ensureNewTimeout(t, timeoutCh, height, round, cs.config.TimeoutPropose.Nanoseconds())
  135. if cs.GetRoundState().Proposal != nil {
  136. t.Error("Expected to make no proposal, since no privValidator")
  137. }
  138. }
  139. // a validator should not timeout of the prevote round (TODO: unless the block is really big!)
  140. func TestStateEnterProposeYesPrivValidator(t *testing.T) {
  141. config := configSetup(t)
  142. ctx, cancel := context.WithCancel(context.Background())
  143. defer cancel()
  144. cs, _ := randState(ctx, t, config, log.TestingLogger(), 1)
  145. height, round := cs.Height, cs.Round
  146. // Listen for propose timeout event
  147. timeoutCh := subscribe(ctx, t, cs.eventBus, types.EventQueryTimeoutPropose)
  148. proposalCh := subscribe(ctx, t, cs.eventBus, types.EventQueryCompleteProposal)
  149. cs.enterNewRound(ctx, height, round)
  150. cs.startRoutines(ctx, 3)
  151. ensureNewProposal(t, proposalCh, height, round)
  152. // Check that Proposal, ProposalBlock, ProposalBlockParts are set.
  153. rs := cs.GetRoundState()
  154. if rs.Proposal == nil {
  155. t.Error("rs.Proposal should be set")
  156. }
  157. if rs.ProposalBlock == nil {
  158. t.Error("rs.ProposalBlock should be set")
  159. }
  160. if rs.ProposalBlockParts.Total() == 0 {
  161. t.Error("rs.ProposalBlockParts should be set")
  162. }
  163. // if we're a validator, enterPropose should not timeout
  164. ensureNoNewTimeout(t, timeoutCh, cs.config.TimeoutPropose.Nanoseconds())
  165. }
  166. func TestStateBadProposal(t *testing.T) {
  167. config := configSetup(t)
  168. ctx, cancel := context.WithCancel(context.Background())
  169. defer cancel()
  170. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 2)
  171. height, round := cs1.Height, cs1.Round
  172. vs2 := vss[1]
  173. partSize := types.BlockPartSizeBytes
  174. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  175. voteCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryVote)
  176. propBlock, _, err := cs1.createProposalBlock() // changeProposer(t, cs1, vs2)
  177. require.NoError(t, err)
  178. // make the second validator the proposer by incrementing round
  179. round++
  180. incrementRound(vss[1:]...)
  181. // make the block bad by tampering with statehash
  182. stateHash := propBlock.AppHash
  183. if len(stateHash) == 0 {
  184. stateHash = make([]byte, 32)
  185. }
  186. stateHash[0] = (stateHash[0] + 1) % 255
  187. propBlock.AppHash = stateHash
  188. propBlockParts, err := propBlock.MakePartSet(partSize)
  189. require.NoError(t, err)
  190. blockID := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()}
  191. proposal := types.NewProposal(vs2.Height, round, -1, blockID)
  192. p := proposal.ToProto()
  193. if err := vs2.SignProposal(ctx, config.ChainID(), p); err != nil {
  194. t.Fatal("failed to sign bad proposal", err)
  195. }
  196. proposal.Signature = p.Signature
  197. // set the proposal block
  198. if err := cs1.SetProposalAndBlock(ctx, proposal, propBlock, propBlockParts, "some peer"); err != nil {
  199. t.Fatal(err)
  200. }
  201. // start the machine
  202. startTestRound(ctx, cs1, height, round)
  203. // wait for proposal
  204. ensureProposal(t, proposalCh, height, round, blockID)
  205. // wait for prevote
  206. ensurePrevoteMatch(t, voteCh, height, round, nil)
  207. // add bad prevote from vs2 and wait for it
  208. bps, err := propBlock.MakePartSet(partSize)
  209. require.NoError(t, err)
  210. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlock.Hash(), bps.Header(), vs2)
  211. ensurePrevote(t, voteCh, height, round)
  212. // wait for precommit
  213. ensurePrecommit(t, voteCh, height, round)
  214. validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
  215. bps2, err := propBlock.MakePartSet(partSize)
  216. require.NoError(t, err)
  217. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, propBlock.Hash(), bps2.Header(), vs2)
  218. }
  219. func TestStateOversizedBlock(t *testing.T) {
  220. config := configSetup(t)
  221. ctx, cancel := context.WithCancel(context.Background())
  222. defer cancel()
  223. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 2)
  224. cs1.state.ConsensusParams.Block.MaxBytes = 2000
  225. height, round := cs1.Height, cs1.Round
  226. vs2 := vss[1]
  227. partSize := types.BlockPartSizeBytes
  228. timeoutProposeCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutPropose)
  229. voteCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryVote)
  230. propBlock, _, err := cs1.createProposalBlock()
  231. require.NoError(t, err)
  232. propBlock.Data.Txs = []types.Tx{tmrand.Bytes(2001)}
  233. propBlock.Header.DataHash = propBlock.Data.Hash()
  234. // make the second validator the proposer by incrementing round
  235. round++
  236. incrementRound(vss[1:]...)
  237. propBlockParts, err := propBlock.MakePartSet(partSize)
  238. require.NoError(t, err)
  239. blockID := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()}
  240. proposal := types.NewProposal(height, round, -1, blockID)
  241. p := proposal.ToProto()
  242. if err := vs2.SignProposal(ctx, config.ChainID(), p); err != nil {
  243. t.Fatal("failed to sign bad proposal", err)
  244. }
  245. proposal.Signature = p.Signature
  246. totalBytes := 0
  247. for i := 0; i < int(propBlockParts.Total()); i++ {
  248. part := propBlockParts.GetPart(i)
  249. totalBytes += len(part.Bytes)
  250. }
  251. if err := cs1.SetProposalAndBlock(ctx, proposal, propBlock, propBlockParts, "some peer"); err != nil {
  252. t.Fatal(err)
  253. }
  254. // start the machine
  255. startTestRound(ctx, cs1, height, round)
  256. t.Log("Block Sizes", "Limit", cs1.state.ConsensusParams.Block.MaxBytes, "Current", totalBytes)
  257. // c1 should log an error with the block part message as it exceeds the consensus params. The
  258. // block is not added to cs.ProposalBlock so the node timeouts.
  259. ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds())
  260. // and then should send nil prevote and precommit regardless of whether other validators prevote and
  261. // precommit on it
  262. ensurePrevoteMatch(t, voteCh, height, round, nil)
  263. bps, err := propBlock.MakePartSet(partSize)
  264. require.NoError(t, err)
  265. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlock.Hash(), bps.Header(), vs2)
  266. ensurePrevote(t, voteCh, height, round)
  267. ensurePrecommit(t, voteCh, height, round)
  268. validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
  269. bps2, err := propBlock.MakePartSet(partSize)
  270. require.NoError(t, err)
  271. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, propBlock.Hash(), bps2.Header(), vs2)
  272. }
  273. //----------------------------------------------------------------------------------------------------
  274. // FullRoundSuite
  275. // propose, prevote, and precommit a block
  276. func TestStateFullRound1(t *testing.T) {
  277. config := configSetup(t)
  278. logger := log.TestingLogger()
  279. ctx, cancel := context.WithCancel(context.Background())
  280. defer cancel()
  281. cs, vss := randState(ctx, t, config, logger, 1)
  282. height, round := cs.Height, cs.Round
  283. pv, err := cs.privValidator.GetPubKey(ctx)
  284. require.NoError(t, err)
  285. voteCh := subscribeToVoter(ctx, t, cs, pv.Address())
  286. propCh := subscribe(ctx, t, cs.eventBus, types.EventQueryCompleteProposal)
  287. newRoundCh := subscribe(ctx, t, cs.eventBus, types.EventQueryNewRound)
  288. // Maybe it would be better to call explicitly startRoutines(4)
  289. startTestRound(ctx, cs, height, round)
  290. ensureNewRound(t, newRoundCh, height, round)
  291. ensureNewProposal(t, propCh, height, round)
  292. propBlockHash := cs.GetRoundState().ProposalBlock.Hash()
  293. ensurePrevoteMatch(t, voteCh, height, round, propBlockHash) // wait for prevote
  294. ensurePrecommit(t, voteCh, height, round) // wait for precommit
  295. // we're going to roll right into new height
  296. ensureNewRound(t, newRoundCh, height+1, 0)
  297. validateLastPrecommit(ctx, t, cs, vss[0], propBlockHash)
  298. }
  299. // nil is proposed, so prevote and precommit nil
  300. func TestStateFullRoundNil(t *testing.T) {
  301. config := configSetup(t)
  302. ctx, cancel := context.WithCancel(context.Background())
  303. defer cancel()
  304. cs, _ := randState(ctx, t, config, log.TestingLogger(), 1)
  305. height, round := cs.Height, cs.Round
  306. voteCh := subscribe(ctx, t, cs.eventBus, types.EventQueryVote)
  307. cs.enterPrevote(ctx, height, round)
  308. cs.startRoutines(ctx, 4)
  309. ensurePrevoteMatch(t, voteCh, height, round, nil) // prevote
  310. ensurePrecommitMatch(t, voteCh, height, round, nil) // precommit
  311. }
  312. // run through propose, prevote, precommit commit with two validators
  313. // where the first validator has to wait for votes from the second
  314. func TestStateFullRound2(t *testing.T) {
  315. config := configSetup(t)
  316. ctx, cancel := context.WithCancel(context.Background())
  317. defer cancel()
  318. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 2)
  319. vs2 := vss[1]
  320. height, round := cs1.Height, cs1.Round
  321. voteCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryVote)
  322. newBlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewBlock)
  323. // start round and wait for propose and prevote
  324. startTestRound(ctx, cs1, height, round)
  325. ensurePrevote(t, voteCh, height, round) // prevote
  326. // we should be stuck in limbo waiting for more prevotes
  327. rs := cs1.GetRoundState()
  328. propBlockHash, propPartSetHeader := rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header()
  329. // prevote arrives from vs2:
  330. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlockHash, propPartSetHeader, vs2)
  331. ensurePrevote(t, voteCh, height, round) // prevote
  332. ensurePrecommit(t, voteCh, height, round) // precommit
  333. // the proposed block should now be locked and our precommit added
  334. validatePrecommit(ctx, t, cs1, 0, 0, vss[0], propBlockHash, propBlockHash)
  335. // we should be stuck in limbo waiting for more precommits
  336. // precommit arrives from vs2:
  337. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, propBlockHash, propPartSetHeader, vs2)
  338. ensurePrecommit(t, voteCh, height, round)
  339. // wait to finish commit, propose in next height
  340. ensureNewBlock(t, newBlockCh, height)
  341. }
  342. //------------------------------------------------------------------------------------------
  343. // LockSuite
  344. // two validators, 4 rounds.
  345. // two vals take turns proposing. val1 locks on first one, precommits nil on everything else
  346. func TestStateLockNoPOL(t *testing.T) {
  347. config := configSetup(t)
  348. ctx, cancel := context.WithCancel(context.Background())
  349. defer cancel()
  350. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 2)
  351. vs2 := vss[1]
  352. height, round := cs1.Height, cs1.Round
  353. partSize := types.BlockPartSizeBytes
  354. timeoutProposeCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutPropose)
  355. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  356. voteCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryVote)
  357. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  358. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  359. /*
  360. Round1 (cs1, B) // B B // B B2
  361. */
  362. // start round and wait for prevote
  363. cs1.enterNewRound(ctx, height, round)
  364. cs1.startRoutines(ctx, 0)
  365. ensureNewRound(t, newRoundCh, height, round)
  366. ensureNewProposal(t, proposalCh, height, round)
  367. roundState := cs1.GetRoundState()
  368. theBlockHash := roundState.ProposalBlock.Hash()
  369. thePartSetHeader := roundState.ProposalBlockParts.Header()
  370. ensurePrevote(t, voteCh, height, round) // prevote
  371. // we should now be stuck in limbo forever, waiting for more prevotes
  372. // prevote arrives from vs2:
  373. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, theBlockHash, thePartSetHeader, vs2)
  374. ensurePrevote(t, voteCh, height, round) // prevote
  375. ensurePrecommit(t, voteCh, height, round) // precommit
  376. // the proposed block should now be locked and our precommit added
  377. validatePrecommit(ctx, t, cs1, round, round, vss[0], theBlockHash, theBlockHash)
  378. // we should now be stuck in limbo forever, waiting for more precommits
  379. // lets add one for a different block
  380. hash := make([]byte, len(theBlockHash))
  381. copy(hash, theBlockHash)
  382. hash[0] = (hash[0] + 1) % 255
  383. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, hash, thePartSetHeader, vs2)
  384. ensurePrecommit(t, voteCh, height, round) // precommit
  385. // (note we're entering precommit for a second time this round)
  386. // but with invalid args. then we enterPrecommitWait, and the timeout to new round
  387. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  388. ///
  389. round++ // moving to the next round
  390. ensureNewRound(t, newRoundCh, height, round)
  391. t.Log("#### ONTO ROUND 1")
  392. /*
  393. Round2 (cs1, B) // B B2
  394. */
  395. incrementRound(vs2)
  396. // now we're on a new round and not the proposer, so wait for timeout
  397. ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds())
  398. rs := cs1.GetRoundState()
  399. require.Nil(t, rs.ProposalBlock, "Expected proposal block to be nil")
  400. // wait to finish prevote
  401. ensurePrevote(t, voteCh, height, round)
  402. // we should have prevoted our locked block
  403. validatePrevote(ctx, t, cs1, round, vss[0], rs.LockedBlock.Hash())
  404. // add a conflicting prevote from the other validator
  405. bps, err := rs.LockedBlock.MakePartSet(partSize)
  406. require.NoError(t, err)
  407. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, hash, bps.Header(), vs2)
  408. ensurePrevote(t, voteCh, height, round)
  409. // now we're going to enter prevote again, but with invalid args
  410. // and then prevote wait, which should timeout. then wait for precommit
  411. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds())
  412. ensurePrecommit(t, voteCh, height, round) // precommit
  413. // the proposed block should still be locked and our precommit added
  414. // we should precommit nil and be locked on the proposal
  415. validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, theBlockHash)
  416. // add conflicting precommit from vs2
  417. bps2, err := rs.LockedBlock.MakePartSet(partSize)
  418. require.NoError(t, err)
  419. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, hash, bps2.Header(), vs2)
  420. ensurePrecommit(t, voteCh, height, round)
  421. // (note we're entering precommit for a second time this round, but with invalid args
  422. // then we enterPrecommitWait and timeout into NewRound
  423. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  424. round++ // entering new round
  425. ensureNewRound(t, newRoundCh, height, round)
  426. t.Log("#### ONTO ROUND 2")
  427. /*
  428. Round3 (vs2, _) // B, B2
  429. */
  430. incrementRound(vs2)
  431. ensureNewProposal(t, proposalCh, height, round)
  432. rs = cs1.GetRoundState()
  433. // now we're on a new round and are the proposer
  434. require.True(t, bytes.Equal(rs.ProposalBlock.Hash(), rs.LockedBlock.Hash()),
  435. "Expected proposal block to be locked block. Got %v, Expected %v",
  436. rs.ProposalBlock,
  437. rs.LockedBlock)
  438. ensurePrevote(t, voteCh, height, round) // prevote
  439. validatePrevote(ctx, t, cs1, round, vss[0], rs.LockedBlock.Hash())
  440. bps0, err := rs.ProposalBlock.MakePartSet(partSize)
  441. require.NoError(t, err)
  442. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, hash, bps0.Header(), vs2)
  443. ensurePrevote(t, voteCh, height, round)
  444. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds())
  445. ensurePrecommit(t, voteCh, height, round) // precommit
  446. validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, theBlockHash) // precommit nil but be locked on proposal
  447. bps1, err := rs.ProposalBlock.MakePartSet(partSize)
  448. require.NoError(t, err)
  449. signAddVotes(
  450. ctx,
  451. t,
  452. config,
  453. cs1,
  454. tmproto.PrecommitType,
  455. hash,
  456. bps1.Header(),
  457. vs2) // NOTE: conflicting precommits at same height
  458. ensurePrecommit(t, voteCh, height, round)
  459. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  460. // needed so generated block is different than locked block
  461. cs2, _ := randState(ctx, t, config, log.TestingLogger(), 2)
  462. require.NoError(t, err)
  463. // before we time out into new round, set next proposal block
  464. prop, propBlock := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round+1)
  465. if prop == nil || propBlock == nil {
  466. t.Fatal("Failed to create proposal block with vs2")
  467. }
  468. incrementRound(vs2)
  469. round++ // entering new round
  470. ensureNewRound(t, newRoundCh, height, round)
  471. t.Log("#### ONTO ROUND 3")
  472. /*
  473. Round4 (vs2, C) // B C // B C
  474. */
  475. // now we're on a new round and not the proposer
  476. // so set the proposal block
  477. bps3, err := propBlock.MakePartSet(partSize)
  478. require.NoError(t, err)
  479. if err := cs1.SetProposalAndBlock(ctx, prop, propBlock, bps3, ""); err != nil {
  480. t.Fatal(err)
  481. }
  482. ensureNewProposal(t, proposalCh, height, round)
  483. ensurePrevote(t, voteCh, height, round) // prevote
  484. // prevote for locked block (not proposal)
  485. validatePrevote(ctx, t, cs1, 3, vss[0], cs1.LockedBlock.Hash())
  486. // prevote for proposed block
  487. bps4, err := propBlock.MakePartSet(partSize)
  488. require.NoError(t, err)
  489. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlock.Hash(), bps4.Header(), vs2)
  490. ensurePrevote(t, voteCh, height, round)
  491. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds())
  492. ensurePrecommit(t, voteCh, height, round)
  493. validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, theBlockHash) // precommit nil but locked on proposal
  494. bps5, err := propBlock.MakePartSet(partSize)
  495. require.NoError(t, err)
  496. signAddVotes(
  497. ctx,
  498. t,
  499. config,
  500. cs1,
  501. tmproto.PrecommitType,
  502. propBlock.Hash(),
  503. bps5.Header(),
  504. vs2) // NOTE: conflicting precommits at same height
  505. ensurePrecommit(t, voteCh, height, round)
  506. }
  507. // 4 vals in two rounds,
  508. // in round one: v1 precommits, other 3 only prevote so the block isn't committed
  509. // in round two: v1 prevotes the same block that the node is locked on
  510. // the others prevote a new block hence v1 changes lock and precommits the new block with the others
  511. func TestStateLockPOLRelock(t *testing.T) {
  512. config := configSetup(t)
  513. logger := log.TestingLogger()
  514. ctx, cancel := context.WithCancel(context.Background())
  515. defer cancel()
  516. cs1, vss := randState(ctx, t, config, logger, 4)
  517. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  518. height, round := cs1.Height, cs1.Round
  519. partSize := types.BlockPartSizeBytes
  520. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  521. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  522. pv1, err := cs1.privValidator.GetPubKey(ctx)
  523. require.NoError(t, err)
  524. addr := pv1.Address()
  525. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  526. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  527. newBlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewBlockHeader)
  528. // everything done from perspective of cs1
  529. /*
  530. Round1 (cs1, B) // B B B B// B nil B nil
  531. eg. vs2 and vs4 didn't see the 2/3 prevotes
  532. */
  533. // start round and wait for propose and prevote
  534. startTestRound(ctx, cs1, height, round)
  535. ensureNewRound(t, newRoundCh, height, round)
  536. ensureNewProposal(t, proposalCh, height, round)
  537. rs := cs1.GetRoundState()
  538. theBlockHash := rs.ProposalBlock.Hash()
  539. theBlockParts := rs.ProposalBlockParts.Header()
  540. ensurePrevote(t, voteCh, height, round) // prevote
  541. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, theBlockHash, theBlockParts, vs2, vs3, vs4)
  542. ensurePrecommit(t, voteCh, height, round) // our precommit
  543. // the proposed block should now be locked and our precommit added
  544. validatePrecommit(ctx, t, cs1, round, round, vss[0], theBlockHash, theBlockHash)
  545. // add precommits from the rest
  546. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  547. // before we timeout to the new round set the new proposal
  548. cs2 := newState(ctx, t, logger, cs1.state, vs2, kvstore.NewApplication())
  549. prop, propBlock := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round+1)
  550. if prop == nil || propBlock == nil {
  551. t.Fatal("Failed to create proposal block with vs2")
  552. }
  553. propBlockParts, err := propBlock.MakePartSet(partSize)
  554. require.NoError(t, err)
  555. propBlockHash := propBlock.Hash()
  556. require.NotEqual(t, propBlockHash, theBlockHash)
  557. incrementRound(vs2, vs3, vs4)
  558. // timeout to new round
  559. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  560. round++ // moving to the next round
  561. //XXX: this isnt guaranteed to get there before the timeoutPropose ...
  562. if err := cs1.SetProposalAndBlock(ctx, prop, propBlock, propBlockParts, "some peer"); err != nil {
  563. t.Fatal(err)
  564. }
  565. ensureNewRound(t, newRoundCh, height, round)
  566. t.Log("### ONTO ROUND 1")
  567. /*
  568. Round2 (vs2, C) // B C C C // C C C _)
  569. cs1 changes lock!
  570. */
  571. // now we're on a new round and not the proposer
  572. // but we should receive the proposal
  573. ensureNewProposal(t, proposalCh, height, round)
  574. // go to prevote, node should prevote for locked block (not the new proposal) - this is relocking
  575. ensurePrevoteMatch(t, voteCh, height, round, theBlockHash)
  576. // now lets add prevotes from everyone else for the new block
  577. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlockHash, propBlockParts.Header(), vs2, vs3, vs4)
  578. ensurePrecommit(t, voteCh, height, round)
  579. // we should have unlocked and locked on the new block, sending a precommit for this new block
  580. validatePrecommit(ctx, t, cs1, round, round, vss[0], propBlockHash, propBlockHash)
  581. // more prevote creating a majority on the new block and this is then committed
  582. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, propBlockHash, propBlockParts.Header(), vs2, vs3)
  583. ensureNewBlockHeader(t, newBlockCh, height, propBlockHash)
  584. ensureNewRound(t, newRoundCh, height+1, 0)
  585. }
  586. // 4 vals, one precommits, other 3 polka at next round, so we unlock and precomit the polka
  587. func TestStateLockPOLUnlock(t *testing.T) {
  588. config := configSetup(t)
  589. ctx, cancel := context.WithCancel(context.Background())
  590. defer cancel()
  591. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  592. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  593. height, round := cs1.Height, cs1.Round
  594. partSize := types.BlockPartSizeBytes
  595. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  596. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  597. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  598. unlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryUnlock)
  599. pv1, err := cs1.privValidator.GetPubKey(ctx)
  600. require.NoError(t, err)
  601. addr := pv1.Address()
  602. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  603. // everything done from perspective of cs1
  604. /*
  605. Round1 (cs1, B) // B B B B // B nil B nil
  606. eg. didn't see the 2/3 prevotes
  607. */
  608. // start round and wait for propose and prevote
  609. startTestRound(ctx, cs1, height, round)
  610. ensureNewRound(t, newRoundCh, height, round)
  611. ensureNewProposal(t, proposalCh, height, round)
  612. rs := cs1.GetRoundState()
  613. theBlockHash := rs.ProposalBlock.Hash()
  614. theBlockParts := rs.ProposalBlockParts.Header()
  615. ensurePrevoteMatch(t, voteCh, height, round, theBlockHash)
  616. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, theBlockHash, theBlockParts, vs2, vs3, vs4)
  617. ensurePrecommit(t, voteCh, height, round)
  618. // the proposed block should now be locked and our precommit added
  619. validatePrecommit(ctx, t, cs1, round, round, vss[0], theBlockHash, theBlockHash)
  620. // add precommits from the rest
  621. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs4)
  622. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, theBlockHash, theBlockParts, vs3)
  623. // before we time out into new round, set next proposal block
  624. prop, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round+1)
  625. propBlockParts, err := propBlock.MakePartSet(partSize)
  626. require.NoError(t, err)
  627. // timeout to new round
  628. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  629. rs = cs1.GetRoundState()
  630. lockedBlockHash := rs.LockedBlock.Hash()
  631. incrementRound(vs2, vs3, vs4)
  632. round++ // moving to the next round
  633. ensureNewRound(t, newRoundCh, height, round)
  634. t.Log("#### ONTO ROUND 1")
  635. /*
  636. Round2 (vs2, C) // B nil nil nil // nil nil nil _
  637. cs1 unlocks!
  638. */
  639. //XXX: this isnt guaranteed to get there before the timeoutPropose ...
  640. if err := cs1.SetProposalAndBlock(ctx, prop, propBlock, propBlockParts, "some peer"); err != nil {
  641. t.Fatal(err)
  642. }
  643. ensureNewProposal(t, proposalCh, height, round)
  644. // go to prevote, prevote for locked block (not proposal)
  645. ensurePrevoteMatch(t, voteCh, height, round, lockedBlockHash)
  646. // now lets add prevotes from everyone else for nil (a polka!)
  647. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  648. // the polka makes us unlock and precommit nil
  649. ensureNewUnlock(t, unlockCh, height, round)
  650. ensurePrecommit(t, voteCh, height, round)
  651. // we should have unlocked and committed nil
  652. // NOTE: since we don't relock on nil, the lock round is -1
  653. validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
  654. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3)
  655. ensureNewRound(t, newRoundCh, height, round+1)
  656. }
  657. // 4 vals, v1 locks on proposed block in the first round but the other validators only prevote
  658. // In the second round, v1 misses the proposal but sees a majority prevote an unknown block so
  659. // v1 should unlock and precommit nil. In the third round another block is proposed, all vals
  660. // prevote and now v1 can lock onto the third block and precommit that
  661. func TestStateLockPOLUnlockOnUnknownBlock(t *testing.T) {
  662. config := configSetup(t)
  663. logger := log.TestingLogger()
  664. ctx, cancel := context.WithCancel(context.Background())
  665. defer cancel()
  666. cs1, vss := randState(ctx, t, config, logger, 4)
  667. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  668. height, round := cs1.Height, cs1.Round
  669. partSize := types.BlockPartSizeBytes
  670. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  671. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  672. pv1, err := cs1.privValidator.GetPubKey(ctx)
  673. require.NoError(t, err)
  674. addr := pv1.Address()
  675. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  676. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  677. // everything done from perspective of cs1
  678. /*
  679. Round0 (cs1, A) // A A A A// A nil nil nil
  680. */
  681. // start round and wait for propose and prevote
  682. startTestRound(ctx, cs1, height, round)
  683. ensureNewRound(t, newRoundCh, height, round)
  684. ensureNewProposal(t, proposalCh, height, round)
  685. rs := cs1.GetRoundState()
  686. firstBlockHash := rs.ProposalBlock.Hash()
  687. firstBlockParts := rs.ProposalBlockParts.Header()
  688. ensurePrevote(t, voteCh, height, round) // prevote
  689. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, firstBlockHash, firstBlockParts, vs2, vs3, vs4)
  690. ensurePrecommit(t, voteCh, height, round) // our precommit
  691. // the proposed block should now be locked and our precommit added
  692. validatePrecommit(ctx, t, cs1, round, round, vss[0], firstBlockHash, firstBlockHash)
  693. // add precommits from the rest
  694. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  695. // before we timeout to the new round set the new proposal
  696. cs2 := newState(ctx, t, logger, cs1.state, vs2, kvstore.NewApplication())
  697. prop, propBlock := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round+1)
  698. if prop == nil || propBlock == nil {
  699. t.Fatal("Failed to create proposal block with vs2")
  700. }
  701. secondBlockParts, err := propBlock.MakePartSet(partSize)
  702. require.NoError(t, err)
  703. secondBlockHash := propBlock.Hash()
  704. require.NotEqual(t, secondBlockHash, firstBlockHash)
  705. incrementRound(vs2, vs3, vs4)
  706. // timeout to new round
  707. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  708. round++ // moving to the next round
  709. ensureNewRound(t, newRoundCh, height, round)
  710. t.Log("### ONTO ROUND 1")
  711. /*
  712. Round1 (vs2, B) // A B B B // nil nil nil nil)
  713. */
  714. // now we're on a new round but v1 misses the proposal
  715. // go to prevote, node should prevote for locked block (not the new proposal) - this is relocking
  716. ensurePrevoteMatch(t, voteCh, height, round, firstBlockHash)
  717. // now lets add prevotes from everyone else for the new block
  718. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, secondBlockHash, secondBlockParts.Header(), vs2, vs3, vs4)
  719. ensurePrecommit(t, voteCh, height, round)
  720. // we should have unlocked and locked on the new block, sending a precommit for this new block
  721. validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
  722. if err := cs1.SetProposalAndBlock(ctx, prop, propBlock, secondBlockParts, "some peer"); err != nil {
  723. t.Fatal(err)
  724. }
  725. // more prevote creating a majority on the new block and this is then committed
  726. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  727. // before we timeout to the new round set the new proposal
  728. cs3 := newState(ctx, t, logger, cs1.state, vs3, kvstore.NewApplication())
  729. require.NoError(t, err)
  730. prop, propBlock = decideProposal(ctx, t, cs3, vs3, vs3.Height, vs3.Round+1)
  731. if prop == nil || propBlock == nil {
  732. t.Fatal("Failed to create proposal block with vs2")
  733. }
  734. thirdPropBlockParts, err := propBlock.MakePartSet(partSize)
  735. require.NoError(t, err)
  736. thirdPropBlockHash := propBlock.Hash()
  737. require.NotEqual(t, secondBlockHash, thirdPropBlockHash)
  738. incrementRound(vs2, vs3, vs4)
  739. // timeout to new round
  740. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  741. round++ // moving to the next round
  742. ensureNewRound(t, newRoundCh, height, round)
  743. t.Log("### ONTO ROUND 2")
  744. /*
  745. Round2 (vs3, C) // C C C C // C nil nil nil)
  746. */
  747. if err := cs1.SetProposalAndBlock(ctx, prop, propBlock, thirdPropBlockParts, "some peer"); err != nil {
  748. t.Fatal(err)
  749. }
  750. ensurePrevote(t, voteCh, height, round)
  751. // we are no longer locked to the first block so we should be able to prevote
  752. validatePrevote(ctx, t, cs1, round, vss[0], thirdPropBlockHash)
  753. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, thirdPropBlockHash, thirdPropBlockParts.Header(), vs2, vs3, vs4)
  754. ensurePrecommit(t, voteCh, height, round)
  755. // we have a majority, now vs1 can change lock to the third block
  756. validatePrecommit(ctx, t, cs1, round, round, vss[0], thirdPropBlockHash, thirdPropBlockHash)
  757. }
  758. // 4 vals
  759. // a polka at round 1 but we miss it
  760. // then a polka at round 2 that we lock on
  761. // then we see the polka from round 1 but shouldn't unlock
  762. func TestStateLockPOLSafety1(t *testing.T) {
  763. config := configSetup(t)
  764. ctx, cancel := context.WithCancel(context.Background())
  765. defer cancel()
  766. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  767. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  768. height, round := cs1.Height, cs1.Round
  769. partSize := types.BlockPartSizeBytes
  770. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  771. timeoutProposeCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutPropose)
  772. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  773. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  774. pv1, err := cs1.privValidator.GetPubKey(ctx)
  775. require.NoError(t, err)
  776. addr := pv1.Address()
  777. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  778. // start round and wait for propose and prevote
  779. startTestRound(ctx, cs1, cs1.Height, round)
  780. ensureNewRound(t, newRoundCh, height, round)
  781. ensureNewProposal(t, proposalCh, height, round)
  782. rs := cs1.GetRoundState()
  783. propBlock := rs.ProposalBlock
  784. ensurePrevoteMatch(t, voteCh, height, round, propBlock.Hash())
  785. // the others sign a polka but we don't see it
  786. bps, err := propBlock.MakePartSet(partSize)
  787. require.NoError(t, err)
  788. prevotes := signVotes(ctx, t, config, tmproto.PrevoteType,
  789. propBlock.Hash(), bps.Header(),
  790. vs2, vs3, vs4)
  791. t.Logf("old prop hash %v", fmt.Sprintf("%X", propBlock.Hash()))
  792. // we do see them precommit nil
  793. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  794. // cs1 precommit nil
  795. ensurePrecommit(t, voteCh, height, round)
  796. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  797. t.Log("### ONTO ROUND 1")
  798. prop, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round+1)
  799. propBlockHash := propBlock.Hash()
  800. propBlockParts, err := propBlock.MakePartSet(partSize)
  801. require.NoError(t, err)
  802. incrementRound(vs2, vs3, vs4)
  803. round++ // moving to the next round
  804. ensureNewRound(t, newRoundCh, height, round)
  805. //XXX: this isnt guaranteed to get there before the timeoutPropose ...
  806. if err := cs1.SetProposalAndBlock(ctx, prop, propBlock, propBlockParts, "some peer"); err != nil {
  807. t.Fatal(err)
  808. }
  809. /*Round2
  810. // we timeout and prevote our lock
  811. // a polka happened but we didn't see it!
  812. */
  813. ensureNewProposal(t, proposalCh, height, round)
  814. rs = cs1.GetRoundState()
  815. require.Nil(t, rs.LockedBlock, "we should not be locked!")
  816. t.Logf("new prop hash %v", fmt.Sprintf("%X", propBlockHash))
  817. // go to prevote, prevote for proposal block
  818. ensurePrevoteMatch(t, voteCh, height, round, propBlockHash)
  819. // now we see the others prevote for it, so we should lock on it
  820. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlockHash, propBlockParts.Header(), vs2, vs3, vs4)
  821. ensurePrecommit(t, voteCh, height, round)
  822. // we should have precommitted
  823. validatePrecommit(ctx, t, cs1, round, round, vss[0], propBlockHash, propBlockHash)
  824. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  825. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  826. incrementRound(vs2, vs3, vs4)
  827. round++ // moving to the next round
  828. ensureNewRound(t, newRoundCh, height, round)
  829. t.Log("### ONTO ROUND 2")
  830. /*Round3
  831. we see the polka from round 1 but we shouldn't unlock!
  832. */
  833. // timeout of propose
  834. ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds())
  835. // finish prevote
  836. // we should prevote what we're locked on
  837. ensurePrevoteMatch(t, voteCh, height, round, propBlockHash)
  838. newStepCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRoundStep)
  839. // before prevotes from the previous round are added
  840. // add prevotes from the earlier round
  841. addVotes(cs1, prevotes...)
  842. t.Log("Done adding prevotes!")
  843. ensureNoNewRoundStep(t, newStepCh)
  844. }
  845. // 4 vals.
  846. // polka P0 at R0, P1 at R1, and P2 at R2,
  847. // we lock on P0 at R0, don't see P1, and unlock using P2 at R2
  848. // then we should make sure we don't lock using P1
  849. // What we want:
  850. // dont see P0, lock on P1 at R1, dont unlock using P0 at R2
  851. func TestStateLockPOLSafety2(t *testing.T) {
  852. config := configSetup(t)
  853. ctx, cancel := context.WithCancel(context.Background())
  854. defer cancel()
  855. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  856. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  857. height, round := cs1.Height, cs1.Round
  858. partSize := types.BlockPartSizeBytes
  859. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  860. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  861. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  862. unlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryUnlock)
  863. pv1, err := cs1.privValidator.GetPubKey(ctx)
  864. require.NoError(t, err)
  865. addr := pv1.Address()
  866. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  867. // the block for R0: gets polkad but we miss it
  868. // (even though we signed it, shhh)
  869. _, propBlock0 := decideProposal(ctx, t, cs1, vss[0], height, round)
  870. propBlockHash0 := propBlock0.Hash()
  871. propBlockParts0, err := propBlock0.MakePartSet(partSize)
  872. require.NoError(t, err)
  873. propBlockID0 := types.BlockID{Hash: propBlockHash0, PartSetHeader: propBlockParts0.Header()}
  874. // the others sign a polka but we don't see it
  875. prevotes := signVotes(ctx, t, config, tmproto.PrevoteType, propBlockHash0, propBlockParts0.Header(), vs2, vs3, vs4)
  876. // the block for round 1
  877. prop1, propBlock1 := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round+1)
  878. propBlockHash1 := propBlock1.Hash()
  879. propBlockParts1, err := propBlock1.MakePartSet(partSize)
  880. require.NoError(t, err)
  881. incrementRound(vs2, vs3, vs4)
  882. round++ // moving to the next round
  883. t.Log("### ONTO Round 1")
  884. // jump in at round 1
  885. startTestRound(ctx, cs1, height, round)
  886. ensureNewRound(t, newRoundCh, height, round)
  887. if err := cs1.SetProposalAndBlock(ctx, prop1, propBlock1, propBlockParts1, "some peer"); err != nil {
  888. t.Fatal(err)
  889. }
  890. ensureNewProposal(t, proposalCh, height, round)
  891. ensurePrevoteMatch(t, voteCh, height, round, propBlockHash1)
  892. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlockHash1, propBlockParts1.Header(), vs2, vs3, vs4)
  893. ensurePrecommit(t, voteCh, height, round)
  894. // the proposed block should now be locked and our precommit added
  895. validatePrecommit(ctx, t, cs1, round, round, vss[0], propBlockHash1, propBlockHash1)
  896. // add precommits from the rest
  897. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs4)
  898. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, propBlockHash1, propBlockParts1.Header(), vs3)
  899. incrementRound(vs2, vs3, vs4)
  900. // timeout of precommit wait to new round
  901. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  902. round++ // moving to the next round
  903. // in round 2 we see the polkad block from round 0
  904. newProp := types.NewProposal(height, round, 0, propBlockID0)
  905. p := newProp.ToProto()
  906. if err := vs3.SignProposal(ctx, config.ChainID(), p); err != nil {
  907. t.Fatal(err)
  908. }
  909. newProp.Signature = p.Signature
  910. if err := cs1.SetProposalAndBlock(ctx, newProp, propBlock0, propBlockParts0, "some peer"); err != nil {
  911. t.Fatal(err)
  912. }
  913. // Add the pol votes
  914. addVotes(cs1, prevotes...)
  915. ensureNewRound(t, newRoundCh, height, round)
  916. t.Log("### ONTO Round 2")
  917. /*Round2
  918. // now we see the polka from round 1, but we shouldnt unlock
  919. */
  920. ensureNewProposal(t, proposalCh, height, round)
  921. ensureNoNewUnlock(t, unlockCh)
  922. ensurePrevoteMatch(t, voteCh, height, round, propBlockHash1)
  923. }
  924. // 4 vals.
  925. // polka P0 at R0 for B0. We lock B0 on P0 at R0. P0 unlocks value at R1.
  926. // What we want:
  927. // P0 proposes B0 at R3.
  928. func TestProposeValidBlock(t *testing.T) {
  929. config := configSetup(t)
  930. ctx, cancel := context.WithCancel(context.Background())
  931. defer cancel()
  932. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  933. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  934. height, round := cs1.Height, cs1.Round
  935. partSize := types.BlockPartSizeBytes
  936. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  937. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  938. timeoutProposeCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutPropose)
  939. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  940. unlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryUnlock)
  941. pv1, err := cs1.privValidator.GetPubKey(ctx)
  942. require.NoError(t, err)
  943. addr := pv1.Address()
  944. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  945. // start round and wait for propose and prevote
  946. startTestRound(ctx, cs1, cs1.Height, round)
  947. ensureNewRound(t, newRoundCh, height, round)
  948. ensureNewProposal(t, proposalCh, height, round)
  949. rs := cs1.GetRoundState()
  950. propBlock := rs.ProposalBlock
  951. propBlockHash := propBlock.Hash()
  952. ensurePrevoteMatch(t, voteCh, height, round, propBlockHash)
  953. // the others sign a polka
  954. bps, err := propBlock.MakePartSet(partSize)
  955. require.NoError(t, err)
  956. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType,
  957. propBlockHash, bps.Header(), vs2,
  958. vs3, vs4)
  959. ensurePrecommit(t, voteCh, height, round)
  960. // we should have precommitted
  961. validatePrecommit(ctx, t, cs1, round, round, vss[0], propBlockHash, propBlockHash)
  962. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  963. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  964. incrementRound(vs2, vs3, vs4)
  965. round++ // moving to the next round
  966. ensureNewRound(t, newRoundCh, height, round)
  967. t.Log("### ONTO ROUND 2")
  968. // timeout of propose
  969. ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds())
  970. ensurePrevoteMatch(t, voteCh, height, round, propBlockHash)
  971. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  972. ensureNewUnlock(t, unlockCh, height, round)
  973. ensurePrecommit(t, voteCh, height, round)
  974. // we should have precommitted
  975. validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
  976. incrementRound(vs2, vs3, vs4)
  977. incrementRound(vs2, vs3, vs4)
  978. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  979. round += 2 // moving to the next round
  980. ensureNewRound(t, newRoundCh, height, round)
  981. t.Log("### ONTO ROUND 3")
  982. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  983. round++ // moving to the next round
  984. ensureNewRound(t, newRoundCh, height, round)
  985. t.Log("### ONTO ROUND 4")
  986. ensureNewProposal(t, proposalCh, height, round)
  987. rs = cs1.GetRoundState()
  988. assert.True(t, bytes.Equal(rs.ProposalBlock.Hash(), propBlockHash))
  989. assert.True(t, bytes.Equal(rs.ProposalBlock.Hash(), rs.ValidBlock.Hash()))
  990. assert.True(t, rs.Proposal.POLRound == rs.ValidRound)
  991. assert.True(t, bytes.Equal(rs.Proposal.BlockID.Hash, rs.ValidBlock.Hash()))
  992. }
  993. // What we want:
  994. // P0 miss to lock B but set valid block to B after receiving delayed prevote.
  995. func TestSetValidBlockOnDelayedPrevote(t *testing.T) {
  996. config := configSetup(t)
  997. ctx, cancel := context.WithCancel(context.Background())
  998. defer cancel()
  999. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1000. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1001. height, round := cs1.Height, cs1.Round
  1002. partSize := types.BlockPartSizeBytes
  1003. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  1004. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  1005. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1006. validBlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryValidBlock)
  1007. pv1, err := cs1.privValidator.GetPubKey(ctx)
  1008. require.NoError(t, err)
  1009. addr := pv1.Address()
  1010. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  1011. // start round and wait for propose and prevote
  1012. startTestRound(ctx, cs1, cs1.Height, round)
  1013. ensureNewRound(t, newRoundCh, height, round)
  1014. ensureNewProposal(t, proposalCh, height, round)
  1015. rs := cs1.GetRoundState()
  1016. propBlock := rs.ProposalBlock
  1017. propBlockHash := propBlock.Hash()
  1018. propBlockParts, err := propBlock.MakePartSet(partSize)
  1019. require.NoError(t, err)
  1020. ensurePrevoteMatch(t, voteCh, height, round, propBlockHash)
  1021. // vs2 send prevote for propBlock
  1022. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlockHash, propBlockParts.Header(), vs2)
  1023. // vs3 send prevote nil
  1024. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, nil, types.PartSetHeader{}, vs3)
  1025. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds())
  1026. ensurePrecommit(t, voteCh, height, round)
  1027. // we should have precommitted
  1028. validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
  1029. rs = cs1.GetRoundState()
  1030. assert.True(t, rs.ValidBlock == nil)
  1031. assert.True(t, rs.ValidBlockParts == nil)
  1032. assert.True(t, rs.ValidRound == -1)
  1033. // vs2 send (delayed) prevote for propBlock
  1034. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlockHash, propBlockParts.Header(), vs4)
  1035. ensureNewValidBlock(t, validBlockCh, height, round)
  1036. rs = cs1.GetRoundState()
  1037. assert.True(t, bytes.Equal(rs.ValidBlock.Hash(), propBlockHash))
  1038. assert.True(t, rs.ValidBlockParts.Header().Equals(propBlockParts.Header()))
  1039. assert.True(t, rs.ValidRound == round)
  1040. }
  1041. // What we want:
  1042. // P0 miss to lock B as Proposal Block is missing, but set valid block to B after
  1043. // receiving delayed Block Proposal.
  1044. func TestSetValidBlockOnDelayedProposal(t *testing.T) {
  1045. config := configSetup(t)
  1046. ctx, cancel := context.WithCancel(context.Background())
  1047. defer cancel()
  1048. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1049. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1050. height, round := cs1.Height, cs1.Round
  1051. partSize := types.BlockPartSizeBytes
  1052. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  1053. timeoutProposeCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutPropose)
  1054. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1055. validBlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryValidBlock)
  1056. pv1, err := cs1.privValidator.GetPubKey(ctx)
  1057. require.NoError(t, err)
  1058. addr := pv1.Address()
  1059. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  1060. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  1061. round++ // move to round in which P0 is not proposer
  1062. incrementRound(vs2, vs3, vs4)
  1063. startTestRound(ctx, cs1, cs1.Height, round)
  1064. ensureNewRound(t, newRoundCh, height, round)
  1065. ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds())
  1066. ensurePrevoteMatch(t, voteCh, height, round, nil)
  1067. prop, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round+1)
  1068. propBlockHash := propBlock.Hash()
  1069. propBlockParts, err := propBlock.MakePartSet(partSize)
  1070. require.NoError(t, err)
  1071. // vs2, vs3 and vs4 send prevote for propBlock
  1072. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlockHash, propBlockParts.Header(), vs2, vs3, vs4)
  1073. ensureNewValidBlock(t, validBlockCh, height, round)
  1074. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds())
  1075. ensurePrecommit(t, voteCh, height, round)
  1076. validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
  1077. if err := cs1.SetProposalAndBlock(ctx, prop, propBlock, propBlockParts, "some peer"); err != nil {
  1078. t.Fatal(err)
  1079. }
  1080. ensureNewProposal(t, proposalCh, height, round)
  1081. rs := cs1.GetRoundState()
  1082. assert.True(t, bytes.Equal(rs.ValidBlock.Hash(), propBlockHash))
  1083. assert.True(t, rs.ValidBlockParts.Header().Equals(propBlockParts.Header()))
  1084. assert.True(t, rs.ValidRound == round)
  1085. }
  1086. // 4 vals, 3 Nil Precommits at P0
  1087. // What we want:
  1088. // P0 waits for timeoutPrecommit before starting next round
  1089. func TestWaitingTimeoutOnNilPolka(t *testing.T) {
  1090. config := configSetup(t)
  1091. ctx, cancel := context.WithCancel(context.Background())
  1092. defer cancel()
  1093. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1094. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1095. height, round := cs1.Height, cs1.Round
  1096. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  1097. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1098. // start round
  1099. startTestRound(ctx, cs1, height, round)
  1100. ensureNewRound(t, newRoundCh, height, round)
  1101. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  1102. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  1103. ensureNewRound(t, newRoundCh, height, round+1)
  1104. }
  1105. // 4 vals, 3 Prevotes for nil from the higher round.
  1106. // What we want:
  1107. // P0 waits for timeoutPropose in the next round before entering prevote
  1108. func TestWaitingTimeoutProposeOnNewRound(t *testing.T) {
  1109. config := configSetup(t)
  1110. ctx, cancel := context.WithCancel(context.Background())
  1111. defer cancel()
  1112. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1113. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1114. height, round := cs1.Height, cs1.Round
  1115. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutPropose)
  1116. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1117. pv1, err := cs1.privValidator.GetPubKey(ctx)
  1118. require.NoError(t, err)
  1119. addr := pv1.Address()
  1120. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  1121. // start round
  1122. startTestRound(ctx, cs1, height, round)
  1123. ensureNewRound(t, newRoundCh, height, round)
  1124. ensurePrevote(t, voteCh, height, round)
  1125. incrementRound(vss[1:]...)
  1126. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  1127. round++ // moving to the next round
  1128. ensureNewRound(t, newRoundCh, height, round)
  1129. rs := cs1.GetRoundState()
  1130. assert.True(t, rs.Step == cstypes.RoundStepPropose) // P0 does not prevote before timeoutPropose expires
  1131. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Propose(round).Nanoseconds())
  1132. ensurePrevoteMatch(t, voteCh, height, round, nil)
  1133. }
  1134. // 4 vals, 3 Precommits for nil from the higher round.
  1135. // What we want:
  1136. // P0 jump to higher round, precommit and start precommit wait
  1137. func TestRoundSkipOnNilPolkaFromHigherRound(t *testing.T) {
  1138. config := configSetup(t)
  1139. ctx, cancel := context.WithCancel(context.Background())
  1140. defer cancel()
  1141. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1142. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1143. height, round := cs1.Height, cs1.Round
  1144. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  1145. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1146. pv1, err := cs1.privValidator.GetPubKey(ctx)
  1147. require.NoError(t, err)
  1148. addr := pv1.Address()
  1149. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  1150. // start round
  1151. startTestRound(ctx, cs1, height, round)
  1152. ensureNewRound(t, newRoundCh, height, round)
  1153. ensurePrevote(t, voteCh, height, round)
  1154. incrementRound(vss[1:]...)
  1155. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  1156. round++ // moving to the next round
  1157. ensureNewRound(t, newRoundCh, height, round)
  1158. ensurePrecommit(t, voteCh, height, round)
  1159. validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
  1160. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  1161. round++ // moving to the next round
  1162. ensureNewRound(t, newRoundCh, height, round)
  1163. }
  1164. // 4 vals, 3 Prevotes for nil in the current round.
  1165. // What we want:
  1166. // P0 wait for timeoutPropose to expire before sending prevote.
  1167. func TestWaitTimeoutProposeOnNilPolkaForTheCurrentRound(t *testing.T) {
  1168. config := configSetup(t)
  1169. ctx, cancel := context.WithCancel(context.Background())
  1170. defer cancel()
  1171. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1172. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1173. height, round := cs1.Height, int32(1)
  1174. timeoutProposeCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutPropose)
  1175. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1176. pv1, err := cs1.privValidator.GetPubKey(ctx)
  1177. require.NoError(t, err)
  1178. addr := pv1.Address()
  1179. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  1180. // start round in which PO is not proposer
  1181. startTestRound(ctx, cs1, height, round)
  1182. ensureNewRound(t, newRoundCh, height, round)
  1183. incrementRound(vss[1:]...)
  1184. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, nil, types.PartSetHeader{}, vs2, vs3, vs4)
  1185. ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds())
  1186. ensurePrevoteMatch(t, voteCh, height, round, nil)
  1187. }
  1188. // What we want:
  1189. // P0 emit NewValidBlock event upon receiving 2/3+ Precommit for B but hasn't received block B yet
  1190. func TestEmitNewValidBlockEventOnCommitWithoutBlock(t *testing.T) {
  1191. config := configSetup(t)
  1192. ctx, cancel := context.WithCancel(context.Background())
  1193. defer cancel()
  1194. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1195. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1196. height, round := cs1.Height, int32(1)
  1197. incrementRound(vs2, vs3, vs4)
  1198. partSize := types.BlockPartSizeBytes
  1199. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1200. validBlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryValidBlock)
  1201. _, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round)
  1202. propBlockHash := propBlock.Hash()
  1203. propBlockParts, err := propBlock.MakePartSet(partSize)
  1204. require.NoError(t, err)
  1205. // start round in which PO is not proposer
  1206. startTestRound(ctx, cs1, height, round)
  1207. ensureNewRound(t, newRoundCh, height, round)
  1208. // vs2, vs3 and vs4 send precommit for propBlock
  1209. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, propBlockHash, propBlockParts.Header(), vs2, vs3, vs4)
  1210. ensureNewValidBlock(t, validBlockCh, height, round)
  1211. rs := cs1.GetRoundState()
  1212. assert.True(t, rs.Step == cstypes.RoundStepCommit)
  1213. assert.True(t, rs.ProposalBlock == nil)
  1214. assert.True(t, rs.ProposalBlockParts.Header().Equals(propBlockParts.Header()))
  1215. }
  1216. // What we want:
  1217. // P0 receives 2/3+ Precommit for B for round 0, while being in round 1. It emits NewValidBlock event.
  1218. // After receiving block, it executes block and moves to the next height.
  1219. func TestCommitFromPreviousRound(t *testing.T) {
  1220. config := configSetup(t)
  1221. ctx, cancel := context.WithCancel(context.Background())
  1222. defer cancel()
  1223. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1224. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1225. height, round := cs1.Height, int32(1)
  1226. partSize := types.BlockPartSizeBytes
  1227. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1228. validBlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryValidBlock)
  1229. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  1230. prop, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round)
  1231. propBlockHash := propBlock.Hash()
  1232. propBlockParts, err := propBlock.MakePartSet(partSize)
  1233. require.NoError(t, err)
  1234. // start round in which PO is not proposer
  1235. startTestRound(ctx, cs1, height, round)
  1236. ensureNewRound(t, newRoundCh, height, round)
  1237. // vs2, vs3 and vs4 send precommit for propBlock for the previous round
  1238. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, propBlockHash, propBlockParts.Header(), vs2, vs3, vs4)
  1239. ensureNewValidBlock(t, validBlockCh, height, round)
  1240. rs := cs1.GetRoundState()
  1241. assert.True(t, rs.Step == cstypes.RoundStepCommit)
  1242. assert.True(t, rs.CommitRound == vs2.Round)
  1243. assert.True(t, rs.ProposalBlock == nil)
  1244. assert.True(t, rs.ProposalBlockParts.Header().Equals(propBlockParts.Header()))
  1245. if err := cs1.SetProposalAndBlock(ctx, prop, propBlock, propBlockParts, "some peer"); err != nil {
  1246. t.Fatal(err)
  1247. }
  1248. ensureNewProposal(t, proposalCh, height, round)
  1249. ensureNewRound(t, newRoundCh, height+1, 0)
  1250. }
  1251. type fakeTxNotifier struct {
  1252. ch chan struct{}
  1253. }
  1254. func (n *fakeTxNotifier) TxsAvailable() <-chan struct{} {
  1255. return n.ch
  1256. }
  1257. func (n *fakeTxNotifier) Notify() {
  1258. n.ch <- struct{}{}
  1259. }
  1260. // 2 vals precommit votes for a block but node times out waiting for the third. Move to next round
  1261. // and third precommit arrives which leads to the commit of that header and the correct
  1262. // start of the next round
  1263. func TestStartNextHeightCorrectlyAfterTimeout(t *testing.T) {
  1264. config := configSetup(t)
  1265. ctx, cancel := context.WithCancel(context.Background())
  1266. defer cancel()
  1267. config.Consensus.SkipTimeoutCommit = false
  1268. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1269. cs1.txNotifier = &fakeTxNotifier{ch: make(chan struct{})}
  1270. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1271. height, round := cs1.Height, cs1.Round
  1272. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  1273. timeoutProposeCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutPropose)
  1274. precommitTimeoutCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  1275. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1276. newBlockHeader := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewBlockHeader)
  1277. pv1, err := cs1.privValidator.GetPubKey(ctx)
  1278. require.NoError(t, err)
  1279. addr := pv1.Address()
  1280. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  1281. // start round and wait for propose and prevote
  1282. startTestRound(ctx, cs1, height, round)
  1283. ensureNewRound(t, newRoundCh, height, round)
  1284. ensureNewProposal(t, proposalCh, height, round)
  1285. rs := cs1.GetRoundState()
  1286. theBlockHash := rs.ProposalBlock.Hash()
  1287. theBlockParts := rs.ProposalBlockParts.Header()
  1288. ensurePrevoteMatch(t, voteCh, height, round, theBlockHash)
  1289. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, theBlockHash, theBlockParts, vs2, vs3, vs4)
  1290. ensurePrecommit(t, voteCh, height, round)
  1291. // the proposed block should now be locked and our precommit added
  1292. validatePrecommit(ctx, t, cs1, round, round, vss[0], theBlockHash, theBlockHash)
  1293. // add precommits
  1294. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2)
  1295. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, theBlockHash, theBlockParts, vs3)
  1296. // wait till timeout occurs
  1297. ensurePrecommitTimeout(t, precommitTimeoutCh)
  1298. ensureNewRound(t, newRoundCh, height, round+1)
  1299. // majority is now reached
  1300. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, theBlockHash, theBlockParts, vs4)
  1301. ensureNewBlockHeader(t, newBlockHeader, height, theBlockHash)
  1302. cs1.txNotifier.(*fakeTxNotifier).Notify()
  1303. ensureNewTimeout(t, timeoutProposeCh, height+1, round, cs1.config.Propose(round).Nanoseconds())
  1304. rs = cs1.GetRoundState()
  1305. assert.False(
  1306. t,
  1307. rs.TriggeredTimeoutPrecommit,
  1308. "triggeredTimeoutPrecommit should be false at the beginning of each round")
  1309. }
  1310. func TestResetTimeoutPrecommitUponNewHeight(t *testing.T) {
  1311. config := configSetup(t)
  1312. ctx, cancel := context.WithCancel(context.Background())
  1313. defer cancel()
  1314. config.Consensus.SkipTimeoutCommit = false
  1315. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1316. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1317. height, round := cs1.Height, cs1.Round
  1318. partSize := types.BlockPartSizeBytes
  1319. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  1320. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1321. newBlockHeader := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewBlockHeader)
  1322. pv1, err := cs1.privValidator.GetPubKey(ctx)
  1323. require.NoError(t, err)
  1324. addr := pv1.Address()
  1325. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  1326. // start round and wait for propose and prevote
  1327. startTestRound(ctx, cs1, height, round)
  1328. ensureNewRound(t, newRoundCh, height, round)
  1329. ensureNewProposal(t, proposalCh, height, round)
  1330. rs := cs1.GetRoundState()
  1331. theBlockHash := rs.ProposalBlock.Hash()
  1332. theBlockParts := rs.ProposalBlockParts.Header()
  1333. ensurePrevoteMatch(t, voteCh, height, round, theBlockHash)
  1334. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, theBlockHash, theBlockParts, vs2, vs3, vs4)
  1335. ensurePrecommit(t, voteCh, height, round)
  1336. validatePrecommit(ctx, t, cs1, round, round, vss[0], theBlockHash, theBlockHash)
  1337. // add precommits
  1338. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2)
  1339. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, theBlockHash, theBlockParts, vs3)
  1340. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, theBlockHash, theBlockParts, vs4)
  1341. ensureNewBlockHeader(t, newBlockHeader, height, theBlockHash)
  1342. prop, propBlock := decideProposal(ctx, t, cs1, vs2, height+1, 0)
  1343. propBlockParts, err := propBlock.MakePartSet(partSize)
  1344. require.NoError(t, err)
  1345. if err := cs1.SetProposalAndBlock(ctx, prop, propBlock, propBlockParts, "some peer"); err != nil {
  1346. t.Fatal(err)
  1347. }
  1348. ensureNewProposal(t, proposalCh, height+1, 0)
  1349. rs = cs1.GetRoundState()
  1350. assert.False(
  1351. t,
  1352. rs.TriggeredTimeoutPrecommit,
  1353. "triggeredTimeoutPrecommit should be false at the beginning of each height")
  1354. }
  1355. //------------------------------------------------------------------------------------------
  1356. // SlashingSuite
  1357. // TODO: Slashing
  1358. /*
  1359. func TestStateSlashingPrevotes(t *testing.T) {
  1360. cs1, vss := randState(2)
  1361. vs2 := vss[1]
  1362. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  1363. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  1364. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1365. voteCh := subscribeToVoter(ctx, t, cs1, cs1.privValidator.GetAddress())
  1366. // start round and wait for propose and prevote
  1367. startTestRound(cs1, cs1.Height, 0)
  1368. <-newRoundCh
  1369. re := <-proposalCh
  1370. <-voteCh // prevote
  1371. rs := re.(types.EventDataRoundState).RoundState.(*cstypes.RoundState)
  1372. // we should now be stuck in limbo forever, waiting for more prevotes
  1373. // add one for a different block should cause us to go into prevote wait
  1374. hash := rs.ProposalBlock.Hash()
  1375. hash[0] = byte(hash[0]+1) % 255
  1376. signAddVotes(cs1, tmproto.PrevoteType, hash, rs.ProposalBlockParts.Header(), vs2)
  1377. <-timeoutWaitCh
  1378. // NOTE: we have to send the vote for different block first so we don't just go into precommit round right
  1379. // away and ignore more prevotes (and thus fail to slash!)
  1380. // add the conflicting vote
  1381. signAddVotes(cs1, tmproto.PrevoteType, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), vs2)
  1382. // XXX: Check for existence of Dupeout info
  1383. }
  1384. func TestStateSlashingPrecommits(t *testing.T) {
  1385. cs1, vss := randState(2)
  1386. vs2 := vss[1]
  1387. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  1388. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  1389. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1390. voteCh := subscribeToVoter(ctx, t, cs1, cs1.privValidator.GetAddress())
  1391. // start round and wait for propose and prevote
  1392. startTestRound(cs1, cs1.Height, 0)
  1393. <-newRoundCh
  1394. re := <-proposalCh
  1395. <-voteCh // prevote
  1396. // add prevote from vs2
  1397. signAddVotes(cs1, tmproto.PrevoteType, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), vs2)
  1398. <-voteCh // precommit
  1399. // we should now be stuck in limbo forever, waiting for more prevotes
  1400. // add one for a different block should cause us to go into prevote wait
  1401. hash := rs.ProposalBlock.Hash()
  1402. hash[0] = byte(hash[0]+1) % 255
  1403. signAddVotes(cs1, tmproto.PrecommitType, hash, rs.ProposalBlockParts.Header(), vs2)
  1404. // NOTE: we have to send the vote for different block first so we don't just go into precommit round right
  1405. // away and ignore more prevotes (and thus fail to slash!)
  1406. // add precommit from vs2
  1407. signAddVotes(cs1, tmproto.PrecommitType, rs.ProposalBlock.Hash(), rs.ProposalBlockParts.Header(), vs2)
  1408. // XXX: Check for existence of Dupeout info
  1409. }
  1410. */
  1411. //------------------------------------------------------------------------------------------
  1412. // CatchupSuite
  1413. //------------------------------------------------------------------------------------------
  1414. // HaltSuite
  1415. // 4 vals.
  1416. // we receive a final precommit after going into next round, but others might have gone to commit already!
  1417. func TestStateHalt1(t *testing.T) {
  1418. config := configSetup(t)
  1419. ctx, cancel := context.WithCancel(context.Background())
  1420. defer cancel()
  1421. cs1, vss := randState(ctx, t, config, log.TestingLogger(), 4)
  1422. vs2, vs3, vs4 := vss[1], vss[2], vss[3]
  1423. height, round := cs1.Height, cs1.Round
  1424. partSize := types.BlockPartSizeBytes
  1425. proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal)
  1426. timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait)
  1427. newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound)
  1428. newBlockCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewBlock)
  1429. pv1, err := cs1.privValidator.GetPubKey(ctx)
  1430. require.NoError(t, err)
  1431. addr := pv1.Address()
  1432. voteCh := subscribeToVoter(ctx, t, cs1, addr)
  1433. // start round and wait for propose and prevote
  1434. startTestRound(ctx, cs1, height, round)
  1435. ensureNewRound(t, newRoundCh, height, round)
  1436. ensureNewProposal(t, proposalCh, height, round)
  1437. rs := cs1.GetRoundState()
  1438. propBlock := rs.ProposalBlock
  1439. propBlockParts, err := propBlock.MakePartSet(partSize)
  1440. require.NoError(t, err)
  1441. ensurePrevote(t, voteCh, height, round)
  1442. signAddVotes(ctx, t, config, cs1, tmproto.PrevoteType, propBlock.Hash(), propBlockParts.Header(), vs2, vs3, vs4)
  1443. ensurePrecommit(t, voteCh, height, round)
  1444. // the proposed block should now be locked and our precommit added
  1445. validatePrecommit(ctx, t, cs1, round, round, vss[0], propBlock.Hash(), propBlock.Hash())
  1446. // add precommits from the rest
  1447. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2) // didnt receive proposal
  1448. signAddVotes(ctx, t, config, cs1, tmproto.PrecommitType, propBlock.Hash(), propBlockParts.Header(), vs3)
  1449. // we receive this later, but vs3 might receive it earlier and with ours will go to commit!
  1450. precommit4 := signVote(ctx, t, vs4, config, tmproto.PrecommitType, propBlock.Hash(), propBlockParts.Header())
  1451. incrementRound(vs2, vs3, vs4)
  1452. // timeout to new round
  1453. ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())
  1454. round++ // moving to the next round
  1455. ensureNewRound(t, newRoundCh, height, round)
  1456. rs = cs1.GetRoundState()
  1457. t.Log("### ONTO ROUND 1")
  1458. /*Round2
  1459. // we timeout and prevote our lock
  1460. // a polka happened but we didn't see it!
  1461. */
  1462. // go to prevote, prevote for locked block
  1463. ensurePrevoteMatch(t, voteCh, height, round, rs.LockedBlock.Hash())
  1464. // now we receive the precommit from the previous round
  1465. addVotes(cs1, precommit4)
  1466. // receiving that precommit should take us straight to commit
  1467. ensureNewBlock(t, newBlockCh, height)
  1468. ensureNewRound(t, newRoundCh, height+1, 0)
  1469. }
  1470. func TestStateOutputsBlockPartsStats(t *testing.T) {
  1471. config := configSetup(t)
  1472. ctx, cancel := context.WithCancel(context.Background())
  1473. defer cancel()
  1474. // create dummy peer
  1475. cs, _ := randState(ctx, t, config, log.TestingLogger(), 1)
  1476. peerID, err := types.NewNodeID("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
  1477. require.NoError(t, err)
  1478. // 1) new block part
  1479. parts := types.NewPartSetFromData(tmrand.Bytes(100), 10)
  1480. msg := &BlockPartMessage{
  1481. Height: 1,
  1482. Round: 0,
  1483. Part: parts.GetPart(0),
  1484. }
  1485. cs.ProposalBlockParts = types.NewPartSetFromHeader(parts.Header())
  1486. cs.handleMsg(ctx, msgInfo{msg, peerID})
  1487. statsMessage := <-cs.statsMsgQueue
  1488. require.Equal(t, msg, statsMessage.Msg, "")
  1489. require.Equal(t, peerID, statsMessage.PeerID, "")
  1490. // sending the same part from different peer
  1491. cs.handleMsg(ctx, msgInfo{msg, "peer2"})
  1492. // sending the part with the same height, but different round
  1493. msg.Round = 1
  1494. cs.handleMsg(ctx, msgInfo{msg, peerID})
  1495. // sending the part from the smaller height
  1496. msg.Height = 0
  1497. cs.handleMsg(ctx, msgInfo{msg, peerID})
  1498. // sending the part from the bigger height
  1499. msg.Height = 3
  1500. cs.handleMsg(ctx, msgInfo{msg, peerID})
  1501. select {
  1502. case <-cs.statsMsgQueue:
  1503. t.Errorf("should not output stats message after receiving the known block part!")
  1504. case <-time.After(50 * time.Millisecond):
  1505. }
  1506. }
  1507. func TestStateOutputVoteStats(t *testing.T) {
  1508. config := configSetup(t)
  1509. ctx, cancel := context.WithCancel(context.Background())
  1510. defer cancel()
  1511. cs, vss := randState(ctx, t, config, log.TestingLogger(), 2)
  1512. // create dummy peer
  1513. peerID, err := types.NewNodeID("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
  1514. require.NoError(t, err)
  1515. randBytes := tmrand.Bytes(tmhash.Size)
  1516. vote := signVote(ctx, t, vss[1], config, tmproto.PrecommitType, randBytes, types.PartSetHeader{})
  1517. voteMessage := &VoteMessage{vote}
  1518. cs.handleMsg(ctx, msgInfo{voteMessage, peerID})
  1519. statsMessage := <-cs.statsMsgQueue
  1520. require.Equal(t, voteMessage, statsMessage.Msg, "")
  1521. require.Equal(t, peerID, statsMessage.PeerID, "")
  1522. // sending the same part from different peer
  1523. cs.handleMsg(ctx, msgInfo{&VoteMessage{vote}, "peer2"})
  1524. // sending the vote for the bigger height
  1525. incrementHeight(vss[1])
  1526. vote = signVote(ctx, t, vss[1], config, tmproto.PrecommitType, randBytes, types.PartSetHeader{})
  1527. cs.handleMsg(ctx, msgInfo{&VoteMessage{vote}, peerID})
  1528. select {
  1529. case <-cs.statsMsgQueue:
  1530. t.Errorf("should not output stats message after receiving the known vote or vote from bigger height")
  1531. case <-time.After(50 * time.Millisecond):
  1532. }
  1533. }
  1534. func TestSignSameVoteTwice(t *testing.T) {
  1535. config := configSetup(t)
  1536. ctx, cancel := context.WithCancel(context.Background())
  1537. defer cancel()
  1538. _, vss := randState(ctx, t, config, log.TestingLogger(), 2)
  1539. randBytes := tmrand.Bytes(tmhash.Size)
  1540. vote := signVote(
  1541. ctx,
  1542. t,
  1543. vss[1],
  1544. config,
  1545. tmproto.PrecommitType,
  1546. randBytes,
  1547. types.PartSetHeader{Total: 10, Hash: randBytes},
  1548. )
  1549. vote2 := signVote(
  1550. ctx,
  1551. t,
  1552. vss[1],
  1553. config,
  1554. tmproto.PrecommitType,
  1555. randBytes,
  1556. types.PartSetHeader{Total: 10, Hash: randBytes},
  1557. )
  1558. require.Equal(t, vote, vote2)
  1559. }
  1560. // subscribe subscribes test client to the given query and returns a channel with cap = 1.
  1561. func subscribe(
  1562. ctx context.Context,
  1563. t *testing.T,
  1564. eventBus *eventbus.EventBus,
  1565. q *tmquery.Query,
  1566. ) <-chan tmpubsub.Message {
  1567. t.Helper()
  1568. sub, err := eventBus.SubscribeWithArgs(ctx, tmpubsub.SubscribeArgs{
  1569. ClientID: testSubscriber,
  1570. Query: q,
  1571. })
  1572. if err != nil {
  1573. t.Fatalf("Failed to subscribe %q to %v: %v", testSubscriber, q, err)
  1574. }
  1575. ch := make(chan tmpubsub.Message)
  1576. go func() {
  1577. for {
  1578. next, err := sub.Next(ctx)
  1579. if err != nil {
  1580. if ctx.Err() != nil {
  1581. return
  1582. }
  1583. t.Errorf("Subscription for %v unexpectedly terminated: %v", q, err)
  1584. return
  1585. }
  1586. select {
  1587. case ch <- next:
  1588. case <-ctx.Done():
  1589. return
  1590. }
  1591. }
  1592. }()
  1593. return ch
  1594. }