Commit graph

104 commits

Author SHA1 Message Date
Evgenii Stratonikov
b50704fd3b rpc: move server-related code to a separate package 2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
d24c6d1d9e rpc: move client-related code to a separate package
This includes Client struct with RPC methods and
BalanceGetter implementation with NeoSCAN.
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
b6bc4e580a rpc: move functions for Tx building in request package/ 2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
98a1e2170a rpc: move ContractDetails to request/ package 2020-02-21 15:12:04 +03:00
Roman Khimov
f330f2f40b rpc: separate out request and response structures
Mostly as is, no real effort done yet to optimize them, so there are still a
lot of duplicates there, but at least we sort them out into different smaller
packages.
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
2fc6375958 cli: provide separate function for opening wallet 2020-02-21 12:14:53 +03:00
Evgenii Stratonikov
3d67d52537 cli: support account creation in existing wallet 2020-02-21 12:14:53 +03:00
Evgenii Stratonikov
20c98411fd cli: implement wallet WIF/NEP2 export
One positional argument can be provided. If so, it is
interpreted as address and only WIFs corresponding to it
are exported. If address is provided '--decrypt' flag can be
specified to export unencrypted WIFs.
2020-02-21 12:14:52 +03:00
Evgenii Stratonikov
a030411310 cli: implement multisig import to wallet 2020-02-21 12:14:33 +03:00
Evgenii Stratonikov
baa68e1d46 cli: implement wallet WIF import 2020-02-21 11:19:34 +03:00
Evgenii Stratonikov
a71c2c4bfd cli: move password getting to a separate function
Also do not ignore errors from `terminal.ReadPassword`.
2020-02-21 10:45:58 +03:00
Evgenii Stratonikov
02954285c1 cli: declare wallet path flag once 2020-02-20 15:52:07 +03:00
Evgenii Stratonikov
0a894db7f8 storage: add Exists flag to KeyValue in batch
Set Exists flag if an item with the specified key was already
present in storage before persisting.
2020-02-12 12:16:31 +03:00
Evgenii Stratonikov
b1d9e1132d cli: dump storage changes into JSON files 2020-02-12 12:16:31 +03:00
Roman Khimov
ea3b76ded1 network: make NewServer return an error, fix #612
It can return nil in two cases, so we're better return an error and handle
it.
2020-01-22 11:17:51 +03:00
Evgenii Stratonikov
63c56cca5c core: refactor out Block, BlockBase and Header structs
See #597.
2020-01-16 10:16:24 +03:00
Roman Khimov
a52e016c22 cli/server: disable sampling completely
It's not safe, we don't want to lose messages and we don't have that many of
them to try to figure out what is the better value than the default 100.
2020-01-13 17:32:44 +03:00
Roman Khimov
565c1940e3
Merge pull request #587 from nspcc-dev/feature/zap
Closes #284.
2020-01-10 14:50:09 +03:00
Evgenii Stratonikov
289cb1c1d9 rpc: use zap.Logger 2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
aecdf470e7 cli,pkg: use zap.Logger 2020-01-10 11:14:27 +03:00
Roman Khimov
aad0d3792d wallet: implement dump command
Mostly a testing tool for the moment.
2020-01-09 18:40:30 +03:00
Roman Khimov
f15a2401b1 cli/server: close the chain gracefully on restore even on error
Not an issue for dumper, but when restoring we should correctly save
everything already imported even if the subsequent block fails.
2019-12-27 12:38:07 +03:00
Roman Khimov
1f4b7b366e cli/server: skip genesis block on restore if it matches ours
Enables more convenient imports without skipping over the block 0.
2019-12-27 12:25:39 +03:00
Roman Khimov
ae003a1578 cli/server: fix db restorer math wrt skip
Given `-s 1` with a dump of 6001 blocks it skipped the first one and then
tried to import the next 6001 which failed with EOF because there are only
6000 blocks left.
2019-12-27 12:15:47 +03:00
Roman Khimov
b706130175 cli/server: redo dumper to dump blocks from 0
NGD dumps are all zero-based and even though I don't like it (genesys block
should not be imported, it's the root of chain trust), we have to conform to
this convention for interoperability with C# nodes (otherwise they're not able
to import our dumps).

This also renames `skip` dumper parameter to `start` which is more logical
now, the default is to start the dump from block number zero.
2019-12-27 12:11:57 +03:00
Roman Khimov
7aa7490fb2 cli: fix wrong db dump format
It was broken by 03ff2976ed that changed fixed
32-bit length encoding to VarBytes.
2019-12-26 20:03:06 +03:00
Roman Khimov
89b6cbf795 address: make Prefix overridable
As it should be, it's specified in the configuration file (and it should be
treated as byte in the config)
2019-12-25 15:42:18 +03:00
Vsevolod Brekelov
9541029303 cli: add metrics to dump and restore calls 2019-12-17 14:13:07 +03:00
Vsevolod Brekelov
0085831ec5 network: add Pprof metrics
Since we have some perf issues from time to time it is good to have pprof debugger. Disabled by default.
2019-12-17 14:13:07 +03:00
Roman Khimov
54d888ba70 io: add type-specific read/write methods
This seriously improves the serialization/deserialization performance for
several reasons:
 * no time spent in `binary` reflection
 * no memory allocations being made on every read/write
 * uses fast ReadBytes everywhere it's appropriate

It also makes Fixed8 Serializable just for convenience.
2019-12-12 20:19:50 +03:00
Evgenii Stratonikov
7179e4ba9f util: add LE suffix to Uint256 methods 2019-12-06 12:16:55 +03:00
Evgenii Stratonikov
57efad912c util: add LE suffix to Uint160 methods 2019-12-06 12:16:55 +03:00
Roman Khimov
c8aa061421 cli/wallet: use more secure way to read passwords
They were printed in plaintext, believe it or not. Also, `ssh/terminal` does
some proper magic to really read something from the terminal.
2019-12-03 20:04:52 +03:00
Roman Khimov
852e6a335b compiler: move it up from vm
It really deserves it, I think. Especially given that it doesn't have any
direct usage of `vm` package now.
2019-12-03 18:23:46 +03:00
Roman Khimov
f48228ef7d
Merge pull request #467 from nspcc-dev/errcheck_297
This patchset closes #297 and #457.
2019-12-03 15:06:11 +03:00
Vsevolod Brekelov
f5e2401984 vm: removed logging to fix #457 2019-12-03 13:49:49 +03:00
Vsevolod Brekelov
03ff2976ed io: refactoring for using WriteVarBytes instead of WriteLE
goal is to be consistent with C# implementation.
For writing []byte WriteBytes used and for byte - WriteVarByte.
2019-12-03 13:49:33 +03:00
Roman Khimov
53e7807d2d smartcontract: implement non-test invokers
Do something real, yeah!
2019-11-29 19:00:24 +03:00
Roman Khimov
82c658613e cli/smartcontract: allow float gas specification
It can be useful for non-deployment transactions.
2019-11-29 18:28:03 +03:00
Roman Khimov
fd93986503 cli/smartcontract: move common endpoint parameter definition
Put more emphasys on that it should be trusted and use localhost example
(because you usually do trust it).
2019-11-29 18:16:46 +03:00
Roman Khimov
d8ef9ba0ec cli/smartcontract: make smartContractTmpl a constant
As it can be a constant and should be a constant.
2019-11-29 18:11:49 +03:00
Roman Khimov
8a5ac12df8 rpc: make generic SignAndPushInvocationTx out of DeployContract
SignAndPushInvocationTx() is gonna be used for more than just deploying
contracts.
2019-11-29 17:59:07 +03:00
Roman Khimov
b0a22cf1e7 cli/smartcontract: add testinvoke cli command
That uses new 'invoke' RPC method.
2019-11-28 19:40:13 +03:00
Roman Khimov
e63b25d5ad smartcontract: add user-facing testinvokefunction command
With a very special syntax.
2019-11-27 15:12:15 +03:00
Roman Khimov
d7d7215392 cli: rename testinvoke to testinvokescript
To not confuse it with future testinvokefunction.
2019-11-27 13:00:11 +03:00
Roman Khimov
aae3e217a8 rpc/cli: implement contract deployment, fix #474
It's used like this:
./bin/neo-go contract deploy -i 1-print.avm -c neo-go.yml -e http://localhost:20331 -w KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr -g 100
2019-11-20 16:12:40 +03:00
Roman Khimov
3adc9150d3 cli: rework smart contract configs
Use plain yaml structure.
2019-11-20 16:12:40 +03:00
Vsevolod Brekelov
7b6756cb7e cli: compatible with NGD reading/writing blockchain dump 2019-11-11 13:15:34 +03:00
Roman Khimov
4736dad8f0 cli: fix skip usage in DB dump/restore
It was failing to process any blocks at all when (skip >= count) and in other
cases it processed wrong number of blocks.
2019-11-08 17:00:02 +03:00
Roman Khimov
b05754deac core: add Close() to blockchainer, implement it to properly close chain
Before it the deferred function in Run() was actually never able to properly
close the Store, so we weren't synching the latest state to the disk.
2019-11-08 12:19:54 +03:00