Anna Shaleva
5a984fdf88
config: move config.go out of config/
...
closes #423
2020-03-31 17:55:59 +03:00
Roman Khimov
79b930f6de
Merge pull request #790 from nspcc-dev/fix/deploy
...
cli: fix type in flags.Fixed8FromContext
2020-03-24 17:37:08 +03:00
Evgenii Stratonikov
7310666479
cli: fix type in flags.Fixed8FromContext
2020-03-24 17:17:28 +03:00
Anna Shaleva
2001a40312
util: JSONify uint160 using LE instead of BE
...
closes #769
2020-03-23 17:38:58 +03:00
Roman Khimov
a5e862c351
rpc/client: add TransferNEP5 method to easily transfer tokens
...
We have TransferAsset for regular tokens, so it'd be nice to have TransferNEP5
for NEP5 ones. Relates to #599 .
2020-03-16 17:52:32 +03:00
Evgenii Stratonikov
325dc7d0e4
cli: implement wallet nep5 remove
...
Remove unused tokens from the wallet.
2020-03-16 15:12:50 +03:00
Evgenii Stratonikov
cc5ec8e6d6
cli: support contract import in wallets
...
Sometimes we need to use custom verification script, e.g.
for contracts where funds needs to become accessible only
after a certain amount of time.
2020-03-16 15:12:50 +03:00
Evgenii Stratonikov
ffc0729adb
cli: implement wallet remove-account
...
Make it possible to remove unneeded accounts from wallet.
2020-03-16 15:12:50 +03:00
Evgenii Stratonikov
2d82eb89f8
cli: rename wallet
commands
...
Creating accounts is done frequently so it makes
sense to have lesser name for this command.
`create` -> `init`
`create-account` -> `create`
2020-03-16 15:12:50 +03:00
Evgenii Stratonikov
cdf025bf89
transaction: implement AddVerificationHash() method
2020-03-16 14:11:19 +03:00
Evgenii Stratonikov
ca476cbf8a
cli: implement Fixed8Flag
...
Parsing gas from float value is not always a right idea as
a transform from float is not 1-to-1.
This commit implements Fixed8Flag which parses Fixed8 value from string.
2020-03-16 14:11:19 +03:00
Evgenii Stratonikov
c25bdd8253
cli: make dump more structured
2020-03-16 12:49:08 +03:00
Evgenii Stratonikov
ae4dc12273
cli: append blocks to existing dumps
2020-03-16 12:49:08 +03:00
Evgenii Stratonikov
c880435c92
cli: persist restored blocks on exit
...
Add grace context to execute defer's on exit.
2020-03-16 12:48:51 +03:00
Roman Khimov
25da5a30d8
cli: change deploy and invoke commands to use wallet
...
Passing WIF directly in the command line is not something we should be doing.
Also split netfee and sysfee in the RPC as they're different (and add a script
attribute for free transactions).
2020-03-12 16:19:12 +03:00
Roman Khimov
bbd802681e
cli: make gas parameter to deployment add gas to the base price
...
That's how it was intended to behave originally. One thing questionable here
is contract price (policy thing, basically) being moved to smartcontract
package, but it's probably fine for NEO 2.0 (as it won't change) and we'll
make something better for NEO 3.0.
2020-03-11 20:34:36 +03:00
Evgenii Stratonikov
c2924795ad
cli: fix a bug in wallet claim
...
getclaimable RPC expects address as a 1-st argument.
2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
97131683d8
cli: display info about imported NEP5 token
2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
053b779be7
cli: implement NEP5 transfer
2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
bcc03e2068
cli: implement NEP5 balance querying
2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
519b27fe0e
cli: implement NEP5 token import
...
To work with NEP5 tokens, one need to save some info
e.g. token Name. This way we will not make additional
RPC just to get Decimals.
2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
8d73276393
cli: do not allow default value for an empty address
...
Right now a bizarre error message can occur if an address flag was not
set: `wallet contains no account for 'AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM'`.
This bug is 10x worse if it occures in `transfer` --from flag.
2020-03-10 09:54:23 +03:00
Evgenii Stratonikov
9be4312d8d
cli: implement AddressFlag
...
This makes code less verbose and performs all parsing
before invoking main function.
2020-03-06 13:50:34 +03:00
Evgenii Stratonikov
a9783d05f5
cli: implement wallet multisig sign
command
...
Implement ability to sign transactions with multisig address.
This should be done in several steps:
1. Create TX with `wallet transfer --out <file>`
2. Sign TX with `wallet multisign sign --in <file> --out <file2>`.
3. Repeat 2 for every party.
Input file contains transaction with possibly incomplete
set of the signatures. Output file will contain the same tx
with updated signature set.
When --rpc flag is provided, result transaction is sent
via `sendrawtransaction`.
2020-03-05 09:45:34 +03:00
Evgenii Stratonikov
0d4ad9f76c
cli: add --out flag to the wallet transfer
command
...
When transferring assets from multisig accounts,
it is useful to export tx into a file, so that
other participants can sign it too.
2020-03-05 09:45:12 +03:00
Evgenii Stratonikov
7eaeb18f18
transaction: marshal ContractTX even if Data is nil
...
It contains no information so it doesn't matter anyway.
2020-03-04 20:01:26 +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
Evgenii Stratonikov
05a3625b7d
wallet: implement (*Account).SignTx
...
It is used in both CLI and RPC.
2020-03-02 18:03:56 +03:00
Evgenii Stratonikov
ed190dcfd3
cli: add command for asset transfer
...
It uses getunspents RPC for getting UTXO and
forming transaction.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
907d599edb
cli: add command for GAS claiming
...
GAS can be claimed via `wallet claim` command.
This will claim first get all claimable outputs via
`getclaimable` RPC and then form a transaction signed
byte the private key from the wallet.
2020-03-02 18:01:49 +03:00
Anna Shaleva
648e0bb242
rpc/smartcontract: merge contract parameter types
...
Merged two types:
- smartcontract.ParamType
- rpc.StackParamType
into single one:
- smartcontract.ParamType
as they duplicated the functionality.
NOTE: type smartcontract.MapType was added (as in C# implementation).
From now, list of supported smartcontract parameter types:
UnknownType
SignatureType
BoolType
IntegerType
Hash160Type
Hash256Type
ByteArrayType
PublicKeyType
StringType
ArrayType
MapType
InteropInterfaceType
VoidType
2020-03-02 17:25:21 +03:00
Roman Khimov
3fa9de764b
rpc/client: only return the Result from calls, handle Error internally
...
Adjust structures accordingly and throw away most of them, they're useless.
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
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
Vsevolod Brekelov
d799c98cfe
io: move common function and add unit tests for it
2019-11-06 17:12:33 +03:00
Vsevolod Brekelov
11ce73af28
server: add log-path and address configuration
...
- LogPath can be configured through config
- node,rpc and monitoring address can be configured thought command line
or config
2019-11-06 15:58:54 +03:00
Roman Khimov
b46dd295bc
rpc: add CORS workaround for RPC
...
This one enables our RPC to be called from the browser if there is a
need. It's insecure and not standards-compliant, thus this behaviour is
configurable is not enabled by default. It makes our node with this workaround
enabled compatible with neo-mon monitoring.
Originally debugged by @anatoly-bogatyrev in #464 .
2019-11-01 13:39:47 +03:00
Roman Khimov
2f6e678a19
Merge pull request #463 from nspcc-dev/smartcontract-fixes
...
Smartcontract RPC fixes
2019-10-29 20:54:46 +03:00
Vsevolod Brekelov
d374175170
monitoring: add prometheus monitoring
...
add init metrics service which uses prometheus;
add configuration for metrics service;
add monitoring metrics for blockchain,rpc,server;
2019-10-29 20:51:17 +03:00
Roman Khimov
2b3fb14a4a
smartcontract: allow RPC endpoint to be specified, fix #363
...
We already have support for running scripts inside VM CLI, so here we can just
make RPC endpoint configurable and be done with it. It also allows to use
local RPC endpoint if there is a need to.
2019-10-29 16:32:49 +03:00
Roman Khimov
579aa31ddd
compiler: drop useless options parameter to Compile()
...
It's not used in any way there.
2019-10-29 13:02:54 +03:00
Roman Khimov
e319c6c638
cli: move avm inspect from vm to contract command
...
Make inspect work with avms by default and with go files if told so. In the
end this makes our CLI interface more consistent and usable. Drop useless
CompileAndInspect() compiler method along the way.
2019-10-29 12:56:44 +03:00
Roman Khimov
3cbb699eb7
Merge pull request #426 from nspcc-dev/logger_247
...
Change fmt.Println to log, close #247 .
2019-10-22 14:41:30 +03:00
Vsevolod Brekelov
e2bfff8666
vm: removed mute mode and pushed logging to upper lvl
...
VM should be responsible for code execution and in case anyone interested in additional logging or errors they could handle them like we do it iin cli.
2019-10-22 13:44:14 +03:00
Roman Khimov
f1750d117b
Merge pull request #440 from nspcc-dev/db-dump-restore
...
DB dump and restore, fixes #436 .
2019-10-21 15:42:05 +03:00
Roman Khimov
c885a69edb
cli: add db dump/restore commands
...
Dump given number of blocks (from the given offset) to file and restore them
from it. Fixes #436 .
2019-10-21 14:18:09 +03:00
Roman Khimov
dafd385f57
cli: extend NewCommand() to NewCommands()
...
So that each module could now return an array of commands. It's gonna be used
in the future to extend them.
2019-10-19 23:58:45 +03:00
Vsevolod Brekelov
59e3bd2fa9
codestyle: fix error string should not be capitalized
2019-10-18 18:34:58 +03:00
Roman Khimov
dca332f333
vm: use new Context.Next() to properly dump programs
...
Fix #295 , deduplicate code and add `inspect` parameter to the vm command to
dump AVMs (`contract inspect` works with Go code).
2019-10-04 16:13:39 +03:00
Roman Khimov
c68a254eba
Merge pull request #404 from nspcc-dev/move-user-docs
...
Move user docs, fix #339 .
2019-09-18 12:50:06 +03:00
Roman Khimov
acb25fb880
cli: move README to docs, refs. #339
2019-09-17 19:07:25 +03:00