mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 22:44:24 +00:00
ints: stricter numbers (#4939)
This commit is contained in:
+1
-1
@@ -354,7 +354,7 @@ func getBeginBlockValidatorInfo(block *types.Block, stateDB dbm.DB) (abci.LastCo
|
||||
}
|
||||
|
||||
return abci.LastCommitInfo{
|
||||
Round: int32(block.LastCommit.Round),
|
||||
Round: block.LastCommit.Round,
|
||||
Votes: voteInfos,
|
||||
}, byzVals
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
chainID = "execution_chain"
|
||||
testPartSize = 65536
|
||||
nTxsPerBlock = 10
|
||||
chainID = "execution_chain"
|
||||
testPartSize uint32 = 65536
|
||||
nTxsPerBlock = 10
|
||||
)
|
||||
|
||||
func TestApplyBlock(t *testing.T) {
|
||||
|
||||
@@ -73,7 +73,7 @@ func makeValidCommit(
|
||||
) (*types.Commit, error) {
|
||||
sigs := make([]types.CommitSig, 0)
|
||||
for i := 0; i < vals.Size(); i++ {
|
||||
_, val := vals.GetByIndex(i)
|
||||
_, val := vals.GetByIndex(int32(i))
|
||||
vote, err := types.MakeVote(height, blockID, vals, privVals[val.Address.String()], chainID, time.Now())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ func testProposerFreq(t *testing.T, caseNum int, valSet *types.ValidatorSet) {
|
||||
|
||||
// assert frequencies match expected (max off by 1)
|
||||
for i, freq := range freqs {
|
||||
_, val := valSet.GetByIndex(i)
|
||||
_, val := valSet.GetByIndex(int32(i))
|
||||
expectFreq := int(val.VotingPower) * runMult
|
||||
gotFreq := freq
|
||||
abs := int(math.Abs(float64(expectFreq - gotFreq)))
|
||||
|
||||
+1
-1
@@ -321,7 +321,7 @@ func LoadValidators(db dbm.DB, height int64) (*types.ValidatorSet, error) {
|
||||
),
|
||||
)
|
||||
}
|
||||
valInfo2.ValidatorSet.IncrementProposerPriority(int(height - lastStoredHeight)) // mutate
|
||||
valInfo2.ValidatorSet.IncrementProposerPriority(tmmath.SafeConvertInt32(height - lastStoredHeight)) // mutate
|
||||
valInfo = valInfo2
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ func TestTxFilter(t *testing.T) {
|
||||
state, err := sm.LoadStateFromDBOrGenesisDoc(stateDB, genDoc)
|
||||
require.NoError(t, err)
|
||||
|
||||
f := sm.TxPreCheck(state)
|
||||
f := sm.TxPreCheck(state) // current max size of a tx 1850
|
||||
if tc.isErr {
|
||||
assert.NotNil(t, f(tc.tx), "#%v", i)
|
||||
} else {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/tendermint/tendermint/crypto/tmhash"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
memmock "github.com/tendermint/tendermint/mempool/mock"
|
||||
tmproto "github.com/tendermint/tendermint/proto/types"
|
||||
sm "github.com/tendermint/tendermint/state"
|
||||
"github.com/tendermint/tendermint/state/mocks"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
@@ -185,7 +186,7 @@ func TestValidateBlockCommit(t *testing.T) {
|
||||
Height: height,
|
||||
Round: 0,
|
||||
Timestamp: tmtime.Now(),
|
||||
Type: types.PrecommitType,
|
||||
Type: tmproto.PrecommitType,
|
||||
BlockID: blockID,
|
||||
}
|
||||
err = badPrivVal.SignVote(chainID, goodVote)
|
||||
@@ -240,9 +241,9 @@ func TestValidateBlockEvidence(t *testing.T) {
|
||||
require.True(t, maxNumEvidence > 2)
|
||||
evidence := make([]types.Evidence, 0)
|
||||
// precisely the amount of allowed evidence
|
||||
for i := uint32(0); i < maxNumEvidence; i++ {
|
||||
for i := int32(0); uint32(i) < maxNumEvidence; i++ {
|
||||
// make different evidence for each validator
|
||||
addr, _ := state.Validators.GetByIndex(int(i))
|
||||
addr, _ := state.Validators.GetByIndex(i)
|
||||
evidence = append(evidence, types.NewMockEvidence(height, time.Now(), addr))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user