Skip to content

Missing Non-Negative for Coin Type in LockCoins Msg #2

Description

@Hellobloc

the LockCoins Msg don't validate non-negative properties which could lead a negative subtractCoins() process in charge process, this would been a risky problem which may lead some wrong balance update and even over-minting problem.

func (keeper Keeper) LockCoins(ctx sdk.Context, owner sdk.AccAddress, unlockTime time.Duration, amount sdk.Coins) sdk.Error {
_, err := keeper.bankKeeper.SubtractCoins(ctx, owner, amount)
if err != nil {
return err
}
lock := keeper.GetLock(ctx, owner, unlockTime)
lock.Amount = lock.Amount.Add(amount)
keeper.setLock(ctx, lock)
return nil
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions