Commit graph

56 commits

Author SHA1 Message Date
AnnaShaleva
49e228ddf8 rpc: fix Client's GetOraclePrice 2022-03-01 19:08:22 +03:00
AnnaShaleva
92282c70cb *: support customisable NotaryServiceFeePerKey value
* Add corresponding methods to Notary contract.
* Extend RPC Client API.
* Adjust tests.
2022-03-01 19:08:16 +03:00
AnnaShaleva
0092330fe1 rpc: carefully review places where Client.cache.initDone is used
1. Keep initDone check only for the places where cache is directly accessed.
   We don't need to check it in other places, otherwise we have a mess of
   duplicating checks.
2. Fix bug in code related to block deserialisation. There's no magic, so
   checking that initialisation is done is not enough for proper block
   deserialisation. We need to manually fill StateRootEnabled field.
3. Since transaction doesn't need network magic to compute its hash, we don't
   need to perform Client initialisation before transaction-related requests.
4. Check that cache is initialised before accessing network magic.
5. Refactor the way Policy contract hash is fetched for Client requests.
   We don't really need Client initialisation for that, it's OK to fetch Policy
   hash on-the-fly.
2022-02-22 12:52:14 +03:00
Anna Shaleva
e306a90554 rpc: add NEP11-D tests to server and client
Also refactor basic chain creation.
2022-02-09 11:57:16 +03:00
Anna Shaleva
47652643df rpc: accept NEP11 token IDs as []byte for client methods
Accepting IDs as string is encoding-ambiguous, so make it []byte instead.
2022-02-09 11:55:07 +03:00
Evgeniy Stratonikov
e890c32dcc rpc/client: remove dependency on examples
Duplicate necessary structures in a dedicated micropackage.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-25 12:41:06 +03:00
Roman Khimov
9f9bd7261c core: return *interop.Context from GetTestVM
Return everything needed, fix #2273.
2022-01-14 19:57:16 +03:00
Roman Khimov
f58d424c6d rpc/client: fix custom* scope processing in CreateTxFromScript
Copying just the scope doesn't work for CustomContracts, CustomGroups and
Rules because they all contain additional metadata. Thanks @mialbu for
reporting this.
2021-11-22 12:44:42 +03:00
Anna Shaleva
07cbe4d253 core: add finalizer functions to interop context
These functions are aimed to free the resources occupied by storage
iterator by the end of script execution or whenever Finilize is called.
2021-10-21 10:05:12 +03:00
Evgeniy Stratonikov
8a3e05096b *: gofmt -s
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-09-10 21:49:11 +03:00
Roman Khimov
aaccf748ac nft-nd-nns: add getAllRecords method
See neo-project/non-native-contracts#5.
2021-09-10 16:30:45 +03:00
Anna Shaleva
50296975e2 crypto: allow to provide non-default scrypt parameters 2021-06-11 15:22:28 +03:00
Anna Shaleva
2d20b0fa23 core: remove nnsrecords package from native
Use nns from examples instead.
2021-05-17 22:24:56 +03:00
Anna Shaleva
7180b2ce06 rpc: use non-native NNS instead of native NNS in testchain 2021-05-17 22:08:15 +03:00
Roman Khimov
e9cefc4bfc *: fix all errcheck warnings in testing code 2021-05-12 21:45:12 +03:00
Anna Shaleva
d0c64347ab *: add data to NEP11 Transfer 2021-05-05 19:44:29 +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
2fb083bd37 rpc: add NEP11TokenInfo method 2021-04-30 11:38:11 +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
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
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
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
bcc5c055de rpc: allow to calculatenetworkfee for verify with args
We can load invocation script for those contract-based witnesses which
requires arguments for `verify` methods.
2021-03-26 19:16:00 +03:00
Anna Shaleva
252e03bc34 rpc: add CalculateNetworkFee RPC method 2021-03-26 19:14:46 +03:00
Anna Shaleva
d2a81daf57 rpc: refactor TestCalculateNetworkFee
We need to ensure that we don't add extra network fee during
calculation.
2021-03-26 19:12:43 +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
edfca68a17 rpc: refactor invokecontractverify
In `(c *Client) AddNetworkFee` we define network fee for contract
witness verification via `invokecontractverify` RPC call, and that's the
initial purpose of this RPC method. But it was not implemented
correctly. It used `System.Contract.Call` instead of beheiving like
`initVerificationVM`.

During real contract witness verification the whole contract's script is
loaded into VM, and then we jump to the `verify` method. Thus, to define
exact contract verification price, we should act like this (and not just
perform `System.Contract.Call` of `verify` method).

Tests are added.

This bug is the reason of adding extra GAS (c.notary.extraVerifyFee) to
pre-calculated value in
https://github.com/nspcc-dev/neofs-node/pull/404/files#diff-639db437ca2578db46c9e8cbf18f9aa01f8ca5aee30e0fa7e70ba0354822d7b3R237
2021-03-12 18:59:20 +03:00
Anna Shaleva
cdaca7be3e core: use Neo.Crypto.CheckSig for standard signature verification 2021-03-10 21:45:58 +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
Anna Shaleva
a237e34c1f rpc: add test for submitNotaryRequest 2021-02-11 17:15:59 +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
Evgenii Stratonikov
dbe81f9b80 smartcontract: move flags to a separate package 2021-01-14 17:52:09 +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
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
Evgenii Stratonikov
cd5219086a wallet: export NewAccountFromPrivateKey()
Don't perform back-and-forth conversion, don't handle error
which never occur.
2020-12-04 12:45:53 +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
a5914f89fa core: allow to provide block in GetTestVM()
Sometimes amount of GAS consumed depends on block height.
2020-11-24 12:17:29 +03:00
Anna Shaleva
b8a88f9378 rpc: allow to use address, id or name instead of scripthash [Client]
... for getcontractstate RPC client method.
2020-11-03 17:58:24 +03:00
Anna Shaleva
590be7a58d rpc, cli: remove Network from RPC client and cli 2020-10-19 16:11:11 +03:00
Evgenii Stratonikov
9733a6f394 core: move CalculateNetworkFee to a separate package 2020-10-07 10:04:19 +03:00
Evgenii Stratonikov
9c7168e4e8 rpc/client: allow to use contract accounts in AddNetworkFee 2020-08-27 11:32:55 +03:00
Evgenii Stratonikov
72ca8b79c3 rpc/client: provide sender in CreateNEP5MultiTransferTx
Specify scope explicitly.
Fix #1354.
2020-08-25 09:21:06 +03:00