diff --git a/modules/light-clients/08-wasm/keeper/genesis_test.go b/modules/light-clients/08-wasm/keeper/genesis_test.go index 7e3482d0b62..cf1d4a63dc5 100644 --- a/modules/light-clients/08-wasm/keeper/genesis_test.go +++ b/modules/light-clients/08-wasm/keeper/genesis_test.go @@ -2,11 +2,11 @@ package keeper_test import ( "encoding/hex" - "os" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing" "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" ) @@ -23,14 +23,12 @@ func (suite *KeeperTestSuite) TestInitGenesis() { { "success", func() { - checksum := "9b18dc4aa6a4dc6183f148bdcadbf7d3de2fdc7aac59394f1589b81e77de5e3c" //nolint:gosec // these are not hard-coded credentials - contractCode, err := os.ReadFile("../test_data/ics07_tendermint_cw.wasm.gz") - suite.Require().NoError(err) + checksum := "b3a49b2914f5e6a673215e74325c1d153bb6776e079774e52c5b7e674d9ad3ab" //nolint:gosec // these are not hard-coded credentials genesisState = *types.NewGenesisState( []types.Contract{ { - CodeBytes: contractCode, + CodeBytes: wasmtesting.Code, }, }, ) @@ -49,7 +47,8 @@ func (suite *KeeperTestSuite) TestInitGenesis() { for _, tc := range testCases { suite.Run(tc.name, func() { - suite.SetupTest() + suite.SetupWasmWithMockVM() + ctx := suite.chainA.GetContext() tc.malleate() @@ -71,16 +70,15 @@ func (suite *KeeperTestSuite) TestInitGenesis() { } func (suite *KeeperTestSuite) TestExportGenesis() { - suite.SetupTest() + suite.SetupWasmWithMockVM() + ctx := suite.chainA.GetContext() - expChecksum := "9b18dc4aa6a4dc6183f148bdcadbf7d3de2fdc7aac59394f1589b81e77de5e3c" //nolint:gosec // these are not hard-coded credentials + expChecksum := "b3a49b2914f5e6a673215e74325c1d153bb6776e079774e52c5b7e674d9ad3ab" //nolint:gosec // these are not hard-coded credentials signer := authtypes.NewModuleAddress(govtypes.ModuleName).String() - contractCode, err := os.ReadFile("../test_data/ics07_tendermint_cw.wasm.gz") - suite.Require().NoError(err) - msg := types.NewMsgStoreCode(signer, contractCode) + msg := types.NewMsgStoreCode(signer, wasmtesting.Code) res, err := GetSimApp(suite.chainA).WasmClientKeeper.StoreCode(ctx, msg) suite.Require().NoError(err) suite.Require().Equal(expChecksum, hex.EncodeToString(res.Checksum)) diff --git a/modules/light-clients/08-wasm/keeper/keeper_test.go b/modules/light-clients/08-wasm/keeper/keeper_test.go index dd5a140ba31..bcb574cd420 100644 --- a/modules/light-clients/08-wasm/keeper/keeper_test.go +++ b/modules/light-clients/08-wasm/keeper/keeper_test.go @@ -78,8 +78,6 @@ func (suite *KeeperTestSuite) SetupWasmWithMockVM() { suite.coordinator = ibctesting.NewCoordinator(suite.T(), 1) suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) - - _ = storeWasmCode(suite, wasmtesting.Code) } func (suite *KeeperTestSuite) setupWasmWithMockVM() (ibctesting.TestingApp, map[string]json.RawMessage) { diff --git a/modules/light-clients/08-wasm/keeper/msg_server_test.go b/modules/light-clients/08-wasm/keeper/msg_server_test.go index 858945c4175..0d230ef903c 100644 --- a/modules/light-clients/08-wasm/keeper/msg_server_test.go +++ b/modules/light-clients/08-wasm/keeper/msg_server_test.go @@ -263,6 +263,7 @@ func (suite *KeeperTestSuite) TestMsgMigrateContract() { suite.Run(tc.name, func() { suite.SetupWasmWithMockVM() + storeWasmCode(suite, wasmtesting.Code) newChecksum = storeWasmCode(suite, newByteCode) endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) @@ -391,6 +392,8 @@ func (suite *KeeperTestSuite) TestMsgRemoveChecksum() { suite.Run(tc.name, func() { suite.SetupWasmWithMockVM() + storeWasmCode(suite, wasmtesting.Code) + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) err := endpoint.CreateClient() suite.Require().NoError(err) diff --git a/modules/light-clients/08-wasm/test_data/ics07_tendermint_cw.wasm.gz b/modules/light-clients/08-wasm/test_data/ics07_tendermint_cw.wasm.gz deleted file mode 100755 index d642c9c1ea5..00000000000 Binary files a/modules/light-clients/08-wasm/test_data/ics07_tendermint_cw.wasm.gz and /dev/null differ