Skip to content

Commit

Permalink
fix(profile): ensure addresses are not equal for MsgAddValidatorOpera…
Browse files Browse the repository at this point in the history
…torAddress sim (#727)
  • Loading branch information
Alex Johnson authored Apr 15, 2022
1 parent 80ea112 commit 0726841
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions x/profile/simulation/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,16 @@ func SimulateMsgAddValidatorOperatorAddress(ak types.AccountKeeper, bk types.Ban
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {

// choose two addresses that are not equal
simAccount, _ := simtypes.RandomAcc(r, accs)
opAddr, _ := simtypes.RandomAcc(r, accs)
opAccount, _ := simtypes.RandomAcc(r, accs)
for simAccount.Address.Equals(opAccount.Address) {
opAccount, _ = simtypes.RandomAcc(r, accs)
}

msg := &types.MsgAddValidatorOperatorAddress{
ValidatorAddress: simAccount.Address.String(),
OperatorAddress: opAddr.Address.String(),
OperatorAddress: opAccount.Address.String(),
}

txCtx := simulation.OperationInput{
Expand All @@ -130,7 +134,7 @@ func SimulateMsgAddValidatorOperatorAddress(ak types.AccountKeeper, bk types.Ban
ModuleName: types.ModuleName,
CoinsSpentInMsg: sdk.NewCoins(),
}
return genAndDeliverTxWithRandFeesAddOpAddr(txCtx, opAddr)
return genAndDeliverTxWithRandFeesAddOpAddr(txCtx, opAccount)
}
}

Expand Down

0 comments on commit 0726841

Please sign in to comment.