Commit graph

461 commits

Author SHA1 Message Date
Roman Khimov
0500c8f9d7 cli/wallet: fix error handling
cli/wallet/wallet.go:527:19: Error return value of `cli.NewExitError` is not checked (errcheck)
                cli.NewExitError("valid account address must be provided", 1)
2021-05-12 20:19:24 +03:00
Roman Khimov
ec50bb4041 cli/wallet: fix error handling
ineffectual assignment to err (ineffassign)

`err` is shadowed at `tx, err = c.CreateNEP11TransferTx()` line.
2021-05-12 19:34:12 +03:00
Roman Khimov
ad8ffee0ab *: remove redundant return statements
Found by gosimple via golangci-lint.
2021-05-12 18:24:16 +03:00
Anna Shaleva
6d59689d9c core: rename Neo.Crypto.CheckMultisig interop 2021-05-11 18:38:14 +03:00
Anna Shaleva
366e79b9b8 core: rename Neo.Crypto.CheckSig interop 2021-05-11 18:37:55 +03:00
Evgeniy Stratonikov
721748acfd examples: change NFT contract to use storage iterators 2021-05-11 12:13:30 +03:00
Roman Khimov
ba5273999f
Merge pull request #1950 from nspcc-dev/nep11/data
*: add `data` to NEP11 Transfer
2021-05-06 10:39:56 +03:00
Anna Shaleva
d0c64347ab *: add data to NEP11 Transfer 2021-05-05 19:44:29 +03:00
Roman Khimov
4fb421738b
Merge pull request #1945 from nspcc-dev/network/tls
cli: reload RPC-server TLS config on SIGHUP
2021-05-05 15:24:30 +03:00
Anna Shaleva
a04e46f719 cli: reload RPC-server TLS config on SIGHUP 2021-05-04 10:38:02 +03:00
Anna Shaleva
f61ab6bd11 cli: add nep11 properties command 2021-04-30 16:23:06 +03:00
Anna Shaleva
ba7ebc2390 cli: add nep11 [tokens | tokensOf | ownerOf] commands 2021-04-30 16:23:06 +03:00
Anna Shaleva
4e55b1a9ed cli: add nep11 ownerOf command 2021-04-30 16:23:06 +03:00
Anna Shaleva
946e940ce0 cli: adjust nep17 transfer command usage text
Token name or hash can be used.
2021-04-30 16:23:06 +03:00
Anna Shaleva
7ea15f02c6 cli: add nep11 transfer command 2021-04-30 16:23:06 +03:00
Anna Shaleva
8cfb72d5e9 cli: allow to omit data parameter for NEP17 transfers
There's a case when cosigners are specified and data is not.
2021-04-30 16:23:06 +03:00
Anna Shaleva
3eefda7f1a cli: add nep11 balance command 2021-04-30 16:23:06 +03:00
Anna Shaleva
3742e38399 cli: add nep11 remove command 2021-04-30 16:23:06 +03:00
Anna Shaleva
5fdb8e2a01 cli: add nep11 info command 2021-04-30 16:23:06 +03:00
Anna Shaleva
ba8b0fd7b0 cli: reuse existing token flag for nep17-related commands 2021-04-30 16:23:06 +03:00
Anna Shaleva
a61a3d5ceb cli: add nep11 import command 2021-04-30 16:23:06 +03:00
Anna Shaleva
4b8d814ee8 cli: move common NEP17 flags to package variables
These flags will be reused for NEP11 commands.
2021-04-30 16:23:06 +03:00
Anna Shaleva
c3264c065d rpc: check token standard in nepTokenInfo 2021-04-30 16:23:04 +03:00
Anna Shaleva
40ae78cb88 wallet: add Standard field to Token
We need to distinguish NEP11 and NEP17 tokens preesnted in the wallet.
2021-04-30 15:58:27 +03:00
Anna Shaleva
e48eb10522 cli: unify 'contract deploy' and 'contract invoke*' commands
These commands share a lot of code.
2021-04-23 12:40:13 +03:00
Anna Shaleva
d98abd75d2 cli: refactor handleVote method
Reuse existing RPC client method for transaction sending.
2021-04-23 10:45:15 +03:00
Anna Shaleva
e43ab642d1 cli: refactor handleCandidate method
Reuse existing RPC client method for transaction sending.
2021-04-23 10:45:15 +03:00
Anna Shaleva
14c2d7d25a cli: allow to provide cosigners for 'wallet nep17 multitransfer' 2021-04-23 10:45:15 +03:00
Anna Shaleva
f848783d5d cli: allow to provide cosigners for 'wallet nep17 transfer' 2021-04-23 10:45:15 +03:00
Anna Shaleva
49c35dec20 rpc: allow to provide cosigners for NEP17-transfer-related commands 2021-04-23 10:29:40 +03:00
Anna Shaleva
16fa191ccb cli: move combining signers and accounts to a separate package
This code will be reused in other packages.
2021-04-23 10:27:43 +03:00
Anna Shaleva
94316fa36d cli: move GetDataFromContext and ParseParams to a helpers package 2021-04-23 10:26:09 +03:00
Anna Shaleva
d12ae0998f cli: return numWordsRead from GetDataFromContext
It's needed when we have extra args after the 'data' argument. Then
these args are started right from numWordsRead offset.
2021-04-23 10:23:06 +03:00
Anna Shaleva
2ab420ed18 cli: move cosigners parsing to a separate function
We have a lot of common code which is shared between `smartcontract` and
`wallet` cli packages. It's convinient to keep it in a separate helper
package in order to avoid functional cli packages dependencies.
2021-04-23 10:11:01 +03:00
Roman Khimov
8407ae057c
Merge pull request #1912 from nspcc-dev/cli/invoke_with_contract_signer
rpc: properly construct cosigners' witnesses in SignAndPushInvocationTx
2021-04-21 19:13:16 +03:00
Anna Shaleva
48ae1cc486 rpc: refactor SignAndPushInvocationTx
We have a set of accounts provided via `cosigners` argument, so we
should fill all transaction witnesses in (not only sender's witness).
If we can't properly construct witnesses for all of the signers then an
error should be returned.
2021-04-21 18:52:32 +03:00
Anna Shaleva
70fc78b768 cli: update usage text for 'wallet sign' command
RPC endpoint can be provided.
2021-04-21 15:51:19 +03:00
Anna Shaleva
a348347fe8 cli: refactor readAccountInfo method
It doesn't require binwriter.
2021-04-21 15:51:19 +03:00
Anna Shaleva
2daae43eaf cli: add optional 'name' argument to 'wallet import-deployed' command
If the provided WIF is encrypted then we have no way to set the
account name. Fixed.
2021-04-21 15:51:19 +03:00
Anna Shaleva
0ccced2274 cli: add usage description to 'wallet import' command 2021-04-21 15:51:19 +03:00
Anna Shaleva
08e88ce5b2 cli: handle 'name' named argument in 'wallet import-multisig'
If the provided WIF is encrypted, then we won't get account name from
readAccountInfo.
2021-04-21 15:51:19 +03:00
Anna Shaleva
6af2f3fdec cli: use AddressFlag for 'wallet remove' command 2021-04-21 15:51:13 +03:00
Anna Shaleva
42bfd413e3 cli: fix UsageText for 'wallet import-deployed' command 2021-04-19 16:23:53 +03:00
Roman Khimov
881ed3065e
Merge pull request #1909 from nspcc-dev/cli/default-cosigner-scope
cli, rpc: use CalledByEntry as a default cosigner's scope
2021-04-19 14:43:31 +03:00
Anna Shaleva
2a144d0420 cli: use CalledByEntry as default cosigner's scope 2021-04-19 11:52:28 +03:00
Anna Shaleva
4e66293612 cli: allow to provide 'data' for 'contract deploy' command 2021-04-19 10:52:42 +03:00
Anna Shaleva
1a8ea8e2d6 cli: specify usage text for 'contract deploy' command 2021-04-19 10:50:15 +03:00
Roman Khimov
8f14c61c34
Merge pull request #1906 from nspcc-dev/cli/transfer_param
cli: allow to pass 'data' for nep17 transfer command
2021-04-19 10:43:42 +03:00
Anna Shaleva
db868f033e cli: allow to provide data for nep17 transfer commands 2021-04-19 10:20:29 +03:00
Anna Shaleva
ced90e0510 cli: use AddressFlag for nep17 import 2021-04-16 15:18:33 +03:00
Anna Shaleva
92c6708fa0 cli: use AddressFlag for import-deployed 2021-04-16 15:15:25 +03:00
Anna Shaleva
1d3a297a6b rpc: add Data field to NEP17 TransferTarget
It's a part of transfer, thus it should be passed along with the other
transfer parameters.
2021-04-16 13:54:23 +03:00
Anna Shaleva
87f950a719 cli: format error message 2021-04-16 12:41:02 +03:00
Anna Shaleva
4edc62148b cli: use AddressFlag for dump-keys 2021-04-16 12:41:42 +03:00
Anna Shaleva
df24c51262 cli: use AddressFlag for calc-hash 2021-04-16 12:41:28 +03:00
Anna Shaleva
90b054afd0 cli: check address flag is set for validator-related commands 2021-04-16 12:41:02 +03:00
Anna Shaleva
ff2b051646 cli: use AddressFlag for nep17-related commands 2021-04-16 12:41:02 +03:00
Anna Shaleva
2dcc729c47 cli: use AddressFlag for wallet sign 2021-04-16 12:40:01 +03:00
Roman Khimov
26eff7110c cli/smartcontract: allow deploying contracts from multisig accounts
By providing `--out` flag.
2021-04-07 11:50:24 +03:00
Roman Khimov
d314f82db3 transaction: drop Network from Transaction
We only need it when signing/verifying.
2021-03-26 13:45:18 +03:00
Anna Shaleva
0948d53244 examples: add documentation
And provide the wallet for examples `my_wallet.json` with the owner
address inside.
2021-03-23 16:46:15 +03:00
Anna Shaleva
0a5072a1da core: allow to compile test contracts with yaml config
And refactored Rubl test contract (it should support NEP-17 and
onNEP17Payment).
2021-03-22 15:32:26 +03:00
Anna Shaleva
e5cdecfa9f core: fix transaction hashes 2021-03-18 17:57:54 +03:00
Roman Khimov
dc980b5847 sc/context: add network magic into the context
See neo-project/neo#2393, we need this to be able to sign multisig
transactions.
2021-03-12 12:59:14 +03:00
Roman Khimov
4462a6a6b7 change block/tx/extensible signing process, fix #1741
Sign [magic, hash], see neo-project/neo#2314.
2021-03-12 11:27:50 +03:00
Anna Shaleva
9015e50847 core: refactor Neo.Crypto.CheckMultisigWithECDsaSecpr1
Rename it to Neo.Crypto.CheckMultisig and remove `message` parameter.
2021-03-10 21:46:05 +03:00
Anna Shaleva
cdaca7be3e core: use Neo.Crypto.CheckSig for standard signature verification 2021-03-10 21:45:58 +03:00
Roman Khimov
19a23a36e4
Merge pull request #1807 from nspcc-dev/feature/walletsign
cli: allow to sign dumped transaction by several non-multisig signers
2021-03-10 14:13:20 +03:00
Roman Khimov
9b0d4e0968
Merge pull request #1792 from nspcc-dev/fix/consensusdata
Remove `ConsensusData` from `Block`
2021-03-10 14:12:38 +03:00
Evgeniy Stratonikov
2f490a3403 block: remove ConsensusData field 2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
09af8b4fcb cli: allow to dump wallet public keys 2021-03-10 12:37:15 +03:00
Evgeniy Stratonikov
1578a99432 cli/wallet: add test for multiple signers 2021-03-09 15:45:02 +03:00
Evgeniy Stratonikov
106c27782e cli/wallet: allow to cosign with a contract
Contracts have empty verification script and their hash is
calculated differently.
2021-03-09 15:45:02 +03:00
Evgeniy Stratonikov
8a4b97171a cli/wallet: fail if signer is missing in tx 2021-03-09 15:45:02 +03:00
Evgeniy Stratonikov
7553c1ac96 cli/wallet: process signers in order 2021-03-09 15:45:02 +03:00
Evgeniy Stratonikov
b9136dbfc0 smartcontract: use hash in GetWitness()
All necessary info must already be in context.
2021-03-09 15:45:02 +03:00
Evgeniy Stratonikov
8ef7dd320c cli: rename multisig sign to wallet sign 2021-03-09 15:45:02 +03:00
Evgeniy Stratonikov
55009153a9 vm/emit: emit Boolean values correctly
We should convert both `true` and `false` values.
2021-03-09 13:34:22 +03:00
Anna Shaleva
6c0faa4ea3 rpc: provide cosigners accounts to CreateTxFromScript
We need to define network fee for each of cosigners, and the only way to
do it is to access the cosigner's script.
2021-03-04 10:37:35 +03:00
Anna Shaleva
b1b9a8cf66 rpc: refactor CreateTxFromScript signature
Make cosigners non-variadic.
2021-03-03 13:42:15 +03:00
Roman Khimov
c9212f29e6
Merge pull request #1744 from nspcc-dev/fix/nativecall
Update `CallNative` to post-preview5
2021-03-02 15:28:00 +03:00
Anna Shaleva
2c81fc8b8e *: upgrade tests to use T.Cleanup() 2021-03-01 17:08:00 +03:00
Evgeniy Stratonikov
f9f1fe03b2 core: refactor native call
1. `System.Contract.CallNative` expects version on stack.
2. Actual method is determined based on current
   instruction pointer.
3. Native hashes don't longer depend on NEF checksum.
2021-02-26 10:59:09 +03:00
Evgeniy Stratonikov
cbda20aca3 core: fix native method call flags
Replace `WriteStates` with `States`.

Follow neo-project/neo#2339.
Close #1775.
Related #1725.
2021-02-25 18:07:33 +03:00
Roman Khimov
c58dc7e453
Merge pull request #1758 from nspcc-dev/cli/0x
cli: support Uint160 hashes with 0x prefix
2021-02-19 16:23:56 +03:00
Anna Shaleva
488e75a246 cli: add filebytes parameter type 2021-02-19 10:52:45 +03:00
Evgeniy Stratonikov
b8024dbfa8 cli: support Uint160 hashes with 0x prefix 2021-02-18 14:38:50 +03:00
Evgeniy Stratonikov
3f7bea4e99 cli/flags: allow to use hashes in address flag 2021-02-18 12:50:20 +03:00
Anna Shaleva
7896ef0640 rpc: allow client to send nep17 transfer with data 2021-02-11 17:11:36 +03:00
Evgeniy Stratonikov
f6176b30f2 cli: support escape codes 2021-02-11 16:06:11 +03:00
Roman Khimov
dc3967ae7b manifest: add manifest validity checks
Refs. #1699.
2021-02-09 22:31:26 +03:00
Roman Khimov
7bef87e2ef cli: use base64 for state dump
See neo-project/neo-modules/#499.
2021-02-07 22:07:30 +03:00
Roman Khimov
a442e1530d native: rename onPayment into onNEP17Payment
Follow neo-project/neo#2287.
2021-02-05 16:09:51 +03:00
Roman Khimov
ac527650eb native: add Ledger contract, fix #1696
But don't change the way we process/store transactions and blocks. Effectively
it's just an interface for smart contracts that replaces old syscalls.

Transaction definition is moved temporarily to runtime package and Block
definition is removed (till we solve #1691 properly).
2021-02-04 13:12:11 +03:00
Evgeniy Stratonikov
c1cc7e6f9d native: add additional parameters to deploy
1. Management contract has 2 overloads of `deploy` method.
2. Normal contracts should have `_deploy` with 2 parameters.
2021-01-29 12:19:08 +03:00
Roman Khimov
9a99054e6b
Merge pull request #1427 from nspcc-dev/oracle/module
network: implement Oracle module
2021-01-28 15:24:36 +03:00
Roman Khimov
02d1411c0e
Merge pull request #1690 from nspcc-dev/usability-improvements
Compiler/CLI usability improvements
2021-01-28 14:44:53 +03:00
Evgenii Stratonikov
43e4d3af88 oracle: integrate module in core and RPC
1. Initialization is performed via `Blockchain` methods.
2. Native Oracle contract updates list of oracle nodes
  and in-fly requests in `PostPersist`.
3. RPC uses Oracle module directly.
2021-01-28 13:00:58 +03:00
Roman Khimov
79e11c93a1 cli: allow to specify cosigners with Neo addresses
Make it a bit more usable.
2021-01-27 22:32:29 +03:00
Roman Khimov
48e3a41133 cli: remove outdated contract deploy comment
It's relevant for Neo 2.0, but not 3.0.
2021-01-27 21:45:44 +03:00