Skip to content

Commit

Permalink
Allow same VM to be assigned to the global vm. (#4236)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored Aug 3, 2023
1 parent c4f8da4 commit 2e17bb2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/light-clients/08-wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
"reflect"

wasmvm "github.com/CosmWasm/wasmvm"

Expand Down Expand Up @@ -37,8 +38,8 @@ func NewKeeperWithVM(
authority string,
vm *wasmvm.VM,
) Keeper {
if types.WasmVM != nil {
panic("global Wasm VM instance should not be already set before calling this function")
if types.WasmVM != nil && !reflect.DeepEqual(types.WasmVM, vm) {
panic("global Wasm VM instance should not be set to a different instance")
}

types.WasmVM = vm
Expand Down

0 comments on commit 2e17bb2

Please sign in to comment.