Skip to content

Commit

Permalink
chore: lint nosec
Browse files Browse the repository at this point in the history
  • Loading branch information
emidev98 committed Aug 29, 2023
1 parent f16c7dc commit c19b43f
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/app_testing/app_testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ func TestSimAppEnforceStakingForVestingTokens(t *testing.T) {
}
}

/* #nosec */
for _, share := range sharePerValidators {
require.Equal(t, sdk.NewDec(3_500_001_000_000), share)
}
Expand Down
7 changes: 5 additions & 2 deletions app/app_testing/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ func (s *AppTestSuite) Setup() {
GRPCQueryRouter: s.App.GRPCQueryRouter(),
Ctx: s.Ctx,
}
s.App.BankKeeper.SetParams(s.Ctx, banktypes.NewParams(true))
s.App.WasmKeeper.SetParams(s.Ctx, wasmtypes.DefaultParams())
err := s.App.BankKeeper.SetParams(s.Ctx, banktypes.NewParams(true))
s.Require().NoError(err)
err = s.App.WasmKeeper.SetParams(s.Ctx, wasmtypes.DefaultParams())
s.Require().NoError(err)

s.App.TokenFactoryKeeper.SetParams(s.Ctx, tokenfactorytypes.DefaultParams())
s.App.DistrKeeper.SetFeePool(s.Ctx, distrtypes.InitialFeePool())
}
Expand Down
1 change: 1 addition & 0 deletions x/tokenfactory/keeper/before_send.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (k Keeper) Hooks() Hooks {

// TrackBeforeSend calls the before send listener contract surpresses any errors
func (h Hooks) TrackBeforeSend(ctx sdk.Context, from, to sdk.AccAddress, amount sdk.Coins) {
/* #nosec */
_ = h.k.callBeforeSendListener(ctx, from, to, amount, false)
}

Expand Down
2 changes: 1 addition & 1 deletion x/tokenfactory/migrations/v2/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func MigrateStore(ctx sdk.Context, subspace paramtypes.Subspace) error {
var params types.Params
subspace.GetParamSet(ctx, &params)
params.DenomCreationGasConsume = uint64(types.DefaultCreationGasFee)
params.DenomCreationGasConsume = types.DefaultCreationGasFee
subspace.SetParamSet(ctx, &params)
return nil
}
3 changes: 2 additions & 1 deletion x/tokenfactory/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) //nolint:errcheck
/* #nosec */
types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
}

// GetTxCmd returns the x/tokenfactory module's root tx command.
Expand Down
7 changes: 7 additions & 0 deletions x/tokenfactory/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (m MsgCreateDenom) GetSignBytes() []byte {
}

func (m MsgCreateDenom) GetSigners() []sdk.AccAddress {
/* #nosec */
sender, _ := sdk.AccAddressFromBech32(m.Sender)
return []sdk.AccAddress{sender}
}
Expand Down Expand Up @@ -91,6 +92,7 @@ func (m MsgMint) GetSignBytes() []byte {
}

func (m MsgMint) GetSigners() []sdk.AccAddress {
/* #nosec */
sender, _ := sdk.AccAddressFromBech32(m.Sender)
return []sdk.AccAddress{sender}
}
Expand Down Expand Up @@ -134,6 +136,7 @@ func (m MsgBurn) GetSignBytes() []byte {
}

func (m MsgBurn) GetSigners() []sdk.AccAddress {
/* #nosec */
sender, _ := sdk.AccAddressFromBech32(m.Sender)
return []sdk.AccAddress{sender}
}
Expand Down Expand Up @@ -179,6 +182,7 @@ func (m MsgForceTransfer) GetSignBytes() []byte {
}

func (m MsgForceTransfer) GetSigners() []sdk.AccAddress {
/* #nosec */
sender, _ := sdk.AccAddressFromBech32(m.Sender)
return []sdk.AccAddress{sender}
}
Expand Down Expand Up @@ -220,6 +224,7 @@ func (m MsgChangeAdmin) GetSignBytes() []byte {
}

func (m MsgChangeAdmin) GetSigners() []sdk.AccAddress {
/* #nosec */
sender, _ := sdk.AccAddressFromBech32(m.Sender)
return []sdk.AccAddress{sender}
}
Expand Down Expand Up @@ -260,6 +265,7 @@ func (m MsgSetDenomMetadata) GetSignBytes() []byte {
}

func (m MsgSetDenomMetadata) GetSigners() []sdk.AccAddress {
/* #nosec */
sender, _ := sdk.AccAddressFromBech32(m.Sender)
return []sdk.AccAddress{sender}
}
Expand Down Expand Up @@ -303,6 +309,7 @@ func (m MsgSetBeforeSendHook) GetSignBytes() []byte {
}

func (m MsgSetBeforeSendHook) GetSigners() []sdk.AccAddress {
/* #nosec */
sender, _ := sdk.AccAddressFromBech32(m.Sender)
return []sdk.AccAddress{sender}
}
7 changes: 4 additions & 3 deletions x/tokenfactory/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var (
KeyDenomCreationGasConsume = []byte("DenomCreationGasConsume")

// chosen as an arbitrary large number, less than the max_gas_wanted_per_tx in config.
DefaultCreationGasFee = 1_000_000
DefaultCreationGasFee = uint64(1_000_000)
)

// ParamTable for gamm module.
Expand All @@ -32,8 +32,9 @@ func NewParams(denomCreationFee sdk.Coins, denomCreationGasConsume uint64) Param
func DefaultParams() Params {
return Params{
// For choice, see: https://github.com/osmosis-labs/osmosis/pull/4983
DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin("uluna", 10000000)),
DenomCreationGasConsume: uint64(DefaultCreationGasFee),
DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin("uluna", 10000000)),
/* #nosec */
DenomCreationGasConsume: DefaultCreationGasFee,
}
}

Expand Down

0 comments on commit c19b43f

Please sign in to comment.