Skip to content

Commit

Permalink
style: make linters happy
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Jan 17, 2024
1 parent a891039 commit f9d6c73
Show file tree
Hide file tree
Showing 48 changed files with 171 additions and 165 deletions.
7 changes: 5 additions & 2 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ package app
import (
"errors"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"

corestoretypes "cosmossdk.io/core/store"
circuitante "cosmossdk.io/x/circuit/ante"
circuitkeeper "cosmossdk.io/x/circuit/keeper"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
"github.com/cosmos/ibc-go/v8/modules/core/keeper"
)
Expand Down
71 changes: 34 additions & 37 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,26 @@ import (
"strings"
"sync"

"cosmossdk.io/client/v2/autocli"

"cosmossdk.io/core/appmodule"

"github.com/cosmos/cosmos-sdk/x/auth/posthandler"

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

"cosmossdk.io/x/circuit"

"github.com/okp4/okp4d/x/mint"

"github.com/cosmos/cosmos-sdk/runtime"

"cosmossdk.io/log"
"cosmossdk.io/x/tx/signing"
abci "github.com/cometbft/cometbft/abci/types"
tmos "github.com/cometbft/cometbft/libs/os"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/gogoproto/proto"
"github.com/ignite/cli/ignite/pkg/openapiconsole"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"

abci "github.com/cometbft/cometbft/abci/types"
tmos "github.com/cometbft/cometbft/libs/os"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/circuit"
circuitkeeper "cosmossdk.io/x/circuit/keeper"
circuittypes "cosmossdk.io/x/circuit/types"
"cosmossdk.io/x/evidence"
Expand All @@ -54,26 +41,35 @@ import (
"cosmossdk.io/x/feegrant"
feegrantkeeper "cosmossdk.io/x/feegrant/keeper"
feegrantmodule "cosmossdk.io/x/feegrant/module"
"cosmossdk.io/x/tx/signing"
"cosmossdk.io/x/upgrade"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/types/msgservice"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/posthandler"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -113,8 +109,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/ibc-go/modules/capability"

"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts"
Expand All @@ -139,16 +135,13 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

okp4wasm "github.com/okp4/okp4d/app/wasm"
"github.com/okp4/okp4d/docs"
logicmodule "github.com/okp4/okp4d/x/logic"
logicfs "github.com/okp4/okp4d/x/logic/fs"
logicmodulekeeper "github.com/okp4/okp4d/x/logic/keeper"
logicmoduletypes "github.com/okp4/okp4d/x/logic/types"
"github.com/okp4/okp4d/x/mint"
mintkeeper "github.com/okp4/okp4d/x/mint/keeper"
minttypes "github.com/okp4/okp4d/x/mint/types"
"github.com/okp4/okp4d/x/vesting"
Expand Down Expand Up @@ -674,8 +667,10 @@ func New(
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper,
app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper,
app.GetSubspace(distrtypes.ModuleName)),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()),
evidence.NewAppModule(app.EvidenceKeeper),
Expand All @@ -689,7 +684,8 @@ func New(
ibcfee.NewAppModule(app.IBCFeeKeeper),
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
ibctm.AppModule{},
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper,
app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
// our modules
vesting.NewAppModule(app.AccountKeeper, app.BankKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
Expand Down Expand Up @@ -935,7 +931,8 @@ func (app *App) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.ResponseFin
app.once.Do(func() {
ctx := app.NewUncachedContext(false, tmproto.Header{})
if _, err := app.ConsensusParamsKeeper.Params(ctx, &consensusparamtypes.QueryParamsRequest{}); err != nil {
// prevents panic: consensus key is nil: collections: not found: key 'no_key' of type github.com/cosmos/gogoproto/tendermint.types.ConsensusParams
// prevents panic: consensus key is nil: collections: not found: key 'no_key' of type
// github.com/cosmos/gogoproto/tendermint.types.ConsensusParams
// sdk 47:
// Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module.
// see https://github.com/cosmos/cosmos-sdk/blob/v0.47.0/simapp/upgrades.go#L66
Expand All @@ -950,7 +947,7 @@ func (app *App) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.ResponseFin
return app.BaseApp.FinalizeBlock(req)
}

// PreBlocker application updates every pre block
// PreBlocker application updates every pre block.
func (app *App) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) {
return app.ModuleManager.PreBlock(ctx)
}
Expand Down Expand Up @@ -1029,7 +1026,7 @@ func (app *App) InterfaceRegistry() types.InterfaceRegistry {
return app.interfaceRegistry
}

// TxConfig returns WasmApp's TxConfig
// TxConfig returns WasmApp's TxConfig.
func (app *App) TxConfig() client.TxConfig {
return app.txConfig
}
Expand All @@ -1056,8 +1053,8 @@ func (app *App) AutoCliOpts() autocli.AppOptions {
}

// DefaultGenesis returns a default genesis from the registered AppModuleBasic's.
func (a *App) DefaultGenesis() map[string]json.RawMessage {
return a.BasicModuleManager.DefaultGenesis(a.appCodec)
func (app *App) DefaultGenesis() map[string]json.RawMessage {
return app.BasicModuleManager.DefaultGenesis(app.appCodec)
}

// GetKey returns the KVStoreKey for the provided store key.
Expand Down
4 changes: 3 additions & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package app
import (
"testing"

dbm "github.com/cosmos/cosmos-db"

"cosmossdk.io/log"

dbm "github.com/cosmos/cosmos-db"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"

"github.com/okp4/okp4d/app/params"
)

Expand Down
6 changes: 3 additions & 3 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"fmt"
"log"

storetypes "cosmossdk.io/store/types"

cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"

storetypes "cosmossdk.io/store/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"
Expand Down Expand Up @@ -61,7 +61,7 @@ func (app *App) ExportAppStateAndValidators(
//
// in favour of export at a block height
//
//nolint:funlen
//nolint:funlen,gocognit,gocyclo
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {

Check failure on line 65 in app/export.go

View workflow job for this annotation

GitHub Actions / lint-go

calculated cyclomatic complexity for function prepForZeroHeightGenesis is 35, max is 20 (cyclop)
applyAllowedAddrs := false

Expand Down
6 changes: 3 additions & 3 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"encoding/json"
"testing"

"cosmossdk.io/log"

dbm "github.com/cosmos/cosmos-db"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"

"cosmossdk.io/log"

"github.com/cosmos/cosmos-sdk/codec"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
)

// The genesis state of the blockchain is represented here as a map of raw json
Expand Down
22 changes: 11 additions & 11 deletions cmd/okp4d/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ import (
"os"
"strings"

"github.com/CosmWasm/wasmd/x/wasm"
wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli"
dbm "github.com/cosmos/cosmos-db"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"

"cosmossdk.io/log"

simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
cmtcfg "github.com/cometbft/cometbft/config"

"cosmossdk.io/log"
confixcmd "cosmossdk.io/tools/confix/cmd"
cmtcfg "github.com/cometbft/cometbft/config"
dbm "github.com/cosmos/cosmos-db"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/debug"
Expand All @@ -29,6 +30,7 @@ import (
"github.com/cosmos/cosmos-sdk/server"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
Expand All @@ -38,14 +40,13 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"

"github.com/CosmWasm/wasmd/x/wasm"
wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli"

"github.com/okp4/okp4d/app"
appparams "github.com/okp4/okp4d/app/params"
)

// NewRootCmd creates a new root command for a Cosmos SDK application.
//
//nolint:funlen
func NewRootCmd() *cobra.Command {
// Set config
initSDKConfig()
Expand Down Expand Up @@ -97,9 +98,8 @@ Want to lean more about OKP4 network? Complete documentation is available at htt
// sets the RPC client needed for SIGN_MODE_TEXTUAL. This sign mode
// is only available if the client is online.
if !initClientCtx.Offline {
enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts := tx.ConfigOptions{
EnabledSignModes: enabledSignModes,
EnabledSignModes: append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL),
TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx),
}
txConfig, err := tx.NewTxConfigWithOptions(
Expand Down Expand Up @@ -266,7 +266,7 @@ func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) {

// newApp creates a new Cosmos SDK app.
//
//nolint:funlen

func newApp(
logger log.Logger,
db dbm.DB,
Expand Down
4 changes: 2 additions & 2 deletions scripts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package main
import (
"os"

"cosmossdk.io/log"

"github.com/spf13/cobra"

"cosmossdk.io/log"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"testing"
"time"

dbm "github.com/cosmos/cosmos-db"
"github.com/stretchr/testify/require"

tmrand "github.com/cometbft/cometbft/libs/rand"
dbm "github.com/cosmos/cosmos-db"

pruningtypes "cosmossdk.io/store/pruning/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
Expand Down
8 changes: 4 additions & 4 deletions x/logic/fs/wasm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import (
"net/url"
"testing"

"cosmossdk.io/store/metrics"

dbm "github.com/cosmos/cosmos-db"
"github.com/golang/mock/gomock"

. "github.com/smartystreets/goconvey/convey"

"cosmossdk.io/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
dbm "github.com/cosmos/cosmos-db"

"cosmossdk.io/log"
"cosmossdk.io/store"
"cosmossdk.io/store/metrics"

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

"github.com/okp4/okp4d/x/logic/testutil"
Expand Down
4 changes: 2 additions & 2 deletions x/logic/interpreter/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"io"
"io/fs"

storetypes "cosmossdk.io/store/types"

"github.com/ichiban/prolog"
"github.com/ichiban/prolog/engine"

storetypes "cosmossdk.io/store/types"
)

// Predicates is a map of predicate names to their execution costs.
Expand Down
4 changes: 2 additions & 2 deletions x/logic/interpreter/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"strconv"
"strings"

storetypes "cosmossdk.io/store/types"

"github.com/ichiban/prolog"
"github.com/ichiban/prolog/engine"

storetypes "cosmossdk.io/store/types"

"github.com/okp4/okp4d/x/logic/predicate"
)

Expand Down
Loading

0 comments on commit f9d6c73

Please sign in to comment.