Skip to content

Commit

Permalink
chore(staking errors): code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jeebster committed May 19, 2021
1 parent b721616 commit 4914118
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
15 changes: 3 additions & 12 deletions x/staking/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ func NewEditValidatorCmd() *cobra.Command {
if minSelfDelegationString != "" {
msb, ok := sdk.NewIntFromString(minSelfDelegationString)
if !ok {
return sdkerrors.Wrap(
sdkerrors.ErrInvalidRequest,
"minimum self delegation must be a positive integer",
)
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer")
}

newMinSelfDelegation = &msb
Expand Down Expand Up @@ -326,10 +323,7 @@ func newBuildCreateValidatorMsg(clientCtx client.Context, txf tx.Factory, fs *fl

minSelfDelegation, ok := sdk.NewIntFromString(msbStr)
if !ok {
return txf, nil, sdkerrors.Wrap(
sdkerrors.ErrInvalidRequest,
"minimum self delegation must be a positive integer",
)
return txf, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer")
}

msg, err := types.NewMsgCreateValidator(
Expand Down Expand Up @@ -532,10 +526,7 @@ func BuildCreateValidatorMsg(clientCtx client.Context, config TxCreateValidatorC
minSelfDelegation, ok := sdk.NewIntFromString(msbStr)

if !ok {
return txBldr, nil, sdkerrors.Wrap(
sdkerrors.ErrInvalidRequest,
"minimum self delegation must be a positive integer",
)
return txBldr, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer")
}

msg, err := types.NewMsgCreateValidator(
Expand Down
5 changes: 1 addition & 4 deletions x/staking/keeper/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,7 @@ func (k Keeper) ValidateUnbondAmount(

delShares := del.GetShares()
if sharesTruncated.GT(delShares) {
return shares, sdkerrors.Wrap(
sdkerrors.ErrInvalidRequest,
"invalid shares amount",
)
return shares, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid shares amount")
}

// Cap the shares at the delegation's shares. Shares being greater could occur
Expand Down
10 changes: 2 additions & 8 deletions x/staking/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,15 @@ func (msg MsgCreateValidator) ValidateBasic() error {
return err
}
if !sdk.AccAddress(valAddr).Equals(delAddr) {
return sdkerrors.Wrap(
sdkerrors.ErrInvalidRequest,
"validator address is invalid",
)
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "validator address is invalid")
}

if msg.Pubkey == nil {
return ErrEmptyValidatorPubKey
}

if !msg.Value.IsValid() || !msg.Value.Amount.IsPositive() {
return sdkerrors.Wrap(
sdkerrors.ErrInvalidRequest,
"invalid delegation amount",
)
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid delegation amount")
}

if msg.Description == (Description{}) {
Expand Down

0 comments on commit 4914118

Please sign in to comment.