From 27838da4cbdbe53e888c0bf87bc5718b2748639d Mon Sep 17 00:00:00 2001 From: Sai Kumar <17549398+gsk967@users.noreply.github.com> Date: Thu, 2 Nov 2023 20:39:21 +0530 Subject: [PATCH] chore: update wasmvm from 1.3 to 1.4 (#2310) * update wasmvm from 1.3 to 1.4 * fix the tests --- app/app.go | 42 +++++++++++---------------- app/test_helpers.go | 2 -- app/upgrades.go | 5 ++-- app/wasm.go | 51 ++++++++++----------------------- app/wasm/custom_plugins.go | 3 +- app/wasm/test/cw20_base_test.go | 22 ++++---------- cmd/umeed/cmd/app_creator.go | 5 +--- go.mod | 8 +++--- go.sum | 16 +++++------ sdkclient/tx/wasm.go | 4 +-- tests/e2e/setup/setup.go | 3 +- tests/grpc/gov.go | 26 ----------------- tests/grpc/tx.go | 35 ++++++++++++++++++++++ tests/qa/cw/cw_test.go | 7 +++-- tests/simulation/sim_test.go | 3 -- tests/simulation/state.go | 2 -- tests/util/cw_util.go | 6 ++++ 17 files changed, 101 insertions(+), 139 deletions(-) create mode 100644 tests/grpc/tx.go diff --git a/app/app.go b/app/app.go index 4d962a159f..c6d8fcd217 100644 --- a/app/app.go +++ b/app/app.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "strings" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" @@ -220,7 +221,7 @@ func init() { icatypes.ModuleName: nil, leveragetypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - wasm.ModuleName: {authtypes.Burner}, + wasmtypes.ModuleName: {authtypes.Burner}, incentive.ModuleName: nil, oracletypes.ModuleName: nil, @@ -266,7 +267,7 @@ type UmeeApp struct { FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper NFTKeeper nftkeeper.Keeper - WasmKeeper wasm.Keeper + WasmKeeper wasmkeeper.Keeper IBCTransferKeeper ibctransferkeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly @@ -295,7 +296,7 @@ type UmeeApp struct { configurator module.Configurator // wasm - wasmCfg wasm.Config + wasmCfg wasmtypes.WasmConfig } func init() { @@ -316,8 +317,7 @@ func New( homePath string, invCheckPeriod uint, appOpts servertypes.AppOptions, - wasmEnabledProposals []wasm.ProposalType, - wasmOpts []wasm.Option, + wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *UmeeApp { encCfg := MakeEncodingConfig() @@ -340,7 +340,7 @@ func New( ibcexported.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey, leveragetypes.StoreKey, oracletypes.StoreKey, uibc.StoreKey, ugov.StoreKey, - wasm.StoreKey, + wasmtypes.StoreKey, incentive.StoreKey, metoken.StoreKey, consensusparamstypes.StoreKey, crisistypes.StoreKey, @@ -389,7 +389,7 @@ func New( app.ScopedIBCKeeper = app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) app.ScopedTransferKeeper = app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - app.ScopedWasmKeeper = app.CapabilityKeeper.ScopeToModule(wasm.ModuleName) + 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` @@ -623,11 +623,6 @@ func New( AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) - // The wasm gov proposal types can be individually enabled - if len(wasmEnabledProposals) != 0 { - govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, wasmEnabledProposals)) - } - govConfig := govtypes.DefaultConfig() govConfig.MaxMetadataLen = 800 app.GovKeeper = govkeeper.NewKeeper( @@ -645,20 +640,15 @@ func New( panic(fmt.Sprintf("error while reading wasm config: %s", err)) } - // The last arguments can contain custom message handlers, and custom query handlers, - // if we want to allow any custom callbacks - // default available capabilities https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md - availableCapabilities := "iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,umee" - // Register umee custom plugin to wasm wasmOpts = append(uwasm.RegisterCustomPlugins(app.LeverageKeeper, app.OracleKeeper, app.IncentiveKeeper, app.MetokenKeeperB), wasmOpts...) // Register stargate queries wasmOpts = append(wasmOpts, uwasm.RegisterStargateQueries(*bApp.GRPCQueryRouter(), appCodec)...) - - app.WasmKeeper = wasm.NewKeeper( + availableCapabilities := strings.Join(AllCapabilities(), ",") + app.WasmKeeper = wasmkeeper.NewKeeper( appCodec, - keys[wasm.StoreKey], + keys[wasmtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.StakingKeeper, @@ -760,7 +750,7 @@ func New( oracletypes.ModuleName, uibc.ModuleName, ugov.ModuleName, - wasm.ModuleName, + wasmtypes.ModuleName, incentive.ModuleName, metoken.ModuleName, } @@ -778,7 +768,7 @@ func New( leveragetypes.ModuleName, uibc.ModuleName, ugov.ModuleName, - wasm.ModuleName, + wasmtypes.ModuleName, incentive.ModuleName, metoken.ModuleName, } @@ -802,7 +792,7 @@ func New( leveragetypes.ModuleName, uibc.ModuleName, ugov.ModuleName, - wasm.ModuleName, + wasmtypes.ModuleName, incentive.ModuleName, metoken.ModuleName, } @@ -818,7 +808,7 @@ func New( leveragetypes.ModuleName, uibc.ModuleName, ugov.ModuleName, - wasm.ModuleName, + wasmtypes.ModuleName, incentive.ModuleName, metoken.ModuleName, } @@ -883,7 +873,7 @@ func New( app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) - app.setAnteHandler(txConfig, &app.wasmCfg, keys[wasm.StoreKey]) + app.setAnteHandler(txConfig, &app.wasmCfg, keys[wasmtypes.StoreKey]) // In v0.46, the SDK introduces _postHandlers_. PostHandlers are like // antehandlers, but are run _after_ the `runMsgs` execution. They are also // defined as a chain, and have the same signature as antehandlers. @@ -1148,7 +1138,7 @@ func initParamsKeeper( paramsKeeper.Subspace(icahosttypes.SubModuleName) paramsKeeper.Subspace(leveragetypes.ModuleName) paramsKeeper.Subspace(oracletypes.ModuleName) - paramsKeeper.Subspace(wasm.ModuleName) + paramsKeeper.Subspace(wasmtypes.ModuleName) return paramsKeeper } diff --git a/app/test_helpers.go b/app/test_helpers.go index 94088f1548..7647e3242e 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -225,7 +225,6 @@ func setup(withGenesis bool, invCheckPeriod uint) (*UmeeApp, GenesisState) { DefaultNodeHome, invCheckPeriod, EmptyAppOptions{}, - GetWasmEnabledProposals(), EmptyWasmOpts, ) if withGenesis { @@ -411,7 +410,6 @@ func NewTestNetworkFixture() network.TestFixture { val.GetCtx().Config.RootDir, 0, EmptyAppOptions{}, - GetWasmEnabledProposals(), EmptyWasmOpts, baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), diff --git a/app/upgrades.go b/app/upgrades.go index ede7249998..069a3127a6 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -1,7 +1,6 @@ package app import ( - "github.com/CosmWasm/wasmd/x/wasm" "github.com/cometbft/cometbft/libs/log" ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" icagenesis "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types" @@ -63,7 +62,7 @@ func (app UmeeApp) RegisterUpgradeHandlers() { app.registerUpgrade("v4.2", upgradeInfo, uibc.ModuleName) app.registerUpgrade4_3(upgradeInfo) app.registerUpgrade("v4.4", upgradeInfo) - app.registerUpgrade("v5.0", upgradeInfo, ugov.ModuleName, wasm.ModuleName) + app.registerUpgrade("v5.0", upgradeInfo, ugov.ModuleName, wasmtypes.ModuleName) app.registerUpgrade5_1(upgradeInfo) app.registerUpgrade("v5.2", upgradeInfo) // v5.2 migration is not compatible with v6, so leaving default here. app.registerUpgrade6(upgradeInfo) @@ -96,7 +95,7 @@ func (app *UmeeApp) registerUpgrade6_2(upgradeInfo upgradetypes.Plan) { keyTable = govv1.ParamKeyTable() //nolint: staticcheck // deprecated but required for upgrade case crisistypes.ModuleName: keyTable = crisistypes.ParamKeyTable() //nolint: staticcheck // deprecated but required for upgrade - case wasm.ModuleName: + case wasmtypes.ModuleName: keyTable = wasmtypes.ParamKeyTable() //nolint: staticcheck // deprecated but required for upgrade default: // subspace not handled diff --git a/app/wasm.go b/app/wasm.go index 52516157f1..b794b958c1 100644 --- a/app/wasm.go +++ b/app/wasm.go @@ -1,44 +1,23 @@ package app -import ( - "strings" - - "github.com/CosmWasm/wasmd/x/wasm" -) - -// WasmProposalsEnabled enables all x/wasm proposals when it's value is "true" -// and EnableSpecificWasmProposals is empty. Otherwise, all x/wasm proposals -// are disabled. -const WasmProposalsEnabled = "true" +import wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" var ( - // EnableSpecificWasmProposals, if set, must be comma-separated list of values - // that are all a subset of "EnableAllProposals", which takes precedence over - // WasmProposalsEnabled. - // - // See: https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 - EnableSpecificWasmProposals = "" - - // EmptyWasmOpts defines a type alias for a list of wasm options. - EmptyWasmOpts []wasm.Option + EmptyWasmOpts []wasmkeeper.Option ) -// GetWasmEnabledProposals parses the WasmProposalsEnabled and -// EnableSpecificWasmProposals values to produce a list of enabled proposals to -// pass into the application. -func GetWasmEnabledProposals() []wasm.ProposalType { - if EnableSpecificWasmProposals == "" { - if WasmProposalsEnabled == "true" { - return wasm.EnableAllProposals - } - return wasm.DisableAllProposals +// AllCapabilities returns all capabilities available with the current wasmvm +// See https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md +// This functionality is going to be moved upstream: https://github.com/CosmWasm/wasmvm/issues/425 +func AllCapabilities() []string { + return []string{ + "iterator", + "staking", + "stargate", + "cosmwasm_1_1", + "cosmwasm_1_2", + "cosmwasm_1_3", + "cosmwasm_1_4", + "umee", } - - chunks := strings.Split(EnableSpecificWasmProposals, ",") - proposals, err := wasm.ConvertToProposals(chunks) - if err != nil { - panic(err) - } - - return proposals } diff --git a/app/wasm/custom_plugins.go b/app/wasm/custom_plugins.go index c9b50a9030..ab753b76fc 100644 --- a/app/wasm/custom_plugins.go +++ b/app/wasm/custom_plugins.go @@ -1,7 +1,6 @@ package wasm import ( - "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -28,7 +27,7 @@ func RegisterCustomPlugins( messagePluginOpt := wasmkeeper.WithMessageHandlerDecorator(msg.NewMessagePlugin(leverageKeeper)) - return []wasm.Option{ + return []wasmkeeper.Option{ queryPluginOpt, messagePluginOpt, } diff --git a/app/wasm/test/cw20_base_test.go b/app/wasm/test/cw20_base_test.go index 4cd6e6a137..b684bfdcb5 100644 --- a/app/wasm/test/cw20_base_test.go +++ b/app/wasm/test/cw20_base_test.go @@ -20,7 +20,6 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module/testutil" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "gotest.tools/v3/assert" @@ -129,9 +128,8 @@ type IntegrationTestSuite struct { ctx sdk.Context app *umeeapp.UmeeApp - wasmMsgServer wasmtypes.MsgServer - wasmQueryClient wasmtypes.QueryClient - wasmProposalHandler govv1.Handler + wasmMsgServer wasmtypes.MsgServer + wasmQueryClient wasmtypes.QueryClient codeID uint64 contractAddr string @@ -162,7 +160,6 @@ func (s *IntegrationTestSuite) SetupTest(t *testing.T) { grpc := wasmkeeper.Querier(&app.WasmKeeper) wasmtypes.RegisterQueryServer(queryHelper, grpc) s.wasmQueryClient = wasmtypes.NewQueryClient(queryHelper) - s.wasmProposalHandler = wasmkeeper.NewWasmProposalHandler(app.WasmKeeper, umeeapp.GetWasmEnabledProposals()) s.encfg = umeeapp.MakeEncodingConfig() } @@ -180,22 +177,15 @@ func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey cryptotypes.PubKey func (s *IntegrationTestSuite) cw20StoreCode(sender sdk.AccAddress, cwArtifacePath string) (codeId uint64) { cw20Code, err := os.ReadFile(cwArtifacePath) assert.NilError(s.T, err) - storeCodeProposal := wasmtypes.StoreCodeProposal{ - Title: cwArtifacePath, - Description: cwArtifacePath, - RunAs: sender.String(), + storeCodeMsg := wasmtypes.MsgStoreCode{ + Sender: sender.String(), WASMByteCode: cw20Code, InstantiatePermission: &wasmtypes.AllowEverybody, } - err = s.wasmProposalHandler(s.ctx, &storeCodeProposal) + resp, err := s.wasmMsgServer.StoreCode(sdk.WrapSDKContext(s.ctx), &storeCodeMsg) assert.NilError(s.T, err) - - codes, err := s.wasmQueryClient.PinnedCodes(sdk.WrapSDKContext(s.ctx), &wasmtypes.QueryPinnedCodesRequest{}) - assert.NilError(s.T, err) - assert.Equal(s.T, true, len(codes.CodeIDs) > 0) - - return codes.CodeIDs[len(codes.CodeIDs)-1] + return resp.CodeID } func (s *IntegrationTestSuite) transfer(contracAddr string, amount uint64, from, to sdk.AccAddress) { diff --git a/cmd/umeed/cmd/app_creator.go b/cmd/umeed/cmd/app_creator.go index a4de5799dc..22d6d0f108 100644 --- a/cmd/umeed/cmd/app_creator.go +++ b/cmd/umeed/cmd/app_creator.go @@ -7,7 +7,6 @@ import ( stdlog "log" "path/filepath" - "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/libs/log" @@ -75,7 +74,7 @@ func (a appCreator) newApp( minGasPrices := cast.ToString(appOpts.Get(server.FlagMinGasPrices)) mustMinUmeeGasPrice(minGasPrices) - var wasmOpts []wasm.Option + var wasmOpts []wasmkeeper.Option if cast.ToBool(appOpts.Get("telemetry.enabled")) { wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) } @@ -97,7 +96,6 @@ func (a appCreator) newApp( cast.ToString(appOpts.Get(flags.FlagHome)), cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), appOpts, - umeeapp.GetWasmEnabledProposals(), wasmOpts, baseapp.SetPruning(pruningOpts), baseapp.SetMinGasPrices(minGasPrices), @@ -153,7 +151,6 @@ func (a appCreator) appExport( homePath, uint(1), appOpts, - umeeapp.GetWasmEnabledProposals(), umeeapp.EmptyWasmOpts, ) diff --git a/go.mod b/go.mod index ca27632303..5b28d1cd3f 100644 --- a/go.mod +++ b/go.mod @@ -7,15 +7,15 @@ require ( cosmossdk.io/errors v1.0.0 cosmossdk.io/math v1.1.2 cosmossdk.io/tools/rosetta v0.2.1 - github.com/CosmWasm/wasmd v0.40.2 - github.com/CosmWasm/wasmvm v1.3.0 + github.com/CosmWasm/wasmd v0.43.0 + github.com/CosmWasm/wasmvm v1.4.1 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.5 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/ibc-go/v7 v7.2.0 + github.com/cosmos/ibc-go/v7 v7.3.0 github.com/gogo/protobuf v1.3.2 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 @@ -104,7 +104,7 @@ require ( github.com/containerd/continuity v0.3.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v0.20.0 // indirect + github.com/cosmos/iavl v0.20.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect diff --git a/go.sum b/go.sum index f267ddb53a..e4c9e157c6 100644 --- a/go.sum +++ b/go.sum @@ -240,10 +240,10 @@ github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= -github.com/CosmWasm/wasmd v0.40.2 h1:GSDHIaeJI7fcDF5mkzSXQI5IZLtvpNq5t3TjJ9bDpPw= -github.com/CosmWasm/wasmd v0.40.2/go.mod h1:vqI238yb4D6aNuigS8mCqTyyCV9HN5eBEZARKRoK3ts= -github.com/CosmWasm/wasmvm v1.3.0 h1:x12X4bKlUPS7TT9QQP45+fJo2sp30GEbiSSgb9jsec8= -github.com/CosmWasm/wasmvm v1.3.0/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc= +github.com/CosmWasm/wasmd v0.43.0 h1:4xQAiNf6Ej+TuYe4PXwrtVJ9C+xyFrbsdqHH/kU9Vxk= +github.com/CosmWasm/wasmd v0.43.0/go.mod h1:gpri8YvkRErBz+qDme5jOThGZmSlHfyN532bWibXOl4= +github.com/CosmWasm/wasmvm v1.4.1 h1:YgodVlBrXa2HJZzOXjWDH0EIRwQzK3zuA73dDPRRLS4= +github.com/CosmWasm/wasmvm v1.4.1/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/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= @@ -478,10 +478,10 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= -github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= -github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-go/v7 v7.2.0 h1:dx0DLUl7rxdyZ8NiT6UsrbzKOJx/w7s+BOaewFRH6cg= -github.com/cosmos/ibc-go/v7 v7.2.0/go.mod h1:OOcjKIRku/j1Xs1RgKK0yvKRrJ5iFuZYMetR1n3yMlc= +github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg= +github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= +github.com/cosmos/ibc-go/v7 v7.3.0 h1:QtGeVMi/3JeLWuvEuC60sBHpAF40Oenx/y+bP8+wRRw= +github.com/cosmos/ibc-go/v7 v7.3.0/go.mod h1:mUmaHFXpXrEdcxfdXyau+utZf14pGKVUiXwYftRZZfQ= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= diff --git a/sdkclient/tx/wasm.go b/sdkclient/tx/wasm.go index a85b00c8db..5ae083ca3a 100644 --- a/sdkclient/tx/wasm.go +++ b/sdkclient/tx/wasm.go @@ -48,9 +48,9 @@ func (c *Client) WasmExecContractWithAccSeq(contractAddr string, execMsg []byte, Msg: execMsg, } if accSeq != 0 { - return c.WithAccSeq(accSeq).WithAsyncBlock().BroadcastTx(fromIdx, &msg) + return c.WithAccSeq(accSeq).BroadcastTx(fromIdx, &msg) } - return c.WithAsyncBlock().BroadcastTx(fromIdx, &msg) + return c.BroadcastTx(fromIdx, &msg) } func (c *Client) WasmExecuteContract(contractAddr string, execMsg []byte) (*sdk.TxResponse, error) { diff --git a/tests/e2e/setup/setup.go b/tests/e2e/setup/setup.go index d4a49df11e..a1b8fcf222 100644 --- a/tests/e2e/setup/setup.go +++ b/tests/e2e/setup/setup.go @@ -85,8 +85,7 @@ func (s *E2ETestSuite) SetupSuite() { "", 0, app.EmptyAppOptions{}, - nil, - nil, + app.EmptyWasmOpts, ) encodingConfig = testutil.TestEncodingConfig{ InterfaceRegistry: app.InterfaceRegistry(), diff --git a/tests/grpc/gov.go b/tests/grpc/gov.go index 0af17089f1..46e0b3d9e6 100644 --- a/tests/grpc/gov.go +++ b/tests/grpc/gov.go @@ -209,29 +209,3 @@ func MakeVoteAndCheckProposal(umeeClient client.Client, resp sdk.TxResponse) err return fmt.Errorf("proposal %d failed to pass with status: %s", proposalIDInt, propStatus) } - -func GetTxResponse(umeeClient client.Client, txHash string) (resp *sdk.TxResponse, err error) { - for i := 0; i < 5; i++ { - resp, err = umeeClient.QueryTxHash(txHash) - if err == nil { - break - } - - time.Sleep(1 * time.Second) - } - - return resp, err -} - -func GetTxResponseAndCheckLogs(umeeClient client.Client, txHash string) (*sdk.TxResponse, error) { - fullResp, err := GetTxResponse(umeeClient, txHash) - if err != nil { - return nil, err - } - - if len(fullResp.Logs) == 0 { - return nil, fmt.Errorf("no logs in response") - } - - return fullResp, nil -} diff --git a/tests/grpc/tx.go b/tests/grpc/tx.go new file mode 100644 index 0000000000..46e69a5b2e --- /dev/null +++ b/tests/grpc/tx.go @@ -0,0 +1,35 @@ +package grpc + +import ( + "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/umee-network/umee/v6/client" +) + +func GetTxResponse(umeeClient client.Client, txHash string) (resp *sdk.TxResponse, err error) { + for i := 0; i < 5; i++ { + resp, err = umeeClient.QueryTxHash(txHash) + if err == nil { + break + } + + time.Sleep(1 * time.Second) + } + + return resp, err +} + +func GetTxResponseAndCheckLogs(umeeClient client.Client, txHash string) (*sdk.TxResponse, error) { + fullResp, err := GetTxResponse(umeeClient, txHash) + if err != nil { + return nil, err + } + + if len(fullResp.Logs) == 0 { + return nil, fmt.Errorf("no logs in response") + } + + return fullResp, nil +} diff --git a/tests/qa/cw/cw_test.go b/tests/qa/cw/cw_test.go index 4a7576c0d2..edf0cd14f2 100644 --- a/tests/qa/cw/cw_test.go +++ b/tests/qa/cw/cw_test.go @@ -46,11 +46,12 @@ func (qaTest *QATest) TestCWPlusGroup() { accAddrs = append(accAddrs, sdk.AccAddress(pubKey.Address())) } - cw := cwutil.NewCosmwasmTestSuite(qaTest.T(), qaTest.Umee) + umeeClient := qaTest.Chain.Validators[0].Client + cw := cwutil.NewCosmwasmTestSuite(qaTest.T(), umeeClient) cw.DeployWasmContract(cwGroupPath) // sender is intital account - admin := qaTest.Umee.Tx.SenderAddr() + admin := umeeClient.Tx.SenderAddr() // instantiate Contract initMsg := GroupInitMsg{ Admin: admin.String(), @@ -85,7 +86,7 @@ func (qaTest *QATest) TestCWPlusGroup() { // doing random txs to flood the cosmwasm network wg := &sync.WaitGroup{} - accSeq, err := qaTest.Umee.QueryAuthSeq(admin.String()) + accSeq, err := umeeClient.QueryAuthSeq(admin.String()) assert.NilError(t, err) total := 0 diff --git a/tests/simulation/sim_test.go b/tests/simulation/sim_test.go index d219d045d6..01da45e853 100644 --- a/tests/simulation/sim_test.go +++ b/tests/simulation/sim_test.go @@ -69,7 +69,6 @@ func TestFullAppSimulation(t *testing.T) { umeeapp.DefaultNodeHome, simcli.FlagPeriodValue, umeeapp.EmptyAppOptions{}, - umeeapp.GetWasmEnabledProposals(), umeeapp.EmptyWasmOpts, fauxMerkleModeOpt, ) @@ -137,7 +136,6 @@ func TestAppStateDeterminism(t *testing.T) { umeeapp.DefaultNodeHome, simcli.FlagPeriodValue, umeeapp.EmptyAppOptions{}, - umeeapp.GetWasmEnabledProposals(), umeeapp.EmptyWasmOpts, interBlockCacheOpt(), baseapp.SetChainID(config.ChainID), @@ -204,7 +202,6 @@ func BenchmarkFullAppSimulation(b *testing.B) { umeeapp.DefaultNodeHome, simcli.FlagPeriodValue, umeeapp.EmptyAppOptions{}, - umeeapp.GetWasmEnabledProposals(), umeeapp.EmptyWasmOpts, interBlockCacheOpt(), ) diff --git a/tests/simulation/state.go b/tests/simulation/state.go index 18cc88789f..8b0d33ddd4 100644 --- a/tests/simulation/state.go +++ b/tests/simulation/state.go @@ -322,7 +322,6 @@ func appExportAndImport(t *testing.T) ( dir, simcli.FlagPeriodValue, umeeapp.EmptyAppOptions{}, - umeeapp.GetWasmEnabledProposals(), umeeapp.EmptyWasmOpts, fauxMerkleModeOpt, ) @@ -369,7 +368,6 @@ func appExportAndImport(t *testing.T) ( newDir, simcli.FlagPeriodValue, umeeapp.EmptyAppOptions{}, - umeeapp.GetWasmEnabledProposals(), umeeapp.EmptyWasmOpts, fauxMerkleModeOpt, ) diff --git a/tests/util/cw_util.go b/tests/util/cw_util.go index 0818ea4a9b..54f1668648 100644 --- a/tests/util/cw_util.go +++ b/tests/util/cw_util.go @@ -10,6 +10,7 @@ import ( "gotest.tools/v3/assert" "github.com/umee-network/umee/v6/client" + "github.com/umee-network/umee/v6/tests/grpc" ) const ( @@ -35,6 +36,8 @@ func (cw *Cosmwasm) DeployWasmContract(path string) { cw.T.Logf("ℹ️ deploying smart contract %s", path) resp, err := cw.umee.Tx.WasmDeployContract(path) assert.NilError(cw.T, err) + resp, err = grpc.GetTxResponseAndCheckLogs(cw.umee, resp.TxHash) + assert.NilError(cw.T, err) storeCode := cw.GetAttributeValue(*resp, "store_code", "code_id") cw.StoreCode, err = strconv.ParseUint(storeCode, 10, 64) assert.NilError(cw.T, err) @@ -51,6 +54,8 @@ func (cw *Cosmwasm) InstantiateContract(initMsg []byte) { cw.T.Log("ℹ️ smart contract is instantiating...") resp, err := cw.umee.Tx.WasmInitContract(cw.StoreCode, initMsg) assert.NilError(cw.T, err) + resp, err = grpc.GetTxResponseAndCheckLogs(cw.umee, resp.TxHash) + assert.NilError(cw.T, err) cw.ContractAddr = cw.GetAttributeValue(*resp, "instantiate", "_contract_address") assert.Equal(cw.T, SucceessRespCode, resp.Code) cw.T.Log("✅ smart contract is instantiating is done.") @@ -86,6 +91,7 @@ func (cw *Cosmwasm) GetAttributeValue(resp sdk.TxResponse, eventName, attrKey st for _, attribute := range event.Attributes { if attribute.Key == attrKey { attrVal = attribute.Value + break } } }