Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: golangci-lint
on:
push:
branches:
- main
- master
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58
54 changes: 27 additions & 27 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ import (
"os"
"path/filepath"

appparams "github.com/sagaxyz/ssc/app/params"
"github.com/sagaxyz/ssc/docs"
sscmodule "github.com/sagaxyz/ssc/x/ssc"
sscmodulekeeper "github.com/sagaxyz/ssc/x/ssc/keeper"
sscmoduletypes "github.com/sagaxyz/ssc/x/ssc/types"
"github.com/spf13/cast"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmos "github.com/cometbft/cometbft/libs/os"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
Expand Down Expand Up @@ -89,6 +93,7 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
Expand All @@ -108,16 +113,11 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/spf13/cast"

sscmodule "github.com/sagaxyz/ssc/x/ssc"
sscmodulekeeper "github.com/sagaxyz/ssc/x/ssc/keeper"
sscmoduletypes "github.com/sagaxyz/ssc/x/ssc/types"

// this line is used by starport scaffolding # stargate/app/moduleImport

appparams "github.com/sagaxyz/ssc/app/params"
"github.com/sagaxyz/ssc/docs"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmos "github.com/cometbft/cometbft/libs/os"
)

const (
Expand All @@ -144,7 +144,7 @@ func getGovProposalHandlers() []govclient.ProposalHandler {
}

var (
// DefaultNodeHome default home directories for the application daemon
// DefaultNodeHome default home directories for the application daemon.
DefaultNodeHome string

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
Expand Down Expand Up @@ -178,7 +178,7 @@ var (
// this line is used by starport scaffolding # stargate/app/moduleBasic
)

// module account permissions
// module account permissions.
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
Expand Down Expand Up @@ -261,7 +261,7 @@ type App struct {
configurator module.Configurator
}

// New returns a reference to an initialized blockchain app
// New returns a reference to an initialized blockchain app.
func New(
logger log.Logger,
db dbm.DB,
Expand Down Expand Up @@ -743,20 +743,20 @@ func New(
return app
}

// Name returns the name of the App
// Name returns the name of the App.
func (app *App) Name() string { return app.BaseApp.Name() }

// BeginBlocker application updates every begin block
// BeginBlocker application updates every begin block.
func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
return app.mm.BeginBlock(ctx, req)
}

// EndBlocker application updates every end block
// EndBlocker application updates every end block.
func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
return app.mm.EndBlock(ctx, req)
}

// InitChainer application update at chain initialization
// InitChainer application update at chain initialization.
func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
var genesisState GenesisState
if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
Expand All @@ -766,12 +766,12 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res
return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
}

// Configurator get app configurator
// Configurator get app configurator.
func (app *App) Configurator() module.Configurator {
return app.configurator
}

// LoadHeight loads a particular height
// LoadHeight loads a particular height.
func (app *App) LoadHeight(height int64) error {
return app.LoadVersion(height)
}
Expand Down Expand Up @@ -811,12 +811,12 @@ func (app *App) AppCodec() codec.Codec {
return app.appCodec
}

// InterfaceRegistry returns an InterfaceRegistry
// InterfaceRegistry returns an InterfaceRegistry.
func (app *App) InterfaceRegistry() types.InterfaceRegistry {
return app.interfaceRegistry
}

// TxConfig returns SimApp's TxConfig
// TxConfig returns SimApp's TxConfig.
func (app *App) TxConfig() client.TxConfig {
return app.txConfig
}
Expand Down Expand Up @@ -888,7 +888,7 @@ func (app *App) RegisterNodeService(clientCtx client.Context) {
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
}

// initParamsKeeper init params keeper and its subspaces
// initParamsKeeper init params keeper and its subspaces.
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper {
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)

Expand All @@ -910,12 +910,12 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
return paramsKeeper
}

// SimulationManager returns the app SimulationManager
// SimulationManager returns the app SimulationManager.
func (app *App) SimulationManager() *module.SimulationManager {
return app.sm
}

// ModuleManager returns the app ModuleManager
// ModuleManager returns the app ModuleManager.
func (app *App) ModuleManager() *module.Manager {
return app.mm
}
6 changes: 3 additions & 3 deletions app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package app

import (
"github.com/sagaxyz/ssc/app/params"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/x/auth/tx"

"github.com/sagaxyz/ssc/app/params"
)

// makeEncodingConfig creates an EncodingConfig for an amino based test configuration.
Expand All @@ -24,7 +24,7 @@ func makeEncodingConfig() params.EncodingConfig {
}
}

// MakeEncodingConfig creates an EncodingConfig for testing
// MakeEncodingConfig creates an EncodingConfig for testing.
func MakeEncodingConfig() params.EncodingConfig {
encodingConfig := makeEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
Expand Down
5 changes: 3 additions & 2 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"fmt"
"log"

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
)

// ExportAppStateAndValidators exports the state of the application for a genesis
Expand Down Expand Up @@ -49,7 +50,7 @@ func (app *App) ExportAppStateAndValidators(
// prepForZeroHeightGenesis prepares for a fresh genesis
//
// NOTE zero height genesis is a temporary feature which will be deprecated
// in favour of export at a block height
// in favour of export at a block height.
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
applyAllowedAddrs := false

Expand Down
17 changes: 9 additions & 8 deletions app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import (
"testing"
"time"

dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/sagaxyz/ssc/app"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
Expand All @@ -34,9 +33,11 @@ import (
simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"

"github.com/sagaxyz/ssc/app"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
)

type storeKeysPrefixes struct {
Expand All @@ -45,7 +46,7 @@ type storeKeysPrefixes struct {
Prefixes [][]byte
}

// Get flags every time the simulator is run
// Get flags every time the simulator is run.
func init() {
simcli.GetSimulatorFlags()
}
Expand All @@ -60,7 +61,7 @@ func fauxMerkleModeOpt(bapp *baseapp.BaseApp) {
// Running using starport command:
// `starport chain simulate -v --numBlocks 200 --blockSize 50`
// Running as go benchmark test:
// `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true`
// `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true`.
func BenchmarkSimulation(b *testing.B) {
simcli.FlagSeedValue = time.Now().Unix()
simcli.FlagVerboseValue = true
Expand Down
4 changes: 2 additions & 2 deletions cmd/sscd/cmd/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cmd

import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/sagaxyz/ssc/app"

sdk "github.com/cosmos/cosmos-sdk/types"
)

func initSDKConfig() {
Expand Down
3 changes: 2 additions & 1 deletion cmd/sscd/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"errors"
"fmt"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
Expand All @@ -16,7 +18,6 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/spf13/cobra"
)

const (
Expand Down
32 changes: 16 additions & 16 deletions cmd/sscd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"path/filepath"
"strings"

dbm "github.com/cometbft/cometbft-db"
tmcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"
"github.com/cometbft/cometbft/libs/log"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/sagaxyz/ssc/app"
appparams "github.com/sagaxyz/ssc/app/params"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
Expand All @@ -33,16 +34,15 @@ import (
"github.com/cosmos/cosmos-sdk/x/genutil"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
// this line is used by starport scaffolding # root/moduleImport

"github.com/sagaxyz/ssc/app"
appparams "github.com/sagaxyz/ssc/app/params"
dbm "github.com/cometbft/cometbft-db"
tmcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"
"github.com/cometbft/cometbft/libs/log"
tmtypes "github.com/cometbft/cometbft/types"
)

// NewRootCmd creates a new root command for a Cosmos SDK application
// NewRootCmd creates a new root command for a Cosmos SDK application.
func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) {
encodingConfig := app.MakeEncodingConfig()
initClientCtx := client.Context{}.
Expand Down Expand Up @@ -147,7 +147,7 @@ func initRootCmd(
)
}

// queryCommand returns the sub-command to send queries to the app
// queryCommand returns the sub-command to send queries to the app.
func queryCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "query",
Expand All @@ -172,7 +172,7 @@ func queryCommand() *cobra.Command {
return cmd
}

// txCommand returns the sub-command to send transactions to the app
// txCommand returns the sub-command to send transactions to the app.
func txCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "tx",
Expand Down Expand Up @@ -224,7 +224,7 @@ type appCreator struct {
encodingConfig appparams.EncodingConfig
}

// newApp creates a new Cosmos SDK app
// newApp creates a new Cosmos SDK app.
func (a appCreator) newApp(
logger log.Logger,
db dbm.DB,
Expand Down Expand Up @@ -299,7 +299,7 @@ func (a appCreator) newApp(
)
}

// appExport creates a new simapp (optionally at a given height)
// appExport creates a new simapp (optionally at a given height).
func (a appCreator) appExport(
logger log.Logger,
db dbm.DB,
Expand Down
6 changes: 3 additions & 3 deletions cmd/sscd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package main
import (
"os"

"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"

"github.com/sagaxyz/ssc/app"
"github.com/sagaxyz/ssc/cmd/sscd/cmd"

"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
)

func main() {
Expand Down
Loading