uint64 -> int64

This commit is contained in:
Ethan Buchman
2017-12-01 00:41:07 -05:00
parent b59fe60e65
commit 0ad7dea71f
8 changed files with 148 additions and 144 deletions
+4 -4
View File
@@ -82,7 +82,7 @@ func TestPersistentDummyInfo(t *testing.T) {
}
dummy := NewPersistentDummyApplication(dir)
InitDummy(dummy)
height := uint64(0)
height := int64(0)
resInfo := dummy.Info(types.RequestInfo{})
if resInfo.LastBlockHeight != height {
@@ -90,10 +90,10 @@ func TestPersistentDummyInfo(t *testing.T) {
}
// make and apply block
height = uint64(1)
height = int64(1)
hash := []byte("foo")
header := &types.Header{
Height: uint64(height),
Height: int64(height),
}
dummy.BeginBlock(types.RequestBeginBlock{hash, header})
dummy.EndBlock(types.RequestEndBlock{header.Height})
@@ -173,7 +173,7 @@ func TestValSetChanges(t *testing.T) {
func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff []*types.Validator, txs ...[]byte) {
// make and apply block
height := uint64(heightInt)
height := int64(heightInt)
hash := []byte("foo")
header := &types.Header{
Height: height,
+1 -1
View File
@@ -11,7 +11,7 @@ import (
func RandVal(i int) *types.Validator {
pubkey := crypto.GenPrivKeyEd25519FromSecret([]byte(cmn.Fmt("test%d", i))).PubKey().Bytes()
power := cmn.RandUint16() + 1
return &types.Validator{pubkey, uint64(power)}
return &types.Validator{pubkey, int64(power)}
}
// RandVals returns a list of cnt validators for initializing
+5 -4
View File
@@ -55,7 +55,8 @@ func (app *PersistentDummyApplication) SetLogger(l log.Logger) {
func (app *PersistentDummyApplication) Info(req types.RequestInfo) types.ResponseInfo {
res := app.app.Info(req)
res.LastBlockHeight = app.app.state.LatestVersion()
var latestVersion uint64 = app.app.state.LatestVersion() // TODO: change to int64
res.LastBlockHeight = int64(latestVersion)
res.LastBlockAppHash = app.app.state.Hash()
return res
}
@@ -145,7 +146,7 @@ func (app *PersistentDummyApplication) Validators() (validators []*types.Validat
return
}
func MakeValSetChangeTx(pubkey []byte, power uint64) []byte {
func MakeValSetChangeTx(pubkey []byte, power int64) []byte {
return []byte(cmn.Fmt("val:%X/%d", pubkey, power))
}
@@ -181,7 +182,7 @@ func (app *PersistentDummyApplication) execValidatorTx(tx []byte) types.Response
}
// decode the power
power, err := strconv.Atoi(powerS)
power, err := strconv.ParseInt(powerS, 10, 64)
if err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
@@ -189,7 +190,7 @@ func (app *PersistentDummyApplication) execValidatorTx(tx []byte) types.Response
}
// update
return app.updateValidator(&types.Validator{pubkey, uint64(power)})
return app.updateValidator(&types.Validator{pubkey, power})
}
// add, update, or remove a validator