From 6a97d39407d9cccb67663a0eb22f50fcf9d1f020 Mon Sep 17 00:00:00 2001 From: zhimao liu Date: Tue, 11 Sep 2018 16:23:32 -0700 Subject: [PATCH] fix type --- x/vote/handler_test.go | 12 +++++++++++- x/vote/wire.go | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/x/vote/handler_test.go b/x/vote/handler_test.go index 70a82122..3810123e 100644 --- a/x/vote/handler_test.go +++ b/x/vote/handler_test.go @@ -127,10 +127,20 @@ func TestRevokeBasic(t *testing.T) { // user1 can revoke voter candidancy now referenceList := &model.ReferenceList{ - AllValidators: []types.AccountKey{}, + AllValidators: []types.AccountKey{user1}, } vm.storage.SetReferenceList(ctx, referenceList) msg5 := NewRevokeStakeMsg("user1") + result2 := handler(ctx, msg5) + assert.Equal(t, ErrValidatorCannotRevoke().Result(), result2) + // invalid user cannot revoke + invalidMsg := NewRevokeStakeMsg("wqwdqwdasdsa") + resultInvalid := handler(ctx, invalidMsg) + assert.Equal(t, model.ErrVoterNotFound().Result(), resultInvalid) + // user1 can revoke voter candidancy now + referenceList = &model.ReferenceList{ + AllValidators: []types.AccountKey{}, + } vm.storage.SetReferenceList(ctx, referenceList) result3 := handler(ctx, msg5) diff --git a/x/vote/wire.go b/x/vote/wire.go index e6708673..45122410 100644 --- a/x/vote/wire.go +++ b/x/vote/wire.go @@ -6,9 +6,9 @@ import ( // Register concrete types on wire codec func RegisterWire(cdc *wire.Codec) { - cdc.RegisterConcrete(StakeInMsg{}, "lino/voteDeposit", nil) - cdc.RegisterConcrete(RevokeStakeMsg{}, "lino/voteRevoke", nil) - cdc.RegisterConcrete(StakeOutMsg{}, "lino/voteWithdraw", nil) + cdc.RegisterConcrete(StakeInMsg{}, "lino/stakeIn", nil) + cdc.RegisterConcrete(RevokeStakeMsg{}, "lino/revokeStake", nil) + cdc.RegisterConcrete(StakeOutMsg{}, "lino/stakeOut", nil) cdc.RegisterConcrete(DelegateMsg{}, "lino/delegate", nil) cdc.RegisterConcrete(DelegatorWithdrawMsg{}, "lino/delegateWithdraw", nil) cdc.RegisterConcrete(RevokeDelegationMsg{}, "lino/delegateRevoke", nil)