Move enabled gov types to app construction

This commit is contained in:
Alex Peters
2020-07-14 13:30:06 +02:00
parent 7903528306
commit 4400c4526f
11 changed files with 75 additions and 72 deletions

View File

@@ -137,10 +137,9 @@ type WasmWrapper struct {
} }
// NewWasmApp returns a reference to an initialized WasmApp. // NewWasmApp returns a reference to an initialized WasmApp.
func NewWasmApp( func NewWasmApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, invCheckPeriod uint, enabledProposals []wasm.ProposalType, skipUpgradeHeights map[int64]bool,
invCheckPeriod uint, skipUpgradeHeights map[int64]bool, baseAppOptions ...func(*bam.BaseApp), baseAppOptions ...func(*bam.BaseApp)) *WasmApp {
) *WasmApp {
cdc := MakeCodec() cdc := MakeCodec()
@@ -252,9 +251,9 @@ func NewWasmApp(
supportedFeatures := "staking" supportedFeatures := "staking"
app.wasmKeeper = wasm.NewKeeper(app.cdc, keys[wasm.StoreKey], app.subspaces[wasm.ModuleName], app.accountKeeper, app.bankKeeper, app.stakingKeeper, wasmRouter, wasmDir, wasmConfig, supportedFeatures, nil, nil) app.wasmKeeper = wasm.NewKeeper(app.cdc, keys[wasm.StoreKey], app.subspaces[wasm.ModuleName], app.accountKeeper, app.bankKeeper, app.stakingKeeper, wasmRouter, wasmDir, wasmConfig, supportedFeatures, nil, nil)
// The gov proposal types can be individually enabled. As default all wasm gov types are supported here. // The gov proposal types can be individually enabled
if len(wasm.DefaultEnabledProposals) != 0 { if len(enabledProposals) != 0 {
govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.wasmKeeper, wasm.DefaultEnabledProposals)) govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.wasmKeeper, enabledProposals))
} }
app.govKeeper = gov.NewKeeper( app.govKeeper = gov.NewKeeper(

View File

@@ -17,12 +17,12 @@ import (
func TestWasmdExport(t *testing.T) { func TestWasmdExport(t *testing.T) {
db := db.NewMemDB() db := db.NewMemDB()
gapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0, map[int64]bool{}) gapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0, wasm.DefaultEnabledProposals, map[int64]bool{})
err := setGenesis(gapp) err := setGenesis(gapp)
require.NoError(t, err) require.NoError(t, err)
// Making a new app object with the db, so that initchain hasn't been called // Making a new app object with the db, so that initchain hasn't been called
newGapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0, map[int64]bool{}) newGapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0, wasm.DefaultEnabledProposals, map[int64]bool{})
_, _, err = newGapp.ExportAppStateAndValidators(false, []string{}) _, _, err = newGapp.ExportAppStateAndValidators(false, []string{})
require.NoError(t, err, "ExportAppStateAndValidators should not have an error") require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
} }
@@ -30,7 +30,7 @@ func TestWasmdExport(t *testing.T) {
// ensure that black listed addresses are properly set in bank keeper // ensure that black listed addresses are properly set in bank keeper
func TestBlackListedAddrs(t *testing.T) { func TestBlackListedAddrs(t *testing.T) {
db := db.NewMemDB() db := db.NewMemDB()
gapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0, map[int64]bool{}) gapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0, wasm.DefaultEnabledProposals, map[int64]bool{})
for acc := range maccPerms { for acc := range maccPerms {
require.True(t, gapp.bankKeeper.BlacklistedAddr(gapp.supplyKeeper.GetModuleAddress(acc))) require.True(t, gapp.bankKeeper.BlacklistedAddr(gapp.supplyKeeper.GetModuleAddress(acc)))

View File

@@ -10,6 +10,7 @@ import (
"testing" "testing"
wasmd "github.com/CosmWasm/wasmd/app" wasmd "github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth"
@@ -31,7 +32,7 @@ const (
// Setup initializes a new wasmd.WasmApp. A Nop logger is set in WasmApp. // Setup initializes a new wasmd.WasmApp. A Nop logger is set in WasmApp.
func Setup(isCheckTx bool) *wasmd.WasmApp { func Setup(isCheckTx bool) *wasmd.WasmApp {
db := dbm.NewMemDB() db := dbm.NewMemDB()
app := wasmd.NewWasmApp(log.NewNopLogger(), db, nil, true, 0, nil) app := wasmd.NewWasmApp(log.NewNopLogger(), db, nil, true, 0, wasm.DefaultEnabledProposals, nil)
// app := wasmd.NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, 0) // app := wasmd.NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, 0)
if !isCheckTx { if !isCheckTx {
// init chain must be called to stop deliverState from being nil // init chain must be called to stop deliverState from being nil
@@ -57,7 +58,7 @@ func Setup(isCheckTx bool) *wasmd.WasmApp {
// genesis accounts. // genesis accounts.
func SetupWithGenesisAccounts(genAccs []authexported.GenesisAccount) *wasmd.WasmApp { func SetupWithGenesisAccounts(genAccs []authexported.GenesisAccount) *wasmd.WasmApp {
db := dbm.NewMemDB() db := dbm.NewMemDB()
app := wasmd.NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0, nil) app := wasmd.NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0, wasm.DefaultEnabledProposals, nil)
// app := wasmd.NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, 0) // app := wasmd.NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, 0)
// initialize the chain with the passed in genesis accounts // initialize the chain with the passed in genesis accounts

View File

@@ -5,10 +5,10 @@ import (
"os" "os"
"testing" "testing"
abci "github.com/tendermint/tendermint/abci/types" "github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/cosmos-sdk/x/simulation"
abci "github.com/tendermint/tendermint/abci/types"
) )
// Profile with: // Profile with:
@@ -27,7 +27,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
} }
}() }()
app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, interBlockCacheOpt()) app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, wasm.DefaultEnabledProposals, map[int64]bool{}, interBlockCacheOpt())
// run randomized simulation // run randomized simulation
_, simParams, simErr := simulation.SimulateFromSeed( _, simParams, simErr := simulation.SimulateFromSeed(
@@ -66,7 +66,7 @@ func BenchmarkInvariants(b *testing.B) {
} }
}() }()
app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, interBlockCacheOpt()) app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, wasm.DefaultEnabledProposals, map[int64]bool{}, interBlockCacheOpt())
// run randomized simulation // run randomized simulation
_, simParams, simErr := simulation.SimulateFromSeed( _, simParams, simErr := simulation.SimulateFromSeed(

View File

@@ -7,6 +7,7 @@ import (
"os" "os"
"testing" "testing"
wasm2 "github.com/CosmWasm/wasmd/x/wasm"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/libs/log"
@@ -62,7 +63,7 @@ func TestFullAppSimulation(t *testing.T) {
require.NoError(t, os.RemoveAll(dir)) require.NoError(t, os.RemoveAll(dir))
}() }()
app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, fauxMerkleModeOpt) app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, wasm2.DefaultEnabledProposals, map[int64]bool{}, fauxMerkleModeOpt)
require.Equal(t, appName, app.Name()) require.Equal(t, appName, app.Name())
// run randomized simulation // run randomized simulation
@@ -94,7 +95,7 @@ func TestAppImportExport(t *testing.T) {
require.NoError(t, os.RemoveAll(dir)) require.NoError(t, os.RemoveAll(dir))
}() }()
app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, fauxMerkleModeOpt) app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, wasm2.DefaultEnabledProposals, map[int64]bool{}, fauxMerkleModeOpt)
require.Equal(t, appName, app.Name()) require.Equal(t, appName, app.Name())
// Run randomized simulation // Run randomized simulation
@@ -128,7 +129,7 @@ func TestAppImportExport(t *testing.T) {
require.NoError(t, os.RemoveAll(newDir)) require.NoError(t, os.RemoveAll(newDir))
}() }()
newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, fauxMerkleModeOpt) newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, wasm2.DefaultEnabledProposals, map[int64]bool{}, fauxMerkleModeOpt)
require.Equal(t, appName, newApp.Name()) require.Equal(t, appName, newApp.Name())
var genesisState GenesisState var genesisState GenesisState
@@ -180,7 +181,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
require.NoError(t, os.RemoveAll(dir)) require.NoError(t, os.RemoveAll(dir))
}() }()
app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, fauxMerkleModeOpt) app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, wasm2.DefaultEnabledProposals, map[int64]bool{}, fauxMerkleModeOpt)
require.Equal(t, appName, app.Name()) require.Equal(t, appName, app.Name())
// Run randomized simulation // Run randomized simulation
@@ -219,7 +220,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
require.NoError(t, os.RemoveAll(newDir)) require.NoError(t, os.RemoveAll(newDir))
}() }()
newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, fauxMerkleModeOpt) newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, wasm2.DefaultEnabledProposals, map[int64]bool{}, fauxMerkleModeOpt)
require.Equal(t, appName, newApp.Name()) require.Equal(t, appName, newApp.Name())
newApp.InitChain(abci.RequestInitChain{ newApp.InitChain(abci.RequestInitChain{
@@ -263,7 +264,7 @@ func TestAppStateDeterminism(t *testing.T) {
db := dbm.NewMemDB() db := dbm.NewMemDB()
app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, interBlockCacheOpt()) app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, wasm2.DefaultEnabledProposals, map[int64]bool{}, interBlockCacheOpt())
fmt.Printf( fmt.Printf(
"running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n",

View File

@@ -4,17 +4,8 @@ import (
"encoding/json" "encoding/json"
"io" "io"
"github.com/spf13/cobra"
"github.com/spf13/viper"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"github.com/CosmWasm/wasmd/app" "github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
@@ -24,6 +15,13 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking"
"github.com/spf13/cobra"
"github.com/spf13/viper"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
) )
const flagInvCheckPeriod = "inv-check-period" const flagInvCheckPeriod = "inv-check-period"
@@ -87,14 +85,13 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application
skipUpgradeHeights[int64(h)] = true skipUpgradeHeights[int64(h)] = true
} }
return app.NewWasmApp( return app.NewWasmApp(logger, db, traceStore, true, invCheckPeriod,
logger, db, traceStore, true, invCheckPeriod, skipUpgradeHeights, wasm.DefaultEnabledProposals, skipUpgradeHeights,
baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))), baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))),
baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)), baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)),
baseapp.SetHaltHeight(viper.GetUint64(server.FlagHaltHeight)), baseapp.SetHaltHeight(viper.GetUint64(server.FlagHaltHeight)),
baseapp.SetHaltTime(viper.GetUint64(server.FlagHaltTime)), baseapp.SetHaltTime(viper.GetUint64(server.FlagHaltTime)),
baseapp.SetInterBlockCache(cache), baseapp.SetInterBlockCache(cache))
)
} }
func exportAppStateAndTMValidators( func exportAppStateAndTMValidators(
@@ -102,7 +99,7 @@ func exportAppStateAndTMValidators(
) (json.RawMessage, []tmtypes.GenesisValidator, error) { ) (json.RawMessage, []tmtypes.GenesisValidator, error) {
if height != -1 { if height != -1 {
gapp := app.NewWasmApp(logger, db, traceStore, false, uint(1), nil) gapp := app.NewWasmApp(logger, db, traceStore, false, uint(1), wasm.DefaultEnabledProposals, nil)
err := gapp.LoadHeight(height) err := gapp.LoadHeight(height)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
@@ -110,6 +107,6 @@ func exportAppStateAndTMValidators(
return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
} }
gapp := app.NewWasmApp(logger, db, traceStore, true, uint(1), nil) gapp := app.NewWasmApp(logger, db, traceStore, true, uint(1), wasm.DefaultEnabledProposals, nil)
return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
} }

View File

@@ -7,22 +7,20 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
cpm "github.com/otiai10/copy" cpm "github.com/otiai10/copy"
"github.com/spf13/cobra" "github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types"
tmos "github.com/tendermint/tendermint/libs/os" tmos "github.com/tendermint/tendermint/libs/os"
"github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/proxy"
tmsm "github.com/tendermint/tendermint/state" tmsm "github.com/tendermint/tendermint/state"
tmstore "github.com/tendermint/tendermint/store" tmstore "github.com/tendermint/tendermint/store"
tm "github.com/tendermint/tendermint/types" tm "github.com/tendermint/tendermint/types"
"github.com/CosmWasm/wasmd/app"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
) )
func replayCmd() *cobra.Command { func replayCmd() *cobra.Command {
@@ -94,9 +92,8 @@ func replayTxs(rootDir string) error {
fmt.Fprintln(os.Stderr, "Creating application") fmt.Fprintln(os.Stderr, "Creating application")
gapp := app.NewWasmApp( gapp := app.NewWasmApp(
// TODO: do we want to set skipUpgradeHieghts here? // TODO: do we want to set skipUpgradeHieghts here?
ctx.Logger, appDB, traceStoreWriter, true, uint(1), nil, ctx.Logger, appDB, traceStoreWriter, true, uint(1), wasm.DefaultEnabledProposals, nil,
baseapp.SetPruning(store.PruneEverything), // nothing baseapp.SetPruning(store.PruneEverything))
)
// Genesis // Genesis
var genDocPath = filepath.Join(configDir, "genesis.json") var genDocPath = filepath.Join(configDir, "genesis.json")

View File

@@ -50,6 +50,7 @@ import (
dbm "github.com/tendermint/tm-db" dbm "github.com/tendermint/tm-db"
"github.com/CosmWasm/wasmd/app" "github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm"
) )
// TODO: Make InitializeTestLCD safe to call in multiple tests at the same time // TODO: Make InitializeTestLCD safe to call in multiple tests at the same time
@@ -73,7 +74,7 @@ func InitializeLCD(nValidators int, initAddrs []sdk.AccAddress, minting bool, po
logger = log.NewFilter(logger, log.AllowError()) logger = log.NewFilter(logger, log.AllowError())
db := dbm.NewMemDB() db := dbm.NewMemDB()
gapp := app.NewWasmApp(logger, db, nil, true, 0, nil, baseapp.SetPruning(store.PruneNothing)) gapp := app.NewWasmApp(logger, db, nil, true, 0, wasm.DefaultEnabledProposals, nil, baseapp.SetPruning(store.PruneNothing))
cdc = app.MakeCodec() cdc = app.MakeCodec()
genDoc, valConsPubKeys, valOperAddrs, privVal, err := defaultGenesis(config, nValidators, initAddrs, minting) genDoc, valConsPubKeys, valOperAddrs, privVal, err := defaultGenesis(config, nValidators, initAddrs, minting)

View File

@@ -91,6 +91,7 @@ var (
) )
type ( type (
ProposalType = types.ProposalType
GenesisState = types.GenesisState GenesisState = types.GenesisState
Code = types.Code Code = types.Code
Contract = types.Contract Contract = types.Contract

View File

@@ -17,7 +17,11 @@ const ( // TODO: same as in handler
) )
// NewWasmProposalHandler creates a new governance Handler for wasm proposals // NewWasmProposalHandler creates a new governance Handler for wasm proposals
func NewWasmProposalHandler(k Keeper, enabledTypes map[string]struct{}) govtypes.Handler { func NewWasmProposalHandler(k Keeper, enabledProposalTypes []types.ProposalType) govtypes.Handler {
enabledTypes := make(map[string]struct{}, len(enabledProposalTypes))
for i := range enabledProposalTypes {
enabledTypes[string(enabledProposalTypes[i])] = struct{}{}
}
return func(ctx sdk.Context, content govtypes.Content) error { return func(ctx sdk.Context, content govtypes.Content) error {
if content == nil { if content == nil {
return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "content must not be empty") return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "content must not be empty")

View File

@@ -11,29 +11,31 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
) )
type ProposalType string
const ( const (
ProposalTypeStoreCode = "StoreCode" ProposalTypeStoreCode ProposalType = "StoreCode"
ProposalTypeStoreInstantiateContract = "InstantiateContract" ProposalTypeStoreInstantiateContract ProposalType = "InstantiateContract"
ProposalTypeMigrateContract = "MigrateContract" ProposalTypeMigrateContract ProposalType = "MigrateContract"
ProposalTypeUpdateAdmin = "UpdateAdmin" ProposalTypeUpdateAdmin ProposalType = "UpdateAdmin"
ProposalTypeClearAdmin = "ClearAdmin" ProposalTypeClearAdmin ProposalType = "ClearAdmin"
) )
// DefaultEnabledProposals contains all wasm gov types as keys. // DefaultEnabledProposals contains all wasm gov types as keys.
var DefaultEnabledProposals = map[string]struct{}{ var DefaultEnabledProposals = []ProposalType{
ProposalTypeStoreCode: {}, ProposalTypeStoreCode,
ProposalTypeStoreInstantiateContract: {}, ProposalTypeStoreInstantiateContract,
ProposalTypeMigrateContract: {}, ProposalTypeMigrateContract,
ProposalTypeUpdateAdmin: {}, ProposalTypeUpdateAdmin,
ProposalTypeClearAdmin: {}, ProposalTypeClearAdmin,
} }
func init() { // register new content types with the sdk func init() { // register new content types with the sdk
govtypes.RegisterProposalType(ProposalTypeStoreCode) govtypes.RegisterProposalType(string(ProposalTypeStoreCode))
govtypes.RegisterProposalType(ProposalTypeStoreInstantiateContract) govtypes.RegisterProposalType(string(ProposalTypeStoreInstantiateContract))
govtypes.RegisterProposalType(ProposalTypeMigrateContract) govtypes.RegisterProposalType(string(ProposalTypeMigrateContract))
govtypes.RegisterProposalType(ProposalTypeUpdateAdmin) govtypes.RegisterProposalType(string(ProposalTypeUpdateAdmin))
govtypes.RegisterProposalType(ProposalTypeClearAdmin) govtypes.RegisterProposalType(string(ProposalTypeClearAdmin))
govtypes.RegisterProposalTypeCodec(StoreCodeProposal{}, "wasm/store-proposal") govtypes.RegisterProposalTypeCodec(StoreCodeProposal{}, "wasm/store-proposal")
govtypes.RegisterProposalTypeCodec(InstantiateContractProposal{}, "wasm/instantiate-proposal") govtypes.RegisterProposalTypeCodec(InstantiateContractProposal{}, "wasm/instantiate-proposal")
govtypes.RegisterProposalTypeCodec(MigrateContractProposal{}, "wasm/migrate-proposal") govtypes.RegisterProposalTypeCodec(MigrateContractProposal{}, "wasm/migrate-proposal")
@@ -95,7 +97,7 @@ type StoreCodeProposal struct {
} }
// ProposalType returns the type // ProposalType returns the type
func (p StoreCodeProposal) ProposalType() string { return ProposalTypeStoreCode } func (p StoreCodeProposal) ProposalType() string { return string(ProposalTypeStoreCode) }
// ValidateBasic validates the proposal // ValidateBasic validates the proposal
func (p StoreCodeProposal) ValidateBasic() error { func (p StoreCodeProposal) ValidateBasic() error {
@@ -170,7 +172,7 @@ type InstantiateContractProposal struct {
// ProposalType returns the type // ProposalType returns the type
func (p InstantiateContractProposal) ProposalType() string { func (p InstantiateContractProposal) ProposalType() string {
return ProposalTypeStoreInstantiateContract return string(ProposalTypeStoreInstantiateContract)
} }
// ValidateBasic validates the proposal // ValidateBasic validates the proposal
@@ -248,7 +250,7 @@ type MigrateContractProposal struct {
} }
// ProposalType returns the type // ProposalType returns the type
func (p MigrateContractProposal) ProposalType() string { return ProposalTypeMigrateContract } func (p MigrateContractProposal) ProposalType() string { return string(ProposalTypeMigrateContract) }
// ValidateBasic validates the proposal // ValidateBasic validates the proposal
func (p MigrateContractProposal) ValidateBasic() error { func (p MigrateContractProposal) ValidateBasic() error {
@@ -303,7 +305,7 @@ type UpdateAdminProposal struct {
} }
// ProposalType returns the type // ProposalType returns the type
func (p UpdateAdminProposal) ProposalType() string { return ProposalTypeUpdateAdmin } func (p UpdateAdminProposal) ProposalType() string { return string(ProposalTypeUpdateAdmin) }
// ValidateBasic validates the proposal // ValidateBasic validates the proposal
func (p UpdateAdminProposal) ValidateBasic() error { func (p UpdateAdminProposal) ValidateBasic() error {
@@ -337,7 +339,7 @@ type ClearAdminProposal struct {
} }
// ProposalType returns the type // ProposalType returns the type
func (p ClearAdminProposal) ProposalType() string { return ProposalTypeClearAdmin } func (p ClearAdminProposal) ProposalType() string { return string(ProposalTypeClearAdmin) }
// ValidateBasic validates the proposal // ValidateBasic validates the proposal
func (p ClearAdminProposal) ValidateBasic() error { func (p ClearAdminProposal) ValidateBasic() error {