Commit graph

39 commits

Author SHA1 Message Date
Roman Khimov
43a59adbd0 rpc/server: move to services/rpcsrv
`server` is not a good package name and it's an internal service, so it can be
just about anywhere.
2022-07-21 22:14:12 +03:00
Anna Shaleva
cbd20eb959 rpc: implement iterator sessions 2022-07-08 17:05:18 +03:00
Anna Shaleva
a033b212a3 rpc: bump getversion compat
Version 0.98.5 is officially released with the old behaviour. The same thing
as #2479.
2022-05-16 06:59:23 +03:00
Roman Khimov
e7a0722849 rpc: bump getversion compat again
Version 0.98.4 is officially released with the old behaviour. The same thing
as #2472.
2022-05-12 10:37:56 +03:00
Roman Khimov
bb0efed8b7 rpc: move latest getversion compat to 0.98.3
Version 0.98.3 is officially released with the old behavior.
2022-05-07 22:34:40 +03:00
Anna Shaleva
9862b40f2c rpc: support InitialGasDistribution response from old Neo-Go nodes
https://github.com/nspcc-dev/neo-go/pull/2435 breaks compatibility
between newer RPC clients and older RPC servers with the following
error:
```
failed to get network magic: json: cannot unmarshal string into Go struct field Protocol.protocol.initialgasdistribution of type int64
```

This behaviour is expected, but we can't allow this radical change.
Thus, the following solution is implemented:
1. RPC server responds with proper non-stringified
   InitialGasDistribution value. The value represents an integral
   of fixed8 multiplied by the decimals.
2. RPC client is able to distinguish older and newer responses. For
   older one the stringified value without decimals part is
   expected. For newer responses the int64 value with decimal part
   is expected.

The cludge will be present in the code for a while until nodes of
version <=0.98.3 become completely absolete.
2022-04-27 19:00:46 +03:00
Roman Khimov
a10b1ad32d rpc/server: make Server conform network.Service interface
With Start() and Shutdown() taking no parameters and returning no values.
2022-04-22 10:49:06 +03:00
Anna Shaleva
e306a90554 rpc: add NEP11-D tests to server and client
Also refactor basic chain creation.
2022-02-09 11:57:16 +03:00
Roman Khimov
bf1604454c blockchainer/network: move StateSync interface to the user
Only network package cares about it.
2022-01-14 19:57:14 +03:00
Roman Khimov
cc4a63e454 rpc/server: use dynamic port for P2P service
Fix running tests alongside regular testnet node.

panic: TCP listen error

goroutine 4634 [running]:
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc0008540c0, 0xc001a4df80, 0x1, 0x1)
        /home/rik/go/pkg/mod/go.uber.org/zap@v1.18.1/zapcore/entry.go:234 +0x532
go.uber.org/zap.(*Logger).Panic(0xc002399ce0, 0xecd669, 0x10, 0xc001a4df80, 0x1, 0x1)
        /home/rik/go/pkg/mod/go.uber.org/zap@v1.18.1/logger.go:230 +0x85
github.com/nspcc-dev/neo-go/pkg/network.(*TCPTransport).Accept(0xc000fd6960)
        /home/rik/dev/neo-go/pkg/network/tcp_transport.go:49 +0x216
created by github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start
        /home/rik/dev/neo-go/pkg/network/server.go:292 +0x2bb
FAIL    github.com/nspcc-dev/neo-go/pkg/rpc/server      1.095s
2021-11-15 12:19:27 +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
95c279325a block: drop Network from the Header
It's not network-tied any more, network is only needed to
sign/verify. Unfortunately we still have to keep network in consensus data
structures because of dbft library interface.
2021-03-26 13:45:18 +03:00
Anna Shaleva
bcb82b457d config: move notary module config to ApplicationConfiguration 2021-02-16 13:58:25 +03:00
Anna Shaleva
a237e34c1f rpc: add test for submitNotaryRequest 2021-02-11 17:15:59 +03:00
Evgenii Stratonikov
43e4d3af88 oracle: integrate module in core and RPC
1. Initialization is performed via `Blockchain` methods.
2. Native Oracle contract updates list of oracle nodes
  and in-fly requests in `PostPersist`.
3. RPC uses Oracle module directly.
2021-01-28 13:00:58 +03:00
Evgenii Stratonikov
1840c1c80d core: redefine opcode prices
Prices are defined in as a coefficients to `BaseExecFee` which
is defined by Policy contract (TBD later).
Native method prices are defined without need to multiply.
2020-12-16 13:55:39 +03:00
Evgenii Stratonikov
1869d6d460 core: allow to use state root in header 2020-11-20 17:16:32 +03:00
Anna Shaleva
ec63d5c456 core: add conflicts attribute
Close #1491
2020-10-29 10:57:31 +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
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
abe3c94b95 core: use big.Int to store NEP5 balances
closes #1133
2020-07-09 13:26:39 +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
5354352d63 core: remove transaction priority
There is no such thing as high/low priority transactions, as there are
no free transactions anymore and they are ordered by fees contained
in transaction itself.

Closes #1063.
2020-06-18 22:44:10 +03:00
Roman Khimov
b483c38593 block/transaction: add network magic into the hash
We make it explicit in the appropriate Block/Transaction structures, not via a
singleton as C# node does. I think this approach has a bit more potential and
allows better packages reuse for different purposes.
2020-06-18 12:39:50 +03:00
Roman Khimov
26f11a52d9 config: move NetMode into its own micropackage
It's going to be used a bit more and pulling whole config just for one type is
a bit wrong.
2020-06-18 12:09:57 +03:00
Roman Khimov
fc22a46a4c rpc/server: add notification subscription
Note that the protocol differs a bit from #895 in its notifications format,
to avoid additional server-side processing we're omitting some metadata like:
 * block size and confirmations
 * transaction fees, confirmations, block hash and timestamp
 * application execution doesn't have ScriptHash populated

Some block fields may also differ in encoding compared to `getblock` results
(like nonce field).

I think these differences are unnoticieable for most use cases, so we can
leave them as is, but it can be changed in the future.
2020-05-26 11:36:47 +03:00
Roman Khimov
612500ed96 rpc/server: start and shutdown Server in tests
It will be important for proper subscription testing and it doesn't hurt even
though technically we've got two http servers listening after this change (one
is a regular Server's http.Server and one is httptest's Server). Reusing
rpc.Server would be nice, but it requires some changes to Start sequence to
start Listener with net.Listen and then communicate back its resulting
Addr. It's not very convenient especially given that no other code needs it,
so doing these changes just for a bit cleaner testing seems like and
overkill.

Update config appropriately. Update Start comment along the way.
2020-05-25 00:27:39 +03:00
Anna Shaleva
1afd630169 core: add senders' fees monitor to mempool
In order to simplify maintainance of overall current senders` fees
in the mempool we are to keep them in a separate map.
2020-05-20 23:34:25 +03:00
Anna Shaleva
7acf5b2841 core: add SystemFee and NetworkFee to transaction
closes #831
2020-05-20 23:26:48 +03:00
Roman Khimov
d275652b37 rpc/server: use httptest.Server for testing
Which allows to reuse it for websockets.
2020-05-04 16:54:35 +03:00
Roman Khimov
57de98e1a3 rpc/server: refactor handler methods a little
request.In is a natural request representation, one can always get
request.Params from it.
2020-05-04 13:57:08 +03:00
Anna Shaleva
5a984fdf88 config: move config.go out of config/
closes #423
2020-03-31 17:55:59 +03:00
Roman Khimov
e41d434a49 *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
Roman Khimov
4c8d327353 rpc: drop duplicating Invoke* structures
And use smartcontract.Parameter instead of vm.StackItem where
appropriate. Closes #689.
2020-03-03 15:38:03 +03:00
Roman Khimov
3282c6ed41
Merge pull request #704 from nspcc-dev/feature/getrawmempool
rpc: implement getrawmempool RPC
2020-03-02 19:44:19 +03:00
Anna Shaleva
e1fe12a07f rpc: implement getrawmempool RPC
closes #175
2020-03-02 19:35:51 +03:00
Evgenii Stratonikov
44792ed5f7 core: make test chain format compatible with mainnet
Write uint32 length before every block.
2020-03-02 18:01:49 +03:00
Roman Khimov
8da20055d6 rpc: drop duplicating structures used in tests
We have proper results now, so use those. The only left is Invoke, but that
depends on another issue at the moment.
2020-02-21 15:23:11 +03:00
Evgenii Stratonikov
b50704fd3b rpc: move server-related code to a separate package 2020-02-21 15:12:04 +03:00
Renamed from pkg/rpc/server_helper_test.go (Browse further)