Evgeniy Stratonikov
868198a36e
cli/smartcontract: add manifest add-group
command
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-06 12:05:32 +03:00
Evgeniy Stratonikov
6fe2ace43b
cli/smartcontract: refactor contract deploy a bit
...
Provide cosigners explicitly during deploy and don't read wallet twice.
This is needed because manifest validation requires valid sender address.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-06 12:05:32 +03:00
Evgeniy Stratonikov
f83395e897
cli/test: move test wallet path to constant
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-06 12:05:32 +03:00
Evgeniy Stratonikov
a429aa3e68
wallet: truncate file when writing
...
If wallet size decreases, we need to remove trailing garbage if it
exists. This can happen when removing account or reading pretty-printed
wallet. It doesn't affect our CLI (we decode only file prefix), but
it is nice to always have a valid JSON file.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-29 17:11:49 +03:00
Roman Khimov
59b4377f90
context: support Neo.Network.P2P.Payloads.Transaction type
...
C# now uses this one, so use it by default, but also accept old one.
2021-07-23 11:33:51 +03:00
Roman Khimov
8b0dfe135f
cli/query: add height command
2021-07-23 10:22:58 +03:00
Roman Khimov
a8a6c8c13d
query: display zeroes for unknown addresses
...
This:
Voted: null
Amount : 0
Block: 0
is better than this:
failed to convert account state from stackitem: invalid stackitem length
2021-07-22 21:13:44 +03:00
Roman Khimov
fde3cce93d
cli/query: output key in voter data
...
People vote for keys, not addresses.
2021-07-22 21:13:44 +03:00
Roman Khimov
24ee8fab5c
cli: move wallet candidate getstate
into query voter
...
This command has nothing to do with wallets.
2021-07-22 21:13:44 +03:00
Roman Khimov
753e61bcff
cli/query: add 'candidates' and 'committee', fix #2067
2021-07-22 21:13:44 +03:00
Roman Khimov
b7bfaa6d09
cli/query: print addresses instead of script hashes
...
They're more familiar to users.
2021-07-21 18:49:58 +03:00
Roman Khimov
7fc3689b48
cli/query: provide better help messages
2021-07-21 18:26:58 +03:00
Roman Khimov
0415e6dc10
cli/query: use application log for vm state
...
C# node doesn't return VMState data, so it leads to "false" being printed for
successful transactions.
2021-07-21 18:25:10 +03:00
Roman Khimov
5fbb60a9ed
cli/wallet: request candidate registration price
...
Hardcoding 1000 is wrong. Inspired by neo-project/neo-node#788 .
2021-07-21 12:26:35 +03:00
Evgeniy Stratonikov
7d2d9e96ef
cli: add query tx
command, fix #2069
...
Implement a way to check if tx has been persisted on blockchain and
to get general info about transaction. Much more convenient than
handwritten curl queries.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-20 18:03:50 +03:00
Roman Khimov
0583f252ab
*: create real temporary dirs and files in tests
...
Improve reliability.
2021-07-20 12:51:11 +03:00
Roman Khimov
19717dd9a8
slice: introduce common Copy helper
...
It's a bit more convenient to use.
2021-07-19 22:57:55 +03:00
Roman Khimov
588f3fbbd3
state: drop State from NEOBalance and NEP17Balance
...
We're in the `state` package already.
2021-07-19 22:01:07 +03:00
Evgeniy Stratonikov
de15d42861
cli: remove --skip
parameter from restore
...
It isn't really a parameter and it's value can be deduced automatically.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-16 13:32:08 +03:00
Evgeniy Stratonikov
df5ee4abdc
cli: allow to use incremental dumps in db restore
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-16 13:32:08 +03:00
Evgeniy Stratonikov
3a4e0caeb8
core/block: add Nonce
field to header
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 15:58:49 +03:00
Roman Khimov
41e0218555
cli/wallet: add sysgas to transfer functions
...
It might also be useful there.
2021-07-02 12:34:18 +03:00
Roman Khimov
2a57e48897
cli/sc: add sysgas option to add some gas
...
Sometimes on-chain invocations need a bit more GAS than expected after test
invocations, so let the user compensate for that. 2.x has similar option since
483fefbb62
.
2021-07-02 11:57:47 +03:00
Roman Khimov
3646270af0
Merge pull request #2026 from nspcc-dev/fix-state
...
Fix manifest `Extra` field marshaling
2021-06-29 15:11:25 +03:00
Evgeniy Stratonikov
8d67a03aec
stackitem: fix Buffer
deserialization
...
Fix incorrect application log for transaction in N3 testnet
8eb4076f1f1c07e693eda7e810779488a2d2b50aba9b727fd237cbc3adbec9e9
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-29 11:39:55 +03:00
Evgeniy Stratonikov
4249674ddc
compiler: check for contract permissions
...
On many occassions we can determine at compile-time if contract config lacks
some properties it needs. This includes all native contract invocations
through stdlib, as both hashes and methods are known at compile-time
there.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-28 11:49:29 +03:00
Anna Shaleva
67fe2a82bc
cli: remove Can't find matching token in the wallet
warning
2021-06-17 11:29:16 +03:00
Anna Shaleva
91f4513357
cli: fix +
marshalling in TestNEP11_OwnerOf_BalanceOf_Transfer
...
Problem:
```
executor_test.go:151:
Error Trace: executor_test.go:151
executor_test.go:147
nep11_test.go:232
Error: Expect "{"name":"HASHY 3HNCEX8D9J0p\u002BLxmr3uPhOhSW90="}" to match "{"name":"HASHY 3HNCEX8D9J0p+Lxmr3uPhOhSW90="}"
Test: TestNEP11_OwnerOf_BalanceOf_Transfer
```
Solution:
Same as preesnted in #2006 .
2021-06-11 15:22:32 +03:00
Anna Shaleva
472a44a464
*: regenerate test wallets with resources-friendly scrypt parameters
2021-06-11 15:22:32 +03:00
Anna Shaleva
50296975e2
crypto: allow to provide non-default scrypt parameters
2021-06-11 15:22:28 +03:00
Anna Shaleva
6ca9c87b9c
Revert "cli: band-aid failing TestNEP11_OwnerOf_BalanceOf_Transfer"
...
This reverts commit f01d94ae53
.
Extra GAS is not needed here after HASHY fix.
2021-06-11 13:58:57 +03:00
Anna Shaleva
39e096da64
examples: use base64 to encode HASHY token ID
...
Base58 does not preserve one-to-one byte correspondence with the
original data, so different combinations of the same number of bytes
might have different encoded string length. We use GAS transfer to mint
HASHY token, where the token hash is Base58Encode(Ripemd160(data + txHash)).
The problem is that `invokescript` RPC call is used to define transfer tx
sysfee, thus, txHash during testinvoke differs from the actual one, that's
why resulting token ID may have different length during testinvoke and
real invoke. As far as we use token ID as a key to store contract
values, the storage price may also differ. The result is failing
TestNEP11_OwnerOf_BalanceOf_Transfer test due to `gas limit exceeded`
error:
```
logger.go:130: 2021-06-10T21:09:08.984+0300 WARN contract invocation failed {"tx": "45a0220b19725eaa0a4d01fa7a6cdaac8498592e8f3b43bdde27aae7d9ecf635", "block": 5, "error": "error encountered at instruction 36 (SYSCALL): error during call from native: error encountered at instruction 22 (SYSCALL): failed to invoke syscall 1736177434: gas limit exceeded"}
executor_test.go:219:
Error Trace: executor_test.go:219
nep11_test.go:132
nep11_test.go:235
Error: Not equal:
expected: 0x2
actual : 0x4
Test: TestNEP11_OwnerOf_BalanceOf_Transfer
```
Fixed by using base64 instead of base58 (base64 preserves the resulting
encoded string length for the same input length).
2021-06-11 13:57:59 +03:00
Roman Khimov
f01d94ae53
cli: band-aid failing TestNEP11_OwnerOf_BalanceOf_Transfer
2021-06-10 22:46:11 +03:00
Evgeniy Stratonikov
4467e2cbfd
cli,compiler: allow to specify manifest permissions
2021-06-04 11:16:22 +03:00
Evgeniy Stratonikov
f33daf759a
compiler/test: fix typo in verify.yml
2021-06-03 10:32:56 +03:00
Roman Khimov
0677838f3e
Merge pull request #1986 from nspcc-dev/cli/getaccountstate
...
cli: add `wallet candidate getstate`
2021-05-31 11:39:34 +03:00
Anna Shaleva
c2b5459646
cli: add wallet candidate getstate
2021-05-31 11:18:59 +03:00
Roman Khimov
1a16068b0a
Merge pull request #1973 from nspcc-dev/custom-contracts
...
cli: allow to specify CustomContracts/Groups signer
2021-05-28 17:32:58 +03:00
Evgeniy Stratonikov
e3e0e2a8a8
cli: allow to specify CustomContracts/Groups signer
...
The syntax is `CalledByEntry,CustomContracts:hash1:hash2`.
2021-05-28 15:46:33 +03:00
Anna Shaleva
9340a70aa8
cli: add description to vote
command on how to unvote
2021-05-28 15:15:37 +03:00
Evgeniy Stratonikov
b693d54282
compiler: count local variables on the go
...
Create local variables as they are needed and remove `INITSLOT`
if there were no locals. This helps to eliminate a whole class
of bugs when calculated and real amount mismatched.
2021-05-19 11:50:07 +03:00
Anna Shaleva
71948d903b
cli: use non-native NNS instead of native NNS in NEP-related tests
2021-05-17 22:09:30 +03:00
Evgeniy Stratonikov
ea49c6b637
wallet: rename isdefault
to isDefault
...
Follow neo-project/neo#2451 .
2021-05-14 10:31:31 +03:00
Roman Khimov
9d2712573f
*: enable godot linter and fix all its warnings
...
It's important for NeoGo to have clean documentation. No functional changes.
2021-05-12 23:17:03 +03:00
Roman Khimov
c4e084b0d8
*: fix whitespace errors
...
leading/trailing newlines
2021-05-12 22:51:41 +03:00
Roman Khimov
6fea16451a
cli/input: ignore term.Restore errors, fix errcheck warnings
...
I'm not sure we can do anything useful here.
2021-05-12 21:53:41 +03:00
Roman Khimov
e9cefc4bfc
*: fix all errcheck warnings in testing code
2021-05-12 21:45:12 +03:00
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