diff --git a/.golangci.yml b/.golangci.yml index 1d93735be..110e41cfd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,6 @@ run: timeout: 5m + tests: true modules-download-mode: readonly skip-files: - ./*_test.go @@ -7,22 +8,16 @@ run: linters: disable-all: true enable: - - gofmt - - goimports + - gofumpt - misspell - revive - - deadcode - errcheck - - gosimple - govet - ineffassign - staticcheck - - structcheck - typecheck - unused - - varcheck - gosec - - gocyclo issues: exclude-use-default: false @@ -37,4 +32,4 @@ linters-settings: disabled: true errcheck: check-type-assertions: true - \ No newline at end of file + diff --git a/CHANGELOG.md b/CHANGELOG.md index 3583e223b..df91fae81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ #### Bug Fixes - (rollapp) [#471](https://github.com/dymensionxyz/dymension/issues/471) Validate rollapp token metadata +- (hygene) [#676](https://github.com/dymensionxyz/dymension/pull/676) lint tests - (ibc) [#678](https://github.com/dymensionxyz/dymension/pull/678) apply a pfm patch ___ diff --git a/app/ante/handlers.go b/app/ante/handlers.go index d59849f46..b5e9bca7f 100644 --- a/app/ante/handlers.go +++ b/app/ante/handlers.go @@ -17,7 +17,7 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler { return sdk.ChainAnteDecorators( ethante.NewEthSetUpContextDecorator(options.EvmKeeper), - //FIXME: need to allow universal fees for Eth as well + // FIXME: need to allow universal fees for Eth as well ethante.NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices ethante.NewEthMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper), // Check eth effective gas price against the global MinGasPrice diff --git a/app/app.go b/app/app.go index db05876ed..283e3d5de 100644 --- a/app/app.go +++ b/app/app.go @@ -752,7 +752,7 @@ func New( // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment // we prefer to be more strict in what arguments the modules expect. - var skipGenesisInvariants = cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) + skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. @@ -946,7 +946,7 @@ func New( TxFeesKeeper: app.TxFeesKeeper, SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), MaxTxGasWanted: maxGasWanted, - ExtensionOptionChecker: nil, //uses default + ExtensionOptionChecker: nil, // uses default }) if err != nil { panic(err) @@ -1007,7 +1007,7 @@ func (app *App) ModuleAccountAddrs() map[string]bool { modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true } - //exclude the streamer as we want him to be able to get external incentives + // exclude the streamer as we want him to be able to get external incentives modAccAddrs[authtypes.NewModuleAddress(streamermoduletypes.ModuleName).String()] = false return modAccAddrs } diff --git a/app/apptesting/test_helpers.go b/app/apptesting/test_helpers.go index 35be2f4df..d9e2b1802 100644 --- a/app/apptesting/test_helpers.go +++ b/app/apptesting/test_helpers.go @@ -58,9 +58,7 @@ var DefaultConsensusParams = &abci.ConsensusParams{ }, } -var ( - TestChainID = "dymension_100-1" -) +var TestChainID = "dymension_100-1" // SetupOptions defines arguments that are passed into `Simapp` constructor. type SetupOptions struct { diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index cea0ccc76..c9bfc61a0 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -48,7 +48,7 @@ func (suite *KeeperTestHelper) CreateDefaultSequencer(ctx sdk.Context, rollappId pkAny1, err := codectypes.NewAnyWithValue(pubkey1) suite.Require().Nil(err) - //fund account + // fund account err = bankutil.FundAccount(suite.App.BankKeeper, ctx, addr1, sdk.NewCoins(bond)) suite.Require().Nil(err) diff --git a/app/export.go b/app/export.go index 55775d017..b98d109c1 100644 --- a/app/export.go +++ b/app/export.go @@ -19,7 +19,6 @@ import ( func (app *App) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, ) (servertypes.ExportedApp, error) { - // as if they could withdraw from the start of the next block ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) diff --git a/app/upgrades/v3/upgrade.go b/app/upgrades/v3/upgrade.go index 41be81753..f7e11e95e 100644 --- a/app/upgrades/v3/upgrade.go +++ b/app/upgrades/v3/upgrade.go @@ -19,11 +19,8 @@ func GetStoreUpgrades() *storetypes.StoreUpgrades { func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, - ) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - logger := ctx.Logger().With("upgrade", UpgradeName) // Start running the module migrations diff --git a/cmd/dymd/cmd/inspect.go b/cmd/dymd/cmd/inspect.go index 84a78be20..8e28dea94 100644 --- a/cmd/dymd/cmd/inspect.go +++ b/cmd/dymd/cmd/inspect.go @@ -48,7 +48,7 @@ func InspectCmd(appExporter types.AppExporter, appCreator types.AppCreator, defa return err } - //TODO: fix to flag + // TODO: fix to flag if len(args) > 0 && args[0] == "tendermint" { return getTendermintState(serverCtx.Config) } diff --git a/cmd/dymd/cmd/inspect_tendermint.go b/cmd/dymd/cmd/inspect_tendermint.go index 5e99763b7..ab66b3aa2 100644 --- a/cmd/dymd/cmd/inspect_tendermint.go +++ b/cmd/dymd/cmd/inspect_tendermint.go @@ -74,7 +74,7 @@ func getTendermintState(config *cfg.Config) error { fmt.Printf("%+v\n", latestBlock) if bh != state.LastBlockHeight { - //priniting block for state height + // priniting block for state height fmt.Println("LOADING BLOCK FOR STATE HEIGHT") block := blockStore.LoadBlock(state.LastBlockHeight) if block == nil { diff --git a/cmd/dymd/cmd/root.go b/cmd/dymd/cmd/root.go index 3b17036f7..e9c30c57a 100644 --- a/cmd/dymd/cmd/root.go +++ b/cmd/dymd/cmd/root.go @@ -159,7 +159,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig txCommand(), ethermintclient.KeyCommands(app.DefaultNodeHome), ) - } // queryCommand returns the sub-command to send queries to the app diff --git a/simulation/simapp.go b/simulation/simapp.go index cc04d677a..f1bb511cc 100644 --- a/simulation/simapp.go +++ b/simulation/simapp.go @@ -55,8 +55,8 @@ func GenAndDeliverMsgWithRandFees( bk types.BankKeeper, ak types.AccountKeeper, futureOperation []simtypes.FutureOperation, - bExpectedError bool) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - + bExpectedError bool, +) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { spendableCoins := bk.SpendableCoins(*ctx, simAccount.Address) if spendableCoins.Empty() { @@ -90,7 +90,6 @@ func GenAndDeliverMsgWithRandFees( if err != nil { panic(err) } - } return operationMsg, futureOperation, err } @@ -134,7 +133,6 @@ func GenAndDeliverTx(txCtx simulation.OperationInput, fees sdk.Coins) (simtypes. []uint64{account.GetSequence()}, txCtx.SimAccount.PrivKey, ) - if err != nil { return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to generate mock tx"), nil, err } @@ -145,5 +143,4 @@ func GenAndDeliverTx(txCtx simulation.OperationInput, fees sdk.Coins) (simtypes. } return simtypes.NewOperationMsg(txCtx.Msg, true, "", txCtx.Cdc), nil, nil - } diff --git a/testutil/keeper/delayedack.go b/testutil/keeper/delayedack.go index 08486e6f4..1e24cdb5f 100644 --- a/testutil/keeper/delayedack.go +++ b/testutil/keeper/delayedack.go @@ -104,7 +104,6 @@ type SequencerKeeperStub struct{} func (SequencerKeeperStub) GetSequencer(ctx sdk.Context, sequencerAddress string) (val sequencertypes.Sequencer, found bool) { return sequencertypes.Sequencer{}, false - } func DelayedackKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { diff --git a/testutil/network/network.go b/testutil/network/network.go index 28953fd91..623496970 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -45,7 +45,7 @@ func DefaultConfig() network.Config { cfg := network.DefaultConfig() encoding := app.MakeEncodingConfig() - //FIXME: add rand tmrand.Uint64() to chainID + // FIXME: add rand tmrand.Uint64() to chainID cfg.ChainID = "dymension_1000-1" cfg.AppConstructor = func(val network.Validator) servertypes.Application { return app.New( diff --git a/x/common/types/key_rollapp_packet.go b/x/common/types/key_rollapp_packet.go index 8ef5b37a1..3c9241383 100644 --- a/x/common/types/key_rollapp_packet.go +++ b/x/common/types/key_rollapp_packet.go @@ -10,7 +10,7 @@ import ( var _ binary.ByteOrder const ( - //KeySeparator defines the separator for keys + // KeySeparator defines the separator for keys KeySeparator = "/" // // RollappPacketKeyPrefix is the prefix to retrieve all RollappPackets // RollappPacketKeyPrefix = "RollappPacket/value/" diff --git a/x/delayedack/eibc.go b/x/delayedack/eibc.go index 7165dd307..c0580a535 100644 --- a/x/delayedack/eibc.go +++ b/x/delayedack/eibc.go @@ -91,7 +91,8 @@ func (im IBCMiddleware) eIBCDemandOrderHandler(ctx sdk.Context, rollappPacket co // calculates the demand order price, and creates a new demand order. // It returns the created demand order or an error if there is any. func (im IBCMiddleware) createDemandOrderFromIBCPacket(fungibleTokenPacketData transfertypes.FungibleTokenPacketData, - rollappPacket *commontypes.RollappPacket, eibcMetaData types.EIBCMetadata) (*eibctypes.DemandOrder, error) { + rollappPacket *commontypes.RollappPacket, eibcMetaData types.EIBCMetadata, +) (*eibctypes.DemandOrder, error) { // Validate the fungible token packet data as we're going to use it to create the demand order if err := fungibleTokenPacketData.ValidateBasic(); err != nil { return nil, err diff --git a/x/delayedack/keeper/fraud.go b/x/delayedack/keeper/fraud.go index 2e1c245cb..082029b69 100644 --- a/x/delayedack/keeper/fraud.go +++ b/x/delayedack/keeper/fraud.go @@ -30,7 +30,7 @@ func (k Keeper) HandleFraud(ctx sdk.Context, rollappID string) error { err := k.writeFailedAck(ctx, rollappPacket, errString) if err != nil { logger.Error("failed to write failed ack", "rollappID", rollappID, "packetId", packetId, "error", errString) - //don't return here as it's nice to have + // don't return here as it's nice to have } } diff --git a/x/delayedack/keeper/keeper.go b/x/delayedack/keeper/keeper.go index 8913dbef8..65a01f327 100644 --- a/x/delayedack/keeper/keeper.go +++ b/x/delayedack/keeper/keeper.go @@ -55,7 +55,6 @@ func NewKeeper( clientKeeper types.ClientKeeper, eibcKeeper types.EIBCKeeper, bankKeeper types.BankKeeper, - ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -189,7 +188,6 @@ func (k *Keeper) LookupModuleByChannel(ctx sdk.Context, portID, channelID string // VallidateRollappId checks that the rollappid from the ibc connection matches the rollapp checking the sequencer registered with the consensus state validator set func (k *Keeper) ValidateRollappId(ctx sdk.Context, rollapp, portID, channelID string) error { - // Get the sequencer from the latest state info update and check the validator set hash // from the headers match with the sequencer for the rollapp // As the assumption the sequencer is honest we don't check the packet proof height. @@ -212,19 +210,19 @@ func (k *Keeper) ValidateRollappId(ctx sdk.Context, rollapp, portID, channelID s return err } - //Gets sequencer information from the sequencer address found in the latest state info + // Gets sequencer information from the sequencer address found in the latest state info sequencer, found := k.sequencerKeeper.GetSequencer(ctx, stateInfo.Sequencer) if !found { return sdkerrors.Wrapf(sequencertypes.ErrUnknownSequencer, "sequencer %s not found for the rollapp %s", stateInfo.Sequencer, rollapp) } - //Gets the validator set hash made out of the pub key for the sequencer + // Gets the validator set hash made out of the pub key for the sequencer seqPubKeyHash, err := sequencer.GetDymintPubKeyHash() if err != nil { return err } - //It compares the validator set hash from the consensus state with the one we recreated from the sequencer. If its true it means the chain corresponds to the rollapp chain + // It compares the validator set hash from the consensus state with the one we recreated from the sequencer. If its true it means the chain corresponds to the rollapp chain if !bytes.Equal(tmConsensusState.NextValidatorsHash, seqPubKeyHash) { errMsg := fmt.Sprintf("consensus state does not match: consensus state validators %x, rollapp sequencer %x", tmConsensusState.NextValidatorsHash, stateInfo.Sequencer) @@ -258,7 +256,7 @@ func (k Keeper) getTmConsensusState(ctx sdk.Context, portID string, channelID st return &tenderminttypes.ConsensusState{}, err } - //TODO(srene) : consensus state is only obtained when getting it for latestheight. this can be an issue when sequencer changes. i have to figure out why is only returned for latest height + // TODO(srene) : consensus state is only obtained when getting it for latestheight. this can be an issue when sequencer changes. i have to figure out why is only returned for latest height consensusState, found := k.clientKeeper.GetClientConsensusState(ctx, connectionEnd.GetClientID(), clientState.GetLatestHeight()) if !found { diff --git a/x/delayedack/proof_height_ante.go b/x/delayedack/proof_height_ante.go index bb1289c0c..5e2d37f39 100644 --- a/x/delayedack/proof_height_ante.go +++ b/x/delayedack/proof_height_ante.go @@ -8,8 +8,7 @@ import ( delayedacktypes "github.com/dymensionxyz/dymension/v3/x/delayedack/types" ) -type IBCProofHeightDecorator struct { -} +type IBCProofHeightDecorator struct{} func NewIBCProofHeightDecorator() IBCProofHeightDecorator { return IBCProofHeightDecorator{} diff --git a/x/delayedack/types/params.go b/x/delayedack/types/params.go index e8b40b8f2..a452c70f7 100644 --- a/x/delayedack/types/params.go +++ b/x/delayedack/types/params.go @@ -7,10 +7,8 @@ import ( var _ paramtypes.ParamSet = (*Params)(nil) -var ( - // KeyEpochIdentifier is the key for the epoch identifier - KeyEpochIdentifier = []byte("EpochIdentifier") -) +// KeyEpochIdentifier is the key for the epoch identifier +var KeyEpochIdentifier = []byte("EpochIdentifier") const ( defaultEpochIdentifier = "hour" diff --git a/x/denommetadata/client/cli/tx.go b/x/denommetadata/client/cli/tx.go index 48ab0b836..1650a1849 100644 --- a/x/denommetadata/client/cli/tx.go +++ b/x/denommetadata/client/cli/tx.go @@ -10,9 +10,7 @@ import ( "github.com/dymensionxyz/dymension/v3/x/denommetadata/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { diff --git a/x/denommetadata/ibc_middleware.go b/x/denommetadata/ibc_middleware.go index 86f40f4f5..4468af622 100644 --- a/x/denommetadata/ibc_middleware.go +++ b/x/denommetadata/ibc_middleware.go @@ -195,7 +195,7 @@ func (im IBCMiddleware) OnRecvPacket( Denom: du.Denom, Exponent: du.Exponent, } - //base denom_unit should be the same as baseDenom + // base denom_unit should be the same as baseDenom if newDu.Exponent == 0 { newDu.Denom = voucherDenom newDu.Aliases = append(newDu.Aliases, du.Denom) diff --git a/x/denommetadata/keeper/keeper.go b/x/denommetadata/keeper/keeper.go index 3acbd59d9..7c447b870 100644 --- a/x/denommetadata/keeper/keeper.go +++ b/x/denommetadata/keeper/keeper.go @@ -19,7 +19,6 @@ type Keeper struct { // NewKeeper returns a new instance of the denommetadata keeper func NewKeeper(bankKeeper types.BankKeeper) *Keeper { - return &Keeper{ bankKeeper: bankKeeper, hooks: nil, @@ -37,7 +36,6 @@ func (k *Keeper) CreateDenomMetadata(ctx sdk.Context, metadata banktypes.Metadat return err } return nil - } func (k *Keeper) UpdateDenomMetadata(ctx sdk.Context, metadata banktypes.Metadata) error { diff --git a/x/denommetadata/module.go b/x/denommetadata/module.go index 383bc9989..a6af6f519 100644 --- a/x/denommetadata/module.go +++ b/x/denommetadata/module.go @@ -68,7 +68,6 @@ 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) { - } // GetTxCmd returns the module's root tx command. @@ -131,7 +130,6 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { // InitGenesis performs the module's genesis initialization. // Returns an empty ValidatorUpdate array. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} } diff --git a/x/denommetadata/proposal_handler.go b/x/denommetadata/proposal_handler.go index 422ec7a71..18a9d8286 100644 --- a/x/denommetadata/proposal_handler.go +++ b/x/denommetadata/proposal_handler.go @@ -23,7 +23,6 @@ func NewDenomMetadataProposalHandler(k *keeper.Keeper) govtypes.Handler { // HandleCreateDenomMetadataProposal is a handler for executing a passed denom metadata creation proposal func HandleCreateDenomMetadataProposal(ctx sdk.Context, k *keeper.Keeper, p *types.CreateDenomMetadataProposal) error { - for _, metadata := range p.TokenMetadata { err := k.CreateDenomMetadata(ctx, metadata) if err != nil { @@ -35,7 +34,6 @@ func HandleCreateDenomMetadataProposal(ctx sdk.Context, k *keeper.Keeper, p *typ // HandleUpdateDenomMetadataProposal is a handler for executing a passed denom metadata update proposal func HandleUpdateDenomMetadataProposal(ctx sdk.Context, k *keeper.Keeper, p *types.UpdateDenomMetadataProposal) error { - for _, metadata := range p.TokenMetadata { err := k.UpdateDenomMetadata(ctx, metadata) if err != nil { diff --git a/x/denommetadata/types/genesis.go b/x/denommetadata/types/genesis.go index 42aaca864..50137fbf7 100644 --- a/x/denommetadata/types/genesis.go +++ b/x/denommetadata/types/genesis.go @@ -13,6 +13,5 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - return nil } diff --git a/x/denommetadata/types/proposal_metadata.go b/x/denommetadata/types/proposal_metadata.go index 60211763b..037204390 100644 --- a/x/denommetadata/types/proposal_metadata.go +++ b/x/denommetadata/types/proposal_metadata.go @@ -17,13 +17,14 @@ const ( ) // Assert CreateDenomMetadataProposal implements govtypes.Content at compile-time -var _ govtypes.Content = &CreateDenomMetadataProposal{} -var _ govtypes.Content = &UpdateDenomMetadataProposal{} +var ( + _ govtypes.Content = &CreateDenomMetadataProposal{} + _ govtypes.Content = &UpdateDenomMetadataProposal{} +) func init() { govtypes.RegisterProposalType(ProposalTypeCreateDenomMetadata) govtypes.RegisterProposalType(ProposalTypeUpdateDenomMetadata) - } // NewCreateMetadataProposal creates a new create denommetadata proposal. diff --git a/x/eibc/client/cli/query_command_orders.go b/x/eibc/client/cli/query_command_orders.go index f1e35441a..feea7a360 100644 --- a/x/eibc/client/cli/query_command_orders.go +++ b/x/eibc/client/cli/query_command_orders.go @@ -23,7 +23,6 @@ func CmdListDemandOrdersByStatus() *cobra.Command { res, err := queryClient.DemandOrdersByStatus(context.Background(), &types.QueryDemandOrdersByStatusRequest{ Status: status, }) - if err != nil { return err } diff --git a/x/eibc/client/cli/tx.go b/x/eibc/client/cli/tx.go index 0670afe0e..3c6192d51 100644 --- a/x/eibc/client/cli/tx.go +++ b/x/eibc/client/cli/tx.go @@ -12,9 +12,7 @@ import ( "github.com/dymensionxyz/dymension/v3/x/eibc/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { diff --git a/x/eibc/keeper/grpc_query.go b/x/eibc/keeper/grpc_query.go index 673e95d78..d3d945590 100644 --- a/x/eibc/keeper/grpc_query.go +++ b/x/eibc/keeper/grpc_query.go @@ -42,7 +42,7 @@ func (q Querier) DemandOrderById(goCtx context.Context, req *types.QueryGetDeman // Get the demand order by its ID and search for it in all statuses var demandOrder *types.DemandOrder var err error - var statuses = []commontypes.Status{commontypes.Status_PENDING, commontypes.Status_FINALIZED, commontypes.Status_REVERTED} + statuses := []commontypes.Status{commontypes.Status_PENDING, commontypes.Status_FINALIZED, commontypes.Status_REVERTED} for _, status := range statuses { demandOrder, err = q.GetDemandOrder(ctx, status, req.Id) if err == nil && demandOrder != nil { diff --git a/x/eibc/keeper/hooks.go b/x/eibc/keeper/hooks.go index e387abc45..66ded9800 100644 --- a/x/eibc/keeper/hooks.go +++ b/x/eibc/keeper/hooks.go @@ -31,7 +31,8 @@ func (k Keeper) GetDelayedAckHooks() delayeacktypes.DelayedAckHooks { // 1. The packet status can change only once hence the oldPacketKey should always represent the order ID as it was created from it. // 2. The packet status can only change from PENDING func (d delayedAckHooks) AfterPacketStatusUpdated(ctx sdk.Context, packet *commontypes.RollappPacket, - oldPacketKey string, newPacketKey string) error { + oldPacketKey string, newPacketKey string, +) error { // Get the demand order from the old packet key demandOrderID := types.BuildDemandIDFromPacketKey(oldPacketKey) demandOrder, err := d.GetDemandOrder(ctx, commontypes.Status_PENDING, demandOrderID) diff --git a/x/eibc/keeper/keeper.go b/x/eibc/keeper/keeper.go index a41fd137a..9488222e5 100644 --- a/x/eibc/keeper/keeper.go +++ b/x/eibc/keeper/keeper.go @@ -35,7 +35,6 @@ func NewKeeper( accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, delayedAckKeeper types.DelayedAckKeeper, - ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -77,7 +76,6 @@ func (k Keeper) SetDemandOrder(ctx sdk.Context, order *types.DemandOrder) error ) return nil - } func (k Keeper) deleteDemandOrder(ctx sdk.Context, order *types.DemandOrder) error { diff --git a/x/eibc/module_simulation.go b/x/eibc/module_simulation.go index af0257762..a892f7c3b 100644 --- a/x/eibc/module_simulation.go +++ b/x/eibc/module_simulation.go @@ -47,7 +47,6 @@ func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedP // RandomizedParams creates randomized param changes for the simulator func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} } diff --git a/x/eibc/types/keys.go b/x/eibc/types/keys.go index 909f5a72c..437f0997b 100644 --- a/x/eibc/types/keys.go +++ b/x/eibc/types/keys.go @@ -13,7 +13,7 @@ const ( // ModuleName defines the module name ModuleName = "eibc" - //KeySeparator defines the separator for keys + // KeySeparator defines the separator for keys KeySeparator = "/" // StoreKey defines the primary module store key diff --git a/x/rollapp/client/cli/tx.go b/x/rollapp/client/cli/tx.go index b2c3af1ab..11eae2b80 100644 --- a/x/rollapp/client/cli/tx.go +++ b/x/rollapp/client/cli/tx.go @@ -12,9 +12,7 @@ import ( "github.com/dymensionxyz/dymension/v3/x/rollapp/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { diff --git a/x/rollapp/client/cli/tx_create_rollapp.go b/x/rollapp/client/cli/tx_create_rollapp.go index 2346bcd35..681a353db 100644 --- a/x/rollapp/client/cli/tx_create_rollapp.go +++ b/x/rollapp/client/cli/tx_create_rollapp.go @@ -1,9 +1,8 @@ package cli import ( - "strconv" - "encoding/json" + "strconv" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" diff --git a/x/rollapp/client/cli/tx_update_state.go b/x/rollapp/client/cli/tx_update_state.go index db89bf8bb..7347d5a2e 100644 --- a/x/rollapp/client/cli/tx_update_state.go +++ b/x/rollapp/client/cli/tx_update_state.go @@ -1,9 +1,8 @@ package cli import ( - "strconv" - "encoding/json" + "strconv" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" diff --git a/x/rollapp/client/proposal_handler.go b/x/rollapp/client/proposal_handler.go index 99d40ab21..775b1043b 100644 --- a/x/rollapp/client/proposal_handler.go +++ b/x/rollapp/client/proposal_handler.go @@ -5,6 +5,4 @@ import ( "github.com/dymensionxyz/dymension/v3/x/rollapp/client/cli" ) -var ( - SubmitFraudHandler = govclient.NewProposalHandler(cli.NewCmdSubmitFraudProposal) -) +var SubmitFraudHandler = govclient.NewProposalHandler(cli.NewCmdSubmitFraudProposal) diff --git a/x/rollapp/keeper/block_height_to_finalization_queue.go b/x/rollapp/keeper/block_height_to_finalization_queue.go index ca958e5fc..77ec36e7d 100644 --- a/x/rollapp/keeper/block_height_to_finalization_queue.go +++ b/x/rollapp/keeper/block_height_to_finalization_queue.go @@ -10,7 +10,6 @@ import ( // Called every block to finalize states that their dispute period over. func (k Keeper) FinalizeQueue(ctx sdk.Context) { - if uint64(ctx.BlockHeight()) < k.DisputePeriodInBlocks(ctx) { return } @@ -61,7 +60,8 @@ func (k Keeper) FinalizeQueue(ctx sdk.Context) { if len(failedToFinalizeQueue) > 0 { newBlockHeightToFinalizationQueue := types.BlockHeightToFinalizationQueue{ CreationHeight: blockHeightToFinalizationQueue.CreationHeight, - FinalizationQueue: failedToFinalizeQueue} + FinalizationQueue: failedToFinalizeQueue, + } k.SetBlockHeightToFinalizationQueue(ctx, newBlockHeightToFinalizationQueue) } @@ -81,7 +81,6 @@ func (k Keeper) SetBlockHeightToFinalizationQueue(ctx sdk.Context, blockHeightTo func (k Keeper) GetBlockHeightToFinalizationQueue( ctx sdk.Context, creationHeight uint64, - ) (val types.BlockHeightToFinalizationQueue, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) @@ -100,7 +99,6 @@ func (k Keeper) GetBlockHeightToFinalizationQueue( func (k Keeper) RemoveBlockHeightToFinalizationQueue( ctx sdk.Context, creationHeight uint64, - ) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) store.Delete(types.BlockHeightToFinalizationQueueKey( diff --git a/x/rollapp/keeper/fraud_handler.go b/x/rollapp/keeper/fraud_handler.go index cb5fc3b0e..bd7c962d5 100644 --- a/x/rollapp/keeper/fraud_handler.go +++ b/x/rollapp/keeper/fraud_handler.go @@ -26,17 +26,17 @@ func (k Keeper) HandleFraud(ctx sdk.Context, rollappID, clientId string, fraudHe return err } - //check height is not finalized + // check height is not finalized if stateInfo.Status == common.Status_FINALIZED { return sdkerrors.Wrapf(types.ErrDisputeAlreadyFinalized, "state info for height %d is already finalized", fraudHeight) } - //check height is not reverted + // check height is not reverted if stateInfo.Status == common.Status_REVERTED { return sdkerrors.Wrapf(types.ErrDisputeAlreadyReverted, "state info for height %d is already reverted", fraudHeight) } - //check the sequencer for this height is the same as the one in the fraud evidence + // check the sequencer for this height is the same as the one in the fraud evidence if stateInfo.Sequencer != seqAddr { return sdkerrors.Wrapf(types.ErrWrongProposerAddr, "sequencer address %s does not match the one in the state info", seqAddr) } @@ -47,13 +47,13 @@ func (k Keeper) HandleFraud(ctx sdk.Context, rollappID, clientId string, fraudHe return err } - //mark the rollapp as frozen. revert all pending states to finalized + // mark the rollapp as frozen. revert all pending states to finalized rollapp.Frozen = true k.SetRollapp(ctx, rollapp) k.RevertPendingStates(ctx, rollappID) - //TODO: get the clientId from rollapp object, instead of by proposal + // TODO: get the clientId from rollapp object, instead of by proposal if clientId != "" { err = k.freezeClientState(ctx, clientId) if err != nil { @@ -99,7 +99,7 @@ func (k Keeper) RevertPendingStates(ctx sdk.Context, rollappID string) { for _, queue := range queuePerHeight { leftPendingStates := []types.StateInfoIndex{} for _, stateInfoIndex := range queue.FinalizationQueue { - //keep pending packets not related to this rollapp in the queue + // keep pending packets not related to this rollapp in the queue if stateInfoIndex.RollappId != rollappID { leftPendingStates = append(leftPendingStates, stateInfoIndex) continue diff --git a/x/rollapp/keeper/grpc_query_rollapp.go b/x/rollapp/keeper/grpc_query_rollapp.go index 56c7e670d..8bd668022 100644 --- a/x/rollapp/keeper/grpc_query_rollapp.go +++ b/x/rollapp/keeper/grpc_query_rollapp.go @@ -27,7 +27,7 @@ func (k Keeper) RollappAll(c context.Context, req *types.QueryAllRollappRequest) if err := k.cdc.Unmarshal(value, &rollapp); err != nil { return err } - var rollappSummary = types.RollappSummary{ + rollappSummary := types.RollappSummary{ RollappId: rollapp.RollappId, } latestStateInfoIndex, found := k.GetLatestStateInfoIndex(ctx, rollapp.RollappId) @@ -42,7 +42,6 @@ func (k Keeper) RollappAll(c context.Context, req *types.QueryAllRollappRequest) rollapps = append(rollapps, rollappSummary) return nil }) - if err != nil { return nil, status.Error(codes.Internal, err.Error()) } diff --git a/x/rollapp/keeper/grpc_query_state_info.go b/x/rollapp/keeper/grpc_query_state_info.go index a8add9c4c..34fae7e04 100644 --- a/x/rollapp/keeper/grpc_query_state_info.go +++ b/x/rollapp/keeper/grpc_query_state_info.go @@ -38,7 +38,6 @@ func (k Keeper) StateInfoAll(c context.Context, req *types.QueryAllStateInfoRequ } return nil }) - if err != nil { return nil, status.Error(codes.Internal, err.Error()) } diff --git a/x/rollapp/keeper/invariants.go b/x/rollapp/keeper/invariants.go index 999b19b9f..b9533e4ef 100644 --- a/x/rollapp/keeper/invariants.go +++ b/x/rollapp/keeper/invariants.go @@ -54,7 +54,7 @@ func RollappByEIP155KeyInvariant(k Keeper) sdk.Invariant { continue } - //not breaking invariant, as eip155 format is not required + // not breaking invariant, as eip155 format is not required if eip155 == nil { continue } @@ -90,7 +90,7 @@ func BlockHeightToFinalizationQueueInvariant(k Keeper) sdk.Invariant { firstUnfinalizedStateIdx := latestFinalizedStateIdx.Index + 1 - //iterate over all the unfinalzied states and make sure they are in the queue + // iterate over all the unfinalzied states and make sure they are in the queue for i := firstUnfinalizedStateIdx; i <= latestStateIdx.Index; i++ { stateInfo, found := k.GetStateInfo(ctx, rollapp.RollappId, i) if !found { @@ -99,7 +99,7 @@ func BlockHeightToFinalizationQueueInvariant(k Keeper) sdk.Invariant { continue } creationHeight := stateInfo.CreationHeight - //finalizationTime := creationHeight + k.DisputePeriodInBlocks(ctx) + // finalizationTime := creationHeight + k.DisputePeriodInBlocks(ctx) val, found := k.GetBlockHeightToFinalizationQueue(ctx, creationHeight) if !found { @@ -108,7 +108,7 @@ func BlockHeightToFinalizationQueueInvariant(k Keeper) sdk.Invariant { continue } - //check that our state index is in the queue + // check that our state index is in the queue found = false for _, idx := range val.FinalizationQueue { if idx.RollappId == rollapp.RollappId && idx.Index == i { @@ -146,7 +146,7 @@ func RollappCountInvariant(k Keeper) sdk.Invariant { return "", false } - //If the count is not equal, need to check wether it's due to rollapp that didn't publish state yet + // If the count is not equal, need to check wether it's due to rollapp that didn't publish state yet var noStateRollappCount int for _, rollapp := range rollapps { if !k.IsRollappStarted(ctx, rollapp.RollappId) { @@ -187,7 +187,7 @@ func RollappLatestStateIndexInvariant(k Keeper) sdk.Invariant { } latestFinalizedStateIdx, _ := k.GetLatestFinalizedStateIndex(ctx, rollapp.RollappId) - //not found is ok, it means no finalized state yet + // not found is ok, it means no finalized state yet if latestStateIdx.Index < latestFinalizedStateIdx.Index { msg += fmt.Sprintf("rollapp (%s) have latestStateIdx < latestFinalizedStateIdx\n", rollapp.RollappId) diff --git a/x/rollapp/keeper/latest_finalized_state_index.go b/x/rollapp/keeper/latest_finalized_state_index.go index 5d12cc725..e3a637f2e 100644 --- a/x/rollapp/keeper/latest_finalized_state_index.go +++ b/x/rollapp/keeper/latest_finalized_state_index.go @@ -21,7 +21,6 @@ func (k Keeper) SetLatestFinalizedStateIndex(ctx sdk.Context, latestFinalizedSta func (k Keeper) GetLatestFinalizedStateIndex( ctx sdk.Context, rollappId string, - ) (val types.StateInfoIndex, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) @@ -40,7 +39,6 @@ func (k Keeper) GetLatestFinalizedStateIndex( func (k Keeper) RemoveLatestFinalizedStateIndex( ctx sdk.Context, rollappId string, - ) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) store.Delete(types.LatestFinalizedStateIndexKey( diff --git a/x/rollapp/keeper/latest_state_info_index.go b/x/rollapp/keeper/latest_state_info_index.go index 6a3615cee..8df8a7827 100644 --- a/x/rollapp/keeper/latest_state_info_index.go +++ b/x/rollapp/keeper/latest_state_info_index.go @@ -21,7 +21,6 @@ func (k Keeper) SetLatestStateInfoIndex(ctx sdk.Context, latestStateInfoIndex ty func (k Keeper) GetLatestStateInfoIndex( ctx sdk.Context, rollappId string, - ) (val types.StateInfoIndex, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) @@ -40,7 +39,6 @@ func (k Keeper) GetLatestStateInfoIndex( func (k Keeper) RemoveLatestStateInfoIndex( ctx sdk.Context, rollappId string, - ) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) store.Delete(types.LatestStateInfoIndexKey( diff --git a/x/rollapp/keeper/msg_server_create_rollapp.go b/x/rollapp/keeper/msg_server_create_rollapp.go index d168971c3..e5ba06588 100644 --- a/x/rollapp/keeper/msg_server_create_rollapp.go +++ b/x/rollapp/keeper/msg_server_create_rollapp.go @@ -45,7 +45,7 @@ func (k msgServer) CreateRollapp(goCtx context.Context, msg *types.MsgCreateRoll GenesisState: rollappGenesisState, } - //copy TokenMetadata + // copy TokenMetadata rollapp.TokenMetadata = make([]*types.TokenMetadata, len(msg.Metadatas)) for i := range msg.Metadatas { rollapp.TokenMetadata[i] = &msg.Metadatas[i] diff --git a/x/rollapp/keeper/rollapp.go b/x/rollapp/keeper/rollapp.go index 5e8c14843..193a83dd5 100644 --- a/x/rollapp/keeper/rollapp.go +++ b/x/rollapp/keeper/rollapp.go @@ -67,7 +67,6 @@ func (k Keeper) GetRollapp( func (k Keeper) RemoveRollapp( ctx sdk.Context, rollappId string, - ) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappKeyPrefix)) store.Delete(types.RollappKey( diff --git a/x/rollapp/keeper/state_info.go b/x/rollapp/keeper/state_info.go index a923f97c4..61215464c 100644 --- a/x/rollapp/keeper/state_info.go +++ b/x/rollapp/keeper/state_info.go @@ -20,7 +20,6 @@ func (k Keeper) GetStateInfo( ctx sdk.Context, rollappId string, index uint64, - ) (val types.StateInfo, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) @@ -40,7 +39,6 @@ func (k Keeper) RemoveStateInfo( ctx sdk.Context, rollappId string, index uint64, - ) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) store.Delete(types.StateInfoKey( diff --git a/x/rollapp/simulation/update_state.go b/x/rollapp/simulation/update_state.go index 19bb5be8e..a7d722d18 100644 --- a/x/rollapp/simulation/update_state.go +++ b/x/rollapp/simulation/update_state.go @@ -18,7 +18,6 @@ func SimulateMsgUpdateState( ) simtypes.Operation { return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - if len(simulation.GlobalSequencerAddressesList) == 0 { return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgUpdateState, "No sequencers"), nil, nil } @@ -100,6 +99,5 @@ func SimulateMsgUpdateState( // } return simulation.GenAndDeliverMsgWithRandFees(msg, msg.Type(), types.ModuleName, r, app, &ctx, &sequencer.Account, bk, ak, nil, bExpectedError) - } } diff --git a/x/rollapp/types/codec.go b/x/rollapp/types/codec.go index 693c9ce8f..6e4725786 100644 --- a/x/rollapp/types/codec.go +++ b/x/rollapp/types/codec.go @@ -19,7 +19,6 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateRollapp{}, &MsgUpdateState{}, &MsgRollappGenesisEvent{}) registry.RegisterImplementations((*govtypes.Content)(nil), &SubmitFraudProposal{}) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) - } var ( diff --git a/x/rollapp/types/message_create_rollapp.go b/x/rollapp/types/message_create_rollapp.go index 9470d7bac..94aa706de 100644 --- a/x/rollapp/types/message_create_rollapp.go +++ b/x/rollapp/types/message_create_rollapp.go @@ -10,7 +10,8 @@ const TypeMsgCreateRollapp = "create_rollapp" var _ sdk.Msg = &MsgCreateRollapp{} func NewMsgCreateRollapp(creator string, rollappId string, maxSequencers uint64, permissionedAddresses []string, - metadatas []TokenMetadata, genesisAccounts []GenesisAccount) *MsgCreateRollapp { + metadatas []TokenMetadata, genesisAccounts []GenesisAccount, +) *MsgCreateRollapp { return &MsgCreateRollapp{ Creator: creator, RollappId: rollappId, diff --git a/x/rollapp/types/state_info.go b/x/rollapp/types/state_info.go index 4d225cd9e..29ca16143 100644 --- a/x/rollapp/types/state_info.go +++ b/x/rollapp/types/state_info.go @@ -32,7 +32,6 @@ func (s *StateInfo) GetIndex() StateInfoIndex { } func (s *StateInfo) GetEvents() []sdk.Attribute { - eventAttributes := []sdk.Attribute{ sdk.NewAttribute(AttributeKeyRollappId, s.StateInfoIndex.RollappId), sdk.NewAttribute(AttributeKeyStateInfoIndex, strconv.FormatUint(s.StateInfoIndex.Index, 10)), diff --git a/x/sequencer/client/cli/tx.go b/x/sequencer/client/cli/tx.go index 799782c2b..f99b480cc 100644 --- a/x/sequencer/client/cli/tx.go +++ b/x/sequencer/client/cli/tx.go @@ -97,7 +97,6 @@ func CmdUnbond() *cobra.Command { Short: "Create a new sequencer for a rollapp", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/sequencer/keeper/grpc_query_sequencer.go b/x/sequencer/keeper/grpc_query_sequencer.go index b473e17eb..7bdf30a0d 100644 --- a/x/sequencer/keeper/grpc_query_sequencer.go +++ b/x/sequencer/keeper/grpc_query_sequencer.go @@ -30,7 +30,6 @@ func (k Keeper) Sequencers(c context.Context, req *types.QuerySequencersRequest) sequencers = append(sequencers, sequencer) return nil }) - if err != nil { return nil, status.Error(codes.Internal, err.Error()) } diff --git a/x/sequencer/keeper/hook_listener.go b/x/sequencer/keeper/hook_listener.go index 8c0e9f7c3..cc43dc0d3 100644 --- a/x/sequencer/keeper/hook_listener.go +++ b/x/sequencer/keeper/hook_listener.go @@ -55,7 +55,7 @@ func (hook rollapphook) FraudSubmitted(ctx sdk.Context, rollappID string, height return err } - //unbond all other bonded sequencers + // unbond all other bonded sequencers sequencers := hook.k.GetSequencersByRollappByStatus(ctx, rollappID, types.Bonded) for _, sequencer := range sequencers { err := hook.k.forceUnbondSequencer(ctx, sequencer.SequencerAddress) diff --git a/x/sequencer/keeper/keeper.go b/x/sequencer/keeper/keeper.go index 6473f15d4..4d26b0374 100644 --- a/x/sequencer/keeper/keeper.go +++ b/x/sequencer/keeper/keeper.go @@ -39,7 +39,6 @@ func NewKeeper( } return &Keeper{ - cdc: cdc, storeKey: storeKey, memKey: memKey, diff --git a/x/sequencer/keeper/msg_server_unbond.go b/x/sequencer/keeper/msg_server_unbond.go index 670d87931..3140f2ac3 100644 --- a/x/sequencer/keeper/msg_server_unbond.go +++ b/x/sequencer/keeper/msg_server_unbond.go @@ -62,7 +62,7 @@ func (k Keeper) setSequencerToUnbonding(ctx sdk.Context, seqAddr string) (time.T k.RotateProposer(ctx, seq.RollappId) } - //TODO: emit an event + // TODO: emit an event return completionTime, nil } diff --git a/x/sequencer/keeper/sequencer.go b/x/sequencer/keeper/sequencer.go index 132533e01..8dbb9b0b0 100644 --- a/x/sequencer/keeper/sequencer.go +++ b/x/sequencer/keeper/sequencer.go @@ -19,7 +19,7 @@ func (k Keeper) SetSequencer(ctx sdk.Context, sequencer types.Sequencer) { seqByrollappKey := types.SequencerByRollappByStatusKey(sequencer.RollappId, sequencer.SequencerAddress, sequencer.Status) store.Set(seqByrollappKey, b) - //To support InitGenesis scenario + // To support InitGenesis scenario if sequencer.Status == types.Unbonding { k.setUnbondingSequencerQueue(ctx, sequencer) } @@ -34,7 +34,7 @@ func (k Keeper) UpdateSequencer(ctx sdk.Context, sequencer types.Sequencer, oldS seqByrollappKey := types.SequencerByRollappByStatusKey(sequencer.RollappId, sequencer.SequencerAddress, sequencer.Status) store.Set(seqByrollappKey, b) - //status changed, need to remove old status key + // status changed, need to remove old status key if sequencer.Status != oldStatus { oldKey := types.SequencerByRollappByStatusKey(sequencer.RollappId, sequencer.SequencerAddress, oldStatus) store.Delete(oldKey) @@ -54,7 +54,7 @@ func (k Keeper) RotateProposer(ctx sdk.Context, rollappId string) { ) return } - //take the next bonded sequencer to be the proposer. sorted by address + // take the next bonded sequencer to be the proposer. sorted by address seq := seqsByRollapp[0] seq.Proposer = true k.UpdateSequencer(ctx, seq, types.Bonded) diff --git a/x/sequencer/keeper/slashing.go b/x/sequencer/keeper/slashing.go index 671a2a23c..d45698867 100644 --- a/x/sequencer/keeper/slashing.go +++ b/x/sequencer/keeper/slashing.go @@ -34,7 +34,7 @@ func (k Keeper) Slashing(ctx sdk.Context, seqAddr string) error { oldStatus := seq.Status wasPropser := seq.Proposer - //in case we are slashing an unbonding sequencer, we need to remove it from the unbonding queue + // in case we are slashing an unbonding sequencer, we need to remove it from the unbonding queue if oldStatus == types.Unbonding { k.removeUnbondingSequencer(ctx, seq) } diff --git a/x/sequencer/module_simulation.go b/x/sequencer/module_simulation.go index 1f6399003..c18c506e7 100644 --- a/x/sequencer/module_simulation.go +++ b/x/sequencer/module_simulation.go @@ -51,7 +51,6 @@ func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedP // RandomizedParams creates randomized param changes for the simulator func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} } diff --git a/x/sequencer/simulation/create_sequencer.go b/x/sequencer/simulation/create_sequencer.go index db8dd4124..255f93865 100644 --- a/x/sequencer/simulation/create_sequencer.go +++ b/x/sequencer/simulation/create_sequencer.go @@ -91,6 +91,5 @@ func SimulateMsgCreateSequencer( } return simulation.GenAndDeliverMsgWithRandFees(msg, msg.Type(), types.ModuleName, r, app, &ctx, &creatorAccount, bk, ak, nil, bExpectedError) - } } diff --git a/x/sequencer/types/genesis.go b/x/sequencer/types/genesis.go index 4ff125196..c5da5058a 100644 --- a/x/sequencer/types/genesis.go +++ b/x/sequencer/types/genesis.go @@ -20,7 +20,7 @@ func (gs GenesisState) Validate() error { for _, elem := range gs.SequencerList { - //FIXME: should run validation on the sequencer objects + // FIXME: should run validation on the sequencer objects index := string(SequencerKey(elem.SequencerAddress)) if _, ok := sequencerIndexMap[index]; ok { @@ -29,7 +29,7 @@ func (gs GenesisState) Validate() error { sequencerIndexMap[index] = struct{}{} } - //FIXME: validate single PROPOSER per rollapp + // FIXME: validate single PROPOSER per rollapp return gs.Params.Validate() } diff --git a/x/streamer/client/cli/query.go b/x/streamer/client/cli/query.go index cb600f266..3808c8e70 100644 --- a/x/streamer/client/cli/query.go +++ b/x/streamer/client/cli/query.go @@ -35,7 +35,8 @@ func GetCmdToDistributeCoins() (*osmocli.QueryDescriptor, *types.ModuleToDistrib Use: "to-distribute-coins", Short: "Query coins that is going to be distributed", Long: `This command allows you to query the coins that are scheduled to be distributed. - It returns a list of coins with their denominations and amounts.`}, + It returns a list of coins with their denominations and amounts.`, + }, &types.ModuleToDistributeCoinsRequest{} } @@ -46,7 +47,8 @@ func GetCmdStreamByID() (*osmocli.QueryDescriptor, *types.StreamByIDRequest) { Short: "Query stream by id.", Long: `{{.Short}}{{.ExampleHeader}} {{.CommandPrefix}} stream-by-id 1 -`}, &types.StreamByIDRequest{} +`, + }, &types.StreamByIDRequest{} } // GetCmdActiveStreams returns active streams. @@ -56,7 +58,8 @@ func GetCmdActiveStreams() (*osmocli.QueryDescriptor, *types.ActiveStreamsReques Short: "Query active streams", Long: `This command allows you to query all active streams. An active stream is a stream that is currently in progress. - The command returns a list of active streams with their details.`}, + The command returns a list of active streams with their details.`, + }, &types.ActiveStreamsRequest{} } @@ -67,6 +70,7 @@ func GetCmdUpcomingStreams() (*osmocli.QueryDescriptor, *types.UpcomingStreamsRe Short: "Query upcoming streams", Long: `This command allows you to query all upcoming streams. An upcoming stream is a stream that is scheduled to start in the future. - The command returns a list of upcoming streams with their details, including the start time, end time, and the coins it contains.`}, + The command returns a list of upcoming streams with their details, including the start time, end time, and the coins it contains.`, + }, &types.UpcomingStreamsRequest{} } diff --git a/x/streamer/keeper/hooks.go b/x/streamer/keeper/hooks.go index cccc97118..0d884486e 100644 --- a/x/streamer/keeper/hooks.go +++ b/x/streamer/keeper/hooks.go @@ -13,8 +13,10 @@ type Hooks struct { k Keeper } -var _ epochstypes.EpochHooks = Hooks{} -var _ gammtypes.GammHooks = Hooks{} +var ( + _ epochstypes.EpochHooks = Hooks{} + _ gammtypes.GammHooks = Hooks{} +) // Hooks returns the hook wrapper struct. func (k Keeper) Hooks() Hooks { diff --git a/x/streamer/keeper/keeper.go b/x/streamer/keeper/keeper.go index 59365fb88..7078707bc 100644 --- a/x/streamer/keeper/keeper.go +++ b/x/streamer/keeper/keeper.go @@ -58,7 +58,7 @@ func (k Keeper) CreateStream(ctx sdk.Context, coins sdk.Coins, records []types.D return 0, err } - //TODO: it's better to check only the denoms of the requested coins. No need to iterate entire balance. + // TODO: it's better to check only the denoms of the requested coins. No need to iterate entire balance. moduleBalance := k.bk.GetAllBalances(ctx, authtypes.NewModuleAddress(types.ModuleName)) alreadyAllocatedCoins := k.GetModuleToDistributeCoins(ctx) diff --git a/x/streamer/types/genesis.go b/x/streamer/types/genesis.go index e3ba24b3f..1029ef8f0 100644 --- a/x/streamer/types/genesis.go +++ b/x/streamer/types/genesis.go @@ -30,7 +30,7 @@ func (gs GenesisState) Validate() error { return fmt.Errorf("streams length does not match last stream id") } - //validate the streams are sorted and last stream id is correct + // validate the streams are sorted and last stream id is correct for i, stream := range gs.Streams { if stream.Id != uint64(i+1) { return fmt.Errorf("stream in idx %d have wrong streamID (%d)", i, stream.Id) diff --git a/x/streamer/types/proposal_distribution.go b/x/streamer/types/proposal_distribution.go index dc757e6b6..2f1c9de42 100644 --- a/x/streamer/types/proposal_distribution.go +++ b/x/streamer/types/proposal_distribution.go @@ -16,13 +16,14 @@ const ( ) // Assert ReplaceStreamDistributionProposal implements govtypes.Content at compile-time -var _ govtypes.Content = &ReplaceStreamDistributionProposal{} -var _ govtypes.Content = &UpdateStreamDistributionProposal{} +var ( + _ govtypes.Content = &ReplaceStreamDistributionProposal{} + _ govtypes.Content = &UpdateStreamDistributionProposal{} +) func init() { govtypes.RegisterProposalType(ProposalTypeReplaceStreamDistribution) govtypes.RegisterProposalType(ProposalTypeUpdateStreamDistribution) - } // NewReplaceStreamDistributionProposal creates a new ReplaceStreamDistribution proposal. diff --git a/x/streamer/types/proposal_stream.go b/x/streamer/types/proposal_stream.go index f42ef9b3d..a87da81d4 100644 --- a/x/streamer/types/proposal_stream.go +++ b/x/streamer/types/proposal_stream.go @@ -18,13 +18,14 @@ const ( ) // Assert CreateStreamProposal implements govtypes.Content at compile-time -var _ govtypes.Content = &CreateStreamProposal{} -var _ govtypes.Content = &TerminateStreamProposal{} +var ( + _ govtypes.Content = &CreateStreamProposal{} + _ govtypes.Content = &TerminateStreamProposal{} +) func init() { govtypes.RegisterProposalType(ProposalTypeCreateStream) govtypes.RegisterProposalType(ProposalTypeTerminateStream) - } // NewCreateStreamProposal creates a new create stream proposal.