Commit graph

52 commits

Author SHA1 Message Date
Anna Shaleva
735db08f84 services: adjust RPC server's getHistoricParams
Update documentation and add index upper bound check to get rid of
CodeQL warning.
2022-10-07 16:06:12 +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
1c376ffa62
Merge pull request #2724 from nspcc-dev/rpc-options
rpcsrv: handle preflight OPTIONS with CORS kludge, fix #2721
2022-10-05 17:02:55 +07:00
Roman Khimov
b48d02f4a6 rpcsrv: handle preflight OPTIONS with CORS kludge, fix #2721 2022-10-05 11:09:45 +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
4f3ffe7290 golangci: enable errorlint and fix everything it found 2022-09-02 18:36:23 +03:00
Roman Khimov
3c009271f8 golangci: enable bodyclose checker and fix related code
It has found an issue in the oracle code, so I think it's worth doing.
2022-09-02 18:35:54 +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
03cc9b2762 rpcsrv: execute all witnesses for calculatenetworkfee
Try to get as much data as possible, fix #2654.
2022-08-23 15:34:18 +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
f3d83c90b1 rpcsrv: allow invalid contract signatures in calculatenetworkfee
See #2805, it allows to cover more cases like Notary contract that can use
CalculateNetworkFee now instead of AddNetworkFee RPC client API.
2022-08-22 14:55:45 +03:00
Roman Khimov
98dfe66466 rpcsrv: simplify calculatenetworkfee
We're dealing with a transaction here and it can't be decoded successfully
unless it has an appropriate number of witness scripts (matching the number of
signers) with appropriate hashes (matching signers). So this iterations make
no sense at all, we know exactly where to look for the
verification/invocation scripts.
2022-08-22 14:47:30 +03:00
Roman Khimov
606597b9a1
Merge pull request #2652 from nspcc-dev/shutdown-fixes
Shutdown sequence fixes
2022-08-22 10:22:54 +03:00
Roman Khimov
eeeb0f6f0e core: accept two-side channels for sub/unsub, read on unsub
Blockchain's notificationDispatcher sends events to channels and these
channels must be read from. Unfortunately, regular service shutdown procedure
does unsubscription first (outside of the read loop) and only then drains the
channel. While it waits for unsubscription request to be accepted
notificationDispatcher can try pushing more data into the same channel which
will lead to a deadlock. Reading in the same method solves this, any number of
events can be pushed until unsub channel accepts the data.
2022-08-19 22:08:40 +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
Anna Shaleva
94e84f0364 core: fix native Management's hasMethod signature
Affects states, see
28ab45a6ec/src/Neo/SmartContract/Native/ContractManagement.cs (L155).
2022-08-11 16:10:01 +03:00
Roman Khimov
593fa4cac8
Merge pull request #2632 from nspcc-dev/rpcclient-actor
RPC client Actor interface
2022-08-09 17:21:24 +03:00
Roman Khimov
95b72db707 rpcsrv: return more configuration data to the client
These are extensions, but they're important for the client to make various
decisions.
2022-08-09 15:36:40 +03:00
Roman Khimov
afef8b85d9 rpcclient: add deprecation warnings 2022-08-08 09:51:51 +03:00
Roman Khimov
ab7743d78d
Merge pull request #2619 from nspcc-dev/script-oob-and-hasmethod-3.4.0
Script OOB checks and HasMethod for 3.4.0
2022-08-04 12:41:43 +03:00
Roman Khimov
d4292ed532
Merge pull request #2621 from nspcc-dev/sc-params
Smartcontract Parameters and Invoker interface
2022-08-02 14:18:34 +03:00
Roman Khimov
cfd2a35172
Merge pull request #2612 from nspcc-dev/fancy-service-restart
Fancy service restart
2022-08-02 14:11:44 +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
2adcf406d3 cli: reload Oracle service on USR1
Which allows to enable/disable the service, change nodes, keys and other
settings. Unfortunately, atomic.Value doesn't allow Store(nil), so we have to
store a pointer there that can point to nil interface.
2022-07-28 19:05:56 +03:00
Roman Khimov
98e2c5568c rpcsrv: don't init Oracle in New, drop oracle dependency
The only thing rpcsrv needs is AddResponse callback.
2022-07-28 19:05:56 +03:00
Roman Khimov
55f910777e Revert "native/interop: revert management.hasMethod()"
This reverts commit 6c7a401f77, introducing
changes from #2598 again.
2022-07-28 17:00:34 +03:00
Roman Khimov
6c7a401f77 native/interop: revert management.hasMethod()
This reverts commits
 * f50bcf617a
 * 4f184498bc
 * ab3330564a

because they're 3.4.0-compatible while we need 3.3.1.
2022-07-27 23:26:24 +03:00
Roman Khimov
88542630ac blockchainer: drop the package completely
It's not an ideal solution, but at least it solves the problem for
now. Caveats:
 * consensus only needs one method, so it's mirrored to Blockchain
 * rpcsrv uses core.* definition of the StateRoot (so technically it might as
   well not have an internal Ledger), but it uses core already unfortunately
2022-07-25 11:58:13 +03:00
Roman Khimov
5ee7ea34b1 blockchainer: drop Blockchainer completely
It's only used by the RPC server now, so it can be internalized.
2022-07-25 11:58:13 +03:00
Roman Khimov
b3c25b5a1f neorpc/result: move NotaryRequestEvent to this package
Not worth a package of its own.
2022-07-25 11:58:13 +03:00
Roman Khimov
4acd1688a1 subscriptions: move NotificationEvent to state
1. It's not good for pkg/core to import anything from pkg/neorpc.
2. The type is closely tied to the state package, even though it's not stored
   in the DB
2022-07-25 11:58:13 +03:00
Roman Khimov
8e70cd3596 rpc: move rpc.Config to pkg/config, remove pkg/rpc
Makes no sense keeping it as is and TLS can be reused in the future.
2022-07-25 11:58:13 +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