Commit graph

228 commits

Author SHA1 Message Date
Roman Khimov
970de84130 rpc: add paging to getnep5transfers call
And add some tests.
2020-09-22 16:40:29 +03:00
Roman Khimov
c50ff7f20e rpc/server: refactor parameter parsing for getnep5transfers 2020-09-21 22:38:59 +03:00
Roman Khimov
e4b52d3947 core/rpc: add continue flag to iterating functions
Most of the time we don't need to get all transfers from the DB and
deserialize them.
2020-09-21 22:23:34 +03:00
Roman Khimov
6902003044 rpc/server: add limit to get*transfers calls
Return only N transfers requested.
2020-09-21 18:03:59 +03:00
Anna Shaleva
770c8d774c core, rpc: add GetCommittee method
Closes #1414
2020-09-21 15:56:25 +03:00
Anna Shaleva
c6f099294b core: do not marshal block hash in application log
Closes #1388
2020-09-21 14:08:15 +03:00
Roman Khimov
1608fbff87
Merge pull request #1378 from nspcc-dev/tests/cli
Implement tests for CLI
2020-09-19 17:02:34 +03:00
Evgenii Stratonikov
758a88a813 rpc: exit from Start after Listener is running
If port is dynamically allocated, `(*Server).Addr` will contain
0 port. This commit executes listener before exiting from `Start()`
and sets Addr to the actual address.
2020-09-18 12:05:31 +03:00
Roman Khimov
93be4bbeee rpc/server: fix "websocket: bad handshake" during testing
I think it's caused by connection limits server-side, we never close
connection on the client.
2020-09-16 12:51:59 +03:00
Roman Khimov
19c69618c5 transaction: cache tx size, don't serialize it over and over again 2020-09-11 18:55:19 +03:00
Roman Khimov
af17bbfeab rpc/server: encode answers more efficiently
We're at the point where even this code can clearly be seen in profiles. We
can save on some buffers (and CPU cycles) by encoding the answer once.

Another ~2% TPS for single node.
2020-09-09 20:46:31 +03:00
Roman Khimov
5df726db68 mempool: replace timeStamp with blockStamp
Time is not really relevant for us here and we don't use this timestamp in any
way. Yet it occupies 24 bytes and we do two clock_gettime calls to get it.

Replace it with blockStamp which is going to be used in the future for
transaction retransmissions.

It allows to improve single-node TPS by another 3%.
2020-09-09 20:46:31 +03:00
Anna Shaleva
acacac1b24 rpc: use state.AppExecResult for ApplicationLog marshalling
Closes #1371
2020-09-07 13:38:32 +03:00
Evgenii Stratonikov
9c7168e4e8 rpc/client: allow to use contract accounts in AddNetworkFee 2020-08-27 11:32:55 +03:00
Evgenii Stratonikov
72ca8b79c3 rpc/client: provide sender in CreateNEP5MultiTransferTx
Specify scope explicitly.
Fix #1354.
2020-08-25 09:21:06 +03:00
Roman Khimov
7fedb4f4ba testchain: move newBlock there from rpc/server
Allow its reuse by other components.
2020-08-20 18:50:36 +03:00
Roman Khimov
9257167af3
Merge pull request #1328 from nspcc-dev/tests/addnetworkfee
rpc/client: provide scripts in AddNetworkFee
2020-08-18 15:30:47 +03:00
Evgenii Stratonikov
6bdaefcfa4 rpc/client: use CreateTxFromScript where possible
There is substantial overlap between `CreateTxFromScript` and
`SignAndPushInvocationTx`. This commit refactors both of them
to reuse common code.
2020-08-18 11:24:48 +03:00
Evgenii Stratonikov
316666cc22 rpc/client: add tests for Ping 2020-08-18 11:24:48 +03:00
Evgenii Stratonikov
48f1502167 rpc/client: add tests for SignAndPushInvocationTx 2020-08-18 11:24:48 +03:00
Evgenii Stratonikov
2699508914 wallet: emit proper multisignature
In case when a signature needs to be added to multisig
we must first find corresponding signer, not append new witness.
2020-08-18 11:24:48 +03:00
Evgenii Stratonikov
8699a4c1a9 rpc/client: provide scripts in AddNetworkFee
To calculate network fee properly we must know type of every
signer (simple, multisig, contract). Providing scripts is the most
simple and flexible way to know this.
2020-08-18 11:24:48 +03:00
Roman Khimov
d0c29f52c9 core: verification script must return exactly one value
C# node is quite picky as it expects there to be exactly one value returned,
but our testchain actually adds 4 signatures for multisig cases instead of 3
which makes it technically incompatible with C# node.
2020-08-17 22:02:15 +03:00
Evgenii Stratonikov
a8cda69bc3 rpc: fix (*Client).BalanceOf
Add missing argument and write tests.
2020-08-14 11:19:24 +03:00
Roman Khimov
c16040aecc native: sort GetValidators result
As it's returned sorted now. Fixes state change mismatch for
NextValidators. It also partially reverts
2f8e7e4d33 and significantly changes the test
chain as the fees are no longer being sent to the same account.
2020-08-10 19:49:09 +03:00
Roman Khimov
fb97ea9458 native: don't register standby validators on initialization
C# doesn't do that since neo-project/neo#1762.
2020-08-10 17:51:46 +03:00
Roman Khimov
6e252fbaae rpc: answer with zero-length when there are no registered validators
There is a huge difference between
   "result" : [],
and
   "result" : null,
2020-08-10 17:50:19 +03:00
Evgenii Stratonikov
412fc53cdd rpc: provide timestamps in getnep5transfers
Set default value for the first timestamp to a week ago.
2020-08-07 18:42:34 +03:00
Evgenii Stratonikov
807338f97e core: do not store NEP5 transfer log in memory
Traversing transfer log instead of accumulating and returning it
is faster and takes less memory.
2020-08-07 18:21:06 +03:00
Roman Khimov
c3c88a57cd
Merge pull request #1281 from nspcc-dev/drop-go-1.12-and-fix-some-things
Drop go 1.12 and fix some things
2020-08-07 13:34: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
205f52c563 core: use error wrapping to provide more details 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
Evgenii Stratonikov
9bc731b3b1 native: implement delegated voting
Close #867.
2020-08-06 20:39:13 +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
Evgenii Stratonikov
9cba25616d rpc: use raw stack items in invoke* RPC
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 16:07:16 +03:00
Anna Shaleva
167bd7d9df rpc: store decimals by contract ID instead of hash
And we should also cache contract scripthash to fill Asset field.
2020-07-29 15:15:48 +03:00
Anna Shaleva
0dd1730632 core: store NEP5Transfer asset by ID instead of hash
To avoid problems with retrieving decimals for migrated contracts.
2020-07-29 15:15:48 +03:00
Anna Shaleva
b9bdab8ec8 core: store nep5balances using contract id
Closes #1194
2020-07-29 15:15:48 +03:00
Anna Shaleva
1f5794b316 rpc: make getDecimals return a standard error
`getDecimals` is an internal method, wo there's no need to return
response.Error.
2020-07-29 15:14:24 +03:00
Anna Shaleva
4bf88ba6b0 core: decouple native contracts from interop service
Closes #1191.
2020-07-29 10:33:18 +03:00
fyrchik
b187dfe3ce
Merge pull request #1236 from nspcc-dev/rpc/getrawmempool
rpc: update `getrawmempool` and `getrawtransaction` RPC-calls
2020-07-29 10:18:51 +03:00
Anna Shaleva
0c424a0ed2 rpc: update getrawtransaction RPC call
Closes #1183.

Added VMState to transaction output raw.
2020-07-29 10:14:08 +03:00
Anna Shaleva
70ef733ce7 core, vm: store VMState as byte instead of string
Part of #1183
2020-07-29 10:14:08 +03:00
Anna Shaleva
990db9f205 rpc: update getrawmempool RPC-call result
Closes #1182
2020-07-29 10:14:01 +03:00
Evgenii Stratonikov
84c148575d rpc: remove Main func from test contract 2020-07-27 13:00:35 +03:00
Evgenii Stratonikov
d2ddf7b7cb *: support invoking methods by offset
Allow to invoke methods by offset:
1. Every invoked contract must have manifest.
2. Check arguments count on invocation.
3. Change AppCall to a regular syscall.
4. Add test suite for `System.Contract.Call`.
2020-07-27 13:00:35 +03:00
Evgenii Stratonikov
54d7882acf core: compiler contract on-the-fly in helper test
Generate proper manifest file too.
2020-07-27 13:00:34 +03:00