Commit graph

321 commits

Author SHA1 Message Date
Anna Shaleva
7180b2ce06 rpc: use non-native NNS instead of native NNS in testchain 2021-05-17 22:08:15 +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
a44376903a rpc: fix errcheck warnings in websocket code 2021-05-12 21:48:38 +03:00
Roman Khimov
e9cefc4bfc *: fix all errcheck warnings in testing code 2021-05-12 21:45:12 +03:00
Roman Khimov
d15cacc1ba rpc/client: fix broken test code
SA1024: cutset contains duplicate characters (staticcheck)
2021-05-12 19:15:21 +03:00
Roman Khimov
333f778aa6 *: drop empty branches
Fix this warning from staticcheck: SA9003: empty branch
2021-05-12 19:10:31 +03:00
Roman Khimov
cfc067dd24 *: remove dead code
Found by deadcode via golangci-lint.
2021-05-12 18:13:14 +03:00
Anna Shaleva
366e79b9b8 core: rename Neo.Crypto.CheckSig interop 2021-05-11 18:37:55 +03:00
Anna Shaleva
d0c64347ab *: add data to NEP11 Transfer 2021-05-05 19:44:29 +03:00
Evgeniy Stratonikov
bb039ef035 manifest: add features field 2021-05-04 13:10:46 +03:00
Anna Shaleva
e27c894338 rpc: add NEP11 commands which return iterator
These are Tokens (optional), TokensOf and OwnerOf (divisible).
2021-04-30 16:23:06 +03:00
Anna Shaleva
35ba3d97e6 rpc: export createNEP11TransferTx
It'll be used from cli package.
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
bc3a3d103e rpc: fix (*Client)TransferNEP11D
Four args should be specified: from, to, amount and tokenID.
2021-04-30 11:38:11 +03:00
Anna Shaleva
2fb083bd37 rpc: add NEP11TokenInfo method 2021-04-30 11:38:11 +03:00
Roman Khimov
438eb0c43a rpc: rename magic to network in JSON
Follow neo-modules/neo-core changes. We don't rename structure fields though
to stay compatible with current code (and we do have netmode.Magic to justify
that also).
2021-04-28 23:41:31 +03:00
Anna Shaleva
127d0ad2ba rpc: allow to provide cosigners for NEP11-transfer-related commands 2021-04-23 10:45:11 +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
1d6ba389c9 rpc: split SignAndPushInvocationTx in two parts
There are several places where constructed transaction need to be
signed and sent. Thus, we definitely need a separate method for signing
and sending constructed transaction to avoid code duplication.
2021-04-23 10:27:47 +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
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
Roman Khimov
5b4f6d255f
Merge pull request #1857 from nspcc-dev/rpc/nep11
rpc: add NEP11 and NNS interfaces to RPC Client
2021-03-27 18:27:29 +03:00
Anna Shaleva
ffc2ad3cc3 rpc: check RPC client is initialised where appropriate
We don't need magic to create tx anymore, but we need it to sign tx.
2021-03-26 20:51:17 +03:00
Anna Shaleva
626ec8a82b rpc: add resolve and isAvailable NNS API to RPC client 2021-03-26 20:48:07 +03:00
Anna Shaleva
f955589370 rpc: add NEP11 API support to the RPC client 2021-03-26 20:48:01 +03:00
Anna Shaleva
347f7ed576 rpc: move all top*FromStack client functions to a separate file
Some of them are shared between multiple RPC client APIs, so let's keep
them in a separate place for better maintainability.
2021-03-26 20:44:32 +03:00
Anna Shaleva
30e7d9a8b0 rpc: remove duplicated code from CreateNEP17MultiTransferTx 2021-03-26 20:44:32 +03:00
Anna Shaleva
252e03bc34 rpc: add CalculateNetworkFee RPC method 2021-03-26 19:14:46 +03:00
Roman Khimov
c789431402 payload: drop Network from P2PNotaryRequest
It's not needed now.
2021-03-26 13:45:18 +03:00
Roman Khimov
95c279325a block: drop Network from the Header
It's not network-tied any more, network is only needed to
sign/verify. Unfortunately we still have to keep network in consensus data
structures because of dbft library interface.
2021-03-26 13:45:18 +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
10fb86c0b2 rpc: add (*Client).GetDesignatedByRole method 2021-03-23 13:56:39 +03:00
Anna Shaleva
1e649bc9a0 core: move NotaryVerificationPrice to a separate package
It is needed to avoid `native` dependency in RPC client.
2021-03-23 13:56:39 +03:00
Roman Khimov
28da00f057
Merge pull request #1852 from nspcc-dev/tests/fix-rubles-contract
rpc: refactor Rubl test contract
2021-03-22 15:55:51 +03:00
Anna Shaleva
ee76db9ff2 rpc: refactor (*Client).AddNetworkFee errors handling
core.ErrVerificationFailed is not very informative. Also removing it
from RPC client allows to get rid of `core` dependency in the `client`
package, which is needed for the next commit.
2021-03-22 13:28:22 +03:00
Roman Khimov
20144e6137 *: fix some misspellings spotted by GoReportCard 2021-03-22 12:13:08 +03:00
Anna Shaleva
e5cdecfa9f core: fix transaction hashes 2021-03-18 17:57:54 +03:00
Roman Khimov
7990fa1b61 client: add gasperblock getter
It's an important chain parameter.
2021-03-16 23:04:41 +03:00
Roman Khimov
87d4939093 client: add NNS price getter 2021-03-16 22:59:04 +03:00
Roman Khimov
f308a9995d client: add GetOraclePrice for oracle price 2021-03-16 22:55:17 +03:00
Roman Khimov
42674e46ac client: add GetStoragePrice for native policy contract 2021-03-16 22:50: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
Evgeniy Stratonikov
3278d23852 native: rename Price to CPUFee
Method price is now multiplied by `BaseExecFee`.
2021-03-11 10:12:30 +03:00
Anna Shaleva
cdaca7be3e core: use Neo.Crypto.CheckSig for standard signature verification 2021-03-10 21:45:58 +03:00
Evgeniy Stratonikov
f83b376181 block: replace Base with Header 2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
2f490a3403 block: remove ConsensusData field 2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
ffd85dd51d native/policy: remove MaxBlockSize and MaxBlockSystemFee 2021-03-04 16:59:19 +03:00
Evgeniy Stratonikov
7b8533b67c native/policy: move MaxTransactionsPerBlock to config 2021-03-04 16:59:19 +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
Anna Shaleva
d9c85a432b rpc: add new rule to SignAndPushP2PNotaryRequest 2021-02-16 14:12:02 +03:00
Roman Khimov
8cd37c781c client: allow transfer method to read states
Makes no sense disabling it with writes enabled. Fixes #1725.
2021-02-11 18:56:05 +03:00
Anna Shaleva
af510b4e25 rpc: add submitnotaryrequest method to RPC client 2021-02-11 17:11:36 +03:00
Anna Shaleva
9d73802244 rpc: add getMaxNotValidBeforeDelta method to RPC client 2021-02-11 17:11:36 +03:00
Anna Shaleva
7896ef0640 rpc: allow client to send nep17 transfer with data 2021-02-11 17:11:36 +03:00
Evgeniy Stratonikov
4f1bea0bcb rpc/client: implement GetNativeContracts 2021-02-11 12:37:03 +03:00
Evgeniy Stratonikov
e1d2a5b5b7 state: split ContractBase and UpdateCounter
Latter doesn't make sense for native contracts.
2021-02-11 12:24:09 +03:00
Evgeniy Stratonikov
18911caa3a Revert "rpc: marshal GAS in getunclaimedgas as decimal"
This reverts commit df801a8539.
2021-02-09 11:37:25 +03:00
Evgeniy Stratonikov
b0fbd897ad Revert "rpc: marshal fees and GAS as Fixed8 decimal"
This reverts commit a79b12b4d4.
2021-02-09 11:16:52 +03:00
Roman Khimov
1f98289f5d
Merge pull request #1717 from nspcc-dev/rpc-base64
RPC base64 changes
2021-02-08 10:42:26 +03:00
Roman Khimov
e0c7a3b77c rpc: add getblockheadercount call
See neo-project/neo-modules#504.
2021-02-07 23:18:09 +03:00
Roman Khimov
272bb03e3b rpc: use base64 for getstorage in/out
See neo-project/neo#484.
2021-02-07 22:07:30 +03:00
Anna Shaleva
a2715404d0 core: serialise manifest as stackitem 2021-02-05 19:10:15 +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
Evgeniy Stratonikov
719dceff77 nef: merge Compiler and Version fields 2021-01-19 11:19:28 +03:00
Evgeniy Stratonikov
0bbdee2ce1 nef: add Reserved bytes 2021-01-19 11:19:28 +03:00
Evgeniy Stratonikov
52843fc1bf nef: add Tokens field 2021-01-19 11:19:24 +03:00
Evgenii Stratonikov
1c0c331e25 core: update System.Contract.Call syscall
1. Remove `System.Contract.CallEx`.
2. Extend number of parameters.
3. Add return value count to `VM.Context`.
2021-01-14 18:23:36 +03:00
Evgeniy Stratonikov
0b26b46234 state: store NEF instead of script for contract
NEFs for native contracts are set statically, thus
field values are taken from the reference implementation.
2021-01-13 15:34:10 +03:00
Roman Khimov
a8bb040558 *: fix ineffassign goreportcard warnings 2020-12-28 17:31:50 +03:00
Roman Khimov
dee97d8542
Merge pull request #1524 from nspcc-dev/rpc/invoke_verify
rpc: add `invokecontractverify` RPC-method
2020-12-21 10:36:54 +03:00
Evgenii Stratonikov
4946556830 native: allow to modify ExecFeeFactor in the policy contract 2020-12-16 13:55:40 +03:00
Evgenii Stratonikov
1840c1c80d core: redefine opcode prices
Prices are defined in as a coefficients to `BaseExecFee` which
is defined by Policy contract (TBD later).
Native method prices are defined without need to multiply.
2020-12-16 13:55:39 +03:00
Anna Shaleva
da5eb67e85 rpc: implement invokecontractverify RPC method 2020-12-15 15:53:36 +03:00
Roman Khimov
cf8cf93e7a native: change contract names, move them to separate package
Follow neo-project/neo#2138 and make RPC client's GetNativeContractHash
case-sensitive.
2020-12-14 15:24:15 +03:00
Roman Khimov
9a78f1da19 rpc/client: get policy contract hash in Init()
Drop hardcoded value.
2020-12-14 15:23:49 +03:00
Evgenii Stratonikov
df801a8539 rpc: marshal GAS in getunclaimedgas as decimal 2020-12-09 11:19:25 +03:00
Evgenii Stratonikov
e4c3339c91 util: move Fixed8 to encoding/fixedn package 2020-12-09 11:18:18 +03:00
Roman Khimov
1cf1fe5d74 *: introduce stable contract hashes
Follow neo-project/neo#2044.
2020-11-27 21:47:08 +03:00
Roman Khimov
b92ea2a48a manifest/compiler: drop hashes from ABI and debug info
See neo-project/neo-devpack-dotnet#391 and neo-project/neo#2044.
2020-11-26 18:30:49 +03:00
Evgenii Stratonikov
a79b12b4d4 rpc: marshal fees and GAS as Fixed8 decimal 2020-11-26 15:04:30 +03:00
Evgenii Stratonikov
7d91a3a89e pkg: move internal/ package to the root directory
This way we can use it in scripts and cli.
2020-11-24 16:39:56 +03:00
Evgenii Stratonikov
31eca342eb *: replace all NEP5 occurences to NEP17 2020-11-24 13:08:24 +03:00
Evgenii Stratonikov
b97dfae8d8 native: replace NEP-5 with NEP-17 2020-11-24 13:08:23 +03:00
Evgenii Stratonikov
c849176be7 manifest: include contract Name 2020-11-24 11:23:44 +03:00
Evgenii Stratonikov
1869d6d460 core: allow to use state root in header 2020-11-20 17:16:32 +03:00
Roman Khimov
286d9185f4 smartcontract: remove contract features
We're featureless now, all contracts have access to storage and payable status
is to be determined via new NEP. Follow neo-project/neo#2060.
2020-11-13 21:26:23 +03:00
Roman Khimov
0f827ee6ba
Merge pull request #1531 from nspcc-dev/core/applicationlog_with_multiple_triggers
core, rpc: store multiple execution results for single hash
2020-11-12 19:05:22 +03:00
Anna Shaleva
d6992cb5c4 core: marshal block hash for AppExecResult [NotificationsSubsystem] 2020-11-12 17:43:20 +03:00
Anna Shaleva
0b15ca8bd0 rpc: add trigger parameter to getapplicationlog 2020-11-12 17:43:11 +03:00
Anna Shaleva
7ca93e76ac core, rpc: allow to store several AppExecResult for a single hash
It is required for we have several executions per block.
2020-11-12 16:24:39 +03:00
Anna Shaleva
20f8fe5699 rpc: use base64 for submitblock and sendrawtransaction
Changes ported from https://github.com/neo-project/neo-modules/pull/394.
2020-11-12 15:21:35 +03:00
Roman Khimov
a9dddf893a
Merge pull request #1525 from nspcc-dev/rpc/base64
rpc: return bse64 bytes from `getblock`, `getblockheader`, `getrawtx`
2020-11-09 10:48:28 +03:00
Anna Shaleva
6bb81d9b51 rpc: return bse64 bytes from getblock, getblockheader, getrawtx
Close #1522
2020-11-09 10:29:33 +03:00
Anna Shaleva
6ee919747f rpc: allow batch JSON-RPC requests
Close #1509
2020-11-06 17:06:20 +03:00