chore: gov audit (secondary reviewer) (backport #16870) (#16878)

Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2023-07-07 14:06:44 +02:00
committed by GitHub
co-authored by atheeshp
parent 2809154caf
commit 939fa27625
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -154,18 +154,18 @@ func (keeper Keeper) ChargeDeposit(ctx context.Context, proposalID uint64, destA
var remainingAmount sdk.Coins
for _, coins := range deposit.Amount {
burnAmount := sdkmath.LegacyNewDecFromInt(coins.Amount).Mul(rate).TruncateInt()
for _, coin := range deposit.Amount {
burnAmount := sdkmath.LegacyNewDecFromInt(coin.Amount).Mul(rate).TruncateInt()
// remaining amount = deposits amount - burn amount
remainingAmount = remainingAmount.Add(
sdk.NewCoin(
coins.Denom,
coins.Amount.Sub(burnAmount),
coin.Denom,
coin.Amount.Sub(burnAmount),
),
)
cancellationCharges = cancellationCharges.Add(
sdk.NewCoin(
coins.Denom,
coin.Denom,
burnAmount,
),
)
@@ -190,7 +190,7 @@ func (keeper Keeper) ChargeDeposit(ctx context.Context, proposalID uint64, destA
// get the distribution module account address
distributionAddress := keeper.authKeeper.GetModuleAddress(disttypes.ModuleName)
switch {
case len(destAddress) == 0:
case destAddress == "":
// burn the cancellation charges from deposits
err := keeper.bankKeeper.BurnCoins(ctx, types.ModuleName, cancellationCharges)
if err != nil {
+1 -1
View File
@@ -119,7 +119,7 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos
}, nil
}
// CancelProposals implements the MsgServer.CancelProposal method.
// CancelProposal implements the MsgServer.CancelProposal method.
func (k msgServer) CancelProposal(goCtx context.Context, msg *v1.MsgCancelProposal) (*v1.MsgCancelProposalResponse, error) {
_, err := k.authKeeper.AddressCodec().StringToBytes(msg.Proposer)
if err != nil {