Anna Shaleva
464061c7c1
rpc: refactor TestInvocationScriptCreationGood
...
Convert expected script from hex to base64 in order to match
`invokefunction` RPC response script encoding. No functional
changes.
2022-06-22 16:05:14 +03:00
Elizaveta Chichindaeva
28908aa3cf
[ #2442 ] English Check
...
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
AnnaShaleva
3d5b1d8d17
rpc: add Rules signer scope to request parameters
2022-03-03 12:18:19 +03:00
AnnaShaleva
8991ee91cd
rpc: make RPC WSClient thread-safe
...
Add ability to use unique request IDs for RPC requests.
2022-02-24 19:01:12 +03:00
Evgeniy Stratonikov
037076f2ee
rpc/request: return error from ExpandArrayIntoScript
if any
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-11 12:48:55 +03:00
Evgeniy Stratonikov
0394a79ef8
rpc: support big integers as request parameters
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-11 12:48:54 +03:00
Roman Khimov
5b470f14cc
rpc: pass single Param to CreateFunctionInvocationScript
...
N3 contracts require method and array of arguments to function correctly, but
CreateFunctionInvocationScript can produce scripts that won't work correctly
if one is to pass anything but a single array parameter to it. This doesn't
make much sense, so we can always expect there to be an array of parameters in
the third positional invokefunction argument (the same way C# node does).
2021-11-20 21:57:41 +03:00
Anna Shaleva
3c13c8b7a5
rpc: refactor GetUint160FromHex helper
...
We can trim prefix using `strings` library like it is done for uint256.
2021-11-10 14:54:18 +03:00
Anna Shaleva
867bb708fc
rpc: add cache to basic parameters
...
Need to cache values of string, bool, int and array because they can be
reused multiple times by RPC handlers. Other values don't need to be
cached.
2021-11-10 14:42:40 +03:00
Anna Shaleva
2fd04fbb35
rpc: allow to pass null parameter to invoke* calls
2021-11-10 14:42:40 +03:00
Anna Shaleva
2e8bbf2a87
rpc: *In parameters marshalling optimisation
...
Parse request parameters on-demand.
2021-11-10 14:42:08 +03:00
Evgeniy Stratonikov
4ab18d084a
rpc/request: add unmarshal benchmark
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:21:04 +03:00
Roman Khimov
b44f9eefb0
rpc: correctly handle RPC invocations with no arguments, fix #2219
...
In N3 no arguments passed should be treated as empty arguments array not as
missing array of arguments, because the array must be present even for
functions that accept no parameters.
2021-10-16 21:28:43 +03:00
Evgeniy Stratonikov
3c34e6fa21
rpc/request: delay parameter unmarshaling
...
It is rather costly to try to unmarshal many structs in order.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-13 16:22:54 +03:00
Roman Khimov
a617390185
rpc/request: support passing accounts as addresses
...
Turns out, it's completely legal in C#, see neo-project/neo#2543 .
2021-07-18 16:45:53 +03:00
Evgeniy Stratonikov
c8ddc790d9
rpc/request: handle bool parameters correctly
2021-05-25 11:24:28 +03:00
Roman Khimov
9d2712573f
*: enable godot linter and fix all its warnings
...
It's important for NeoGo to have clean documentation. No functional changes.
2021-05-12 23:17:03 +03:00
Evgeniy Stratonikov
da360be5b1
rpc/request: allow to provide bool parameters, fix #1919
2021-04-28 16:44:19 +03:00
Anna Shaleva
8f4257639e
rpc: use CalledByEntry as default cosigner's scope
2021-04-19 12:06:13 +03:00
Anna Shaleva
edfca68a17
rpc: refactor invokecontractverify
...
In `(c *Client) AddNetworkFee` we define network fee for contract
witness verification via `invokecontractverify` RPC call, and that's the
initial purpose of this RPC method. But it was not implemented
correctly. It used `System.Contract.Call` instead of beheiving like
`initVerificationVM`.
During real contract witness verification the whole contract's script is
loaded into VM, and then we jump to the `verify` method. Thus, to define
exact contract verification price, we should act like this (and not just
perform `System.Contract.Call` of `verify` method).
Tests are added.
This bug is the reason of adding extra GAS (c.notary.extraVerifyFee) to
pre-calculated value in
https://github.com/nspcc-dev/neofs-node/pull/404/files#diff-639db437ca2578db46c9e8cbf18f9aa01f8ca5aee30e0fa7e70ba0354822d7b3R237
2021-03-12 18:59:20 +03:00
Evgenii Stratonikov
1c0c331e25
core: update System.Contract.Call
syscall
...
1. Remove `System.Contract.CallEx`.
2. Extend number of parameters.
3. Add return value count to `VM.Context`.
2021-01-14 18:23:36 +03:00
Anna Shaleva
da5eb67e85
rpc: implement invokecontractverify
RPC method
2020-12-15 15:53:36 +03:00
Roman Khimov
ab12eee346
native: move contract deployment to management contract
...
See neo-project/neo#2119 .
2020-12-14 15:23:46 +03:00
Roman Khimov
470e1592d9
request: make CreateDeploymentScript work with NEFs
...
And use it in testing code.
2020-11-27 21:53:39 +03:00
Roman Khimov
3cb945f022
manifest: simplify marshaling
2020-11-13 21:46:26 +03:00
Anna Shaleva
6ee919747f
rpc: allow batch JSON-RPC requests
...
Close #1509
2020-11-06 17:06:20 +03:00
Roman Khimov
c8ba155d47
server: don't always Sprintf params for logger
...
Add Stringer to Params, if we're not printing Debug messages (which usually is
the case), it won't be called at all. Micro-optimization.
2020-10-08 16:37:28 +03:00
Evgenii Stratonikov
b2a3a0851e
emit: accept multiple opcodes in Opcode()
2020-10-06 18:03:25 +03:00
Evgenii Stratonikov
fa09b9af7b
transaction: rename FeeOnly to None
...
Follow missed change from neo-project/neo#1816 .
`None` may be used for any signer. Currently it is used
for sender to only pay fees, or to sign tx attributes.
2020-10-01 15:28:19 +03:00
Roman Khimov
5d306297e9
Merge pull request #1367 from nspcc-dev/rpc/array_func_params
...
rpc: allow to use arrays in expandArrayIntoScript
2020-08-27 17:31:07 +03:00
Anna Shaleva
5e8ce45a84
rpc: allow to use arrays in expandArrayIntoScript
...
Should be done together with #1363 . Also removed
CreateInvocationScript function as we don't have `Invoke` RPC-call
anymore.
2020-08-27 16:38:45 +03:00
Evgenii Stratonikov
db4eecf4dc
rpc: support 0x form of Uint256 in requests
2020-08-27 12:36:33 +03:00
Evgenii Stratonikov
7854dcfd8f
core: replace interop names with named constants
2020-08-14 14:21:54 +03:00
Roman Khimov
0e2784cd2c
always wrap errors when creating new ones with fmt.Errorf()
...
It doesn't really change anything in most of the cases, but it's a useful
habit anyway.
Fix #350 .
2020-08-07 12:21:52 +03:00
Roman Khimov
5ef08f60ae
remove github.com/pkg/errors from dependencies
...
It's not needed any more with Go 1.13 as we have wrapping/unwrapping in base
packages. All errors.Wrap calls are replaced with fmt.Errorf, some strings are
improved along the way.
2020-08-07 12:21:52 +03:00
Roman Khimov
4bbe863904
Merge pull request #1266 from nspcc-dev/notifications/filter_by_name
...
rpc: filter subscriptions' notifications by name
2020-08-05 10:00:15 +03:00
Anna Shaleva
90825efa16
core: move transaction's sender to cosigners
...
Closes #1184
Ported changes from https://github.com/neo-project/neo/pull/1752
2020-08-04 17:33:50 +03:00
Anna Shaleva
4ff3a9e9a7
rpc: filter subscriptions' notifications by name
...
Closes #1263
2020-08-04 16:29:13 +03:00
Anna Shaleva
8697582b23
core: add FeeOnly witness scope
2020-08-04 15:08:59 +03:00
Evgenii Stratonikov
62bb130ccb
rpc/request: add (*Param).GetUint160FromAddressOrHex()
...
Allow to get address from both representations.
2020-07-17 18:51:13 +03:00
Roman Khimov
540a20c1c9
rpc/request: decode bytearray as base64, fix #1151
...
It's encoded in base64 now.
2020-07-07 22:35:03 +03:00
Roman Khimov
0819583413
cli/rpc: test-invoke deployment script to get the system fee value
...
Fix #1134 .
2020-07-02 16:41:31 +03:00
Anna Shaleva
73b630db9b
*: switch from fixed8 to int64
...
Follow C# implementation, we have to marshall JSON Fixed8 fields without
taking into account decimals.
2020-06-29 21:39:27 +03:00
Evgenii Stratonikov
d550e539ba
rpc: convert null
value to a defaultT
...
Right now we convert it is unmarshaler into a float64(0)
so an error is supressed.
2020-06-27 12:15:29 +03:00
Evgenii Stratonikov
bed08d3f89
rpc/server: unify boolean flag handling
...
Implement (*Param).GetBoolean() for converting parameter to bool value.
It is used for verbosity flag and is false iff it is either zero number
or empty sting.
2020-06-27 12:13:06 +03:00
Evgenii Stratonikov
35f952e44f
rpc/server: simplify errors handling during parameter parsing
...
Forward-ported from 2.x with some updates.
2020-06-27 12:11:21 +03:00
Roman Khimov
1081791c68
core: fix contract manifest unpacking in System.Contract.Create
...
It's just JSON, io.Serializable is only used for DB storage where the length
should be obtained from the stream. Fixes:
2020-06-18T22:14:10.571+0300 WARN contract invocation failed {"tx": "1ffd475a9c246495d6206cb80a9a78e9d14a433ded60cd37aa87d897655606e1", "block": 25893, "error": "error encountered at instruction 3696 (SYSCALL): failed to invoke syscall: invalid character ':' after top-level value"}
2020-06-18 22:38:34 +03:00
Evgenii Stratonikov
7b4ca57e33
*: change address to the new format
...
NEO3 uses new prefix for address (53 = 0x35), thus string representations as
well as encrypted WIFs should be changed.
2020-06-17 15:58:21 +03:00
Anna Shaleva
3568ab3d6d
core: add json marshaller for Cosigner's scopes
...
Following C# implementation, we should marshal Scopes as a set of
strings instead of single byte.
2020-06-15 13:48:15 +03:00
Roman Khimov
fe31c7ed2d
Merge pull request #1047 from nspcc-dev/neo3/rpc/invoke
...
rpc: update invoke* RPC-calls
2020-06-11 21:39:20 +03:00