Use gogoproto's nullable=false (#166)

* Use gogoproto's nullable=false where appropriate.
This commit is contained in:
Jae Kwon
2017-12-22 19:41:19 -08:00
committed by GitHub
parent e4b9f1abe7
commit aaaacba1cd
8 changed files with 174 additions and 173 deletions

View File

@ -92,7 +92,7 @@ func TestPersistentDummyInfo(t *testing.T) {
// make and apply block
height = int64(1)
hash := []byte("foo")
header := &types.Header{
header := types.Header{
Height: int64(height),
}
dummy.BeginBlock(types.RequestBeginBlock{hash, header, nil, nil})
@ -124,11 +124,11 @@ func TestValUpdates(t *testing.T) {
vals1, vals2 := vals[:nInit], dummy.Validators()
valsEqual(t, vals1, vals2)
var v1, v2, v3 *types.Validator
var v1, v2, v3 types.Validator
// add some validators
v1, v2 = vals[nInit], vals[nInit+1]
diff := []*types.Validator{v1, v2}
diff := []types.Validator{v1, v2}
tx1 := MakeValSetChangeTx(v1.PubKey, v1.Power)
tx2 := MakeValSetChangeTx(v2.PubKey, v2.Power)
@ -142,7 +142,7 @@ func TestValUpdates(t *testing.T) {
v1.Power = 0
v2.Power = 0
v3.Power = 0
diff = []*types.Validator{v1, v2, v3}
diff = []types.Validator{v1, v2, v3}
tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power)
tx2 = MakeValSetChangeTx(v2.PubKey, v2.Power)
tx3 := MakeValSetChangeTx(v3.PubKey, v3.Power)
@ -160,22 +160,22 @@ func TestValUpdates(t *testing.T) {
} else {
v1.Power = 5
}
diff = []*types.Validator{v1}
diff = []types.Validator{v1}
tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power)
makeApplyBlock(t, dummy, 3, diff, tx1)
vals1 = append([]*types.Validator{v1}, vals1[1:]...)
vals1 = append([]types.Validator{v1}, vals1[1:]...)
vals2 = dummy.Validators()
valsEqual(t, vals1, vals2)
}
func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff []*types.Validator, txs ...[]byte) {
func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff []types.Validator, txs ...[]byte) {
// make and apply block
height := int64(heightInt)
hash := []byte("foo")
header := &types.Header{
header := types.Header{
Height: height,
}
@ -193,7 +193,7 @@ func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff [
}
// order doesn't matter
func valsEqual(t *testing.T, vals1, vals2 []*types.Validator) {
func valsEqual(t *testing.T, vals1, vals2 []types.Validator) {
if len(vals1) != len(vals2) {
t.Fatalf("vals dont match in len. got %d, expected %d", len(vals2), len(vals1))
}