Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Shares Concept from Unbond/Redelegate UX #3857

Merged
merged 22 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c36f946
Remove shares concept from unbonding and redelegation
alexanderbez Mar 11, 2019
2e15c57
Remove redundant staking REST type declerations
alexanderbez Mar 11, 2019
8c738b4
Rename staking REST request types
alexanderbez Mar 11, 2019
3716954
Fix slashing tests
alexanderbez Mar 12, 2019
39d38f4
Fix staking tests
alexanderbez Mar 12, 2019
978348e
Fix integration tests
alexanderbez Mar 12, 2019
84e6634
Add safety checks for when validator tokens are zero
alexanderbez Mar 12, 2019
43feda4
Attempt to fix simulation
alexanderbez Mar 12, 2019
7b7ee30
Add pending log entry
alexanderbez Mar 12, 2019
cf717b6
Update docs
alexanderbez Mar 12, 2019
df8da11
Merge branch 'develop' into bez/3516-remove-shares-ux
alexanderbez Mar 12, 2019
b8222ab
Implement and use SharesFromTokens
alexanderbez Mar 13, 2019
1f83a51
Rename ShareTokens and ShareTokensTruncated
alexanderbez Mar 13, 2019
6f8144a
Rename Delegation to Amount in DelegateRequest
alexanderbez Mar 13, 2019
762d02d
Merge branch 'develop' into bez/3516-remove-shares-ux
alexanderbez Mar 14, 2019
eac5105
Merge branch 'develop' into bez/3516-remove-shares-ux
alexanderbez Mar 14, 2019
fbe8e89
Implement and use SharesFromTokensTruncated
alexanderbez Mar 15, 2019
d49c3b8
Merge branch 'develop' into bez/3516-remove-shares-ux
alexanderbez Mar 20, 2019
d308e8e
Update MsgDelegate to use Amount instead of Value
alexanderbez Mar 20, 2019
e1ee01e
Use constructors in staking sim messages
alexanderbez Mar 20, 2019
50db599
Merge branch 'develop' into bez/3516-remove-shares-ux
alexanderbez Mar 25, 2019
82b2ff1
Implement and use ValidateUnbondAmount
alexanderbez Mar 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#3516 Remove concept of shares from staking unbonding and redelegation UX;
replaced by direct coin amount.
2 changes: 1 addition & 1 deletion client/lcd/lcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ func TestBonding(t *testing.T) {
// hence we utilize the exchange rate in the following test

validator2 := getValidator(t, port, operAddrs[1])
delTokensAfterRedelegation := validator2.ShareTokens(delegatorDels[0].GetShares())
delTokensAfterRedelegation := validator2.TokensFromShares(delegatorDels[0].GetShares())
require.Equal(t, rdTokens.ToDec(), delTokensAfterRedelegation)

redelegation := getRedelegations(t, port, addr, operAddrs[0], operAddrs[1])
Expand Down
34 changes: 6 additions & 28 deletions client/lcd/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,11 +815,11 @@ func doDelegate(
from := acc.GetAddress().String()

baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
msg := msgDelegationsInput{
msg := stakingrest.DelegateRequest{
BaseReq: baseReq,
DelegatorAddress: delAddr,
ValidatorAddress: valAddr,
Delegation: sdk.NewCoin(sdk.DefaultBondDenom, amount),
Amount: sdk.NewCoin(sdk.DefaultBondDenom, amount),
}

req, err := cdc.MarshalJSON(msg)
Expand All @@ -839,13 +839,6 @@ func doDelegate(
return txResp
}

type msgDelegationsInput struct {
BaseReq rest.BaseReq `json:"base_req"`
DelegatorAddress sdk.AccAddress `json:"delegator_address"` // in bech32
ValidatorAddress sdk.ValAddress `json:"validator_address"` // in bech32
Delegation sdk.Coin `json:"delegation"`
}

// POST /staking/delegators/{delegatorAddr}/delegations Submit delegation
func doUndelegate(
t *testing.T, port, name, pwd string, delAddr sdk.AccAddress,
Expand All @@ -859,11 +852,11 @@ func doUndelegate(
from := acc.GetAddress().String()

baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
msg := msgUndelegateInput{
msg := stakingrest.UndelegateRequest{
BaseReq: baseReq,
DelegatorAddress: delAddr,
ValidatorAddress: valAddr,
SharesAmount: amount.ToDec(),
Amount: sdk.NewCoin(sdk.DefaultBondDenom, amount),
}

req, err := cdc.MarshalJSON(msg)
Expand All @@ -882,13 +875,6 @@ func doUndelegate(
return txResp
}

type msgUndelegateInput struct {
BaseReq rest.BaseReq `json:"base_req"`
DelegatorAddress sdk.AccAddress `json:"delegator_address"` // in bech32
ValidatorAddress sdk.ValAddress `json:"validator_address"` // in bech32
SharesAmount sdk.Dec `json:"shares"`
}

// POST /staking/delegators/{delegatorAddr}/delegations Submit delegation
func doBeginRedelegation(
t *testing.T, port, name, pwd string, delAddr sdk.AccAddress, valSrcAddr,
Expand All @@ -902,12 +888,12 @@ func doBeginRedelegation(
from := acc.GetAddress().String()

baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
msg := stakingrest.MsgBeginRedelegateInput{
msg := stakingrest.RedelegateRequest{
BaseReq: baseReq,
DelegatorAddress: delAddr,
ValidatorSrcAddress: valSrcAddr,
ValidatorDstAddress: valDstAddr,
SharesAmount: amount.ToDec(),
Amount: sdk.NewCoin(sdk.DefaultBondDenom, amount),
}

req, err := cdc.MarshalJSON(msg)
Expand All @@ -926,14 +912,6 @@ func doBeginRedelegation(
return txResp
}

type msgBeginRedelegateInput struct {
BaseReq rest.BaseReq `json:"base_req"`
DelegatorAddress sdk.AccAddress `json:"delegator_address"` // in bech32
ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address"` // in bech32
ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address"` // in bech32
SharesAmount sdk.Dec `json:"shares"`
}

// GET /staking/delegators/{delegatorAddr}/delegations Get all delegations from a delegator
func getDelegatorDelegations(t *testing.T, port string, delegatorAddr sdk.AccAddress) []staking.Delegation {
res, body := Request(t, port, "GET", fmt.Sprintf("/staking/delegators/%s/delegations", delegatorAddr), nil)
Expand Down
6 changes: 3 additions & 3 deletions cmd/gaia/cli_test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,13 @@ func TestGaiaCLICreateValidator(t *testing.T) {
require.NotZero(t, validatorDelegations[0].Shares)

// unbond a single share
unbondTokens := sdk.TokensFromTendermintPower(1)
success = f.TxStakingUnbond(keyBar, unbondTokens.String(), barVal, "-y")
unbondAmt := sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromTendermintPower(1))
success = f.TxStakingUnbond(keyBar, unbondAmt.String(), barVal, "-y")
require.True(t, success)
tests.WaitForNextNBlocksTM(1, f.Port)

// Ensure bonded staking is correct
remainingTokens := newValTokens.Sub(unbondTokens)
remainingTokens := newValTokens.Sub(unbondAmt.Amount)
validator = f.QueryStakingValidator(barVal)
require.Equal(t, remainingTokens, validator.Tokens)

Expand Down
2 changes: 1 addition & 1 deletion docs/_attic/WIP-lamborghini-distribution/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ When a validator wishes to withdraw their transaction fees it must send
triggered each with any change in individual delegations, such as an unbond,
redelegation, or delegation of additional tokens to a specific validator. This
transaction withdraws the validators commission rewards, as well as any rewards
earning on their self-delegation.
earning on their self-delegation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... we can just delete this whole directory, we're not going to implement the Lamborghini model, unless there's a reason to keep it around. Certainly we don't need to update it, since it doesn't reflect any implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's why it's in "attic". Should we just wipe this @rigelrozanski ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a good idea to wipe... @ValarDragon wanted it in here for reference a while ago... either way I've added it to a new repo https://github.com/rigelrozanski/lamborghini-distribution

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like the best of both worlds to me! We should delete it here then.


```golang
type TxWithdrawValidator struct {
Expand Down
13 changes: 7 additions & 6 deletions docs/gaia/gaiacli.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,13 @@ gaiacli query staking delegations <delegator_addr>

#### Unbond Tokens

If for any reason the validator misbehaves, or you just want to unbond a certain amount of tokens, use this following command. You can unbond a specific `shares-amount` (eg:`12.1`\) or a `shares-fraction` (eg:`0.25`) with the corresponding flags.
If for any reason the validator misbehaves, or you just want to unbond a certain
amount of tokens, use this following command.

```bash
gaiacli tx staking unbond \
--validator=<account_cosmosval> \
--shares-fraction=0.5 \
<validator_addr> \
10atom \
--from=<key_name> \
--chain-id=<chain_id>
```
Expand Down Expand Up @@ -414,9 +415,9 @@ A redelegation is a type delegation that allows you to bond illiquid tokens from

```bash
gaiacli tx staking redelegate \
--addr-validator-source=<account_cosmosval> \
--addr-validator-dest=<account_cosmosval> \
--shares-fraction=50 \
<src-validator-operator-addr> \
<dst-validator-operator-addr> \
10atom \
--from=<key_name> \
--chain-id=<chain_id>
```
Expand Down
19 changes: 9 additions & 10 deletions docs/translations/kr/gaia/gaiacli.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,12 @@ gaiacli query staking delegation <delegator_addr(위임자 코스모스 주소)>

만약 특정 검증인이 악의적인 행동을 했거나 또는 본인이 개인적인 이유로 일부 토큰을 언본딩을 워하는 경우 다음 명령어를 통해 토큰을 언본딩 할 수 있습니다. 언본딩은 정확한 수량인 `shares-amount`(예시, `12.1`) 또는 언본딩을 원하는 물량의 비율인 `shares-fraction`(예시, `0.25`) 값으로 표현될 수 있습니다.


```bash
gaiacli tx staking unbond \
--validator=<account_cosmosval(검증인 cosmosval 주소)> \
--shares-fraction=0.5 \
--from=<key_name(트랜잭션을 발생시킬 키/계정 이름)> \
--chain-id=<chain_id(체인 아이디)>
<validator_addr> \
10atom \
--from=<key_name> \
--chain-id=<chain_id>
```

언본딩은 언본딩 기간이 끝나는 대로 완료됩니다.
Expand Down Expand Up @@ -412,11 +411,11 @@ gaiacli query staking unbonding-delegations-from <account_cosmosval(검증인 co

```bash
gaiacli tx staking redelegate \
--addr-validator-source=<account_cosmosval(스테이킹을 취소할 검증인의 cosmosval 주소)> \
--addr-validator-dest=<account_cosmosval(스테이킹을 받을 검증인의 cosmosval 주소)> \
--shares-fraction=50 \
--from=<key_name(트랜잭션을 발생시킬 키/계정 이름)> \
--chain-id=<chain_id(체인 아이디)>
<src-validator-operator-addr> \
<dst-validator-operator-addr> \
10atom \
--from=<key_name> \
--chain-id=<chain_id>
```

위 예시와 같이 재위임될 토큰의 수량은 특정 수량(`shares-amount`) 또는 일정 비율(`shares-fraction`)로 표현될 수 있습니다.
Expand Down
30 changes: 16 additions & 14 deletions types/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,22 @@ func (b BondStatus) Equal(b2 BondStatus) bool {

// validator for a delegated proof of stake system
type Validator interface {
GetJailed() bool // whether the validator is jailed
GetMoniker() string // moniker of the validator
GetStatus() BondStatus // status of the validator
GetOperator() ValAddress // operator address to receive/return validators coins
GetConsPubKey() crypto.PubKey // validation consensus pubkey
GetConsAddr() ConsAddress // validation consensus address
GetTokens() Int // validation tokens
GetBondedTokens() Int // validator bonded tokens
GetTendermintPower() int64 // validation power in tendermint
GetCommission() Dec // validator commission rate
GetMinSelfDelegation() Int // validator minimum self delegation
GetDelegatorShares() Dec // total outstanding delegator shares
ShareTokens(Dec) Dec // token worth of provided delegator shares
ShareTokensTruncated(Dec) Dec // token worth of provided delegator shares, truncated
GetJailed() bool // whether the validator is jailed
GetMoniker() string // moniker of the validator
GetStatus() BondStatus // status of the validator
GetOperator() ValAddress // operator address to receive/return validators coins
GetConsPubKey() crypto.PubKey // validation consensus pubkey
GetConsAddr() ConsAddress // validation consensus address
GetTokens() Int // validation tokens
GetBondedTokens() Int // validator bonded tokens
GetTendermintPower() int64 // validation power in tendermint
GetCommission() Dec // validator commission rate
GetMinSelfDelegation() Int // validator minimum self delegation
GetDelegatorShares() Dec // total outstanding delegator shares
TokensFromShares(Dec) Dec // token worth of provided delegator shares
TokensFromSharesTruncated(Dec) Dec // token worth of provided delegator shares, truncated
SharesFromTokens(amt Int) (Dec, Error) // shares worth of delegator's bond
SharesFromTokensTruncated(amt Int) (Dec, Error) // truncated shares worth of delegator's bond
}

// validator which fulfills abci validator interface for use in Tendermint
Expand Down
4 changes: 2 additions & 2 deletions x/distribution/keeper/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (k Keeper) initializeDelegation(ctx sdk.Context, val sdk.ValAddress, del sd
// calculate delegation stake in tokens
// we don't store directly, so multiply delegation shares * (tokens per share)
// note: necessary to truncate so we don't allow withdrawing more rewards than owed
stake := validator.ShareTokensTruncated(delegation.GetShares())
stake := validator.TokensFromSharesTruncated(delegation.GetShares())
k.SetDelegatorStartingInfo(ctx, val, del, types.NewDelegatorStartingInfo(previousPeriod, stake, uint64(ctx.BlockHeight())))
}

Expand Down Expand Up @@ -90,7 +90,7 @@ func (k Keeper) calculateDelegationRewards(ctx sdk.Context, val sdk.Validator, d
// a stake sanity check - recalculated final stake should be less than or equal to current stake
// here we cannot use Equals because stake is truncated when multiplied by slash fractions
// we could only use equals if we had arbitrary-precision rationals
currentStake := val.ShareTokens(del.GetShares())
currentStake := val.TokensFromShares(del.GetShares())
if stake.GT(currentStake) {
panic(fmt.Sprintf("calculated final stake for delegator %s greater than current stake: %s, %s",
del.GetDelegatorAddr(), stake, currentStake))
Expand Down
2 changes: 1 addition & 1 deletion x/slashing/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func handleMsgUnjail(ctx sdk.Context, msg MsgUnjail, k Keeper) sdk.Result {
return ErrMissingSelfDelegation(k.codespace).Result()
}

if validator.ShareTokens(selfDel.GetShares()).TruncateInt().LT(validator.GetMinSelfDelegation()) {
if validator.TokensFromShares(selfDel.GetShares()).TruncateInt().LT(validator.GetMinSelfDelegation()) {
return ErrSelfDelegationTooLowToUnjail(k.codespace).Result()
}

Expand Down
7 changes: 4 additions & 3 deletions x/slashing/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ func TestCannotUnjailUnlessMeetMinSelfDelegation(t *testing.T) {
sdk.Coins{sdk.NewCoin(sk.GetParams(ctx).BondDenom, initCoins.Sub(amt))},
)

undelegateMsg := staking.NewMsgUndelegate(sdk.AccAddress(addr), addr, sdk.OneDec())
unbondAmt := sdk.NewCoin(sk.GetParams(ctx).BondDenom, sdk.OneInt())
undelegateMsg := staking.NewMsgUndelegate(sdk.AccAddress(addr), addr, unbondAmt)
got = staking.NewHandler(sk)(ctx, undelegateMsg)

require.True(t, sk.Validator(ctx, addr).GetJailed())
Expand Down Expand Up @@ -92,10 +93,10 @@ func TestJailedValidatorDelegations(t *testing.T) {
got = staking.NewHandler(stakingKeeper)(ctx, msgDelegate)
require.True(t, got.IsOK(), "expected delegation to be ok, got %v", got)

unbondShares := bondAmount.ToDec()
unbondAmt := sdk.NewCoin(stakingKeeper.GetParams(ctx).BondDenom, bondAmount)

// unbond validator total self-delegations (which should jail the validator)
msgUndelegate := staking.NewMsgUndelegate(sdk.AccAddress(valAddr), valAddr, unbondShares)
msgUndelegate := staking.NewMsgUndelegate(sdk.AccAddress(valAddr), valAddr, unbondAmt)
got = staking.NewHandler(stakingKeeper)(ctx, msgUndelegate)
require.True(t, got.IsOK(), "expected begin unbonding validator msg to be ok, got: %v", got)

Expand Down
5 changes: 4 additions & 1 deletion x/slashing/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ func TestHandleDoubleSign(t *testing.T) {

// Should be able to unbond now
del, _ := sk.GetDelegation(ctx, sdk.AccAddress(operatorAddr), operatorAddr)
msgUnbond := staking.NewMsgUndelegate(sdk.AccAddress(operatorAddr), operatorAddr, del.GetShares())
validator, _ := sk.GetValidator(ctx, operatorAddr)

totalBond := validator.TokensFromShares(del.GetShares()).TruncateInt()
msgUnbond := staking.NewMsgUndelegate(sdk.AccAddress(operatorAddr), operatorAddr, sdk.NewCoin(sk.GetParams(ctx).BondDenom, totalBond))
res = staking.NewHandler(sk)(ctx, msgUnbond)
require.True(t, res.IsOK())
}
Expand Down
2 changes: 1 addition & 1 deletion x/staking/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestStakingMsgs(t *testing.T) {
checkDelegation(t, mApp, keeper, addr2, sdk.ValAddress(addr1), true, bondTokens.ToDec())

// begin unbonding
beginUnbondingMsg := NewMsgUndelegate(addr2, sdk.ValAddress(addr1), bondTokens.ToDec())
beginUnbondingMsg := NewMsgUndelegate(addr2, sdk.ValAddress(addr1), bondCoin)
header = abci.Header{Height: mApp.LastBlockHeight() + 1}
mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{beginUnbondingMsg}, []uint64{1}, []uint64{1}, true, true, priv2)

Expand Down
16 changes: 6 additions & 10 deletions x/staking/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,14 @@ func GetCmdRedelegate(storeName string, cdc *codec.Codec) *cobra.Command {
Args: cobra.ExactArgs(3),
Long: strings.TrimSpace(`Redelegate an amount of illiquid staking tokens from one validator to another:

$ gaiacli tx staking redelegate cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 100 --from mykey
$ gaiacli tx staking redelegate cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 100stake --from mykey
alexanderbez marked this conversation as resolved.
Show resolved Hide resolved
`),
RunE: func(cmd *cobra.Command, args []string) error {
txBldr := authtxb.NewTxBuilderFromCLI().WithTxEncoder(auth.DefaultTxEncoder(cdc))
cliCtx := context.NewCLIContext().
WithCodec(cdc).
WithAccountDecoder(cdc)

// var err error

delAddr := cliCtx.GetFromAddress()
valSrcAddr, err := sdk.ValAddressFromBech32(args[0])
if err != nil {
Expand All @@ -174,13 +172,12 @@ $ gaiacli tx staking redelegate cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmq
return err
}

// get the shares amount
sharesAmount, err := getShares(args[2], delAddr, valSrcAddr)
amount, err := sdk.ParseCoin(args[2])
if err != nil {
return err
}

msg := staking.NewMsgBeginRedelegate(delAddr, valSrcAddr, valDstAddr, sharesAmount)
msg := staking.NewMsgBeginRedelegate(delAddr, valSrcAddr, valDstAddr, amount)
return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}, false)
},
}
Expand All @@ -194,7 +191,7 @@ func GetCmdUnbond(storeName string, cdc *codec.Codec) *cobra.Command {
Args: cobra.ExactArgs(2),
Long: strings.TrimSpace(`Unbond an amount of bonded shares from a validator:

$ gaiacli tx staking unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100 --from mykey
$ gaiacli tx staking unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake --from mykey
alexanderbez marked this conversation as resolved.
Show resolved Hide resolved
`),
RunE: func(cmd *cobra.Command, args []string) error {
txBldr := authtxb.NewTxBuilderFromCLI().WithTxEncoder(auth.DefaultTxEncoder(cdc))
Expand All @@ -208,13 +205,12 @@ $ gaiacli tx staking unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
return err
}

// get the shares amount
sharesAmount, err := getShares(args[1], delAddr, valAddr)
amount, err := sdk.ParseCoin(args[1])
if err != nil {
return err
}

msg := staking.NewMsgUndelegate(delAddr, valAddr, sharesAmount)
msg := staking.NewMsgUndelegate(delAddr, valAddr, amount)
return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}, false)
},
}
Expand Down
13 changes: 0 additions & 13 deletions x/staking/client/cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking/types"
)

func getShares(sharesAmountStr string, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sharesAmount sdk.Dec, err error) {
sharesAmount, err = sdk.NewDecFromStr(sharesAmountStr)
if err != nil {
return sharesAmount, err
}

if !sharesAmount.GT(sdk.ZeroDec()) {
return sharesAmount, errors.New("shares amount must be positive number (ex. 123, 1.23456789)")
}

return
}

func buildCommissionMsg(rateStr, maxRateStr, maxChangeRateStr string) (commission types.CommissionMsg, err error) {
if rateStr == "" || maxRateStr == "" || maxChangeRateStr == "" {
return commission, errors.New("must specify all validator commission parameters")
Expand Down
Loading