Skip to content

Commit

Permalink
fix lint err
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd committed Sep 2, 2024
1 parent ee79c33 commit caef9a1
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 12 deletions.
16 changes: 6 additions & 10 deletions app/ante/cosmos/fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,13 @@ func checkFeeCoinsAgainstMinGasPrices(ctx sdk.Context, feeCoins sdk.Coins, gas u
// provided in a transaction.
// NOTE: This implementation should be used with a great consideration as it opens potential attack vectors
// where txs with multiple coins could not be prioritized as expected.
// getTxPriority returns a naive tx priority based on the amount of the smallest denomination of the gas price
// provided in a transaction.
// NOTE: This implementation should be used with a great consideration as it opens potential attack vectors
// where txs with multiple coins could not be prioritized as expected.
func getTxPriority(fees sdk.Coins, gas uint64) uint64 {
var priority uint64
func getTxPriority(fees sdk.Coins, gas int64) int64 {
var priority int64
for _, c := range fees {
p := uint64(math.MaxUint64)
gasPrice := c.Amount.QuoRaw(int64(gas))
if gasPrice.IsUint64() {
p = gasPrice.Uint64()
p := int64(math.MaxInt64)
gasPrice := c.Amount.QuoRaw(gas)
if gasPrice.IsInt64() {
p = gasPrice.Int64()
}
if priority == 0 || p < priority {
priority = p
Expand Down
2 changes: 2 additions & 0 deletions precompiles/delegation/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func (p Precompile) AssociateOperatorWithStaker(
if !ok || staker == nil {
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", args[1])
}
// #nosec G115
if uint32(len(staker)) < clientChainAddrLength {
return nil, fmt.Errorf(exocmn.ErrInvalidAddrLength, len(staker), clientChainAddrLength)
}
Expand Down Expand Up @@ -176,6 +177,7 @@ func (p Precompile) DissociateOperatorFromStaker(
if !ok || staker == nil {
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", args[1])
}
// #nosec G115
if uint32(len(staker)) < clientChainAddrLength {
return nil, fmt.Errorf(exocmn.ErrInvalidAddrLength, len(staker), clientChainAddrLength)
}
Expand Down
4 changes: 2 additions & 2 deletions x/assets/keeper/client_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func (k Keeper) GetAllClientChainInfo(ctx sdk.Context) (infos []assetstype.Clien
return ret, nil
}

func (k Keeper) GetAllClientChainID(ctx sdk.Context) ([]uint64, error) {
ret := make([]uint64, 0)
func (k Keeper) GetAllClientChainID(ctx sdk.Context) ([]uint32, error) {
ret := make([]uint32, 0)
opFunc := func(clientChain *assetstype.ClientChainInfo) error {
// #nosec G115
ret = append(ret, uint32(clientChain.LayerZeroChainID))
Expand Down
1 change: 1 addition & 0 deletions x/avs/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func QuerySubmitTaskResult() *cobra.Command {
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

func QueryChallengeInfo() *cobra.Command {
cmd := &cobra.Command{
Use: "ChallengeInfo <task-address-in-hex> <task-id> <operator-addreess>",
Expand Down
1 change: 1 addition & 0 deletions x/avs/keeper/avs.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func (k *Keeper) GetTaskStatisticalEpochEndAVSs(ctx sdk.Context, epochIdentifier
})
return taskResList
}

// RegisterAVSWithChainID registers an AVS by its chainID.
// It is responsible for generating an AVS address based on the chainID.
// The following bare minimum parameters must be supplied:
Expand Down
1 change: 1 addition & 0 deletions x/avs/keeper/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func (k Keeper) QueryAVSAddrByChainID(ctx context.Context, req *types.QueryAVSAd
}
return &types.QueryAVSAddrByChainIDResponse{AVSAddress: avsAddr.String()}, nil
}

func (k Keeper) QuerySubmitTaskResult(ctx context.Context, req *types.QuerySubmitTaskResultReq) (*types.QuerySubmitTaskResultResponse, error) {
c := sdk.UnwrapSDKContext(ctx)
id, err := strconv.ParseUint(req.TaskId, 10, 64)
Expand Down
2 changes: 2 additions & 0 deletions x/avs/keeper/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func (k *Keeper) SetTaskResultInfo(
)
}
// check epoch,The first stage submission must be within the response window period
// #nosec G115
if epoch.CurrentEpoch > int64(task.StartingEpoch)+int64(task.TaskResponsePeriod) {
return errorsmod.Wrap(
types.ErrSubmitTooLateError,
Expand Down Expand Up @@ -228,6 +229,7 @@ func (k *Keeper) SetTaskResultInfo(
)
}
// check epoch,The second stage submission must be within the statistical window period
// #nosec G115
if epoch.CurrentEpoch <= int64(task.StartingEpoch)+int64(task.TaskResponsePeriod) ||
epoch.CurrentEpoch > int64(task.StartingEpoch)+int64(task.TaskResponsePeriod)+int64(task.TaskStatisticalPeriod) {
return errorsmod.Wrap(
Expand Down
1 change: 1 addition & 0 deletions x/operator/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cli

import (
"context"

"github.com/ExocoreNetwork/exocore/x/avs/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
Expand Down
1 change: 1 addition & 0 deletions x/operator/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ func (k *Keeper) QueryOperatorSlashInfo(goCtx context.Context, req *types.QueryO
Pagination: pageRes,
}, nil
}

func (k *Keeper) QueryAllOperatorsWithOptInAVS(goCtx context.Context, req *types.QueryAllOperatorsWithOptInAVSRequest) (*types.QueryAllOperatorsWithOptInAVSResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
operatorList, err := k.GetOptedInOperatorListByAVS(ctx, req.Avs)
Expand Down

0 comments on commit caef9a1

Please sign in to comment.