Skip to content

Commit

Permalink
chore: fix a few compiler errs in 08-wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan committed Nov 20, 2024
1 parent 386b258 commit bfd2454
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 31 deletions.
2 changes: 1 addition & 1 deletion modules/light-clients/08-wasm/internal/types/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func GetSimApp(chain *ibctesting.TestChain) *simapp.SimApp {
// setupTestingApp provides the duplicated simapp which is specific to the 08-wasm module on chain creation.
func setupTestingApp() (ibctesting.TestingApp, map[string]json.RawMessage) {
db := dbm.NewMemDB()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, nil)
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.AppOptionsMap{}, nil)
return app, app.DefaultGenesis()
}

Expand Down
4 changes: 2 additions & 2 deletions modules/light-clients/08-wasm/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func init() {
// setupTestingApp provides the duplicated simapp which is specific to the 08-wasm module on chain creation.
func setupTestingApp() (ibctesting.TestingApp, map[string]json.RawMessage) {
db := dbm.NewMemDB()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, nil)
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.AppOptionsMap{}, nil)
return app, app.DefaultGenesis()
}

Expand Down Expand Up @@ -113,7 +113,7 @@ func (suite *KeeperTestSuite) setupWasmWithMockVM() (ibctesting.TestingApp, map[
})

db := dbm.NewMemDB()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, suite.mockVM)
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.AppOptionsMap{}, suite.mockVM)

// reset DefaultTestingAppInit to its original value
ibctesting.DefaultTestingAppInit = setupTestingApp
Expand Down
8 changes: 0 additions & 8 deletions modules/light-clients/08-wasm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import (

"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/registry"
"cosmossdk.io/x/gov/simulation"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"

"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/client/cli"
"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper"
Expand All @@ -25,7 +23,6 @@ import (
var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModule)(nil)
_ module.HasProposalMsgs = (*AppModule)(nil)
_ module.HasGenesis = (*AppModule)(nil)
_ appmodule.HasConsensusVersion = (*AppModule)(nil)
_ module.HasServices = (*AppModule)(nil)
Expand Down Expand Up @@ -115,11 +112,6 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 2 }

// ProposalMsgs returns msgs used for governance proposals for simulations.
func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg {
return simulation.ProposalMsgs()
}

func (am AppModule) InitGenesis(ctx context.Context, bz json.RawMessage) error {
var gs types.GenesisState
err := am.cdc.UnmarshalJSON(bz, &gs)
Expand Down
18 changes: 1 addition & 17 deletions modules/light-clients/08-wasm/testing/simapp/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import (
"cosmossdk.io/x/staking"
stakingtypes "cosmossdk.io/x/staking/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"

cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
cmttypes "github.com/cometbft/cometbft/types"
)

// ExportAppStateAndValidators exports the state of the application for a genesis
Expand Down Expand Up @@ -43,24 +41,10 @@ func (app *SimApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAd
}

validators, err := staking.WriteValidators(ctx, app.StakingKeeper)
cmtValidators := []cmttypes.GenesisValidator{}
for _, val := range validators {
cmtPk, err := cryptocodec.ToCmtPubKeyInterface(val.PubKey)
if err != nil {
return servertypes.ExportedApp{}, err
}
cmtVal := cmttypes.GenesisValidator{
Address: val.Address.Bytes(),
PubKey: cmtPk,
Power: val.Power,
Name: val.Name,
}

cmtValidators = append(cmtValidators, cmtVal)
}
return servertypes.ExportedApp{
AppState: appState,
Validators: cmtValidators,
Validators: validators,
Height: height,
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
}, err
Expand Down
2 changes: 1 addition & 1 deletion modules/light-clients/08-wasm/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ func GetSimApp(chain *ibctesting.TestChain) *simapp.SimApp {
// setupTestingApp provides the duplicated simapp which is specific to the 08-wasm module on chain creation.
func setupTestingApp() (ibctesting.TestingApp, map[string]json.RawMessage) {
db := dbm.NewMemDB()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, nil)
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.AppOptionsMap{}, nil)
return app, app.DefaultGenesis()
}
4 changes: 2 additions & 2 deletions modules/light-clients/08-wasm/wasm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func GetSimApp(chain *ibctesting.TestChain) *simapp.SimApp {
// setupTestingApp provides the duplicated simapp which is specific to the 08-wasm module on chain creation.
func setupTestingApp() (ibctesting.TestingApp, map[string]json.RawMessage) {
db := dbm.NewMemDB()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, nil)
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.AppOptionsMap{}, nil)
return app, app.DefaultGenesis()
}

Expand Down Expand Up @@ -109,7 +109,7 @@ func (suite *WasmTestSuite) setupWasmWithMockVM() (ibctesting.TestingApp, map[st
})

db := dbm.NewMemDB()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, suite.mockVM)
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.AppOptionsMap{}, suite.mockVM)

// reset DefaultTestingAppInit to its original value
ibctesting.DefaultTestingAppInit = setupTestingApp
Expand Down

0 comments on commit bfd2454

Please sign in to comment.