From b2d9cd242cfd32359855fddd736dd6a929b13eb1 Mon Sep 17 00:00:00 2001 From: beer-1 Date: Tue, 3 Sep 2024 17:58:53 +0900 Subject: [PATCH] fix lint --- x/opchild/ante/fee_utils.go | 3 ++- x/opchild/keeper/msg_server.go | 7 ++++++- x/opchild/keeper/oracle.go | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/x/opchild/ante/fee_utils.go b/x/opchild/ante/fee_utils.go index 31105575..fe4ad901 100644 --- a/x/opchild/ante/fee_utils.go +++ b/x/opchild/ante/fee_utils.go @@ -1,6 +1,7 @@ package ante import ( + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -26,7 +27,7 @@ func computeRequiredFees(gas uint64, minGasPrices sdk.DecCoins) sdk.Coins { // Determine the required fees by multiplying each required minimum gas // price by the gas limit, where fee = ceil(minGasPrice * gasLimit). for i, gp := range minGasPrices { - fee := gp.Amount.MulInt64(int64(gas)) + fee := gp.Amount.MulInt(math.NewIntFromUint64(gas)) requiredFees[i] = sdk.NewCoin(gp.Denom, fee.Ceil().RoundInt()) } } diff --git a/x/opchild/keeper/msg_server.go b/x/opchild/keeper/msg_server.go index 1add4b41..137fbceb 100644 --- a/x/opchild/keeper/msg_server.go +++ b/x/opchild/keeper/msg_server.go @@ -109,7 +109,12 @@ func (ms MsgServer) ExecuteMessages(ctx context.Context, req *types.MsgExecuteMe // assert that the opchild module account is the only signer for ExecuteMessages message if !bytes.Equal(signers[0], authority) { - return nil, errorsmod.Wrapf(types.ErrInvalidSigner, sdk.AccAddress(signers[0]).String()) + signer, err := ms.addressCodec.BytesToString(signers[0]) + if err != nil { + return nil, err + } + + return nil, errorsmod.Wrap(types.ErrInvalidSigner, signer) } handler := ms.Router().Handler(msg) diff --git a/x/opchild/keeper/oracle.go b/x/opchild/keeper/oracle.go index ac8b9f00..83350fef 100644 --- a/x/opchild/keeper/oracle.go +++ b/x/opchild/keeper/oracle.go @@ -65,7 +65,9 @@ func (k L2OracleHandler) UpdateOracle(ctx context.Context, height uint64, extCom return err } - if hostStoreLastHeight > int64(height) { + //nolint:gosec + h := int64(height) + if hostStoreLastHeight > h { return types.ErrInvalidOracleHeight } @@ -83,7 +85,7 @@ func (k L2OracleHandler) UpdateOracle(ctx context.Context, height uint64, extCom return err } - err = l2slinky.ValidateVoteExtensions(sdkCtx, k.HostValidatorStore, int64(height-1), hostChainID, extendedCommitInfo) + err = l2slinky.ValidateVoteExtensions(sdkCtx, k.HostValidatorStore, h-1, hostChainID, extendedCommitInfo) if err != nil { return err }