no more compile errors in tests

This commit is contained in:
rigelrozanski 2018-09-20 22:09:27 -04:00
parent 9e2b8e413d
commit 1243507098
5 changed files with 23 additions and 13 deletions

View File

@ -24,7 +24,12 @@ func (v Validator) GetOperator() sdk.ValAddress {
}
// Implements sdk.Validator
func (v Validator) GetPubKey() crypto.PubKey {
func (v Validator) GetConsPubKey() crypto.PubKey {
return nil
}
// Implements sdk.Validator
func (v Validator) GetConsAddr() sdk.ConsAddress {
return nil
}
@ -88,7 +93,12 @@ func (vs *ValidatorSet) Validator(ctx sdk.Context, addr sdk.ValAddress) sdk.Vali
}
// ValidatorByPubKey implements sdk.ValidatorSet
func (vs *ValidatorSet) ValidatorByPubKey(ctx sdk.Context, pubkey crypto.PubKey) sdk.Validator {
func (vs *ValidatorSet) ValidatorByConsPubKey(_ sdk.Context, _ crypto.PubKey) sdk.Validator {
panic("not implemented")
}
// ValidatorByPubKey implements sdk.ValidatorSet
func (vs *ValidatorSet) ValidatorByConsAddr(_ sdk.Context, _ sdk.ConsAddress) sdk.Validator {
panic("not implemented")
}
@ -122,21 +132,21 @@ func (vs *ValidatorSet) RemoveValidator(addr sdk.AccAddress) {
}
// Implements sdk.ValidatorSet
func (vs *ValidatorSet) Slash(ctx sdk.Context, pubkey crypto.PubKey, height int64, power int64, amt sdk.Dec) {
func (vs *ValidatorSet) Slash(_ sdk.Context, _ sdk.ConsAddress, _ int64, _ int64, _ sdk.Dec) {
panic("not implemented")
}
// Implements sdk.ValidatorSet
func (vs *ValidatorSet) Jail(ctx sdk.Context, pubkey crypto.PubKey) {
func (vs *ValidatorSet) Jail(_ sdk.Context, _ sdk.ConsAddress) {
panic("not implemented")
}
// Implements sdk.ValidatorSet
func (vs *ValidatorSet) Unjail(ctx sdk.Context, pubkey crypto.PubKey) {
func (vs *ValidatorSet) Unjail(_ sdk.Context, _ sdk.ConsAddress) {
panic("not implemented")
}
// Implements sdk.ValidatorSet
func (vs *ValidatorSet) Delegation(ctx sdk.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress) sdk.Delegation {
func (vs *ValidatorSet) Delegation(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) sdk.Delegation {
panic("not implemented")
}

View File

@ -440,7 +440,7 @@ func TestTallyJailedValidator(t *testing.T) {
val2, found := sk.GetValidator(ctx, sdk.ValAddress(addrs[1]))
require.True(t, found)
sk.Jail(ctx, val2.ConsPubKey)
sk.Jail(ctx, sdk.ConsAddress(val2.ConsPubKey.Address()))
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
proposalID := proposal.GetProposalID()

View File

@ -5,10 +5,10 @@ const (
pastEvidenceFraction float64 = 0.5
// Minimum time per block
minTimePerBlock int64 = 1000 / 2
minTimePerBlock int64 = 86400 / 2
// Maximum time per block
maxTimePerBlock int64 = 1000
maxTimePerBlock int64 = 86400
// Number of keys
numKeys int = 250

View File

@ -27,7 +27,7 @@ func TestHandleDoubleSign(t *testing.T) {
// initial setup
ctx, ck, sk, _, keeper := createTestInput(t)
sk = sk.WithHooks(keeper.Hooks())
sk = sk.WithValidatorHooks(keeper.ValidatorHooks())
amtInt := int64(100)
addr, val, amt := addrs[0], pks[0], sdk.NewInt(amtInt)
got := stake.NewHandler(sk)(ctx, newTestMsgCreateValidator(addr, val, amt))
@ -69,7 +69,7 @@ func TestSlashingPeriodCap(t *testing.T) {
// initial setup
ctx, ck, sk, _, keeper := createTestInput(t)
sk = sk.WithHooks(keeper.Hooks())
sk = sk.WithValidatorHooks(keeper.ValidatorHooks())
amtInt := int64(100)
addr, amt := addrs[0], sdk.NewInt(amtInt)
valConsPubKey, valConsAddr := pks[0], sdk.ConsAddress(pks[0].Address())
@ -125,7 +125,7 @@ func TestHandleAbsentValidator(t *testing.T) {
// initial setup
ctx, ck, sk, _, keeper := createTestInput(t)
sk = sk.WithHooks(keeper.Hooks())
sk = sk.WithValidatorHooks(keeper.ValidatorHooks())
amtInt := int64(100)
addr, val, amt := addrs[0], pks[0], sdk.NewInt(amtInt)
sh := stake.NewHandler(sk)

View File

@ -80,7 +80,7 @@ func PositivePowerInvariant(k stake.Keeper) simulation.Invariant {
var err error
k.IterateValidatorsBonded(ctx, func(_ int64, validator sdk.Validator) bool {
if !validator.GetPower().GT(sdk.ZeroDec()) {
err = fmt.Errorf("validator with non-positive power stored. (pubkey %v)", validator.GetPubKey())
err = fmt.Errorf("validator with non-positive power stored. (pubkey %v)", validator.GetConsPubKey())
return true
}
return false