Skip to content

Commit

Permalink
fix: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Lockwarr committed Nov 11, 2024
1 parent 7b57a4a commit 4426156
Show file tree
Hide file tree
Showing 66 changed files with 162 additions and 167 deletions.
2 changes: 1 addition & 1 deletion testutil/common/sample/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

// AccAddress returns a sample account address
// AccAddress returns a sample account address.
func AccAddress() string {
pk := ed25519.GenPrivKey().PubKey()
addr := pk.Address()
Expand Down
2 changes: 1 addition & 1 deletion testutil/contractmanager/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func New(t *testing.T, configs ...network.Config) *network.Network {
}

// DefaultConfig will initialize config for the network with custom application,
// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig
// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig.
func DefaultConfig() network.Config {
// app doesn't have these modules anymore, but we need them for test setup, which uses gentx and MsgCreateValidator
app.ModuleBasics[genutiltypes.ModuleName] = genutil.AppModuleBasic{}
Expand Down
2 changes: 1 addition & 1 deletion testutil/interchainqueries/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func New(t *testing.T, configs ...network.Config) *network.Network {
}

// DefaultConfig will initialize config for the network with custom application,
// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig
// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig.
func DefaultConfig() network.Config {
// app doesn't have these modules anymore, but we need them for test setup, which uses gentx and MsgCreateValidator
app.ModuleBasics[genutiltypes.ModuleName] = genutil.AppModuleBasic{}
Expand Down
2 changes: 1 addition & 1 deletion testutil/interchaintxs/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func New(t *testing.T, configs ...network.Config) *network.Network {
}

// DefaultConfig will initialize config for the network with custom application,
// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig
// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig.
func DefaultConfig() network.Config {
// app doesn't have these modules anymore, but we need them for test setup, which uses gentx and MsgCreateValidator
app.ModuleBasics[genutiltypes.ModuleName] = genutil.AppModuleBasic{}
Expand Down
6 changes: 3 additions & 3 deletions third_party/proto/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ deps:
# TODO: update sdk buf dependency when v0.50.0 is tagged and pushed to BSR
# see: (https://github.com/cosmos/cosmos-sdk/tree/main/proto#sdk-x-buf)
- buf.build/cosmos/cosmos-sdk:v0.50.0
- buf.build/cosmos/cosmos-proto:1935555c206d4afb9e94615dfd0fad31
- buf.build/cosmos/gogo-proto:a14993478f40695898ed8a86931094b6656e8a5d
- buf.build/googleapis/googleapis:8d7204855ec14631a499bd7393ce1970
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/gogo-proto
- buf.build/googleapis/googleapis
- buf.build/cosmos/ics23:b1abd8678aab07165efd453c96796a179eb3131f
breaking:
use:
Expand Down
3 changes: 1 addition & 2 deletions x/contractmanager/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cli

import (
"fmt"
// "strings"

"github.com/spf13/cobra"

Expand All @@ -11,7 +10,7 @@ import (
"github.com/Nolus-Protocol/nolus-core/x/contractmanager/types"
)

// GetQueryCmd returns the cli query commands for this module
// GetQueryCmd returns the cli query commands for this module.
func GetQueryCmd(_ string) *cobra.Command {
// Group contractmanager queries under a subcommand
cmd := &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion x/contractmanager/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
}
}

// ExportGenesis returns the module's exported genesis
// ExportGenesis returns the module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
genesis := types.DefaultGenesis()
genesis.Params = k.GetParams(ctx)
Expand Down
6 changes: 3 additions & 3 deletions x/contractmanager/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type SudoLimitWrapper struct {
contractmanagertypes.WasmKeeper
}

// NewSudoLimitWrapper suppresses an error from a Sudo contract handler and saves it to a store
// NewSudoLimitWrapper suppresses an error from a Sudo contract handler and saves it to a store.
func NewSudoLimitWrapper(contractManager contractmanagertypes.ContractManagerKeeper, sudoKeeper contractmanagertypes.WasmKeeper) contractmanagertypes.WasmKeeper {
return SudoLimitWrapper{
contractManager,
Expand All @@ -28,7 +28,7 @@ func NewSudoLimitWrapper(contractManager contractmanagertypes.ContractManagerKee

// Sudo calls underlying Sudo handlers with a limited amount of gas
// in case of `out of gas` panic it converts the panic into an error and stops `out of gas` panic propagation
// if error happens during the Sudo call, we store the data that raised the error, and return the error
// if error happens during the Sudo call, we store the data that raised the error, and return the error.
func (k SudoLimitWrapper) Sudo(ctx context.Context, contractAddress sdk.AccAddress, msg []byte) (resp []byte, err error) {
c := sdk.UnwrapSDKContext(ctx)

Expand Down Expand Up @@ -67,7 +67,7 @@ func (k SudoLimitWrapper) Logger(ctx sdk.Context) log.Logger {
}

// outOfGasRecovery converts `out of gas` panic into an error
// leaving unprocessed any other kinds of panics
// leaving unprocessed any other kinds of panics.
func outOfGasRecovery(
gasMeter types.GasMeter,
err *error,
Expand Down
2 changes: 1 addition & 1 deletion x/contractmanager/keeper/failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (k Keeper) GetNextFailureIDKey(ctx context.Context, address string) uint64
return 0
}

// GetAllFailures returns all failures
// GetAllFailures returns all failures.
func (k Keeper) GetAllFailures(ctx context.Context) (list []types.Failure) {
c := sdk.UnwrapSDKContext(ctx)

Expand Down
2 changes: 1 addition & 1 deletion x/contractmanager/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer {

var _ types.MsgServer = msgServer{}

// UpdateParams updates the module parameters
// UpdateParams updates the module parameters.
func (k Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
if err := req.Validate(); err != nil {
return nil, errors.Wrap(err, "failed to validate MsgUpdateParams")
Expand Down
4 changes: 2 additions & 2 deletions x/contractmanager/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/Nolus-Protocol/nolus-core/x/contractmanager/types"
)

// GetParams get all parameters as types.Params
// GetParams get all parameters as types.Params.
func (k Keeper) GetParams(ctx context.Context) (params types.Params) {
c := sdk.UnwrapSDKContext(ctx)
store := c.KVStore(k.storeKey)
Expand All @@ -21,7 +21,7 @@ func (k Keeper) GetParams(ctx context.Context) (params types.Params) {
return params
}

// SetParams set the params
// SetParams set the params.
func (k Keeper) SetParams(ctx context.Context, params types.Params) error {
c := sdk.UnwrapSDKContext(ctx)
store := c.KVStore(k.storeKey)
Expand Down
2 changes: 1 addition & 1 deletion x/contractmanager/migrations/v2/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// MigrateStore performs in-place store migrations.
// The migration rearranges removes all old failures,
// since they do not have the necessary fields packet and ack for resubmission
// since they do not have the necessary fields packet and ack for resubmission.
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey) error {
return migrateFailures(ctx, storeKey)
}
Expand Down
36 changes: 18 additions & 18 deletions x/contractmanager/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"cosmossdk.io/core/appmodule"

// this line is used by starport scaffolding # 1
// this line is used by starport scaffolding # 1.

"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
Expand Down Expand Up @@ -44,27 +44,27 @@ func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic {
return AppModuleBasic{cdc: cdc}
}

// Name returns the name of the module as a string
// Name returns the name of the module as a string.
func (AppModuleBasic) Name() string {
return types.ModuleName
}

// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore
// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore.
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
}

// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message
// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message.
func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
types.RegisterInterfaces(reg)
}

// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing
// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesis())
}

// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form
// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
Expand All @@ -77,27 +77,27 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingCo
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
}

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module
// 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
}

// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module
// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module.
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
return nil
}

// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module
// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd(types.StoreKey)
}

// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------.
// AppModule
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------.
var _ appmodule.AppModule = AppModule{}

// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement
// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement.
type AppModule struct {
AppModuleBasic

Expand All @@ -122,10 +122,10 @@ func (am AppModule) IsOnePerModuleType() { // marker
func (am AppModule) IsAppModule() { // marker
}

// Deprecated: use RegisterServices
// Deprecated: use RegisterServices.
func (AppModule) QuerierRoute() string { return types.RouterKey }

// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries
// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
Expand All @@ -136,7 +136,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
}
}

// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted)
// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted).
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}

// InitGenesis performs the module's genesis initialization. It returns no validator updates.
Expand All @@ -156,13 +156,13 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
return cdc.MustMarshalJSON(genState)
}

// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1
// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1.
func (AppModule) ConsensusVersion() uint64 { return types.ConsensusVersion }

// BeginBlock contains the logic that is automatically triggered at the beginning of each block
// BeginBlock contains the logic that is automatically triggered at the beginning of each block.
func (am AppModule) BeginBlock(_ sdk.Context) {}

// EndBlock contains the logic that is automatically triggered at the end of each block
// EndBlock contains the logic that is automatically triggered at the end of each block.
func (am AppModule) EndBlock(_ sdk.Context) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{}
}
2 changes: 1 addition & 1 deletion x/contractmanager/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"cosmossdk.io/errors"
)

// x/contractmanager module sentinel errors
// x/contractmanager module sentinel errors.
var (
ErrIncorrectFailureToResubmit = errors.Register(ModuleName, 1101, "incorrect failure to resubmit")
ErrFailedToResubmitFailure = errors.Register(ModuleName, 1102, "failed to resubmit failure")
Expand Down
2 changes: 1 addition & 1 deletion x/contractmanager/types/events.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package types

// Contractmanager events
// Contractmanager events.
const (
// AttributeKeySudoError indicates an attribute containing detailed Sudo call error.
AttributeKeySudoError = "error"
Expand Down
4 changes: 2 additions & 2 deletions x/contractmanager/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"fmt"
)

// DefaultIndex is the default global index
// DefaultIndex is the default global index.
const DefaultIndex uint64 = 1

// DefaultGenesis returns the default genesis state
// DefaultGenesis returns the default genesis state.
func DefaultGenesis() *GenesisState {
return &GenesisState{
FailuresList: []Failure{},
Expand Down
12 changes: 6 additions & 6 deletions x/contractmanager/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package types
import sdk "github.com/cosmos/cosmos-sdk/types"

const (
// ModuleName defines the module name
// ModuleName defines the module name.
ModuleName = "contractmanager"

// StoreKey defines the primary module store key
// StoreKey defines the primary module store key.
StoreKey = ModuleName

// RouterKey defines the module's message routing key
// RouterKey defines the module's message routing key.
RouterKey = ModuleName

// MemStoreKey defines the in-memory store key
// MemStoreKey defines the in-memory store key.
MemStoreKey = "mem_" + ModuleName
)

Expand All @@ -26,7 +26,7 @@ var (
ParamsKey = []byte{prefixParamsKey}
)

// GetFailureKeyPrefix returns the store key for the failures of the specific address
// GetFailureKeyPrefix returns the store key for the failures of the specific address.
func GetFailureKeyPrefix(
address string,
) []byte {
Expand All @@ -35,7 +35,7 @@ func GetFailureKeyPrefix(
return append(key, []byte("/")...)
}

// GetFailureKey returns the store key to retrieve a Failure from the index fields
// GetFailureKey returns the store key to retrieve a Failure from the index fields.
func GetFailureKey(
address string,
offset uint64,
Expand Down
10 changes: 5 additions & 5 deletions x/contractmanager/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ var _ paramtypes.ParamSet = (*Params)(nil)

const DefaultSudoCallGasLimit = uint64(1_000_000)

// ParamKeyTable the param key table for launch module
// ParamKeyTable the param key table for launch module.
func ParamKeyTable() paramtypes.KeyTable {
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
}

// NewParams creates a new Params instance
// NewParams creates a new Params instance.
func NewParams(sudoCallGasLimit uint64) Params {
return Params{
SudoCallGasLimit: sudoCallGasLimit,
}
}

// DefaultParams returns a default set of parameters
// DefaultParams returns a default set of parameters.
func DefaultParams() Params {
return NewParams(DefaultSudoCallGasLimit)
}

// ParamSetPairs get the params.ParamSet
// ParamSetPairs get the params.ParamSet.
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{}
}

// Validate validates the set of params
// Validate validates the set of params.
func (p Params) Validate() error {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion x/feerefunder/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/Nolus-Protocol/nolus-core/x/feerefunder/types"
)

// GetQueryCmd returns the cli query commands for this module
// GetQueryCmd returns the cli query commands for this module.
func GetQueryCmd(_ string) *cobra.Command {
// Group feerefunder queries under a subcommand
cmd := &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion x/feerefunder/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
}
}

// ExportGenesis returns the module's exported genesis
// ExportGenesis returns the module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
genesis := types.DefaultGenesis()
genesis.Params = k.GetParams(ctx)
Expand Down
2 changes: 1 addition & 1 deletion x/feerefunder/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (k Keeper) distributeFee(ctx sdk.Context, receiver sdk.AccAddress, fee sdk.
}

// allowedCoins returns true if one or more coins from `fees` are not present in coins from `params`
// assumes that `params` is sorted
// assumes that `params` is sorted.
func allowedCoins(fees, params sdk.Coins) bool {
for _, fee := range fees {
if params.AmountOf(fee.Denom).IsZero() {
Expand Down
Loading

0 comments on commit 4426156

Please sign in to comment.