Skip to content

Commit

Permalink
delete revokeStake msg
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhimaoL committed Sep 13, 2018
1 parent 31ca63a commit 212a6cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
11 changes: 4 additions & 7 deletions test/vote/revoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,13 @@ func TestVoterRevoke(t *testing.T) {
delegatorWithdrawMsg := vote.NewDelegatorWithdrawMsg(delegator1Name, newAccountName,
types.LNO("70000"))
test.SignCheckDeliver(t, lb, delegatorWithdrawMsg, 1, true, delegator1TransactionPriv, baseTime)
//all validators cannot revoke voter candidancy
RevokeStakeMsg := vote.NewRevokeStakeMsg(newAccountName)
test.SimulateOneBlock(lb, baseTime)
test.SignCheckDeliver(t, lb, RevokeStakeMsg, 2, false, newAccountTransactionPriv, baseTime)

//validators can revoke voter candidancy after revoking validator candidancy
//validators can stake out after revoking validator candidancy
stakeOutMsg := vote.NewStakeOutMsg(newAccountName, types.LNO("300000"))
valRevokeMsg := val.NewValidatorRevokeMsg(newAccountName)
test.SignCheckDeliver(t, lb, valRevokeMsg, 3, true, newAccountTransactionPriv, baseTime)
test.SignCheckDeliver(t, lb, valRevokeMsg, 2, true, newAccountTransactionPriv, baseTime)
test.SimulateOneBlock(lb, baseTime)
test.SignCheckDeliver(t, lb, RevokeStakeMsg, 4, true, newAccountTransactionPriv, baseTime)
test.SignCheckDeliver(t, lb, stakeOutMsg, 3, true, newAccountTransactionPriv, baseTime)

// check delegator withdraw first coin return
test.SimulateOneBlock(lb, baseTime+test.CoinReturnIntervalSec+1)
Expand Down
12 changes: 2 additions & 10 deletions x/vote/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,12 @@ func TestRevokeBasic(t *testing.T) {

// user1 can revoke voter candidancy now
referenceList := &model.ReferenceList{
AllValidators: []types.AccountKey{user1},
AllValidators: []types.AccountKey{},
}
vm.storage.SetReferenceList(ctx, referenceList)
msg5 := NewRevokeStakeMsg("user1")
msg5 := NewStakeOutMsg("user1", coinToString(voteParam.VoterMinDeposit))
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)
Expand Down

0 comments on commit 212a6cc

Please sign in to comment.