fix lints

This commit is contained in:
Callum Waters
2022-11-01 14:18:13 +01:00
parent 296ec7e113
commit 11976a4863
8 changed files with 24 additions and 21 deletions

View File

@@ -166,7 +166,8 @@ func TestNoBlockResponse(t *testing.T) {
for _, reactor := range reactorPairs {
// turn on the syncing algorithm
reactor.reactor.SwitchToBlockSync(state)
err := reactor.reactor.SwitchToBlockSync(state)
require.NoError(t, err)
}
defer func() {
@@ -249,7 +250,8 @@ func TestBadBlockStopsPeer(t *testing.T) {
for _, reactor := range reactorPairs {
// turn on the syncing algorithm
reactor.reactor.SwitchToBlockSync(state)
err := reactor.reactor.SwitchToBlockSync(state)
require.NoError(t, err)
}
defer func() {
@@ -296,7 +298,9 @@ func TestBadBlockStopsPeer(t *testing.T) {
}
otherState, err := sm.MakeGenesisState(otherGenDoc)
lastReactorPair.reactor.SwitchToBlockSync(otherState)
require.NoError(t, err)
err = lastReactorPair.reactor.SwitchToBlockSync(otherState)
require.NoError(t, err)
for {
if lastReactorPair.reactor.pool.IsCaughtUp() || lastReactorPair.reactor.Switch.Peers().Size() == 0 {

View File

@@ -256,7 +256,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
// start the consensus reactors
for i := 0; i < nValidators; i++ {
reactors[i].SwitchToConsensus(state.Copy(), false)
require.NoError(t, reactors[i].SwitchToConsensus(state.Copy(), false))
}
defer stopConsensusNet(log.TestingLogger(), reactors, eventBuses)
@@ -409,13 +409,13 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) {
// note these must be started before the byz
for i := 1; i < N; i++ {
cr := reactors[i].(*Reactor)
cr.SwitchToConsensus(cr.conS.GetState(), false)
require.NoError(t, cr.SwitchToConsensus(cr.conS.GetState(), false))
}
// start the byzantine state machine
byzR := reactors[0].(*ByzantineReactor)
s := byzR.reactor.conS.GetState()
byzR.reactor.SwitchToConsensus(s, false)
require.NoError(t, byzR.reactor.SwitchToConsensus(s, false))
// byz proposer sends one block to peers[0]
// and the other block to peers[1] and peers[2].

View File

@@ -87,7 +87,8 @@ func startConsensusNet(t *testing.T, css []*State, n int) (
// TODO: is this still true with new pubsub?
for i := 0; i < n; i++ {
s := reactors[i].conS.GetState()
reactors[i].SwitchToConsensus(s, false)
err := reactors[i].SwitchToConsensus(s, false)
require.NoError(t, err)
}
return reactors, blocksSubs, eventBuses
}

View File

@@ -663,12 +663,12 @@ func tempWALWithData(data []byte) string {
// Then restart the app and sync it up with the remaining blocks
func testHandshakeReplay(t *testing.T, nBlocks int, mode uint, testValidatorsChange bool) {
var (
chain []*types.Block
commits []*types.Commit
store *mockBlockStore
stateDB dbm.DB
chain []*types.Block
commits []*types.Commit
store *mockBlockStore
stateDB dbm.DB
genesisState sm.State
config *cfg.Config
config *cfg.Config
)
if testValidatorsChange {
config = ResetConfig(fmt.Sprintf("%s_%v_m", t.Name(), mode))
@@ -816,7 +816,7 @@ func buildAppStateFromChain(t *testing.T, proxyApp proxy.AppConns, stateStore sm
validators := types.TM2PB.ValidatorUpdates(state.Validators)
_, err := proxyApp.Consensus().InitChainSync(abci.RequestInitChain{
Validators: validators,
});
})
require.NoError(t, err)
require.NoError(t, stateStore.Save(state))
switch mode {

View File

@@ -204,11 +204,11 @@ func WithMetrics(metrics *Metrics) StateOption {
}
func WithState(state sm.State) StateOption {
return func(cs *State) {
return func(cs *State) {
if state.LastBlockHeight > 0 {
cs.reconstructLastCommit(state)
}
cs.updateToState(state)
cs.updateToState(state)
}
}

View File

@@ -12,7 +12,6 @@ import (
"github.com/rs/cors"
"github.com/tendermint/tendermint/blocksync"
bc "github.com/tendermint/tendermint/blocksync"
cfg "github.com/tendermint/tendermint/config"
cs "github.com/tendermint/tendermint/consensus"
"github.com/tendermint/tendermint/evidence"
@@ -49,7 +48,6 @@ type Node struct {
privValidator types.PrivValidator // local node's validator key
// network
transport *p2p.MultiplexTransport
sw *p2p.Switch // p2p connections
addrBook pex.AddrBook // known peers
nodeInfo p2p.NodeInfo
@@ -797,7 +795,7 @@ func makeNodeInfo(
Network: genDoc.ChainID,
Version: version.TMCoreSemVer,
Channels: []byte{
bc.BlocksyncChannel,
blocksync.BlocksyncChannel,
cs.StateChannel, cs.DataChannel, cs.VoteChannel, cs.VoteSetBitsChannel,
mempl.MempoolChannel,
evidence.EvidenceChannel,

View File

@@ -124,7 +124,7 @@ func TestNodeSetAppVersion(t *testing.T) {
n, err := DefaultNewNode(config, log.TestingLogger())
require.NoError(t, err)
require.NoError(t, n.Start())
defer n.Stop()
defer n.Stop() //nolint:errcheck
// default config uses the kvstore app
var appVersion = kvstore.ProtocolVersion

View File

@@ -113,7 +113,7 @@ func TestTransportMultiplexConnFilterTimeout(t *testing.T) {
err = mt.Start()
require.NoError(t, err)
defer mt.Stop()
defer mt.Stop() //nolint:errcheck
errc := make(chan error)
go func() {
@@ -664,7 +664,7 @@ func testSetupMultiplexTransport(t *testing.T) *MultiplexTransport {
err = mt.Start()
require.NoError(t, err)
t.Cleanup(func() {
mt.Stop()
mt.Stop() //nolint:errcheck
})
// give the listener some time to get ready