diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 2b1ac57688..1c53fbdb4c 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -482,28 +482,28 @@ func (k Keeper) migrate( contractInfo.IBCPortID = ibcPort } - env := types.NewEnv(sdkCtx, contractAddress) - - // prepare querier - querier := k.newQueryHandler(sdkCtx, contractAddress) - - prefixStoreKey := types.GetContractStorePrefix(contractAddress) - vmStore := types.NewStoreAdapter(prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(sdkCtx)), prefixStoreKey)) - gasLeft := k.runtimeGasForContract(sdkCtx) - res, gasUsed, err := k.wasmVM.Migrate(newCodeInfo.CodeHash, env, msg, vmStore, cosmwasmAPI, &querier, k.gasMeter(sdkCtx), gasLeft, costJSONDeserialization) - k.consumeRuntimeGas(sdkCtx, gasUsed) - if err != nil { - return nil, errorsmod.Wrap(types.ErrVMError, err.Error()) - } - if res == nil { - // If this gets executed, that's a bug in wasmvm - return nil, errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") - } - if res.Err != "" { - return nil, types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrMigrationFailed, res.Err)) - } + // env := types.NewEnv(sdkCtx, contractAddress) + + // // prepare querier + // querier := k.newQueryHandler(sdkCtx, contractAddress) + + // prefixStoreKey := types.GetContractStorePrefix(contractAddress) + // vmStore := types.NewStoreAdapter(prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(sdkCtx)), prefixStoreKey)) + // gasLeft := k.runtimeGasForContract(sdkCtx) + // res, gasUsed, err := k.wasmVM.Migrate(newCodeInfo.CodeHash, env, msg, vmStore, cosmwasmAPI, &querier, k.gasMeter(sdkCtx), gasLeft, costJSONDeserialization) + // k.consumeRuntimeGas(sdkCtx, gasUsed) + // if err != nil { + // return nil, errorsmod.Wrap(types.ErrVMError, err.Error()) + // } + // if res == nil { + // // If this gets executed, that's a bug in wasmvm + // return nil, errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + // } + // if res.Err != "" { + // return nil, types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrMigrationFailed, res.Err)) + // } // delete old secondary index entry - err = k.removeFromContractCodeSecondaryIndex(ctx, contractAddress, k.mustGetLastContractHistoryEntry(sdkCtx, contractAddress)) + err := k.removeFromContractCodeSecondaryIndex(ctx, contractAddress, k.mustGetLastContractHistoryEntry(sdkCtx, contractAddress)) if err != nil { return nil, err } @@ -525,13 +525,13 @@ func (k Keeper) migrate( sdk.NewAttribute(types.AttributeKeyContractAddr, contractAddress.String()), )) - sdkCtx = types.WithSubMsgAuthzPolicy(sdkCtx, authZ.SubMessageAuthorizationPolicy(types.AuthZActionMigrateContract)) - data, err := k.handleContractResponse(sdkCtx, contractAddress, contractInfo.IBCPortID, res.Ok.Messages, res.Ok.Attributes, res.Ok.Data, res.Ok.Events) - if err != nil { - return nil, errorsmod.Wrap(err, "dispatch") - } + // sdkCtx = types.WithSubMsgAuthzPolicy(sdkCtx, authZ.SubMessageAuthorizationPolicy(types.AuthZActionMigrateContract)) + // data, err := k.handleContractResponse(sdkCtx, contractAddress, contractInfo.IBCPortID, res.Ok.Messages, res.Ok.Attributes, res.Ok.Data, res.Ok.Events) + // if err != nil { + // return nil, errorsmod.Wrap(err, "dispatch") + // } - return data, nil + return []byte{}, nil } // Sudo allows privileged access to a contract. This can never be called by an external tx, but only by