Commit graph

297 commits

Author SHA1 Message Date
Roman Khimov
b590d4ca04
Merge pull request #2766 from nspcc-dev/rpc-wrapper-autogen
Rpc wrapper autogeneration
2022-10-28 11:54:47 +07:00
Roman Khimov
02ce59cfd5 binding: avoid name conflicts with Go keywords
And clashing one name on another after rename.
2022-10-27 22:57:49 +03:00
Roman Khimov
617c31093f smartcontract: initial rpcbinding implementation, fix #2705
It can do some unwrapping and reuse nepXX packages. It only uses manifest data
at the moment, see #2767, #2768, #2769.
2022-10-27 22:57:49 +03:00
Roman Khimov
e0eff94094 standard: correct Comply* comments 2022-10-27 18:32:00 +03:00
Roman Khimov
64b603b056 standard: export standard definitions
Make Comply* functions useful and expose standard definitions for some reuse.
2022-10-27 18:32:00 +03:00
Roman Khimov
396f56f792 binding: drop unused lowerFirst 2022-10-26 12:47:39 +03:00
Roman Khimov
4191b18728 binding: make TemplateFromManifest more reusable
Other template generators can make use of it.
2022-10-26 12:43:48 +03:00
Roman Khimov
d6d4f07280 binding: always import some packages and do it outside
If the contract has no methods, it's probably a broken one.
2022-10-26 12:40:59 +03:00
Roman Khimov
5d43367082 emit: optimize Bool GAS cost
NOT is 1 byte shorter and 2048 times cheaper than CONVERT. Inspired by
neo-project/neo-vm#493.
2022-10-25 13:08:33 +03:00
Anna Shaleva
4dbaf2a123 smartcontract: add comment to GetCompleteTransaction 2022-10-13 16:07:34 +03:00
Anna Shaleva
af658bc3e5 cli: support Null as an argument for invocation-related commands 2022-10-13 16:07:31 +03:00
Anna Shaleva
7eb87afab8 cli: unify parameters parsing
Share parameters parsing code between 'contract invokefunction' and
'vm run' commands. It allows VM CLI to parse more complicated parameter
types including arrays and file-backed bytestrings.
2022-10-13 08:20:27 +03:00
Anna Shaleva
641abd4d1c smartcontract: fix underlying PublicKey parameter value
Value of PublicKey parameter always stores public key bytes, not the
deserialized representation. All other code (CLI parameters parsing with
its NewParameterFromString, Parameter unmarshaller, etc.) is based on
the idea that value of PublicKey is []byte.
2022-10-11 13:50:32 +03:00
Anna Shaleva
4a46001746 smartcontract: fix error message for CreateMultiSigRedeemScript 2022-10-07 15:56:34 +03:00
Roman Khimov
8893163803 smartcontract: define parameter lengths as constants and use them 2022-10-05 10:46:21 +03:00
Roman Khimov
317dd42513 *: use uint*Size and SignatureLen constants where appropriate 2022-10-05 10:45:52 +03:00
Roman Khimov
79887f9d78 runtime: check notifications against ABI
Related to #2703, just a logged thing for now.
2022-10-04 17:52:38 +03:00
Anna Shaleva
554e48e7b7 compiler: enforce runtime.Notify parameters cast
If notification parameters type can be defined in a compile time then enforce
parameter cast to the desired type got from manifest.
2022-09-30 14:42:43 +03:00
Roman Khimov
18ed26194f smartcontract: add Len to Builder
Which is useful in some cases.
2022-09-14 10:25:10 +03:00
Roman Khimov
541d4b49e1 context: define a constant for transaction context type 2022-09-08 14:33:04 +03:00
Roman Khimov
4fb4f5a1ac smartcontract: make *util.Uint160 and *util.Uint256 usable for parameters
Use Any type for NULL.
2022-09-08 14:33:04 +03:00
Roman Khimov
ea92f3d716 smartcontract: add some notes on API limitations 2022-09-08 13:27:07 +03:00
Roman Khimov
69176168c3 smartcontract: modernize Builder example
And make it a bit more useful.
2022-09-07 22:40:25 +03:00
Roman Khimov
58dc8d0c9b *: always close the wallet after use
Fix #2631.
2022-09-02 14:44:32 +03:00
Roman Khimov
411ebdf51e cli: add complete support for offline signing, fix #2662
See documentation update for an example. Some code is made generic as well,
GetCompleteTransaction can now be used directly on ParameterContext.
2022-09-01 15:30:34 +03:00
Roman Khimov
773bcc3a59 context: make error messages a bit less cryptic
Refs. #2664.
2022-09-01 15:30:33 +03:00
Roman Khimov
58707c2b1e context: handle the case when we have more sigs than needed
We can technically have more signatures in the file than we need and it's OK,
this case should be handled.
2022-09-01 15:30:33 +03:00
Roman Khimov
bf06b32278
Merge pull request #2658 from nspcc-dev/calculate-network-fee-fixes
calculatenetworkfee improvements
2022-08-24 10:24:53 +03:00
Roman Khimov
03cc9b2762 rpcsrv: execute all witnesses for calculatenetworkfee
Try to get as much data as possible, fix #2654.
2022-08-23 15:34:18 +03:00
Anna Shaleva
fb8a3973f1 smartcontract: remove empty method parameter handling
It's prohibited by the manifest validness checker, thus should not be
supported by bindings generator.
2022-08-22 15:01:38 +03:00
Anna Shaleva
15732580eb smartcontract: improve manifest validness errors
It should be clear from error what's wrong with ABI
(specify bad method/event/parameter identifier).
2022-08-22 14:59:28 +03:00
Roman Khimov
593fa4cac8
Merge pull request #2632 from nspcc-dev/rpcclient-actor
RPC client Actor interface
2022-08-09 17:21:24 +03:00
Anna Shaleva
916f2293b8 *: apply go 1.19 formatter heuristics
And make manual corrections where needed. See the "Common mistakes
and pitfalls" section of https://tip.golang.org/doc/comment.
2022-08-09 15:37:52 +03:00
Roman Khimov
afef8b85d9 rpcclient: add deprecation warnings 2022-08-08 09:51:51 +03:00
Roman Khimov
aa2dbe9caf smartcontract: accept Parameter in NewParameterFromValue
While it makes little sense, there can be a situation where this function will
get predefined Parameters in some way.
2022-08-07 22:33:56 +03:00
Roman Khimov
25bd941d6f
Merge pull request #2601 from nspcc-dev/disallow-unnamed-parameters
compiler: disallow unnamed parameters for exported methods of the main package
2022-08-02 18:04:11 +03:00
Anna Shaleva
725e8779a1 compiler: always ensure manifest passes base check 2022-08-02 17:37:43 +03:00
Roman Khimov
55164132df smartcontract: provide NewParametersFromValues for convenience as well 2022-08-01 21:31:23 +03:00
Roman Khimov
92a931c145 smartcontract: provide interface{}->Parameter conversion
Which is almost like a NeoFS's toStackParameter() on steroids (except it
doesn't mess with noderoles package, it can be casted to int). RPC client's
Invoke* functions expect Parameters, so make it easy to create them.
2022-08-01 21:31:23 +03:00
Roman Khimov
a8a2f2ed5a smartcontract: make CreateCallAndUnwrapIteratorScript accept Go types
Parameter is for the RPC client, all other CreateXXXScript functions deal with
regular types.
2022-08-01 21:31:23 +03:00
Roman Khimov
848d68fba8 smartcontract: improve package documentation 2022-08-01 21:31:23 +03:00
Roman Khimov
3c5a720e3a smartcontract: drop Params type and TryParse methods
They were first introduced in a058598ecc and
then carefully moved in 648e0bb242, but it looks
like they were never used by any external code. This code can be useful on the
server, but the server has its own params package to deal with
parameters. Clients usually create Parameters and then get results as
stackitem.Items, so they don't use this code either. So there is zero point in
keeping it.
2022-08-01 21:31:23 +03:00
Roman Khimov
f749aaff3c *: reuse smartcontract package to create standard entry scripts 2022-07-26 12:19:49 +03:00
Roman Khimov
32ebb4a90d smartcontract: add Builder, method invocation helpers and doc
Move the last remaining script-related things out of the rpcclient.
2022-07-25 22:49:47 +03:00
Roman Khimov
1b6f4051d8 smartcontract: move CreateCallAndUnwrapIteratorScript there
RPC client shouldn't build scripts and this function can be useful as a
reusable building block.
2022-07-25 15:46:20 +03:00
Evgeniy Stratonikov
ec21c14ca9 gomod: upgrade yaml package from v2 to v3
Close #2085.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-05-30 15:26:17 +03:00
Elizaveta Chichindaeva
28908aa3cf [#2442] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
Evgeniy Stratonikov
739db259e3 smartcontract: remove unused ParameterFromStackItem
It is exists from the times we used `smartcontract.Parameter` somewhere
in the `NotificationEvent`/`ApplicationLog`. `stackitem.ToJSON` now
handles this.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:35 +03:00
Evgeniy Stratonikov
fe0cd5fe32 smartcontract: remove EncodeBinary for Parameter
It seems, we don't use it anywhere.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:35 +03:00
Evgeniy Stratonikov
0b0d39f797 smartcontract: allow to use *big.Int numbers for integers
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:34 +03:00