Skip to content

Commit

Permalink
chore: remove deprecated wasm proposal handler
Browse files Browse the repository at this point in the history
  • Loading branch information
dadamu committed Aug 15, 2023
1 parent aeac30d commit 3bb6389
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 25 deletions.
8 changes: 1 addition & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ type DesmosApp struct {

func NewDesmosApp(
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
appOpts servertypes.AppOptions, wasmEnabledProposals []wasmtypes.ProposalType,
baseAppOptions ...func(*baseapp.BaseApp),
appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp),
) *DesmosApp {
var (
app = &DesmosApp{}
Expand Down Expand Up @@ -423,11 +422,6 @@ func NewDesmosApp(
wasmOpts...,
)

// The gov proposal types can be individually enabled
if len(wasmEnabledProposals) != 0 {
govRouter.AddRoute(wasmtypes.RouterKey, wasmkeeper.NewWasmProposalHandler(app.WasmKeeper, wasmEnabledProposals))
}

// Set legacy router for backwards compatibility with gov v1beta1
app.GovKeeper.SetLegacyRouter(govRouter)

Expand Down
6 changes: 2 additions & 4 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

"github.com/CosmWasm/wasmd/x/wasm"
)

func TestSimAppExportAndBlockedAddrs(t *testing.T) {
db := dbm.NewMemDB()
app := NewDesmosApp(
log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true,
simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), wasm.EnableAllProposals,
simtestutil.NewAppOptionsWithFlagHome(t.TempDir()),
)

privVal := mock.NewPV()
Expand Down Expand Up @@ -79,7 +77,7 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) {

// Making a new app object with the db, so that initchain hasn't been called
app2 := NewDesmosApp(
log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), wasm.EnableAllProposals,
log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()),
)
_, err = app2.ExportAppStateAndValidators(false, []string{}, []string{})
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
Expand Down
3 changes: 0 additions & 3 deletions app/desmos/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -257,7 +256,6 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
return app.NewDesmosApp(
logger, db, traceStore, true,
appOpts,
wasmtypes.DisableAllProposals,
server.DefaultBaseappOptions(appOpts)...,
)
}
Expand Down Expand Up @@ -292,7 +290,6 @@ func createDesmosappAndExport(
desmosApp = app.NewDesmosApp(
logger, db, traceStore, height == -1,
appOpts,
wasmtypes.DisableAllProposals,
)

if height != -1 {
Expand Down
13 changes: 6 additions & 7 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (

profilestypes "github.com/desmos-labs/desmos/v5/x/profiles/types"

"github.com/CosmWasm/wasmd/x/wasm"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -105,7 +104,7 @@ func TestFullAppSimulation(t *testing.T) {
appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue

app := NewDesmosApp(
logger, db, nil, true, appOptions, wasm.EnableAllProposals, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
)
require.Equal(t, appName, app.Name())

Expand Down Expand Up @@ -152,7 +151,7 @@ func TestAppImportExport(t *testing.T) {
appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue

app := NewDesmosApp(
logger, db, nil, true, appOptions, wasm.EnableAllProposals, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
)
require.Equal(t, appName, app.Name())

Expand Down Expand Up @@ -205,7 +204,7 @@ func TestAppImportExport(t *testing.T) {
}()

newApp := NewDesmosApp(
log.NewNopLogger(), newDB, nil, true, appOptions, wasm.EnableAllProposals, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
)
require.Equal(t, appName, newApp.Name())

Expand Down Expand Up @@ -296,7 +295,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue

app := NewDesmosApp(
logger, db, nil, true, appOptions, wasm.EnableAllProposals, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
)
require.Equal(t, appName, app.Name())

Expand Down Expand Up @@ -343,7 +342,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
}()

newApp := NewDesmosApp(
log.NewNopLogger(), newDB, nil, true, appOptions, wasm.EnableAllProposals, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID),
)
require.Equal(t, appName, newApp.Name())

Expand Down Expand Up @@ -402,7 +401,7 @@ func TestAppStateDeterminism(t *testing.T) {
db := dbm.NewMemDB()

app := NewDesmosApp(
logger, db, nil, true, appOptions, wasm.EnableAllProposals, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID),
logger, db, nil, true, appOptions, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID),
)

fmt.Printf(
Expand Down
3 changes: 1 addition & 2 deletions testutil/ibctesting/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
tmtypes "github.com/cometbft/cometbft/types"
"github.com/stretchr/testify/require"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/flags"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand All @@ -34,7 +33,7 @@ func setup(chainID string, withGenesis bool, invCheckPeriod uint) (*simapp.Desmo
appOptions[flags.FlagHome] = simapp.DefaultNodeHome // ensure unique folder
appOptions[server.FlagInvCheckPeriod] = invCheckPeriod

app := simapp.NewDesmosApp(log.NewNopLogger(), db, nil, true, appOptions, wasmtypes.DisableAllProposals, baseapp.SetChainID(chainID))
app := simapp.NewDesmosApp(log.NewNopLogger(), db, nil, true, appOptions, baseapp.SetChainID(chainID))
if withGenesis {
return app, simapp.NewDefaultGenesisState(app.AppCodec())
}
Expand Down
2 changes: 0 additions & 2 deletions testutil/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"time"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
dbm "github.com/cometbft/cometbft-db"
tmrand "github.com/cometbft/cometbft/libs/rand"
"github.com/cosmos/cosmos-sdk/baseapp"
Expand All @@ -27,7 +26,6 @@ func NewAppConstructor() network.AppConstructor {
return app.NewDesmosApp(
val.GetCtx().Logger, dbm.NewMemDB(), nil, true,
simtestutil.NewAppOptionsWithFlagHome(val.GetCtx().Config.RootDir),
wasmtypes.DisableAllProposals,
baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)),
baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices),
baseapp.SetChainID(val.GetCtx().Viper.GetString(flags.FlagChainID)),
Expand Down

0 comments on commit 3bb6389

Please sign in to comment.