From a15e52ee3d3d419410231159b02a1d4c9c810900 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 22 Jun 2022 15:33:56 +0300 Subject: [PATCH] rpc: adjust TestInvocationScriptCreationGood testcase Although neo-go can handle both ByteArray and ByteString parameter types, C# node can't, so let's use the common one for tests. Compat test: ``` anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "ByteString", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}] ]}' seed1.neo.org:10332 | json_pp % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1271 0 1070 100 201 2860 537 --:--:-- --:--:-- --:--:-- 3398 { "jsonrpc" : "2.0", "id" : 1, "error" : { "message" : "Requested value 'ByteString' was not found.", "data" : " at System.Enum.TryParseByName(RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result)\n at System.Enum.TryParseUInt32Enum(RuntimeType enumType, ReadOnlySpan`1 value, UInt32 maxInclusive, Boolean ignoreCase, Boolean throwOnFailure, TypeCode type, UInt32& result)\n at System.Enum.TryParse[TEnum](ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result)\n at System.Enum.TryParse[TEnum](String value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result)\n at Neo.SmartContract.ContractParameter.FromJson(JObject json)\n at Neo.Plugins.RpcServer.<>c.b__43_0(JObject p)\n at System.Linq.Enumerable.SelectIListIterator`2.ToArray()\n at Neo.Plugins.RpcServer.InvokeFunction(JArray _params)\n at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)", "code" : -2147024809 } } anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "ByteArray", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}] ]}' seed1.neo.org:10332 | json_pp % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 507 0 307 100 200 161 105 0:00:01 0:00:01 --:--:-- 266 { "result" : { "gasconsumed" : "104526", "notifications" : [], "stack" : [], "script" : "DCEDAS1H52IQrsc745qz0YbgpA/o2Gv6PU+r/aV7oTuI+WoRwB8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=", "state" : "FAULT", "exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f" }, "id" : 1, "jsonrpc" : "2.0" } ``` --- pkg/rpc/request/tx_builder_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/rpc/request/tx_builder_test.go b/pkg/rpc/request/tx_builder_test.go index 55e450398..1a5fd4f1a 100644 --- a/pkg/rpc/request/tx_builder_test.go +++ b/pkg/rpc/request/tx_builder_test.go @@ -31,7 +31,7 @@ func TestInvocationScriptCreationGood(t *testing.T) { ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[]`)}}, script: "wh8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=", }, { - ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[{"type": "ByteString", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}]`)}}, + ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[{"type": "ByteArray", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}]`)}}, script: "DCEDAS1H52IQrsc745qz0YbgpA/o2Gv6PU+r/aV7oTuI+WoRwB8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=", }, { ps: Params{{RawMessage: []byte(`"a"`)}, {RawMessage: []byte(`[{"type": "Signature", "value": "4edf5005771de04619235d5a4c7a9a11bb78e008541f1da7725f654c33380a3c87e2959a025da706d7255cb3a3fa07ebe9c6559d0d9e6213c68049168eb1056f"}]`)}},