Skip to content

Commit

Permalink
pass lint and shellcheck ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lukitsbrian committed Nov 20, 2024
1 parent 0caa55d commit ae193ae
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 40 deletions.
5 changes: 1 addition & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ import (
ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v8/modules/core"
ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
ibcporttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
Expand Down Expand Up @@ -634,8 +632,7 @@ func New(
govRouter.
AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(ccvprovidertypes.RouterKey, ccvprovider.NewProviderProposalHandler(app.ProviderKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))
AddRoute(ccvprovidertypes.RouterKey, ccvprovider.NewProviderProposalHandler(app.ProviderKeeper))
govConfig := govtypes.DefaultConfig()
app.GovKeeper = govkeeper.NewKeeper(
appCodec,
Expand Down
18 changes: 11 additions & 7 deletions app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func init() {

// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of
// an IAVLStore for faster simulation speed.
func fauxMerkleModeOpt(bapp *baseapp.BaseApp) {
bapp.SetFauxMerkleMode()
}
// func fauxMerkleModeOpt(bapp *baseapp.BaseApp) {
// bapp.SetFauxMerkleMode()
// }

// BenchmarkSimulation run the chain simulation
// Running using starport command:
Expand Down Expand Up @@ -315,9 +315,12 @@ func TestAppImportExport(t *testing.T) {

ctxA := bApp.NewContextLegacy(true, tmproto.Header{Height: bApp.LastBlockHeight()})
ctxB := newApp.NewContextLegacy(true, tmproto.Header{Height: bApp.LastBlockHeight()})
newApp.ModuleManager().InitGenesis(ctxB, bApp.AppCodec(), genesisState)
newApp.StoreConsensusParams(ctxB, exported.ConsensusParams)

if _, err = newApp.ModuleManager().InitGenesis(ctxB, bApp.AppCodec(), genesisState); err != nil {
panic(err)
}
if err = newApp.StoreConsensusParams(ctxB, exported.ConsensusParams); err != nil {
panic(err)
}
fmt.Printf("comparing stores...\n")

storeKeysPrefixes := []storeKeysPrefixes{
Expand Down Expand Up @@ -449,10 +452,11 @@ func TestAppSimulationAfterImport(t *testing.T) {
)
require.Equal(t, app.Name, bApp.Name())

newApp.InitChain(&abci.RequestInitChain{
_, err = newApp.InitChain(&abci.RequestInitChain{
ChainId: config.ChainID,
AppStateBytes: exported.AppState,
})
require.NoError(t, err)

_, _, err = simulation.SimulateFromSeed(
t,
Expand Down
5 changes: 4 additions & 1 deletion cmd/sscd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) {
set := func(s *pflag.FlagSet, key, val string) {
if f := s.Lookup(key); f != nil {
f.DefValue = val
f.Value.Set(val)
err := f.Value.Set(val)
if err != nil {
panic(err)
}
}
}
for key, val := range defaults {
Expand Down
1 change: 1 addition & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func handler(title string) http.HandlerFunc {
t, _ := httptemplate.ParseFS(template, indexFile)

return func(w http.ResponseWriter, req *http.Request) {
// nolint: errcheck
t.Execute(w, struct {
Title string
URL string
Expand Down
4 changes: 2 additions & 2 deletions scripts/ci/prepare-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

sscd init test --chain-id testchain
cp ./scripts/ci/config/client.toml ~/.ssc/config/
sscd keys add alice 2>&1 > /dev/null
sscd keys add bob 2>&1 > /dev/null
sscd keys add alice > /dev/null 2>&1
sscd keys add bob > /dev/null 2>&1
sscd add-genesis-account "$(sscd keys show alice -a)" 100000000000000000000000000utsaga,100000000stake
sscd add-genesis-account "$(sscd keys show bob -a)" 100000000000000000000000000utsaga,100000000stake
jq '.app_state["chainlet"]["params"]["chainletStackProtections"]=true' ~/.ssc/config/genesis.json > ~/.ssc/config/tmp_genesis.json && mv ~/.ssc/config/tmp_genesis.json ~/.ssc/config/genesis.json
Expand Down
4 changes: 1 addition & 3 deletions x/billing/keeper/grpc_query_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ package keeper_test
import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
testkeeper "github.com/sagaxyz/ssc/testutil/keeper"
"github.com/sagaxyz/ssc/x/billing/types"
"github.com/stretchr/testify/require"
)

func TestParamsQuery(t *testing.T) {
keeper, ctx := testkeeper.BillingKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
params := types.DefaultParams()
keeper.SetParams(ctx, params)

response, err := keeper.Params(wctx, &types.QueryParamsRequest{})
response, err := keeper.Params(ctx, &types.QueryParamsRequest{})
require.NoError(t, err)
require.Equal(t, &types.QueryParamsResponse{Params: params}, response)
}
6 changes: 2 additions & 4 deletions x/billing/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import (

// BeforeEpochStart is the epoch start hook.
func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error {
ctxx := sdk.WrapSDKContext(ctx)

stacks, err := k.chainletkeeper.ListChainletStack(ctxx, &chainlettypes.QueryListChainletStackRequest{})
stacks, err := k.chainletkeeper.ListChainletStack(ctx, &chainlettypes.QueryListChainletStackRequest{})
if err != nil {
ctx.Logger().Error("could not list chainlet stacks. Error: " + err.Error())
return cosmossdkerrors.Wrapf(types.ErrInternalFailure, "could not list chainlet stacks. Error: "+err.Error())

Check failure on line 22 in x/billing/keeper/hooks.go

View workflow job for this annotation

GitHub Actions / lint

printf: non-constant format string in call to cosmossdk.io/errors.Wrapf (govet)
Expand All @@ -35,7 +33,7 @@ func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochN
}
}

chainlets, err := k.chainletkeeper.ListChainlets(ctxx, &chainlettypes.QueryListChainletsRequest{Pagination: &query.PageRequest{Limit: k.chainletkeeper.GetParams(ctx).MaxChainlets}})
chainlets, err := k.chainletkeeper.ListChainlets(ctx, &chainlettypes.QueryListChainletsRequest{Pagination: &query.PageRequest{Limit: k.chainletkeeper.GetParams(ctx).MaxChainlets}})
if err != nil {
ctx.Logger().Error("could not list chainlets. Error: " + err.Error())
return cosmossdkerrors.Wrapf(types.ErrInternalFailure, "could not list chainlets. Error: "+err.Error())

Check failure on line 39 in x/billing/keeper/hooks.go

View workflow job for this annotation

GitHub Actions / lint

printf: non-constant format string in call to cosmossdk.io/errors.Wrapf (govet)
Expand Down
3 changes: 1 addition & 2 deletions x/billing/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"context"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
keepertest "github.com/sagaxyz/ssc/testutil/keeper"
"github.com/sagaxyz/ssc/x/billing/keeper"
"github.com/sagaxyz/ssc/x/billing/types"
)

func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { //nolint:unused
k, ctx := keepertest.BillingKeeper(t)
return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx)
return keeper.NewMsgServerImpl(*k), ctx
}
4 changes: 1 addition & 3 deletions x/chainlet/keeper/grpc_query_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ import (

"github.com/sagaxyz/ssc/x/chainlet/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
)

func TestParamsQuery(t *testing.T) {
keeper, ctx := testkeeper.ChainletKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
params := types.DefaultParams()
keeper.SetParams(ctx, params)

response, err := keeper.Params(wctx, &types.QueryParamsRequest{})
response, err := keeper.Params(ctx, &types.QueryParamsRequest{})
require.NoError(t, err)
require.Equal(t, &types.QueryParamsResponse{Params: params}, response)
}
4 changes: 1 addition & 3 deletions x/chainlet/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import (

"github.com/sagaxyz/ssc/x/chainlet/keeper"
"github.com/sagaxyz/ssc/x/chainlet/types"

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

//nolint:unused
func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) {
k, ctx := keepertest.ChainletKeeper(t)
return keeper.NewMsgServerImpl(k), sdk.WrapSDKContext(ctx)
return keeper.NewMsgServerImpl(k), ctx
}
4 changes: 1 addition & 3 deletions x/escrow/keeper/grpc_query_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ package keeper_test
import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
testkeeper "github.com/sagaxyz/ssc/testutil/keeper"
"github.com/sagaxyz/ssc/x/escrow/types"
"github.com/stretchr/testify/require"
)

func TestParamsQuery(t *testing.T) {
keeper, ctx := testkeeper.EscrowKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
params := types.DefaultParams()
keeper.SetParams(ctx, params)

response, err := keeper.Params(wctx, &types.QueryParamsRequest{})
response, err := keeper.Params(ctx, &types.QueryParamsRequest{})
require.NoError(t, err)
require.Equal(t, &types.QueryParamsResponse{Params: params}, response)
}
3 changes: 1 addition & 2 deletions x/escrow/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"context"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
keepertest "github.com/sagaxyz/ssc/testutil/keeper"
"github.com/sagaxyz/ssc/x/escrow/keeper"
"github.com/sagaxyz/ssc/x/escrow/types"
)

func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { //nolint:unused
k, ctx := keepertest.EscrowKeeper(t)
return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx)
return keeper.NewMsgServerImpl(*k), ctx
}
4 changes: 1 addition & 3 deletions x/peers/keeper/grpc_query_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ import (

"github.com/sagaxyz/ssc/x/peers/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
)

func TestParamsQuery(t *testing.T) {
keeper, ctx := testkeeper.PeersKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
params := types.DefaultParams()
keeper.SetParams(ctx, params)

response, err := keeper.Params(wctx, &types.QueryParamsRequest{})
response, err := keeper.Params(ctx, &types.QueryParamsRequest{})
require.NoError(t, err)
require.Equal(t, &types.QueryParamsResponse{Params: params}, response)
}
4 changes: 1 addition & 3 deletions x/peers/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import (

"github.com/sagaxyz/ssc/x/peers/keeper"
"github.com/sagaxyz/ssc/x/peers/types"

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

//nolint:unused
func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) {
k, ctx := keepertest.PeersKeeper(t)
return keeper.NewMsgServerImpl(k), sdk.WrapSDKContext(ctx)
return keeper.NewMsgServerImpl(k), ctx
}

0 comments on commit ae193ae

Please sign in to comment.