diff --git a/modules/light-clients/08-wasm/keeper/keeper.go b/modules/light-clients/08-wasm/keeper/keeper.go index 87f588c17d0..f1d4939d782 100644 --- a/modules/light-clients/08-wasm/keeper/keeper.go +++ b/modules/light-clients/08-wasm/keeper/keeper.go @@ -98,6 +98,11 @@ func (k Keeper) storeWasmCode(ctx sdk.Context, code []byte) ([]byte, error) { return nil, errorsmod.Wrap(err, "failed to store contract") } + // pin the code to the vm in-memory cache + if err := k.wasmVM.Pin(codeHash); err != nil { + return nil, errorsmod.Wrapf(err, "failed to pin contract to vm cache %s", codeHash) + } + // safety check to assert that code ID returned by WasmVM equals to code hash if !bytes.Equal(codeHash, expectedHash) { return nil, errorsmod.Wrapf(types.ErrInvalidCodeID, "expected %s, got %s", hex.EncodeToString(expectedHash), hex.EncodeToString(codeHash))