mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-02 22:21:44 +00:00
cs/replay: execCommitBlock should not read from state.lastValidators (#3067)
* execCommitBlock should not read from state.lastValidators
* fix height 1
* fix blockchain/reactor_test
* fix consensus/mempool_test
* fix consensus/reactor_test
* fix consensus/replay_test
* add CHANGELOG
* fix consensus/reactor_test
* fix consensus/replay_test
* add a test for replay validators change
* fix mem_pool test
* fix byzantine test
* remove a redundant code
* reduce validator change blocks to 6
* fix
* return peer0 config
* seperate testName
* seperate testName 1
* seperate testName 2
* seperate app db path
* seperate app db path 1
* add a lock before startNet
* move the lock to reactor_test
* simulate just once
* try to find problem
* handshake only saveState when app version changed
* update gometalinter to 3.0.0 (#3233)
in the attempt to fix https://circleci.com/gh/tendermint/tendermint/43165
also
code is simplified by running gofmt -s .
remove unused vars
enable linters we're currently passing
remove deprecated linters
(cherry picked from commit d470945503
)
* gofmt code
* goimport code
* change the bool name to testValidatorsChange
* adjust receive kvstore.ProtocolVersion
* adjust receive kvstore.ProtocolVersion 1
* adjust receive kvstore.ProtocolVersion 3
* fix merge execution.go
* fix merge develop
* fix merge develop 1
* fix run cleanupFunc
* adjust code according to reviewers' opinion
* modify the func name match the convention
* simplify simulate a chain containing some validator change txs 1
* test CI error
* Merge remote-tracking branch 'upstream/develop' into fixReplay 1
* fix pubsub_test
* subscribeUnbuffered vote channel
This commit is contained in:
@ -239,7 +239,7 @@ func TestStateFullRound1(t *testing.T) {
|
||||
cs.SetEventBus(eventBus)
|
||||
eventBus.Start()
|
||||
|
||||
voteCh := subscribe(cs.eventBus, types.EventQueryVote)
|
||||
voteCh := subscribeUnBuffered(cs.eventBus, types.EventQueryVote)
|
||||
propCh := subscribe(cs.eventBus, types.EventQueryCompleteProposal)
|
||||
newRoundCh := subscribe(cs.eventBus, types.EventQueryNewRound)
|
||||
|
||||
@ -267,7 +267,7 @@ func TestStateFullRoundNil(t *testing.T) {
|
||||
cs, vss := randConsensusState(1)
|
||||
height, round := cs.Height, cs.Round
|
||||
|
||||
voteCh := subscribe(cs.eventBus, types.EventQueryVote)
|
||||
voteCh := subscribeUnBuffered(cs.eventBus, types.EventQueryVote)
|
||||
|
||||
cs.enterPrevote(height, round)
|
||||
cs.startRoutines(4)
|
||||
@ -286,7 +286,7 @@ func TestStateFullRound2(t *testing.T) {
|
||||
vs2 := vss[1]
|
||||
height, round := cs1.Height, cs1.Round
|
||||
|
||||
voteCh := subscribe(cs1.eventBus, types.EventQueryVote)
|
||||
voteCh := subscribeUnBuffered(cs1.eventBus, types.EventQueryVote)
|
||||
newBlockCh := subscribe(cs1.eventBus, types.EventQueryNewBlock)
|
||||
|
||||
// start round and wait for propose and prevote
|
||||
@ -330,7 +330,7 @@ func TestStateLockNoPOL(t *testing.T) {
|
||||
|
||||
timeoutProposeCh := subscribe(cs1.eventBus, types.EventQueryTimeoutPropose)
|
||||
timeoutWaitCh := subscribe(cs1.eventBus, types.EventQueryTimeoutWait)
|
||||
voteCh := subscribe(cs1.eventBus, types.EventQueryVote)
|
||||
voteCh := subscribeUnBuffered(cs1.eventBus, types.EventQueryVote)
|
||||
proposalCh := subscribe(cs1.eventBus, types.EventQueryCompleteProposal)
|
||||
newRoundCh := subscribe(cs1.eventBus, types.EventQueryNewRound)
|
||||
|
||||
@ -1623,3 +1623,12 @@ func subscribe(eventBus *types.EventBus, q tmpubsub.Query) <-chan tmpubsub.Messa
|
||||
}
|
||||
return sub.Out()
|
||||
}
|
||||
|
||||
// subscribe subscribes test client to the given query and returns a channel with cap = 0.
|
||||
func subscribeUnBuffered(eventBus *types.EventBus, q tmpubsub.Query) <-chan tmpubsub.Message {
|
||||
sub, err := eventBus.SubscribeUnbuffered(context.Background(), testSubscriber, q)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to subscribe %s to %v", testSubscriber, q))
|
||||
}
|
||||
return sub.Out()
|
||||
}
|
||||
|
Reference in New Issue
Block a user