diff --git a/pkg/core/helper_test.go b/pkg/core/helper_test.go index 07e6ffe45..db6d97ab2 100644 --- a/pkg/core/helper_test.go +++ b/pkg/core/helper_test.go @@ -214,6 +214,18 @@ func _(t *testing.T) { t.Fatal(err) } + script = io.NewBufBinWriter() + emit.String(script.BinWriter, "testvalue") + emit.String(script.BinWriter, "testkey") + emit.Int(script.BinWriter, 2) + emit.Opcode(script.BinWriter, opcode.PACK) + emit.String(script.BinWriter, "Put") + emit.AppCall(script.BinWriter, hash.Hash160(avm), false) + + tx3 := transaction.NewInvocationTX(script.Bytes(), util.Fixed8FromFloat(100)) + b := newBlock(uint32(n+2), newMinerTX(), tx3) + require.NoError(t, bc.AddBlock(b)) + outStream, err := os.Create("../rpc/testdata/testblocks.acc") if err != nil { t.Fatal(err) diff --git a/pkg/rpc/server_test.go b/pkg/rpc/server_test.go index a0c83480a..f95ec07bc 100644 --- a/pkg/rpc/server_test.go +++ b/pkg/rpc/server_test.go @@ -75,13 +75,13 @@ var rpcTestCases = map[string][]rpcTestCase{ "getcontractstate": { { name: "positive", - params: `["6d1eeca891ee93de2b7a77eb91c26f3b3c04d6cf"]`, + params: `["5ec6b374fd13e53fe60be7901a091695123ea2f0"]`, result: func(e *executor) interface{} { return &GetContractStateResponce{} }, check: func(t *testing.T, e *executor, result interface{}) { res, ok := result.(*GetContractStateResponce) require.True(t, ok) assert.Equal(t, byte(0), res.Result.Version) - assert.Equal(t, util.Uint160{0x6d, 0x1e, 0xec, 0xa8, 0x91, 0xee, 0x93, 0xde, 0x2b, 0x7a, 0x77, 0xeb, 0x91, 0xc2, 0x6f, 0x3b, 0x3c, 0x4, 0xd6, 0xcf}, res.Result.ScriptHash) + assert.Equal(t, util.Uint160{0x5e, 0xc6, 0xb3, 0x74, 0xfd, 0x13, 0xe5, 0x3f, 0xe6, 0x0b, 0xe7, 0x90, 0x1a, 0x09, 0x16, 0x95, 0x12, 0x3e, 0xa2, 0xf0}, res.Result.ScriptHash) assert.Equal(t, "0.99", res.Result.CodeVersion) }, }, diff --git a/pkg/rpc/testdata/test_contract.avm b/pkg/rpc/testdata/test_contract.avm index 10193d3de..15e36929d 100755 Binary files a/pkg/rpc/testdata/test_contract.avm and b/pkg/rpc/testdata/test_contract.avm differ diff --git a/pkg/rpc/testdata/test_contract.go b/pkg/rpc/testdata/test_contract.go new file mode 100644 index 000000000..f1ee83997 --- /dev/null +++ b/pkg/rpc/testdata/test_contract.go @@ -0,0 +1,9 @@ +package testdata + +import "github.com/CityOfZion/neo-go/pkg/interop/storage" + +func Main(operation string, args []interface{}) interface{} { + ctx := storage.GetContext() + storage.Put(ctx, args[0].([]byte), args[1].([]byte)) + return true +} diff --git a/pkg/rpc/testdata/testblocks.acc b/pkg/rpc/testdata/testblocks.acc index 3f63e2bdc..f0bcc1f75 100644 Binary files a/pkg/rpc/testdata/testblocks.acc and b/pkg/rpc/testdata/testblocks.acc differ