diff --git a/pkg/vm/bigint.go b/pkg/vm/emit/bigint.go similarity index 99% rename from pkg/vm/bigint.go rename to pkg/vm/emit/bigint.go index f0698c87e..8c14a377c 100644 --- a/pkg/vm/bigint.go +++ b/pkg/vm/emit/bigint.go @@ -1,4 +1,4 @@ -package vm +package emit import ( "encoding/binary" diff --git a/pkg/vm/bigint_test.go b/pkg/vm/emit/bigint_test.go similarity index 99% rename from pkg/vm/bigint_test.go rename to pkg/vm/emit/bigint_test.go index 756accf62..542c4050b 100644 --- a/pkg/vm/bigint_test.go +++ b/pkg/vm/emit/bigint_test.go @@ -1,4 +1,4 @@ -package vm +package emit import ( "math" diff --git a/pkg/vm/json_test.go b/pkg/vm/json_test.go index d459f3d14..9216d75be 100644 --- a/pkg/vm/json_test.go +++ b/pkg/vm/json_test.go @@ -13,6 +13,8 @@ import ( "strings" "testing" + "github.com/CityOfZion/neo-go/pkg/vm/emit" + "github.com/CityOfZion/neo-go/pkg/crypto/hash" "github.com/CityOfZion/neo-go/pkg/util" "github.com/CityOfZion/neo-go/pkg/vm/opcode" @@ -196,7 +198,7 @@ func compareItems(t *testing.T, a, b StackItem) { case *BigIntegerItem: require.Equal(t, val, ac.value.Int64()) case *ByteArrayItem: - require.Equal(t, val, BytesToInt(ac.value).Int64()) + require.Equal(t, val, emit.BytesToInt(ac.value).Int64()) case *BoolItem: if ac.value { require.Equal(t, val, int64(1)) diff --git a/pkg/vm/serialization.go b/pkg/vm/serialization.go index 245102f20..6de372163 100644 --- a/pkg/vm/serialization.go +++ b/pkg/vm/serialization.go @@ -3,6 +3,8 @@ package vm import ( "errors" + "github.com/CityOfZion/neo-go/pkg/vm/emit" + "github.com/CityOfZion/neo-go/pkg/io" ) @@ -48,7 +50,7 @@ func serializeItemTo(item StackItem, w *io.BinWriter, seen map[StackItem]bool) { w.WriteBool(t.value) case *BigIntegerItem: w.WriteBytes([]byte{byte(integerT)}) - w.WriteVarBytes(IntToBytes(t.value)) + w.WriteVarBytes(emit.IntToBytes(t.value)) case *InteropItem: w.Err = errors.New("not supported") case *ArrayItem, *StructItem: @@ -106,7 +108,7 @@ func DecodeBinaryStackItem(r *io.BinReader) StackItem { return NewBoolItem(b) case integerT: data := r.ReadVarBytes() - num := BytesToInt(data) + num := emit.BytesToInt(data) return &BigIntegerItem{ value: num, } diff --git a/pkg/vm/stack.go b/pkg/vm/stack.go index 2b8596414..b968d9cc2 100644 --- a/pkg/vm/stack.go +++ b/pkg/vm/stack.go @@ -5,6 +5,8 @@ import ( "errors" "fmt" "math/big" + + "github.com/CityOfZion/neo-go/pkg/vm/emit" ) // Stack implementation for the neo-go virtual machine. The stack implements @@ -81,7 +83,7 @@ func (e *Element) BigInt() *big.Int { return big.NewInt(0) default: b := t.Value().([]uint8) - return BytesToInt(b) + return emit.BytesToInt(b) } } diff --git a/pkg/vm/stack_item.go b/pkg/vm/stack_item.go index 21db4a785..19833ead4 100644 --- a/pkg/vm/stack_item.go +++ b/pkg/vm/stack_item.go @@ -7,6 +7,8 @@ import ( "fmt" "math/big" "reflect" + + "github.com/CityOfZion/neo-go/pkg/vm/emit" ) // A StackItem represents the "real" value that is pushed on the stack. @@ -142,7 +144,7 @@ func NewBigIntegerItem(value int) *BigIntegerItem { // Bytes converts i to a slice of bytes. func (i *BigIntegerItem) Bytes() []byte { - return IntToBytes(i.value) + return emit.IntToBytes(i.value) } // Value implements StackItem interface.