diff --git a/app/sim_test.go b/app/sim_test.go index a08cb3c6d8..d5e4f5307e 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -140,8 +140,10 @@ func TestAppImportExport(t *testing.T) { ctxA := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) ctxB := newApp.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) - newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState) - newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) + _, err = newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState) + require.NoError(t, err) + err = newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) + require.NoError(t, err) t.Log("comparing stores...") // skip certain prefixes @@ -227,10 +229,11 @@ func TestAppSimulationAfterImport(t *testing.T) { newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, wasm.EnableAllProposals, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "WasmApp", newApp.Name()) - newApp.InitChain(&abci.RequestInitChain{ + _, err = newApp.InitChain(&abci.RequestInitChain{ ChainId: SimAppChainID, AppStateBytes: exported.AppState, }) + require.NoError(t, err) _, _, err = simulation.SimulateFromSeed( t, diff --git a/benchmarks/app_test.go b/benchmarks/app_test.go index 5117ea33d3..8c48cfc643 100644 --- a/benchmarks/app_test.go +++ b/benchmarks/app_test.go @@ -62,7 +62,7 @@ func SetupWithGenesisAccountsAndValSet(b testing.TB, db dbm.DB, genAccs []authty bondAmt := sdk.DefaultPowerReduction for _, val := range valSet.Validators { - pk, _ := cryptocodec.FromTmPubKeyInterface(val.PubKey) + pk, _ := cryptocodec.FromCmtPubKeyInterface(val.PubKey) pkAny, _ := codectypes.NewAnyWithValue(pk) validator := stakingtypes.Validator{ OperatorAddress: sdk.ValAddress(val.Address).String(), @@ -116,7 +116,8 @@ func SetupWithGenesisAccountsAndValSet(b testing.TB, db dbm.DB, genAccs []authty }, ) require.NoError(b, err) - wasmApp.Commit() + _, err = wasmApp.Commit() + require.NoError(b, err) _, err = wasmApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: wasmApp.LastBlockHeight() + 1}) require.NoError(b, err) @@ -225,7 +226,8 @@ func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo { _, err = wasmApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: height}) require.NoError(b, err) - wasmApp.Commit() + _, err = wasmApp.Commit() + require.NoError(b, err) return AppInfo{ App: wasmApp, diff --git a/x/wasm/ibctesting/chain.go b/x/wasm/ibctesting/chain.go index b7ca474a79..9e7811bab3 100644 --- a/x/wasm/ibctesting/chain.go +++ b/x/wasm/ibctesting/chain.go @@ -450,8 +450,7 @@ func (chain *TestChain) GetConsensusState(clientID string, height exported.Heigh // a success boolean depending on if the validator set exists or not at that height. func (chain *TestChain) GetValsAtHeight(height int64) (*cmttypes.ValidatorSet, bool) { histInfo, err := chain.App.GetStakingKeeper().GetHistoricalInfo(chain.GetContext(), height) - switch { - case stakingtypes.ErrNoHistoricalInfo.Is(err): + if stakingtypes.ErrNoHistoricalInfo.Is(err) { return nil, false } require.NoError(chain.t, err) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index 2e80edc40e..a593c53af3 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -120,8 +120,10 @@ func TestGenesisExportImport(t *testing.T) { creatorAddress := sdk.MustAccAddressFromBech32(info.Creator) history := wasmKeeper.GetContractHistory(srcCtx, address) - wasmKeeper.addToContractCodeSecondaryIndex(srcCtx, address, history[len(history)-1]) - wasmKeeper.addToContractCreatorSecondaryIndex(srcCtx, creatorAddress, history[0].Updated, address) + err = wasmKeeper.addToContractCodeSecondaryIndex(srcCtx, address, history[len(history)-1]) + require.NoError(t, err) + err = wasmKeeper.addToContractCreatorSecondaryIndex(srcCtx, creatorAddress, history[0].Updated, address) + require.NoError(t, err) return false }) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index e29b0fca8a..cf7294dfb6 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -14,7 +14,6 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - stypes "cosmossdk.io/store/types" wasmvm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/types" @@ -306,7 +305,7 @@ func TestCreateWithSimulation(t *testing.T) { ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) ctx = ctx.WithBlockHeader(tmproto.Header{Height: 1}). - WithGasMeter(stypes.NewInfiniteGasMeter()) + WithGasMeter(storetypes.NewInfiniteGasMeter()) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) @@ -337,15 +336,15 @@ func TestIsSimulationMode(t *testing.T) { exp bool }{ "genesis block": { - ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{}).WithGasMeter(stypes.NewInfiniteGasMeter()), + ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{}).WithGasMeter(storetypes.NewInfiniteGasMeter()), exp: false, }, "any regular block": { - ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{Height: 1}).WithGasMeter(stypes.NewGasMeter(10000000)), + ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{Height: 1}).WithGasMeter(storetypes.NewGasMeter(10000000)), exp: false, }, "simulation": { - ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{Height: 1}).WithGasMeter(stypes.NewInfiniteGasMeter()), + ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{Height: 1}).WithGasMeter(storetypes.NewInfiniteGasMeter()), exp: true, }, } @@ -620,13 +619,13 @@ func TestInstantiateWithAccounts(t *testing.T) { expAccount: authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+2, 0), // +1 for next seq, +1 for spec.account created expBalance: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1))), }, - //"prunable account without balance gets overwritten": { // todo : can not initialize vesting with empty balance + // "prunable account without balance gets overwritten": { // todo : can not initialize vesting with empty balance // account: must(vestingtypes.NewContinuousVestingAccount( // authtypes.NewBaseAccount(contractAddr, nil, 0, 0), // sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(0))), time.Now().Add(time.Hour).Unix(), time.Now().Add(2*time.Hour).Unix())), // expAccount: authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+2, 0), // +1 for next seq, +1 for spec.account created // expBalance: sdk.NewCoins(), - //}, + // }, "unknown account type is rejected with error": { account: authtypes.NewModuleAccount( authtypes.NewBaseAccount(contractAddr, nil, 0, 0), diff --git a/x/wasm/keeper/staking_test.go b/x/wasm/keeper/staking_test.go index 61a52286c2..77975bf536 100644 --- a/x/wasm/keeper/staking_test.go +++ b/x/wasm/keeper/staking_test.go @@ -698,7 +698,7 @@ func nextBlock(ctx sdk.Context, stakingKeeper *stakingkeeper.Keeper) sdk.Context panic(err) } ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) - stakingKeeper.BeginBlocker(ctx) + _ = stakingKeeper.BeginBlocker(ctx) return ctx } @@ -713,7 +713,10 @@ func setValidatorRewards(ctx sdk.Context, stakingKeeper *stakingkeeper.Keeper, d panic(err) } payout := sdk.DecCoins{{Denom: "stake", Amount: amount}} - distKeeper.AllocateTokensToValidator(ctx, vali, payout) + err = distKeeper.AllocateTokensToValidator(ctx, vali, payout) + if err != nil { + panic(err) + } } func assertBalance(t *testing.T, ctx sdk.Context, keeper Keeper, contract sdk.AccAddress, addr sdk.AccAddress, expected string) {