Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pinosu committed Nov 14, 2024
1 parent b60fce4 commit 4bf806b
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 24 deletions.
7 changes: 3 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ func NewWasmApp(
// baseAppOptions = append(baseAppOptions, prepareOpt)

// create and set dummy vote extension handler
//voteExtOp := func(bApp *baseapp.BaseApp) {
// voteExtOp := func(bApp *baseapp.BaseApp) {
// voteExtHandler := NewVoteExtensionHandler()
// voteExtHandler.SetHandlers(bApp)
//}
//baseAppOptions = append(baseAppOptions, voteExtOp)
// baseAppOptions = append(baseAppOptions, voteExtOp)

// enable optimistic execution
baseAppOptions = append(baseAppOptions, baseapp.SetOptimisticExecution())
Expand Down Expand Up @@ -613,7 +613,6 @@ func NewWasmApp(
var icaControllerStack porttypes.IBCModule
// integration point for custom authentication modules
// see https://medium.com/the-interchain-foundation/ibc-go-v6-changes-to-interchain-accounts-and-how-it-impacts-your-chain-806c185300d7
icaControllerStack = icacontroller.NewIBCMiddleware(app.ICAControllerKeeper)
// app.ICAAuthModule = icaControllerStack.(ibcmock.IBCModule)
icaControllerStack = icacontroller.NewIBCMiddleware(app.ICAControllerKeeper)
icaControllerStack = ibccallbacks.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper, wasmStackIBCHandler, wasm.DefaultMaxIBCCallbackGas)
Expand Down Expand Up @@ -953,7 +952,7 @@ func (app *WasmApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) {
return app.ModuleManager.EndBlock(ctx)
}

func (a *WasmApp) Configurator() module.Configurator {
func (a *WasmApp) Configurator() module.Configurator { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
return a.configurator
}

Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/noop/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewUpgrade(semver string) upgrades.Upgrade {

func CreateUpgradeHandler(
mm upgrades.ModuleManager,
configurator module.Configurator,
configurator module.Configurator, //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
ak *upgrades.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, plan upgradetypes.Plan, fromVM appmodule.VersionMap) (appmodule.VersionMap, error) {
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type AppKeepers struct {
AuthKeeper authkeeper.AccountKeeper
}
type ModuleManager interface {
RunMigrations(ctx context.Context, cfg module.Configurator, fromVM appmodule.VersionMap) (appmodule.VersionMap, error)
RunMigrations(ctx context.Context, cfg module.Configurator, fromVM appmodule.VersionMap) (appmodule.VersionMap, error) //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
GetVersionMap() appmodule.VersionMap
}

Expand All @@ -40,6 +40,6 @@ type Upgrade struct {
UpgradeName string

// CreateUpgradeHandler defines the function that creates an upgrade handler
CreateUpgradeHandler func(ModuleManager, module.Configurator, *AppKeepers) upgradetypes.UpgradeHandler
CreateUpgradeHandler func(ModuleManager, module.Configurator, *AppKeepers) upgradetypes.UpgradeHandler //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
StoreUpgrades corestore.StoreUpgrades
}
2 changes: 1 addition & 1 deletion app/upgrades/v050/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var Upgrade = upgrades.Upgrade{

func CreateUpgradeHandler(
mm upgrades.ModuleManager,
configurator module.Configurator,
configurator module.Configurator, //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
ak *upgrades.AppKeepers,
) upgradetypes.UpgradeHandler {
// sdk 47 to sdk 50
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v052/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var Upgrade = upgrades.Upgrade{

func CreateUpgradeHandler(
mm upgrades.ModuleManager,
configurator module.Configurator,
configurator module.Configurator, //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
ak *upgrades.AppKeepers,
) upgradetypes.UpgradeHandler {
// sdk 50 to sdk 52
Expand Down
16 changes: 13 additions & 3 deletions cmd/wasmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,19 @@ func initTestnetFiles(
return err
}

if err := writeFile(fmt.Sprintf("%v.json", nodeDirName), gentxsDir, txBz); err != nil {
err = writeFile(fmt.Sprintf("%v.json", nodeDirName), gentxsDir, txBz)
if err != nil {
return err
}

srvconfig.SetConfigTemplate(srvconfig.DefaultConfigTemplate)
srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appConfig)
err = srvconfig.SetConfigTemplate(srvconfig.DefaultConfigTemplate)
if err != nil {
return err
}
err = srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appConfig)
if err != nil {
return err
}
}

if err := initGenFiles(clientCtx, mbm, args.chainID, genAccounts, genBalances, genFiles, args.numValidators); err != nil {
Expand Down Expand Up @@ -421,6 +428,9 @@ func initGenFiles(
clientCtx.Codec.MustUnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState)

bankGenState.Balances, err = banktypes.SanitizeGenesisBalances(genBalances, clientCtx.AddressCodec)
if err != nil {
return err
}
for _, bal := range bankGenState.Balances {
bankGenState.Supply = bankGenState.Supply.Add(bal.Coins...)
}
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/ibc_fees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"
"time"

wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types"
ibcfee "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types"
ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" //nolint:staticcheck
Expand Down Expand Up @@ -246,12 +247,12 @@ func TestIBCFeesReflect(t *testing.T) {
path := wasmibctesting.NewPath(chainA, chainB)
path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{
PortID: ibctransfertypes.PortID,
Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})),
Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.V1})),
Order: channeltypes.UNORDERED,
}
path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{
PortID: ibctransfertypes.PortID,
Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})),
Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.V1})),
Order: channeltypes.UNORDERED,
}
// with an ics-29 fee enabled channel setup between both chains
Expand Down Expand Up @@ -331,7 +332,7 @@ func TestIBCFeesReflect(t *testing.T) {
// and on chain B
pendingIncentivisedPackages = appA.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainA.GetContext(), ibctransfertypes.PortID, path.EndpointA.ChannelID)
assert.Len(t, pendingIncentivisedPackages, 0)
expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, sdk.DefaultBondDenom, sdkmath.NewInt(10))
expBalance := GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, sdk.DefaultBondDenom, sdkmath.NewInt(10))
gotBalance := chainB.Balance(actorChainB, expBalance.Denom)
assert.Equal(t, expBalance.String(), gotBalance.String(), chainB.AllBalances(actorChainB))
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ibctesting/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ func CommitHeader(proposedHeader cmttypes.Header, valSet *cmttypes.ValidatorSet,
// Thus we iterate over the ordered validator set and construct a signer array
// from the signer map in the same order.
signerArr := make([]cmttypes.PrivValidator, len(valSet.Validators))
for i, v := range valSet.Validators { //nolint:staticcheck // need to check for nil validator set
for i, v := range valSet.Validators {
signerArr[i] = signers[v.Address.String()]
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ibctesting/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ func (endpoint *Endpoint) ChanUpgradeInit() error {
endpoint.Chain.SenderAccount.GetAddress().String(),
endpoint.ChannelID,
"upgrade-init",
fmt.Sprintf("gov proposal for initialising channel upgrade: %s", endpoint.ChannelID),
fmt.Sprintf("gov proposal for initializing channel upgrade: %s", endpoint.ChannelID),
govtypesv1.ProposalType_PROPOSAL_TYPE_EXPEDITED,
)
require.NoError(endpoint.Chain.TB, err)
Expand Down
4 changes: 3 additions & 1 deletion x/wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ func (k Keeper) instantiate(
ctx, discount := k.checkDiscountEligibility(sdkCtx, codeInfo.CodeHash, k.IsPinnedCode(ctx, codeID))
setupCost := k.gasRegister.SetupContractCost(discount, len(initMsg))

k.GasService.GasMeter(ctx).Consume(setupCost, "Loading CosmWasm module: instantiate")
if err := k.GasService.GasMeter(ctx).Consume(setupCost, "Loading CosmWasm module: instantiate"); err != nil {
return nil, nil, err
}

if !authPolicy.CanInstantiateContract(codeInfo.InstantiateConfig, creator) {
return nil, nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "can not instantiate")
Expand Down
7 changes: 3 additions & 4 deletions x/wasm/keeper/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
consensusparamtypes "cosmossdk.io/x/consensus/types"
"cosmossdk.io/x/distribution"
distributionkeeper "cosmossdk.io/x/distribution/keeper"
distributiontypes "cosmossdk.io/x/distribution/types"
distrtypes "cosmossdk.io/x/distribution/types"
epochstypes "cosmossdk.io/x/epochs/types"
"cosmossdk.io/x/evidence"
Expand Down Expand Up @@ -307,7 +306,7 @@ func createTestInput(
banktypes.ModuleName,
stakingtypes.ModuleName,
minttypes.ModuleName,
distributiontypes.ModuleName,
distrtypes.ModuleName,
slashingtypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
Expand Down Expand Up @@ -438,8 +437,8 @@ func createTestInput(
authtypes.FeeCollectorName,
govModuleAddr)

require.NoError(t, distKeeper.Params.Set(ctx, distributiontypes.DefaultParams()))
require.NoError(t, distKeeper.FeePool.Set(ctx, distributiontypes.InitialFeePool()))
require.NoError(t, distKeeper.Params.Set(ctx, distrtypes.DefaultParams()))
require.NoError(t, distKeeper.FeePool.Set(ctx, distrtypes.InitialFeePool()))
stakingKeeper.SetHooks(distKeeper.Hooks())

upgradeKeeper := upgradekeeper.NewKeeper(
Expand Down
4 changes: 2 additions & 2 deletions x/wasm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/spf13/cobra"

"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/appmodule/v2"
appmodulev2 "cosmossdk.io/core/appmodule/v2"
"cosmossdk.io/core/registry"

"github.com/cosmos/cosmos-sdk/baseapp"
Expand Down Expand Up @@ -145,7 +145,7 @@ func (am AppModule) IsAppModule() { // marker
// should be set to 1.
func (AppModule) ConsensusVersion() uint64 { return 4 }

func (am AppModule) RegisterServices(cfg module.Configurator) {
func (am AppModule) RegisterServices(cfg module.Configurator) { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), keeper.Querier(am.keeper))
}
Expand Down

0 comments on commit 4bf806b

Please sign in to comment.