diff --git a/pkg/vm/json_test.go b/pkg/vm/json_test.go index f1f5f9702..34e2d2d46 100644 --- a/pkg/vm/json_test.go +++ b/pkg/vm/json_test.go @@ -229,9 +229,11 @@ func (v *vmUTStackItem) toStackItem() StackItem { items := v.Value.(map[string]vmUTStackItem) result := NewMapItem() for k, v := range items { - var item vmUTStackItem - _ = json.Unmarshal([]byte(`"`+k+`"`), &item) - result.Add(item.toStackItem(), v.toStackItem()) + item := jsonStringToInteger(k) + if item == nil { + panic(fmt.Sprintf("can't unmarshal StackItem %s", k)) + } + result.Add(item, v.toStackItem()) } return result case typeInterop: @@ -291,6 +293,14 @@ func execStep(t *testing.T, v *VM, step vmUTStep) { } } +func jsonStringToInteger(s string) StackItem { + b, err := decodeHex(s) + if err == nil { + return NewBigIntegerItem(new(big.Int).SetBytes(b)) + } + return nil +} + func (v vmUTStackItemType) toLower() vmUTStackItemType { return vmUTStackItemType(strings.ToLower(string(v))) }