Commit graph

597 commits

Author SHA1 Message Date
Roman Khimov
1da4b333f6 cli/wallet: modernize nep11 balances command, unify with nep17
Make NEP-11 code use getnep11balances the same way NEP-17 code uses
getnep17balances. This command was introduced well before getnep11balances
appeared, so it required always specifying contract explicitly. Now this
constraint can be relaxed somewhat in most cases.
2022-08-30 12:52:14 +03:00
Roman Khimov
7cfcf072b8 cli/wallet: make NEP-17 token selection logic a bit more robust
1. In the single token mode compare known hashes instead of names, names can
   be misleading.
2. Hardcode NEO/GAS, they are special (if not overrided by the wallet data).
2022-08-30 12:52:14 +03:00
Roman Khimov
5f1fe72504 cli/wallet: use token data from getnepXXbalances
We have this data available since 0.99.1 while all public networks require at
least 0.99.2 for compatibility and NeoFS setups use 0.99.2+ too. This data can
simplify account handling considerably making additional requests unneccessary
in many cases.
2022-08-29 22:52:27 +03:00
Roman Khimov
e28bf55ebb cli/wallet: search for NEP-11 token name in balances
In the same way we do for NEP-17 tokens. This code predates "getnep11balances"
call, so this wasn't possible back then, but now we can improve the situation
(allow specifying names/symbols instead of hashes only).
2022-08-29 22:52:27 +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
Anna Shaleva
40315fe092 cli: check manifest for validness if it's got from user input
And adjust the test case along the way, unnamed arguments are not
allowed for valid manifest.
2022-08-22 14:59:34 +03:00
Roman Khimov
8005bfcd32 cli/wallet: compensate for CLI waiting time
Similar to ba2e7063dd.
2022-08-22 09:55:31 +03:00
Roman Khimov
f60fa02a96 cli/wallet: deduplicate some transfer code 2022-08-22 09:55:31 +03:00
Roman Khimov
7e212de41a cli: drop the use of deprecated APIs from sc/nep11/nep17 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
5c8f3a99dc rpcclient: add management wrapper for ContractManagement 2022-08-17 11:42:20 +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
be74cc6b55 cli: use nep17 wrapper to implement commands 2022-08-12 18:21:02 +03:00
Roman Khimov
7c266fc9bf cli/wallet: use Actor for voting commands 2022-08-09 17:28:46 +03:00
Roman Khimov
e98ac8bc53 cli: rework registration commands with Actor
And reduce the amount of wasted GAS.
2022-08-09 17:28:45 +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
f3d7656b44
Merge pull request #2634 from nspcc-dev/go-1-19-upd
*: go 1.19 support
2022-08-09 16:33:08 +03:00
Anna Shaleva
bb751535d3 *: bump minimum supported go version
Close #2497.
2022-08-08 13:59:32 +03:00
Roman Khimov
afef8b85d9 rpcclient: add deprecation warnings 2022-08-08 09:51:51 +03:00
Roman Khimov
260bcc0f49 wallet: fix wallet version to conform to NEP-6
See neo-project/neo#2390. Can't see it there? No wonder, that's why we have
this bug for a year and a half. Not critical, we don't care about versions,
but _very_ annoying.
2022-08-07 22:41:40 +03:00
Roman Khimov
d9feec2be5 cli: use MVUBI for saved transactions
And DO NOT CHANGE TX in paramcontext InitAndSave, because it's really
unobvious and must not be done this way.
2022-08-07 22:33:57 +03:00
Roman Khimov
ba2e7063dd cli: compensate VUB for prompt waiting time
We also have now ways to change it with actor package, so technically this
fixes #2618.
2022-08-07 22:33:57 +03:00
Roman Khimov
7132b38425 cli: use actor.Actor for smart contract invocations
That's a proof of the concept mostly since it doesn't change much in this
particular case.
2022-08-07 22:33:56 +03:00
Roman Khimov
8385efe4b3 cli: simplify and fix invokeWithArgs logic
Saving into a file can't be successful without signAndPush flag (wallet
present). This situation can't happen in CLI invocations since
testinvokefunction doesn't have `--out` flag, but still it's a logic
error. Everything else can be simplified a bit taking that into account.
2022-08-07 22:33:56 +03:00
Roman Khimov
4c8e00369c cli/wallet: specify --wallet-config for all commands accepting it 2022-08-05 18:28:02 +03:00
Roman Khimov
28e2010cbd cli: add UsageText to commands that were missing it
Makes --help a bit more useful.
2022-08-05 18:28:02 +03:00
Roman Khimov
1367d0df00 cli: provide more explanations for node options 2022-08-05 16:04:56 +03:00
Roman Khimov
3e147a3fc9 cli: db dump/restore commands have no --debug flag 2022-08-05 15:59:23 +03:00
Roman Khimov
1518019be8 cli: add excessive arguments checks
Some commands don't accept arguments, but users try giving them and don't
notice a mistake. It's a bit more user-friendly to tell the user that there is
something wrong with the way he tries to use the command.
2022-08-05 15:50:12 +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
9b0ea2c21b network/consensus: always process dBFT messages as high priority
Move category definition from consensus to payload, consensus service is the
one of its kind (HP), so network.Server can be adjusted accordingly.
2022-08-02 13:07:18 +03:00
Roman Khimov
b92896b0c0 cli: fix FTBFS on Windows
It has a stub for SIGHUP, but doesn't have anything for USR1 and USR2:

Error: cli\server\server.go:520:31: undefined: syscall.SIGUSR1
Error: cli\server\server.go:521:31: undefined: syscall.SIGUSR2
Error: cli\server\server.go:565:17: undefined: syscall.SIGUSR1
Error: cli\server\server.go:608:17: undefined: syscall.SIGUSR2
2022-08-02 13:06:08 +03:00
Roman Khimov
94a8784dcb network: allow to drop services and solve concurrency issues
Now that services can come and go we need to protect all of the associated
fields and allow to deregister them.
2022-08-02 13:05:39 +03:00
Roman Khimov
5a7fa2d3df cli: restart consensus service on USR2
Fix #1949. Also drop wallet from the ServerConfig since it's not used in any
meaningful way after this change.
2022-08-02 13:05:07 +03:00
Roman Khimov
bf92966633 cli: reload state root service on USR1
It's a bit special since it's _always_ present to catch stateroots from the
network.
2022-08-02 13:02:36 +03:00
Roman Khimov
9341bb6628 cli: restart notary service on USR1 2022-07-28 19:05:56 +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
eb67b61c0f cli: change --version output format, fix #2611 2022-07-27 16:28:40 +03:00
Roman Khimov
df24c1268e cli: restart pprof and prometheus on HUP 2022-07-27 12:30:08 +03:00
Roman Khimov
6593b94594 cli: use new configuration for the RPC server
Also fix addresses if needed and store this new configuration.
2022-07-27 12:30:08 +03:00
Roman Khimov
94099de3c3 cli: also check new ApplicationConfiguration for consistency
Most of the settings can't be changed, only services can.
2022-07-27 12:30:08 +03:00
Roman Khimov
3fca3352d8 cli: read new config on signal and check ProtocolConfiguration
ProtocolConfiguration must remain the same, any errors mean that the signal
will be ignored.
2022-07-27 12:30:08 +03:00
Roman Khimov
f749aaff3c *: reuse smartcontract package to create standard entry scripts 2022-07-26 12:19:49 +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
Roman Khimov
2e27c3d829 metrics: move package to services
Where it belongs.
2022-07-21 23:38:23 +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
Roman Khimov
96c4e61063 storage: move Operation into package of its own
Don't use storage.* types in rpc/response/result.
2022-07-08 23:30:30 +03:00