Browse Source

linters: enable scopelint (#3963)

* Pin range scope vars

* Don't disable scopelint

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

Contributes to #3262
pull/3978/head
Phil Salant 5 years ago
committed by Anton Kaliaev
parent
commit
d1d517a9b7
33 changed files with 73 additions and 1 deletions
  1. +0
    -1
      .golangci.yml
  2. +4
    -0
      blockchain/v0/reactor_test.go
  3. +2
    -0
      blockchain/v1/peer_test.go
  4. +9
    -0
      blockchain/v1/pool_test.go
  5. +4
    -0
      blockchain/v1/reactor_fsm_test.go
  6. +4
    -0
      blockchain/v1/reactor_test.go
  7. +7
    -0
      consensus/reactor_test.go
  8. +1
    -0
      consensus/replay_test.go
  9. +2
    -0
      consensus/wal_test.go
  10. +1
    -0
      crypto/merkle/rfc6962_test.go
  11. +5
    -0
      crypto/multisig/bitarray/compact_bit_array_test.go
  12. +1
    -0
      crypto/secp256k1/secp256k1_internal_test.go
  13. +1
    -0
      crypto/secp256k1/secp256k1_test.go
  14. +1
    -0
      evidence/reactor_test.go
  15. +1
    -0
      libs/common/bit_array_test.go
  16. +1
    -0
      libs/common/bytes_test.go
  17. +2
    -0
      libs/flowrate/io_test.go
  18. +1
    -0
      libs/log/filter_test.go
  19. +2
    -0
      p2p/conn/secret_connection_test.go
  20. +1
    -0
      p2p/netaddress_test.go
  21. +1
    -0
      rpc/lib/client/http_client.go
  22. +1
    -0
      rpc/lib/server/handlers.go
  23. +1
    -0
      scripts/privValUpgrade_test.go
  24. +2
    -0
      state/execution_test.go
  25. +1
    -0
      state/store_test.go
  26. +2
    -0
      state/txindex/kv/kv_test.go
  27. +2
    -0
      store/store_test.go
  28. +7
    -0
      types/block_test.go
  29. +1
    -0
      types/event_bus_test.go
  30. +1
    -0
      types/evidence_test.go
  31. +2
    -0
      types/part_set_test.go
  32. +1
    -0
      types/proposal_test.go
  33. +1
    -0
      types/vote_test.go

+ 0
- 1
.golangci.yml View File

@ -13,7 +13,6 @@ linters:
- lll
- gochecknoglobals
- gochecknoinits
- scopelint
- stylecheck
# linters-settings:
# govet:


+ 4
- 0
blockchain/v0/reactor_test.go View File

@ -258,6 +258,7 @@ func TestBcBlockRequestMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
request := bcBlockRequestMessage{Height: tc.requestHeight}
assert.Equal(t, tc.expectErr, request.ValidateBasic() != nil, "Validate Basic had an unexpected result")
@ -277,6 +278,7 @@ func TestBcNoBlockResponseMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
nonResponse := bcNoBlockResponseMessage{Height: tc.nonResponseHeight}
assert.Equal(t, tc.expectErr, nonResponse.ValidateBasic() != nil, "Validate Basic had an unexpected result")
@ -296,6 +298,7 @@ func TestBcStatusRequestMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
request := bcStatusRequestMessage{Height: tc.requestHeight}
assert.Equal(t, tc.expectErr, request.ValidateBasic() != nil, "Validate Basic had an unexpected result")
@ -315,6 +318,7 @@ func TestBcStatusResponseMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
response := bcStatusResponseMessage{Height: tc.responseHeight}
assert.Equal(t, tc.expectErr, response.ValidateBasic() != nil, "Validate Basic had an unexpected result")


+ 2
- 0
blockchain/v1/peer_test.go View File

@ -125,6 +125,7 @@ func TestPeerGetAndRemoveBlock(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
// try to get the block
b, err := peer.BlockAtHeight(tt.height)
@ -167,6 +168,7 @@ func TestPeerAddBlock(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
// try to get the block
err := peer.AddBlock(makeSmallBlock(int(tt.height)), 10)


+ 9
- 0
blockchain/v1/pool_test.go View File

@ -159,6 +159,7 @@ func TestBlockPoolUpdatePeer(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
pool := tt.pool
err := pool.UpdatePeer(tt.args.id, tt.args.height)
@ -232,6 +233,7 @@ func TestBlockPoolRemovePeer(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt.pool.RemovePeer(tt.args.peerID, tt.args.err)
assertBlockPoolEquivalent(t, tt.poolWanted, tt.pool)
@ -272,6 +274,7 @@ func TestBlockPoolRemoveShortPeers(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
pool := tt.pool
pool.removeShortPeers()
@ -317,6 +320,7 @@ func TestBlockPoolSendRequestBatch(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
resetPoolTestResults()
@ -421,6 +425,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
err := tt.pool.AddBlock(tt.args.peerID, tt.args.block, tt.args.blockSize)
assert.Equal(t, tt.errWanted, err)
@ -473,6 +478,7 @@ func TestBlockPoolFirstTwoBlocksAndPeers(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
pool := tt.pool
gotFirst, gotSecond, err := pool.FirstTwoBlocksAndPeers()
@ -544,6 +550,7 @@ func TestBlockPoolInvalidateFirstTwoBlocks(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt.pool.InvalidateFirstTwoBlocks(errNoPeerResponse)
assertBlockPoolEquivalent(t, tt.poolWanted, tt.pool)
@ -584,6 +591,7 @@ func TestProcessedCurrentHeightBlock(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt.pool.ProcessedCurrentHeightBlock()
assertBlockPoolEquivalent(t, tt.poolWanted, tt.pool)
@ -642,6 +650,7 @@ func TestRemovePeerAtCurrentHeight(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt.pool.RemovePeerAtCurrentHeights(errNoPeerResponse)
assertBlockPoolEquivalent(t, tt.poolWanted, tt.pool)


+ 4
- 0
blockchain/v1/reactor_fsm_test.go View File

@ -211,6 +211,7 @@ type testFields struct {
func executeFSMTests(t *testing.T, tests []testFields, matchRespToReq bool) {
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
// Create test reactor
testBcR := newTestReactor(tt.startingHeight)
@ -220,6 +221,7 @@ func executeFSMTests(t *testing.T, tests []testFields, matchRespToReq bool) {
}
for _, step := range tt.steps {
step := step
assert.Equal(t, step.currentState, testBcR.fsm.state.name)
var heightBefore int64
@ -862,6 +864,7 @@ func TestFSMCorrectTransitionSequences(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
// Create test reactor
testBcR := newTestReactor(tt.startingHeight)
@ -871,6 +874,7 @@ func TestFSMCorrectTransitionSequences(t *testing.T) {
}
for _, step := range tt.steps {
step := step
assert.Equal(t, step.currentState, testBcR.fsm.state.name)
oldNumStatusRequests := testBcR.numStatusRequests


+ 4
- 0
blockchain/v1/reactor_test.go View File

@ -329,6 +329,7 @@ func TestBcBlockRequestMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
request := bcBlockRequestMessage{Height: tc.requestHeight}
assert.Equal(t, tc.expectErr, request.ValidateBasic() != nil, "Validate Basic had an unexpected result")
@ -348,6 +349,7 @@ func TestBcNoBlockResponseMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
nonResponse := bcNoBlockResponseMessage{Height: tc.nonResponseHeight}
assert.Equal(t, tc.expectErr, nonResponse.ValidateBasic() != nil, "Validate Basic had an unexpected result")
@ -367,6 +369,7 @@ func TestBcStatusRequestMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
request := bcStatusRequestMessage{Height: tc.requestHeight}
assert.Equal(t, tc.expectErr, request.ValidateBasic() != nil, "Validate Basic had an unexpected result")
@ -386,6 +389,7 @@ func TestBcStatusResponseMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
response := bcStatusResponseMessage{Height: tc.responseHeight}
assert.Equal(t, tc.expectErr, response.ValidateBasic() != nil, "Validate Basic had an unexpected result")


+ 7
- 0
consensus/reactor_test.go View File

@ -656,6 +656,7 @@ func TestNewRoundStepMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
message := NewRoundStepMessage{
Height: tc.messageHeight,
@ -685,6 +686,7 @@ func TestNewValidBlockMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
message := NewValidBlockMessage{
Height: tc.messageHeight,
@ -715,6 +717,7 @@ func TestProposalPOLMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
message := ProposalPOLMessage{
Height: tc.messageHeight,
@ -742,6 +745,7 @@ func TestBlockPartMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
message := BlockPartMessage{
Height: tc.messageHeight,
@ -781,6 +785,7 @@ func TestHasVoteMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
message := HasVoteMessage{
Height: tc.messageHeight,
@ -825,6 +830,7 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
message := VoteSetMaj23Message{
Height: tc.messageHeight,
@ -871,6 +877,7 @@ func TestVoteSetBitsMessageValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
message := VoteSetBitsMessage{
Height: tc.messageHeight,


+ 1
- 0
consensus/replay_test.go View File

@ -123,6 +123,7 @@ func TestWALCrash(t *testing.T) {
}
for i, tc := range testCases {
tc := tc
consensusReplayConfig := ResetConfig(fmt.Sprintf("%s_%d", t.Name(), i))
t.Run(tc.name, func(t *testing.T) {
crashWALandCheckLiveness(t, consensusReplayConfig, tc.initFn, tc.heightToStop)


+ 2
- 0
consensus/wal_test.go View File

@ -86,6 +86,8 @@ func TestWALEncoderDecoder(t *testing.T) {
b := new(bytes.Buffer)
for _, msg := range msgs {
msg := msg
b.Reset()
enc := NewWALEncoder(b)


+ 1
- 0
crypto/merkle/rfc6962_test.go View File

@ -56,6 +56,7 @@ func TestRFC6962Hasher(t *testing.T) {
got: innerHash([]byte("N123"), []byte("N456")),
},
} {
tc := tc
t.Run(tc.desc, func(t *testing.T) {
wantBytes, err := hex.DecodeString(tc.want)
if err != nil {


+ 5
- 0
crypto/multisig/bitarray/compact_bit_array_test.go View File

@ -72,6 +72,7 @@ func TestJSONMarshalUnmarshal(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.bA.String(), func(t *testing.T) {
bz, err := json.Marshal(tc.bA)
require.NoError(t, err)
@ -131,6 +132,7 @@ func TestCompactMarshalUnmarshal(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.bA.String(), func(t *testing.T) {
bz := tc.bA.CompactMarshal()
@ -165,12 +167,15 @@ func TestCompactBitArrayNumOfTrueBitsBefore(t *testing.T) {
{`"______________xx"`, []int{14, 15}, []int{0, 1}},
}
for tcIndex, tc := range testCases {
tc := tc
tcIndex := tcIndex
t.Run(tc.marshalledBA, func(t *testing.T) {
var bA *CompactBitArray
err := json.Unmarshal([]byte(tc.marshalledBA), &bA)
require.NoError(t, err)
for i := 0; i < len(tc.bAIndex); i++ {
require.Equal(t, tc.trueValueIndex[i], bA.NumTrueBitsBefore(tc.bAIndex[i]), "tc %d, i %d", tcIndex, i)
}
})


+ 1
- 0
crypto/secp256k1/secp256k1_internal_test.go View File

@ -29,6 +29,7 @@ func Test_genPrivKey(t *testing.T) {
{"valid because 0 < 1 < N", validOne, false},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
if tt.shouldPanic {
require.Panics(t, func() {


+ 1
- 0
crypto/secp256k1/secp256k1_test.go View File

@ -100,6 +100,7 @@ func TestGenPrivKeySecp256k1(t *testing.T) {
{"another seed used in cosmos tests #3", []byte("")},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
gotPrivKey := secp256k1.GenPrivKeySecp256k1(tt.secret)
require.NotNil(t, gotPrivKey)


+ 1
- 0
evidence/reactor_test.go View File

@ -203,6 +203,7 @@ func TestEvidenceListMessageValidationBasic(t *testing.T) {
}, true},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
evListMsg := &EvidenceListMessage{}
n := 3


+ 1
- 0
libs/common/bit_array_test.go View File

@ -232,6 +232,7 @@ func TestJSONMarshalUnmarshal(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.bA.String(), func(t *testing.T) {
bz, err := json.Marshal(tc.bA)
require.NoError(t, err)


+ 1
- 0
libs/common/bytes_test.go View File

@ -40,6 +40,7 @@ func TestJSONMarshal(t *testing.T) {
}
for i, tc := range cases {
tc := tc
t.Run(fmt.Sprintf("Case %d", i), func(t *testing.T) {
ts := TestStruct{B1: tc.input, B2: tc.input}


+ 2
- 0
libs/flowrate/io_test.go View File

@ -89,6 +89,7 @@ func TestReader(t *testing.T) {
{false, start, _300ms, 0, 20, 3, 0, 0, 67, 100, 0, 0, 0},
}
for i, s := range status {
s := s
if !statusesAreEqual(&s, &want[i]) {
t.Errorf("r.Status(%v)\nexpected: %v\ngot : %v", i, want[i], s)
}
@ -143,6 +144,7 @@ func TestWriter(t *testing.T) {
{true, start, _500ms, _100ms, 100, 5, 200, 200, 200, 200, 0, 0, 100000},
}
for i, s := range status {
s := s
if !statusesAreEqual(&s, &want[i]) {
t.Errorf("w.Status(%v)\nexpected: %v\ngot : %v\n", i, want[i], s)
}


+ 1
- 0
libs/log/filter_test.go View File

@ -55,6 +55,7 @@ func TestVariousLevels(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
var buf bytes.Buffer
logger := log.NewFilter(log.NewTMJSONLogger(&buf), tc.allowed)


+ 2
- 0
p2p/conn/secret_connection_test.go View File

@ -110,6 +110,7 @@ func TestShareLowOrderPubkey(t *testing.T) {
// all blacklisted low order points:
for _, remLowOrderPubKey := range blacklist {
remLowOrderPubKey := remLowOrderPubKey
_, _ = cmn.Parallel(
func(_ int) (val interface{}, err error, abort bool) {
_, err = shareEphPubKey(fooConn, locEphPub)
@ -135,6 +136,7 @@ func TestShareLowOrderPubkey(t *testing.T) {
func TestComputeDHFailsOnLowOrder(t *testing.T) {
_, locPrivKey := genEphKeys()
for _, remLowOrderPubKey := range blacklist {
remLowOrderPubKey := remLowOrderPubKey
shared, err := computeDHSecret(&remLowOrderPubKey, locPrivKey)
assert.Error(t, err)


+ 1
- 0
p2p/netaddress_test.go View File

@ -67,6 +67,7 @@ func TestNewNetAddressString(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
addr, err := NewNetAddressString(tc.addr)
if tc.correct {


+ 1
- 0
rpc/lib/client/http_client.go View File

@ -394,6 +394,7 @@ func unmarshalResponseBytesArray(cdc *amino.Codec, responseBytes []byte, expecte
}
for i, response := range responses {
response := response
// From the JSON-RPC 2.0 spec:
// id: It MUST be the same as the value of the id member in the Request Object.
if err := validateResponseID(&response, expectedID); err != nil {


+ 1
- 0
rpc/lib/server/handlers.go View File

@ -129,6 +129,7 @@ func makeJSONRPCHandler(funcMap map[string]*RPCFunc, cdc *amino.Codec, logger lo
}
for _, request := range requests {
request := request
// A Notification is a Request object without an "id" member.
// The Server MUST NOT reply to a Notification, including those that are within a batch request.
if request.ID == types.JSONRPCStringID("") {


+ 1
- 0
scripts/privValUpgrade_test.go View File

@ -75,6 +75,7 @@ func TestLoadAndUpgrade(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
// need to re-write the file everytime because upgrading renames it
err := ioutil.WriteFile(oldFilePath, []byte(oldPrivvalContent), 0600)


+ 2
- 0
state/execution_test.go View File

@ -210,6 +210,7 @@ func TestValidateValidatorUpdates(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
err := sm.ValidateValidatorUpdates(tc.abciUpdates, tc.validatorParams)
if tc.shouldErr {
@ -275,6 +276,7 @@ func TestUpdateValidators(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
updates, err := types.PB2TM.ValidatorUpdates(tc.abciUpdates)
assert.NoError(t, err)


+ 1
- 0
state/store_test.go View File

@ -70,6 +70,7 @@ func BenchmarkLoadValidators(b *testing.B) {
sm.SaveState(stateDB, state)
for i := 10; i < 10000000000; i *= 10 { // 10, 100, 1000, ...
i := i
sm.SaveValidatorsInfo(stateDB, int64(i), state.LastHeightValidatorsChanged, state.NextValidators)
b.Run(fmt.Sprintf("height=%d", i), func(b *testing.B) {


+ 2
- 0
state/txindex/kv/kv_test.go View File

@ -118,6 +118,7 @@ func TestTxSearch(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.q, func(t *testing.T) {
results, err := indexer.Search(query.MustParse(tc.q))
assert.NoError(t, err)
@ -191,6 +192,7 @@ func TestTxSearchDeprecatedIndexing(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.q, func(t *testing.T) {
results, err := indexer.Search(query.MustParse(tc.q))
require.NoError(t, err)


+ 2
- 0
store/store_test.go View File

@ -84,6 +84,7 @@ func TestNewBlockStore(t *testing.T) {
}
for i, tt := range panicCausers {
tt := tt
// Expecting a panic here on trying to parse an invalid blockStore
_, _, panicErr := doFn(func() (interface{}, error) {
db.Set(blockStoreKey, tt.data)
@ -253,6 +254,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
}
for i, tuple := range tuples {
tuple := tuple
bs, db := freshBlockStore()
// SaveBlock
res, err, panicErr := doFn(func() (interface{}, error) {


+ 7
- 0
types/block_test.go View File

@ -83,6 +83,8 @@ func TestBlockValidateBasic(t *testing.T) {
}, true},
}
for i, tc := range testCases {
tc := tc
i := i
t.Run(tc.testName, func(t *testing.T) {
block := MakeBlock(h, txs, commit, evList)
block.ProposerAddress = valSet.GetProposer().Address
@ -228,6 +230,7 @@ func TestCommitValidateBasic(t *testing.T) {
{"Incorrect round", func(com *Commit) { com.Precommits[0].Round = 100 }, true},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
com := randCommit()
tc.malleateCommit(com)
@ -302,6 +305,7 @@ func TestBlockMaxDataBytes(t *testing.T) {
}
for i, tc := range testCases {
tc := tc
if tc.panics {
assert.Panics(t, func() {
MaxDataBytes(tc.maxBytes, tc.valsCount, tc.evidenceCount)
@ -330,6 +334,7 @@ func TestBlockMaxDataBytesUnknownEvidence(t *testing.T) {
}
for i, tc := range testCases {
tc := tc
if tc.panics {
assert.Panics(t, func() {
MaxDataBytesUnknownEvidence(tc.maxBytes, tc.valsCount)
@ -406,6 +411,7 @@ func TestSignedHeaderValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
sh := SignedHeader{
Header: tc.shHeader,
@ -445,6 +451,7 @@ func TestBlockIDValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
blockID := BlockID{
Hash: tc.blockIDHash,


+ 1
- 0
types/event_bus_test.go View File

@ -338,6 +338,7 @@ func BenchmarkEventBus(b *testing.B) {
}
for _, bm := range benchmarks {
bm := bm
b.Run(bm.name, func(b *testing.B) {
benchmarkEventBus(bm.numClients, bm.randQueries, bm.randEvents, b)
})


+ 1
- 0
types/evidence_test.go View File

@ -146,6 +146,7 @@ func TestDuplicateVoteEvidenceValidation(t *testing.T) {
}, true},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
ev := &DuplicateVoteEvidence{
PubKey: secp256k1.GenPrivKey().PubKey(),


+ 2
- 0
types/part_set_test.go View File

@ -95,6 +95,7 @@ func TestPartSetHeaderValidateBasic(t *testing.T) {
{"Invalid Hash", func(psHeader *PartSetHeader) { psHeader.Hash = make([]byte, 1) }, true},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
data := cmn.RandBytes(testPartSize * 100)
ps := NewPartSetFromData(data, testPartSize)
@ -117,6 +118,7 @@ func TestPartValidateBasic(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
data := cmn.RandBytes(testPartSize * 100)
ps := NewPartSetFromData(data, testPartSize)


+ 1
- 0
types/proposal_test.go View File

@ -127,6 +127,7 @@ func TestProposalValidateBasic(t *testing.T) {
blockID := makeBlockID(tmhash.Sum([]byte("blockhash")), math.MaxInt64, tmhash.Sum([]byte("partshash")))
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
prop := NewProposal(
4, 2, 2,


+ 1
- 0
types/vote_test.go View File

@ -285,6 +285,7 @@ func TestVoteValidateBasic(t *testing.T) {
{"Too big Signature", func(v *Vote) { v.Signature = make([]byte, MaxSignatureSize+1) }, true},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.testName, func(t *testing.T) {
vote := examplePrecommit()
err := privVal.SignVote("test_chain_id", vote)


Loading…
Cancel
Save