diff --git a/app/ante.go b/app/ante.go new file mode 100644 index 0000000000..79a73822fa --- /dev/null +++ b/app/ante.go @@ -0,0 +1,66 @@ +package app + +import ( + ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" + "github.com/cosmos/ibc-go/v7/modules/core/keeper" + + errorsmod "cosmossdk.io/errors" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" +) + +// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC +// channel keeper. +type HandlerOptions struct { + ante.HandlerOptions + + IBCKeeper *keeper.Keeper + WasmKeeper *wasmkeeper.Keeper + WasmConfig *wasmTypes.WasmConfig + TXCounterStoreKey storetypes.StoreKey +} + +func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { + if options.AccountKeeper == nil { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") + } + if options.BankKeeper == nil { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") + } + if options.SignModeHandler == nil { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") + } + if options.WasmConfig == nil { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder") + } + if options.TXCounterStoreKey == nil { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder") + } + + anteDecorators := []sdk.AnteDecorator{ + ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first + wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), // after setup context to enforce limits early + wasmkeeper.NewCountTXDecorator(options.TXCounterStoreKey), + wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()), + ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), + ante.NewValidateBasicDecorator(), + ante.NewTxTimeoutHeightDecorator(), + ante.NewValidateMemoDecorator(options.AccountKeeper), + ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), + ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), + ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators + ante.NewValidateSigCountDecorator(options.AccountKeeper), + ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), + ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), + ante.NewIncrementSequenceDecorator(options.AccountKeeper), + ibcante.NewRedundantRelayDecorator(options.IBCKeeper), + } + + return sdk.ChainAnteDecorators(anteDecorators...), nil +} diff --git a/app/app.go b/app/app.go index dc9cbb97ae..bf755bd277 100644 --- a/app/app.go +++ b/app/app.go @@ -7,7 +7,11 @@ import ( "math/big" "net/http" "os" + "path/filepath" + "strings" + "github.com/CosmWasm/wasmd/x/wasm" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" @@ -19,6 +23,8 @@ import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -189,6 +195,7 @@ var ( ica.AppModuleBasic{}, ibcfee.AppModuleBasic{}, intertxmodule.AppModule{}, + wasm.AppModuleBasic{}, ) // module account permissions @@ -196,8 +203,6 @@ var ( perms := map[string][]string{ authtypes.FeeCollectorName: nil, distrtypes.ModuleName: nil, - icatypes.ModuleName: nil, - ibcfeetypes.ModuleName: nil, minttypes.ModuleName: {authtypes.Minter}, stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, @@ -206,6 +211,11 @@ var ( ecocredit.ModuleName: {authtypes.Burner}, baskettypes.BasketSubModuleName: {authtypes.Burner, authtypes.Minter}, marketplace.FeePoolName: {authtypes.Burner}, + + // non sdk + icatypes.ModuleName: nil, + ibcfeetypes.ModuleName: nil, + wasmtypes.ModuleName: {authtypes.Burner}, } return perms @@ -250,11 +260,6 @@ type RegenApp struct { FeeGrantKeeper feegrantkeeper.Keeper GovKeeper *govkeeper.Keeper GroupKeeper groupkeeper.Keeper - IBCFeeKeeper ibcfeekeeper.Keeper - IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly - IBCTransferKeeper ibctransferkeeper.Keeper - ICAControllerKeeper icacontrollerkeeper.Keeper - ICAHostKeeper icahostkeeper.Keeper InterTxKeeper intertxkeeper.Keeper MintKeeper mintkeeper.Keeper ParamsKeeper paramskeeper.Keeper @@ -262,6 +267,14 @@ type RegenApp struct { StakingKeeper *stakingkeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper + IBCFeeKeeper ibcfeekeeper.Keeper + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + IBCTransferKeeper ibctransferkeeper.Keeper + ICAControllerKeeper icacontrollerkeeper.Keeper + ICAHostKeeper icahostkeeper.Keeper + + WasmKeeper wasmkeeper.Keeper + // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedIBCTransferKeeper capabilitykeeper.ScopedKeeper @@ -269,6 +282,8 @@ type RegenApp struct { ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper ScopedInterTxKeeper capabilitykeeper.ScopedKeeper + ScopedWasmKeeper capabilitykeeper.ScopedKeeper + // the module manager ModuleManager *module.Manager @@ -283,6 +298,7 @@ type RegenApp struct { func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, invCheckPeriod uint, appOpts servertypes.AppOptions, + wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp)) *RegenApp { encCfg := MakeEncodingConfig() @@ -306,6 +322,7 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest ibcexported.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey, ibcfeetypes.StoreKey, icacontrollertypes.StoreKey, ecocredit.ModuleName, data.ModuleName, intertx.ModuleName, + wasmtypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -352,6 +369,9 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest app.ScopedICAControllerKeeper = app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) app.ScopedInterTxKeeper = app.CapabilityKeeper.ScopeToModule(intertx.ModuleName) + // grant capabilities for wasm modules + app.ScopedWasmKeeper = app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName) + // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating // their scoped modules in `NewApp` with `ScopeToModule` app.CapabilityKeeper.Seal() @@ -514,6 +534,40 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest app.ScopedInterTxKeeper, ) + // Wasm Keepr + wasmDir := filepath.Join(homePath, "wasm") + wasmConfig, err := wasm.ReadWasmConfig(appOpts) + if err != nil { + panic(fmt.Sprintf("error while reading wasm config: %s", err)) + } + availableCapabilities := strings.Join(AllCapabilities(), ",") + // The last arguments can contain custom message handlers, and custom query handlers, + // if we want to allow any custom callbacks + app.WasmKeeper = wasmkeeper.NewKeeper( + appCodec, + keys[wasmtypes.StoreKey], + app.AccountKeeper, + app.BankKeeper, + app.StakingKeeper, + distrkeeper.NewQuerier(app.DistrKeeper), + app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, + app.ScopedWasmKeeper, + app.IBCTransferKeeper, + app.MsgServiceRouter(), + app.GRPCQueryRouter(), + wasmDir, + wasmConfig, + availableCapabilities, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + wasmOpts..., + ) + // Create fee enabled wasm ibc Stack + var wasmStack porttypes.IBCModule + wasmStack = wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCFeeKeeper) + wasmStack = ibcfee.NewIBCMiddleware(wasmStack, app.IBCFeeKeeper) + // Create IBC stacks to add to IBC router interTxModule := intertxmodule.NewModule(app.InterTxKeeper) @@ -534,7 +588,8 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest AddRoute(ibctransfertypes.ModuleName, ibcTransferStack). AddRoute(intertx.ModuleName, icaControllerStack). AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). - AddRoute(icahosttypes.SubModuleName, icaHostStack) + AddRoute(icahosttypes.SubModuleName, icaHostStack). + AddRoute(wasmtypes.ModuleName, wasmStack) app.IBCKeeper.SetRouter(ibcRouter) // Register the proposal types @@ -595,6 +650,8 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest params.NewAppModule(app.ParamsKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + // + wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), ibctransfer.NewAppModule(app.IBCTransferKeeper), ecocreditMod, dataMod, @@ -635,6 +692,9 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest icatypes.ModuleName, ibcfeetypes.ModuleName, intertx.ModuleName, + + // wasm module + wasmtypes.ModuleName, ) app.ModuleManager.SetOrderEndBlockers( crisistypes.ModuleName, @@ -663,6 +723,9 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest icatypes.ModuleName, ibcfeetypes.ModuleName, intertx.ModuleName, + + // wasm module + wasmtypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. @@ -696,6 +759,9 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest icatypes.ModuleName, ibcfeetypes.ModuleName, intertx.ModuleName, + + // wasm module + wasmtypes.ModuleName, ) app.ModuleManager.RegisterInvariants(app.CrisisKeeper) @@ -742,30 +808,49 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) - app.setAnteHandler(txConfig) + app.setAnteHandler(txConfig, wasmConfig, keys[wasmtypes.StoreKey]) app.setPostHandler() + // + if manager := app.SnapshotManager(); manager != nil { + err = manager.RegisterExtensions(wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper)) + if err != nil { + panic("failed to register snapshot extension: " + err.Error()) + } + } + if loadLatest { if err := app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error()) } + + ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) + if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil { + tmos.Exit(fmt.Sprintf("WasmKeeper failed initialize pinned codes %s", err)) + } } return app } -func (app *RegenApp) setAnteHandler(txConfig client.TxConfig) { - anteHandler, err := ante.NewAnteHandler( - ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - SignModeHandler: txConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, +func (app *RegenApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.WasmConfig, txCounterStoreKey storetypes.StoreKey) { + anteHandler, err := NewAnteHandler( + HandlerOptions{ + HandlerOptions: ante.HandlerOptions{ + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + SignModeHandler: txConfig.SignModeHandler(), + FeegrantKeeper: app.FeeGrantKeeper, + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + }, + IBCKeeper: app.IBCKeeper, + WasmConfig: &wasmConfig, + TXCounterStoreKey: txCounterStoreKey, + WasmKeeper: &app.WasmKeeper, }, ) if err != nil { - panic(err) + panic(fmt.Errorf("failed to create AnteHandler: %s", err)) } app.SetAnteHandler(anteHandler) } @@ -986,6 +1071,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(icahosttypes.SubModuleName) paramsKeeper.Subspace(ibcfeetypes.ModuleName) paramsKeeper.Subspace(icacontrollertypes.SubModuleName) + paramsKeeper.Subspace(wasmtypes.ModuleName) return paramsKeeper } diff --git a/app/client/cli/root.go b/app/client/cli/root.go index 86b83bd21d..6a2dc43f1f 100644 --- a/app/client/cli/root.go +++ b/app/client/cli/root.go @@ -5,9 +5,13 @@ import ( "io" "os" + "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" dbm "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/log" + "github.com/prometheus/client_golang/prometheus" "github.com/spf13/cast" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -41,7 +45,9 @@ import ( // main function. func NewRootCmd() *cobra.Command { // we "pre"-instantiate the application for getting the injected/configured encoding configuration - tempApp := app.NewRegenApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, 1, simtestutil.NewAppOptionsWithFlagHome(app.DefaultNodeHome)) + + emptyWasmOpts := []wasmkeeper.Option{} + tempApp := app.NewRegenApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, 1, simtestutil.NewAppOptionsWithFlagHome(app.DefaultNodeHome), emptyWasmOpts) encodingConfig := testutil.TestEncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), Codec: tempApp.AppCodec(), @@ -110,6 +116,8 @@ func initTendermintConfig() *tmcfg.Config { func initAppConfig() (string, interface{}) { type CustomAppConfig struct { serverconfig.Config + + Wasm wasmtypes.WasmConfig `mapstructure:"wasm"` } // Optionally allow the chain developer to overwrite the SDK's default @@ -132,9 +140,12 @@ func initAppConfig() (string, interface{}) { customAppConfig := CustomAppConfig{ Config: *srvCfg, + Wasm: wasmtypes.DefaultWasmConfig(), } - return "", customAppConfig + defaultAppTemplate := serverconfig.DefaultConfigTemplate + wasmtypes.DefaultConfigTemplate() + + return defaultAppTemplate, customAppConfig } func initRootCmd(rootCmd *cobra.Command, encodingConfig testutil.TestEncodingConfig) { @@ -168,6 +179,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig testutil.TestEncodingCon func addModuleInitFlags(startCmd *cobra.Command) { crisis.AddModuleInitFlags(startCmd) + wasm.AddModuleInitFlags(startCmd) } // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter @@ -233,10 +245,16 @@ func txCommand() *cobra.Command { func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { baseappOptions := server.DefaultBaseappOptions(appOpts) + var wasmOpts []wasmkeeper.Option + if cast.ToBool(appOpts.Get("telemetry.enabled")) { + wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) + } + return app.NewRegenApp( logger, db, traceStore, true, cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), appOpts, + wasmOpts, baseappOptions..., ) } @@ -270,14 +288,16 @@ func appExport( viperAppOpts.Set(server.FlagInvCheckPeriod, 1) appOpts = viperAppOpts + var emptyWasmOpts []wasmkeeper.Option + if height != -1 { - regenApp = app.NewRegenApp(logger, db, traceStore, false, 1, appOpts) + regenApp = app.NewRegenApp(logger, db, traceStore, false, 1, appOpts, emptyWasmOpts) if err := regenApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - regenApp = app.NewRegenApp(logger, db, traceStore, true, 1, appOpts) + regenApp = app.NewRegenApp(logger, db, traceStore, true, 1, appOpts, emptyWasmOpts) } return regenApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) diff --git a/app/testsuite/app_test.go b/app/testsuite/app_test.go index ec0d1bfb79..688ab9b7d8 100644 --- a/app/testsuite/app_test.go +++ b/app/testsuite/app_test.go @@ -31,7 +31,7 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) { regenApp.Commit() // Making a new app object with the db, so that initchain hasn't been called - app2 := app.NewRegenApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, setupOptions.InvCheckPeriod, EmptyAppOptions{}) + app2 := app.NewRegenApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, setupOptions.InvCheckPeriod, EmptyAppOptions{}, emptyWasmOption) _, err := app2.ExportAppStateAndValidators(false, []string{}, []string{}) require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } diff --git a/app/testsuite/helpers.go b/app/testsuite/helpers.go index 407d1f4885..0bf4a2bdc4 100644 --- a/app/testsuite/helpers.go +++ b/app/testsuite/helpers.go @@ -4,6 +4,7 @@ import ( "testing" "time" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" dbm "github.com/cometbft/cometbft-db" "github.com/stretchr/testify/require" @@ -47,6 +48,9 @@ var DefaultConsensusParams = &tmproto.ConsensusParams{ }, } +// emptyWasmOption is an empty option for wasmKeeper +var emptyWasmOption []wasmkeeper.Option + // SetupOptions defines arguments that are passed into `Simapp` constructor. type SetupOptions struct { Logger log.Logger @@ -83,7 +87,7 @@ func NewAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), } - regenApp := app.NewRegenApp(options.Logger, options.DB, nil, true, options.InvCheckPeriod, options.AppOpts) + regenApp := app.NewRegenApp(options.Logger, options.DB, nil, true, options.InvCheckPeriod, options.AppOpts, emptyWasmOption) genesisState := app.NewDefaultGenesisState(regenApp.AppCodec()) genesisState = genesisStateWithValSet(t, regenApp, genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) diff --git a/app/testsuite/network_config.go b/app/testsuite/network_config.go index 1489bc8c6b..7208f752a6 100644 --- a/app/testsuite/network_config.go +++ b/app/testsuite/network_config.go @@ -4,6 +4,7 @@ import ( "fmt" "os" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/baseapp" @@ -17,6 +18,8 @@ import ( "github.com/regen-network/regen-ledger/v5/app" ) +var emptyWasmOpts = []wasmkeeper.Option{} + // NewTestNetworkFixture returns a new simapp AppConstructor for network simulation tests func NewTestNetworkFixture() network.TestFixture { dir, err := os.MkdirTemp("", "regen") @@ -26,7 +29,7 @@ func NewTestNetworkFixture() network.TestFixture { defer os.RemoveAll(dir) a := app.NewRegenApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, 0, - simtestutil.NewAppOptionsWithFlagHome(dir)) + simtestutil.NewAppOptionsWithFlagHome(dir), emptyWasmOption) appCtr := func(val network.ValidatorI) servertypes.Application { cfg := val.GetAppConfig() @@ -34,6 +37,7 @@ func NewTestNetworkFixture() network.TestFixture { return app.NewRegenApp( val.GetCtx().Logger, dbm.NewMemDB(), nil, true, 0, simtestutil.NewAppOptionsWithFlagHome(val.GetCtx().Config.RootDir), + emptyWasmOpts, baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(cfg.Pruning)), baseapp.SetMinGasPrices(cfg.MinGasPrices), baseapp.SetChainID(val.GetCtx().Viper.GetString(flags.FlagChainID)), diff --git a/app/wasm_utills.go b/app/wasm_utills.go new file mode 100644 index 0000000000..e06386a86a --- /dev/null +++ b/app/wasm_utills.go @@ -0,0 +1,15 @@ +package app + +// Deprecated: Use BuiltInCapabilities from github.com/CosmWasm/wasmd/x/wasm/keeper + +func AllCapabilities() []string { + return []string{ + "iterator", + "staking", + "stargate", + "cosmwasm_1_1", + "cosmwasm_1_2", + "cosmwasm_1_3", + "cosmwasm_1_4", + } +} diff --git a/go.mod b/go.mod index ef77b79d6e..19ee8dd954 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.21 require ( cosmossdk.io/api v0.3.1 cosmossdk.io/math v1.3.0 + github.com/CosmWasm/wasmd v0.45.0 github.com/cometbft/cometbft v0.37.5 github.com/cometbft/cometbft-db v0.11.0 github.com/cosmos/cosmos-sdk v0.47.12 @@ -20,11 +21,15 @@ require ( ) require ( + github.com/CosmWasm/wasmvm v1.5.0 // indirect github.com/DataDog/zstd v1.5.0 // indirect github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.12.0.20240514101554-56648741cbd6 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect github.com/regen-network/regen-ledger/types/v2 v2.0.0 // indirect github.com/rs/zerolog v1.32.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect @@ -45,7 +50,7 @@ require ( cloud.google.com/go/storage v1.36.0 // indirect cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/errors v1.0.1 // indirect + cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 // indirect cosmossdk.io/tools/rosetta v0.2.1 filippo.io/edwards25519 v1.0.0 // indirect @@ -151,10 +156,10 @@ require ( github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect + github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/procfs v0.10.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/regen-network/regen-ledger/api/v2 v2.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect diff --git a/go.sum b/go.sum index 4488975c42..233be20a4e 100644 --- a/go.sum +++ b/go.sum @@ -217,6 +217,10 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= +github.com/CosmWasm/wasmd v0.45.0 h1:9zBqrturKJwC2kVsfHvbrA++EN0PS7UTXCffCGbg6JI= +github.com/CosmWasm/wasmd v0.45.0/go.mod h1:RnSAiqbNIZu4QhO+0pd7qGZgnYAMBPGmXpzTADag944= +github.com/CosmWasm/wasmvm v1.5.0 h1:3hKeT9SfwfLhxTGKH3vXaKFzBz1yuvP8SlfwfQXbQfw= +github.com/CosmWasm/wasmvm v1.5.0/go.mod h1:fXB+m2gyh4v9839zlIXdMZGeLAxqUdYdFQqYsTha2hc= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.0 h1:+K/VEwIAaPcHiMtQvpLD4lqW7f0Gk3xdYZmI1hD+CXo= @@ -471,6 +475,8 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= @@ -1043,8 +1049,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= +github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1069,8 +1075,8 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= +github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=