Commit graph

44 commits

Author SHA1 Message Date
Roman Khimov
6f7fed344b rpcclient: add Internal client for direct RPC server calls
It has a special `requestF` and a special initialization function, but other
than that it's an absolutely regular WSClient. Can be used to call, can be
used to subscribe. Fixes #2909.
2023-02-16 23:49:58 +03:00
Roman Khimov
a55a01d456 rpcsrv: provide RegisterLocal for local clients
This allows to call RPC server more effectively in the same process (bypassing
TCP/HTTP). Refs. #2909.
2023-02-16 23:49:58 +03:00
Roman Khimov
b1f1405f42
Merge pull request #2836 from nspcc-dev/fix-subs
rpcclient: fix filtered naive subscriptions receiver
2022-12-07 21:17:07 +07:00
Anna Shaleva
2c0844221a rpcclient: fix filtered naive subscriptions receiver
We should return the filter itself instead of pointer.
2022-12-07 16:56:16 +03:00
Roman Khimov
236e633ee4 native: make management compatible with C# node 3.5.0
It doesn't store id->hash mappings for native contracts. We need blockchain's
GetContractScriptHash to serve both anyway, so it was changed a bit. The only
other direct user of native.GetContractScriptHash is the VM CLI, but I doubt
anyone will use it for native contracts (they have ~zero VM code anyway).
2022-12-07 15:13:17 +03:00
Anna Shaleva
9cf6cc61f4 network: allow multiple bind addresses for server
And replace Transporter.Address() with Transporter.HostPort() along the way.
2022-12-07 13:06:03 +03:00
Roman Khimov
b7518423d4
Merge pull request #2829 from nspcc-dev/ms-per-block
TimePerBlock config
2022-12-05 14:27:55 +07:00
Roman Khimov
c2adbf768b config: add TimePerBlock to replace SecondsPerBlock
It's more generic and convenient than MillisecondsPerBlock. This setting is
made in backwards-compatible fashion, but it'll override SecondsPerBlock if
both are used. Configurations are specifically not changed here, it's
important to check compatibility.

Fixes #2675.
2022-12-02 19:52:14 +03:00
Roman Khimov
d909cab4a4 rpcclient/management: add new methods 2022-12-02 10:57:05 +03:00
Roman Khimov
0ad6e295ea core: make GetHeaderHash accept uint32
It should've always been this way because block indexes are uint32.
2022-11-25 14:30:51 +03:00
Roman Khimov
327dfb8dbf rpcsrv: add wsclient error message test for #2818
Now it can be done easily.
2022-11-23 12:24:20 +03:00
Roman Khimov
cd6bb68246 actor: check for tx after the subscription in wsWaiter, fix #2805
Don't wait for VUB block, solve this race immediately.
2022-11-22 17:28:55 +03:00
Anna Shaleva
e73c3c7ec4 services: adjust WS waiter test
Make it more stable.
2022-11-17 17:15:01 +03:00
Anna Shaleva
95e23c8e46 actor: fix event-based tx awaiting
If VUB-th block is received, we still can't guaranty that transaction
wasn't accepted to chain. Back this situation by rolling back to a
poll-based waiter.
2022-11-16 23:44:31 +03:00
Anna Shaleva
6dbae7edc4 rpcclient: fix WS-client unsubscription process
Do not block subscribers until the unsubscription request to RPC server
is completed. Otherwise, another notification may be received from the
RPC server which will block the unsubscription process.

At the same time, fix event-based waiter. We must not block the receiver
channel during unsubscription because there's a chance that subsequent
event will be sent by the server. We need to read this event in order not
to block the WSClient's readloop.
2022-11-16 23:44:30 +03:00
Roman Khimov
1e07cacc79 rpcsrv: fix test
client_test.go:1935:
                Error Trace:    /home/rik/dev/neo-go/pkg/services/rpcsrv/client_test.go:1935
                Error:          Should NOT be empty, but was 00000000-0000-0000-0000-000000000000
                Test:           TestClient_Iterator_SessionConfigVariations/sessions_disabled

It's obviously empty, since we have sessions disabled, but it was not
considered to be empty in testify 1.7.0, now it is, see 840cb80149
2022-11-08 18:31:25 +03:00
Anna Shaleva
10a0716217 rpc: implement transaction awaiting functionality
Close #2704.
2022-10-24 06:09:36 +03:00
Anna Shaleva
79e13f73d8 core, rpc: move getFakeNextBlock to Blockchain
It's needed for VM CLI as far and may be improved later.
2022-10-07 15:56:34 +03:00
Roman Khimov
317dd42513 *: use uint*Size and SignatureLen constants where appropriate 2022-10-05 10:45:52 +03:00
Roman Khimov
d40eb79975 rpcclient: simplify historic API
util.Uint256 is util.Uint256 and it's same RPC behind the scenes, so we can
make it a bit easier to digest. See #2545 also.
2022-09-09 13:41:45 +03:00
Roman Khimov
e569edc841 wallet: add ScriptHash() to Account
It allows to simplify a lot of code and avoid getting a PrivateKey in some
cases.
2022-09-02 14:43:34 +03:00
Roman Khimov
314cd3341b
Merge pull request #2667 from nspcc-dev/rpc-nep-token-info
Drop NEPXXTokenInfo from the RPC client
2022-08-30 14:41:30 +03:00
Roman Khimov
673c8954cc
Merge pull request #2665 from nspcc-dev/notary-rpcclient
Notary RPC client
2022-08-30 12:43:13 +03:00
Roman Khimov
07f3023e84 rpcclient: add notary.Actor for seamless notary experience 2022-08-30 11:47:56 +03:00
Roman Khimov
ed6ed61712 neptoken: add Info to replace old NEPXXTokenInfo methods
I'm still not sure it's good to have this exposed from neptoken at all, but
let's try it this way.
2022-08-29 22:52:27 +03:00
Roman Khimov
0d9158bd79 rpcclient: add enough of NNS into nns to deprecate NNS methods 2022-08-26 19:45:37 +03:00
Roman Khimov
8b132cba0c wallet: respect user-locked accounts, don't sign with them
NEP-6 has a notion of locked acccounts and SignTx must respect this user's
choice. For some reason this setting was inappropriately used by our RPC
client tests (probably a different kind of lock was meant).
2022-08-26 18:21:58 +03:00
Roman Khimov
2f8896f7a1 rpcclient: add notary subpackage with the notary contract wrapper 2022-08-26 18:21:58 +03:00
Roman Khimov
a2c4a7f611 rpcsrv: adjust for paid attritbutes in calculatenetworkfee
calculatenetworkfee MUST calculate complete proper network fee, if we have
some extensions enabled and some attributes should be paid for that they're a
part of the equation too.
2022-08-23 15:34:18 +03:00
Roman Khimov
c034f94a94 nep17: provide out of the box multitransfer capability
It can't replicate the old multitransfer methods in ability to transfer
multiple tokens, but it at the same time can do multiple senders.
2022-08-19 21:52:43 +03:00
Roman Khimov
194933a5cc rpcclient: provide nep11 package for NEP-11 tokens
Unfortunately Go doesn't allow to easily reuse readers in full packages, still
we can have this wrapper with a little overhead (the alternative is to move
specific methods into types of their own, but I'm not sure how it's going to
be accepted user-side).
2022-08-19 10:37:22 +03:00
Roman Khimov
f011b3c3dd rpcclient: introduce NEO wrapper
Notice that int64 types are used for gas per block or registration price
because the price has to fit into the system fee limitation and gas per block
value can't be more than 10 GAS. We use int64 for votes as well in other types
since NEO is limited to 100M.
2022-08-17 22:03:09 +03:00
Roman Khimov
0dbe8b6ce2 rpcclient: add oracle package for OracleContract 2022-08-17 11:42:20 +03:00
Roman Khimov
5c8f3a99dc rpcclient: add management wrapper for ContractManagement 2022-08-17 11:42:20 +03:00
Roman Khimov
5d5455312a rpcclient: add policy package for the PolicyContract contract
And test it with the RPC server.

Notice that getters still return int64 instead of *big.Int, that's because
these values are very limited and technically could even fit into an int (but
that seems to be too dangerous to use for long-term compatibility).
2022-08-16 12:43:25 +03:00
Roman Khimov
ee72b2fa29 rpcclient: add gas package for the GAS contract
Test it with the RPC server.
2022-08-16 12:43:25 +03:00
Roman Khimov
ee84a4ab32 rpcclient: add rolemgmt pkg for RoleManagement contract
And test it with RPC server.
2022-08-16 12:43:25 +03:00
Roman Khimov
c967005216 rpcclient: add deprecation notices
And fix test code using old APIs to pass linter checks.
2022-08-12 18:21:02 +03:00
Roman Khimov
afef8b85d9 rpcclient: add deprecation warnings 2022-08-08 09:51:51 +03:00
Roman Khimov
31c9ae6339 rpcclient: add CallAndExpandIterator to Invoker
And deprecate Client.InvokeAndPackIteratorResults.
2022-08-01 21:31:23 +03:00
Roman Khimov
3c5a720e3a smartcontract: drop Params type and TryParse methods
They were first introduced in a058598ecc and
then carefully moved in 648e0bb242, but it looks
like they were never used by any external code. This code can be useful on the
server, but the server has its own params package to deal with
parameters. Clients usually create Parameters and then get results as
stackitem.Items, so they don't use this code either. So there is zero point in
keeping it.
2022-08-01 21:31:23 +03:00
Roman Khimov
1e0750e3cd rpc: merge response and request under pkg/neorpc
Move result there also.
2022-07-25 11:57:53 +03:00
Roman Khimov
8c668765d2 rpc/client: move to pkg/rpcclient
Better package name, closer to user.
2022-07-21 22:39:53 +03:00
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
Renamed from pkg/rpc/server/client_test.go (Browse further)