Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mockVM for wasm clients testing #4804

Merged
merged 23 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
877c0df
feat: poc of mock engine
colin-axner Oct 2, 2023
ed161e4
chore: remove debug println
colin-axner Oct 2, 2023
d43af71
chore: remove unused file
colin-axner Oct 2, 2023
2559a5b
fix: fixup tests
colin-axner Oct 3, 2023
e5187b4
fix build
colin-axner Oct 3, 2023
842719d
fix: use wasm endpoint instead of ibctesting endpoint
colin-axner Oct 3, 2023
cde7797
imp: remove dep on ibctesting to run wasm logic
colin-axner Oct 3, 2023
ef6b6ee
Update modules/light-clients/08-wasm/testing/mock_engine.go
colin-axner Oct 4, 2023
323b6ae
apply self nits
colin-axner Oct 4, 2023
b1b62d1
lint lint lint
colin-axner Oct 4, 2023
c458d23
refactor: remove reassinging global check in keeper
colin-axner Oct 4, 2023
c088c77
Merge branch 'feat/wasm-clients' of github.com:cosmos/ibc-go into col…
colin-axner Oct 4, 2023
6dbe416
remove unecessary logic and apply self nits
colin-axner Oct 4, 2023
af729ee
me vs the linter
colin-axner Oct 4, 2023
db819b0
Merge branch 'feat/wasm-clients' of github.com:cosmos/ibc-go into col…
colin-axner Oct 4, 2023
4055830
Merge branch 'feat/wasm-clients' of github.com:cosmos/ibc-go into col…
colin-axner Oct 4, 2023
23114ae
Update modules/light-clients/08-wasm/testing/wasm_endpoint.go
colin-axner Oct 4, 2023
98087c2
apply review feedback from Cian
colin-axner Oct 4, 2023
2541e6c
Merge branch 'colin/4798-mock-wasmvm' of github.com:cosmos/ibc-go int…
colin-axner Oct 4, 2023
7e51364
me vs the linter, round 2
colin-axner Oct 4, 2023
f3c57b9
chore: add godoc for WasmEndpoint
colin-axner Oct 4, 2023
7bdda21
chore: add godoc for NewWasmEndpoint
colin-axner Oct 4, 2023
d9b8f06
me vs the linter, round 3 hahah
colin-axner Oct 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions modules/light-clients/08-wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/hex"
"errors"
"fmt"
"reflect"
"strings"

wasmvm "github.com/CosmWasm/wasmvm"
Expand Down Expand Up @@ -44,9 +43,9 @@ func NewKeeperWithVM(
panic(errors.New("wasm VM must be not nil"))
}

if types.WasmVM != nil && !reflect.DeepEqual(types.WasmVM, vm) {
panic(errors.New("global Wasm VM instance should not be set to a different instance"))
}
Comment on lines -47 to -49
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check doesn't work with mock vm when you have other testing also uses the wasmvm, so I decided to remove it, especially since we are going to manage global assignment internally

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I like this quite a bit, even though we're still dealing with global variables, removing the scope at which we assign them can never be a bad thing.

// if types.WasmVM != nil && !reflect.DeepEqual(types.WasmVM, vm) {
// panic(errors.New("global Wasm VM instance should not be set to a different instance"))
// }

if strings.TrimSpace(authority) == "" {
panic(errors.New("authority must be non-empty"))
Expand Down
63 changes: 63 additions & 0 deletions modules/light-clients/08-wasm/testing/mock_engine.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package mock

import (
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"

"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
)

var _ types.WasmEngine = &MockWasmEngine{}
colin-axner marked this conversation as resolved.
Show resolved Hide resolved

// MockWasmEngine implements types.WasmEngine for testing purpose. One or multiple messages can be stubbed.
// Without a stub function a panic is thrown.
type MockWasmEngine struct {

Check warning on line 14 in modules/light-clients/08-wasm/testing/mock_engine.go

View workflow job for this annotation

GitHub Actions / lint

exported: type name will be used as mock.MockWasmEngine by other packages, and that stutters; consider calling this WasmEngine (revive)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can add this link in the code? Will be nice as an easy reference for making changes in the future.

StoreCodeFn func(codeID wasmvm.WasmCode) (wasmvm.Checksum, error)
InstantiateFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error)
QueryFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error)
SudoFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error)
GetCodeFn func(codeID wasmvm.Checksum) (wasmvm.WasmCode, error)
PinFn func(checksum wasmvm.Checksum) error
}

func (m *MockWasmEngine) StoreCode(codeID wasmvm.WasmCode) (wasmvm.Checksum, error) {
if m.StoreCodeFn == nil {
panic("mock engine is not properly initialized")
}
return m.StoreCodeFn(codeID)
}

func (m *MockWasmEngine) Instantiate(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these funcs are only expected to perform a single action (initialize the contract or not), so I think a simple override of functionality makes sense for those

if m.InstantiateFn == nil {
panic("mock engine is not properly initialized")
}
return m.InstantiateFn(codeID, env, info, initMsg, store, goapi, querier, gasMeter, gasLimit, deserCost)
}

func (m *MockWasmEngine) Query(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other funcs like query are expected to handle a subset of queries, so we may actually want to make the subset actions overrideable, not the entire query fn itself

I could remove the QueryFn field and replace with overrides for each subset action, then the QueryFn would use code magic to determine what the request is and then delegate to the appropriate response handler?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we utilize amap[someKey]QueryFn to handle different message types?

Maybe expose a mockVm.OverrideQueryFn(key, func(){...})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to leave as is for the initial run and see if we can make improvements later 👍

if m.QueryFn == nil {
panic("mock engine is not properly initialized")
}
return m.QueryFn(codeID, env, queryMsg, store, goapi, querier, gasMeter, gasLimit, deserCost)
}

func (m *MockWasmEngine) Sudo(codeID wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
if m.SudoFn == nil {
panic("mock engine is not properly initialized")
}
return m.SudoFn(codeID, env, sudoMsg, store, goapi, querier, gasMeter, gasLimit, deserCost)
}

func (m *MockWasmEngine) GetCode(codeID wasmvm.Checksum) (wasmvm.WasmCode, error) {
if m.GetCodeFn == nil {
panic("mock engine is not properly initialized")
}
Comment on lines +60 to +62
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a default of a hashmap maintaining code ids might be a nice default.

return m.GetCodeFn(codeID)
}

func (m *MockWasmEngine) Pin(checksum wasmvm.Checksum) error {
if m.PinFn == nil {
panic("mock engine is not properly initialized")
}
Comment on lines +68 to +70
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder maybe some of these fns can have defualts, for Pin I think in all of our tests we'd be happy with a no-op.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, I decided to hold off for now until we run into the reason they need a default. I attempted to bring in the existing default functionality for initialize and status to the mock engine, but it requires exposing access to a cdc and other fields the suite has, so I decided it was better to handle that later when we have more of the testing pattern defined

return m.PinFn(checksum)
}
8 changes: 7 additions & 1 deletion modules/light-clients/08-wasm/testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ func NewSimApp(
traceStore io.Writer,
loadLatest bool,
appOpts servertypes.AppOptions,
mockVM wasmtypes.WasmEngine,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick hack, didn't want to spend so much time on this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could maybe just add an additional constructor NewSimAppWithVm (also no ideal and would be reworked later) but I'm fine with just adding this as is for now.

Copy link
Contributor Author

@colin-axner colin-axner Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will leave as is for now, I figure once we get time to reduce the redundant simapps we will solve this issue, but also happy to see a followup with a nicer solution

baseAppOptions ...func(*baseapp.BaseApp),
) *SimApp {
encodingConfig := makeEncodingConfig()
Expand Down Expand Up @@ -488,7 +489,12 @@ func NewSimApp(
MemoryCacheSize: uint32(math.Pow(2, 8)),
ContractDebugMode: false,
}
app.WasmClientKeeper = wasmkeeper.NewKeeperWithConfig(appCodec, keys[wasmtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmConfig)
if mockVM != nil {
// NOTE: mockVM is used for testing purposes only!
app.WasmClientKeeper = wasmkeeper.NewKeeperWithVM(appCodec, keys[wasmtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String(), mockVM)
Comment on lines +469 to +471
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit icky but I think I can live with it, we'll need this for the E2Es to work I guess!

} else {
app.WasmClientKeeper = wasmkeeper.NewKeeperWithConfig(appCodec, keys[wasmtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmConfig)
}

// IBC Fee Module keeper
app.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
Expand Down
3 changes: 3 additions & 0 deletions modules/light-clients/08-wasm/types/client_state.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package types

import (
"fmt"

errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -64,6 +66,7 @@ func (cs ClientState) Status(ctx sdk.Context, clientStore sdk.KVStore, _ codec.B

result, err := wasmQuery[statusResult](ctx, clientStore, &cs, payload)
if err != nil {
fmt.Println(err)
return exported.Unknown
}

Expand Down
66 changes: 37 additions & 29 deletions modules/light-clients/08-wasm/types/client_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ package types_test
import (
"crypto/sha256"
"encoding/base64"
"encoding/json"
"errors"
"time"

wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
Expand Down Expand Up @@ -89,11 +94,10 @@ func (suite *TypesTestSuite) TestStatusGrandpa() {
}
}

func (suite *TypesTestSuite) TestStatusTendermint() {
func (suite *TypesTestSuite) TestStatus() {
var (
path *ibctesting.Path
clientState *types.ClientState
tmClientState *tmtypes.ClientState
path *ibctesting.Path
clientState *types.ClientState
)

testCases := []struct {
Expand All @@ -109,54 +113,58 @@ func (suite *TypesTestSuite) TestStatusTendermint() {
{
"client is frozen",
func() {
tmClientState.FrozenHeight = clienttypes.NewHeight(0, 1)

wasmData, err := suite.chainA.Codec.MarshalInterface(tmClientState)
suite.Require().NoError(err)

clientState.Data = wasmData
path.EndpointA.SetClientState(clientState)
suite.mockVM.QueryFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is super nice, one thing that might be useful for readability is a function alias, but editors will auto fill this stuff for you so I don't feel super strongly about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly either, so I'll let it be a followup if we so chose

resp, err := json.Marshal(&mockStatusResult{
Status: exported.Frozen,
})
suite.Require().NoError(err)
gasUsed := uint64(10) // TODO
return resp, gasUsed, nil
}
},
exported.Frozen,
},
{
"client status without consensus state",
"client status is expired",
func() {
latestHeight := clientState.LatestHeight.Increment().(clienttypes.Height)
tmClientState.LatestHeight = latestHeight

wasmData, err := suite.chainA.Codec.MarshalInterface(tmClientState)
suite.Require().NoError(err)

clientState.Data = wasmData
clientState.LatestHeight = latestHeight
path.EndpointA.SetClientState(clientState)
suite.mockVM.QueryFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) {
resp, err := json.Marshal(&mockStatusResult{
Status: exported.Expired,
})
suite.Require().NoError(err)
gasUsed := uint64(10) // TODO
return resp, gasUsed, nil
}
},
exported.Expired,
},
{
"client status is expired",
"client status is unknown: vm returns an error",
func() {
suite.coordinator.IncrementTimeBy(tmClientState.TrustingPeriod)
suite.mockVM.QueryFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) {
return nil, 0, errors.New("client status not implemented")
}
},
exported.Expired,
},
}

for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupWasmTendermint()
suite.SetupWasmWithMockVM()

path = ibctesting.NewPath(suite.chainA, suite.chainB)

clientConfig, ok := path.EndpointA.ClientConfig.(*ibctesting.TendermintConfig)
suite.Require().True(ok)
clientConfig.IsWasmClient = true // TODO
path.EndpointA.ClientConfig = clientConfig

suite.coordinator.SetupClients(path)

clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)
clientState = path.EndpointA.GetClientState().(*types.ClientState)

var cs exported.ClientState
err := suite.chainA.Codec.UnmarshalInterface(clientState.Data, &cs)
suite.Require().NoError(err)
tmClientState = cs.(*tmtypes.ClientState)

tc.malleate()

status := clientState.Status(suite.chainA.GetContext(), clientStore, suite.chainA.App.AppCodec())
Expand Down
9 changes: 9 additions & 0 deletions modules/light-clients/08-wasm/types/export_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package types

/*
This file is to allow for unexported functions and fields to be accessible to the testing package.
*/

type StatusResult struct {
statusResult
}
61 changes: 59 additions & 2 deletions modules/light-clients/08-wasm/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"testing"
"time"

wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
testifysuite "github.com/stretchr/testify/suite"

simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
Expand All @@ -19,13 +21,29 @@ import (
"github.com/cometbft/cometbft/libs/log"
tmtypes "github.com/cometbft/cometbft/types"

wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing"
simapp "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing/simapp"
"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
)

// TODO
// contractResult is the default implementation of the ContractResult interface and the default return type of any contract call
// that does not require a custom return type.
type contractResult struct {
IsValid bool `json:"is_valid,omitempty"`
ErrorMsg string `json:"error_msg,omitempty"`
Data []byte `json:"data,omitempty"`
}

// TODO
type mockStatusResult struct {
contractResult
Status exported.Status `json:"status"`
}

const (
tmClientID = "07-tendermint-0"
grandpaClientID = "08-wasm-0"
Expand All @@ -46,6 +64,7 @@ type TypesTestSuite struct {
coordinator *ibctesting.Coordinator
chainA *ibctesting.TestChain
chainB *ibctesting.TestChain
mockVM *wasmtesting.MockWasmEngine

ctx sdk.Context
store sdk.KVStore
Expand All @@ -71,7 +90,45 @@ func GetSimApp(chain *ibctesting.TestChain) *simapp.SimApp {
func setupTestingApp() (ibctesting.TestingApp, map[string]json.RawMessage) {
db := dbm.NewMemDB()
encCdc := simapp.MakeTestEncodingConfig()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{})
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, nil)
return app, simapp.NewDefaultGenesisState(encCdc.Codec)
}

// SetupWasmTendermint sets up 2 chains and stores the tendermint/cometbft light client wasm contract on both.
func (suite *TypesTestSuite) SetupWasmWithMockVM() {
ibctesting.DefaultTestingAppInit = suite.setupWasmWithMockVM

suite.coordinator = ibctesting.NewCoordinator(suite.T(), 1)
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
suite.chainA.SetWasm(true)
suite.coordinator.SetCodeHash(suite.codeHash)
}

func (suite *TypesTestSuite) setupWasmWithMockVM() (ibctesting.TestingApp, map[string]json.RawMessage) {
suite.mockVM = &wasmtesting.MockWasmEngine{}
// TODO: need a default instantiate function has clients need to be created for testing
suite.mockVM.InstantiateFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
// TODO
var payload instantiateMessage
err := json.Unmarsha(initMsg, &payload)
suite.Require().NoError(err)
// TODO:
// - set client state in store
// - set consensus state in store
return nil, 0, nil
}
suite.mockVM.QueryFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) {
resp, err := json.Marshal(&mockStatusResult{
Status: exported.Active,
})
suite.Require().NoError(err)
gasUsed := uint64(10) // TODO
return resp, gasUsed, nil
}

db := dbm.NewMemDB()
encCdc := simapp.MakeTestEncodingConfig()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, suite.mockVM)
return app, simapp.NewDefaultGenesisState(encCdc.Codec)
}

Expand Down Expand Up @@ -138,7 +195,7 @@ func (suite *TypesTestSuite) SetupWasmGrandpa() {
func SetupTestingWithChannel() (ibctesting.TestingApp, map[string]json.RawMessage) {
db := dbm.NewMemDB()
encCdc := simapp.MakeTestEncodingConfig()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{})
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, nil)
genesisState := simapp.NewDefaultGenesisState(encCdc.Codec)

bytes, err := os.ReadFile("../test_data/genesis.json")
Expand Down
6 changes: 3 additions & 3 deletions modules/light-clients/08-wasm/types/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ func wasmQuery[T ContractResult](ctx sdk.Context, clientStore sdk.KVStore, cs *C
if err := json.Unmarshal(resp, &result); err != nil {
return result, errorsmod.Wrapf(err, "failed to unmarshal result of wasm query")
}
if !result.Validate() {
return result, errorsmod.Wrapf(errors.New(result.Error()), "error occurred while querying contract with code hash %s", hex.EncodeToString(cs.CodeHash))
}
// if !result.Validate() {
// return result, errorsmod.Wrapf(errors.New(result.Error()), "error occurred while querying contract with code hash %s", hex.EncodeToString(cs.CodeHash))
// }
return result, nil
}

Expand Down
Loading