Anna Shaleva
0f0f7b364f
rpcbinding: use typed return err value in etTypeConverter
...
Otherwise the resulting code can't be compiled.
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-25 16:41:23 +03:00
Anna Shaleva
8beb9f23c3
smartcontract: add comments to binding config fields
...
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-25 16:41:23 +03:00
Anna Shaleva
36af361c2b
smartcontract: add FromStackItem wrapper for RPC bindings
...
Make it exported and reusable from the user's code.
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-24 11:27:49 +03:00
Anna Shaleva
15138b2004
vm: allow to emit convertible
...
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-17 12:47:31 +03:00
Roman Khimov
433275265f
*: use require.ErrorIs instead of require.True(t, error.Is())
...
This is just a much better way to do the same thing. Inspired by
nspcc-dev/neofs-sdk-go#407 .
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-05-04 17:03:47 +03:00
Roman Khimov
c053f1a4af
Merge pull request #2957 from nspcc-dev/rm-go-17
...
*: drop go 1.17 support
2023-04-04 15:25:14 +03:00
Anna Shaleva
6b21ad9922
*: replace interface{}
with any
keyword
...
Everywhere including examples, external interop APIs, bindings generators
code and in other valuable places. A couple of `interface{}` usages are
intentionally left in the CHANGELOG.md, documentation and tests.
2023-04-04 13:22:42 +03:00
ZhangTao1596
d36df15878
ci: fix lint issues ( fix #2948 )
2023-03-29 11:19:23 +08:00
Roman Khimov
b1e7f40226
rpcbinding: fix wrappers for Any type, fix #2898
2023-02-18 00:06:45 +03:00
Roman Khimov
cad0fab704
Merge pull request #2828 from nspcc-dev/rpcwrapper-structures
...
Handle structures in the RPC wrapper generator
2022-12-06 21:40:16 +07:00
Roman Khimov
e5aa5ca294
rpcbinding: improve error reporting in generated code
2022-12-06 13:15:10 +03:00
Roman Khimov
ec5ebc8c18
rpcbinding: improve indentation for internal unwrappers
2022-12-06 13:15:10 +03:00
Roman Khimov
c058ab5604
rpcbinding: handle more complex non-structured types
2022-12-06 13:15:10 +03:00
Roman Khimov
ce67e6795e
rpcbinding: properly support maps
...
I'm not sure that map with a `*big.Int` key is a good one, but it can work
this way.
2022-12-06 13:15:10 +03:00
Roman Khimov
8e0be6e7a5
rpcbinding: improve indentation for internal array code
2022-12-06 13:15:10 +03:00
Roman Khimov
0214628127
rpcbinding: generate bindings using new extended type data
2022-12-06 13:15:10 +03:00
Roman Khimov
b9d20b32e9
compiler: push additional type data into the bindings file
...
Structures/arrays and maps.
2022-12-06 13:15:10 +03:00
Anna Shaleva
1250e82c2a
vm: add PUSHT and PUSHF opcodes
...
Port https://github.com/neo-project/neo-vm/pull/497 .
2022-12-02 10:02:33 +03:00
Roman Khimov
82c6ce218b
rpcbinding: use binding condig to generate code for simple arrays
...
Part of #2767 .
2022-11-14 13:01:13 +03:00
Roman Khimov
145ebad90e
binding: drop the only error condition from TemplateFromManifest
...
Simplify the interface, we do IsValid() check anyway in the CLI and it covers
this condition as well.
2022-11-09 18:13:45 +03:00
Roman Khimov
be02eea7b1
binding: precompile template, remove useless error condition
2022-11-09 18:13:45 +03:00
Roman Khimov
a7f86dcb7f
rpcbinding: generate Expanded methods for iterators
...
Refs. #2768 .
2022-11-09 18:13:45 +03:00
Roman Khimov
d569fe01e6
rpcbinding: initial support for iterators, see #2768
...
Already better than stackitem.Item.
2022-11-09 18:13:45 +03:00
Roman Khimov
69d8905ad9
rpcbinding: exclude onNEPXXPayment methods from wrappers
...
They make no sense there.
2022-11-08 17:01:36 +03:00
Roman Khimov
130608ac67
rpcbinding: support writer-only wrappers
...
"verify" contract doesn't have any safe methods.
2022-11-08 17:01:36 +03:00
Roman Khimov
df29008a50
rpcbinding: add GAS testcase, fix methodless wrappers
...
* strip NEP-XX methods before going into generator to avoid unused imports
* nepXX.Invoker types already include Call
* always import util, it's used for Hash
2022-11-08 17:01:36 +03:00
Roman Khimov
aeb61fb61d
rpcbinding: generate ASSERT for bool-returning methods
...
It's a common pattern.
2022-11-08 17:01:36 +03:00
Roman Khimov
2a4a5ab479
rpcbinding: support simple wrappers for writer methods
...
Fixes #2769 .
2022-11-08 17:01:36 +03:00
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
Anna Shaleva
2096ad6e81
*: remove io/ioutil uses
...
Close #1764 .
2022-03-17 19:39:18 +03:00
Roman Khimov
b65ab011fe
Merge pull request #2349 from nspcc-dev/codegen-contract
...
cli/smartcontract: generate bindings to an existing contract
2022-02-24 15:51:33 +03:00
Anna Shaleva
0357d9f4f4
smartcontract: add hash check to paramcontext
...
Close #2344 .
2022-02-24 10:21:08 +03:00
Evgeniy Stratonikov
da03d895de
cli/smartcontract: generate bindings to an existing contract
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-23 15:40:06 +03:00
Evgeniy Stratonikov
4aab85ef51
callflag: allow to marshal call flags in YAML
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-21 10:43:35 +03:00
Anna Shaleva
9c2e92d7d9
compiler: check overloaded methods for safeness one more time
...
It's possible that overloaded method is marked as `safe` in manifest, so
that it must have `save` field set to true after its name was
overwritten.
2022-01-21 18:03:04 +03:00
Anna Shaleva
fa1174ec7e
smartcontract: adjust NEP11-D standard
...
Method `ownerOf` returns iterator which should be of the type
InteropInterface.
2022-01-21 18:03:04 +03:00
Roman Khimov
ce9d0b22cf
*: use NEP-XX naming consistently in docs/comments
...
Standards are NEP-11 and NEP-17, not NEP11, not NEP17, not anything
else. Variable/function names of course can use whatever fits, but documents
and comments should be consistent wrt this.
2021-11-19 12:58:46 +03:00
Roman Khimov
9875799893
transaction: add new Rules witness scope
...
See neo-project/neo#2622 . The implementation is somewhat asymmetric (and not
very efficient) for binary/JSON encoding/decoding, but it should be
sufficient.
2021-11-12 15:29:28 +03:00
Roman Khimov
42a9d3d7b8
nef: add Source field
...
Follow neo-project/neo#2605 .
2021-09-24 00:19:37 +03:00
Roman Khimov
68af14100c
Merge pull request #2174 from nspcc-dev/states-diff_testnet_284177
...
smartcontract: escape non-ascii characters for manifest.Extra SI
2021-09-15 15:07:25 +03:00
Anna Shaleva
dfc0b25cfe
gomod: use nspcc-dev's fork of go-ordered-json
...
Escape non-ASCII characters while JSON encoding.
2021-09-15 15:01:01 +03:00
Evgeniy Stratonikov
918d7e65bf
smartcontract: unmarhal null
values properly
...
First we unmarshal `null` to `[]byte`, then we marshal it to the empty
string.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-09-14 13:28:01 +03:00
Anna Shaleva
61fd7bd6ba
core: avoid nil
values during natives manifest marshalling
2021-09-10 11:38:59 +03:00
Evgeniy Stratonikov
cff8b1c24e
stackitem: use Bool
item directly
...
It is always copied.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-12 17:53:36 +03:00
Roman Khimov
06c3dda5d1
Merge pull request #2093 from nspcc-dev/states-exchange/drop-nep17-balance-state
...
core: implement dynamic NEP17 balances tracking
2021-07-29 19:08:42 +03:00
Anna Shaleva
c0a2c74e0c
core: maintain a set of NEP17-compliant contracts
2021-07-28 13:22:53 +03:00
Roman Khimov
6103da8d10
context: read item key in LE
...
Hi, neo-project/neo#938 .
2021-07-23 12:43:04 +03:00
Roman Khimov
efb67a0ea3
context: scripts and signatures are base64-encoded in C# now
...
So use base64 too and add compatibility test. Unfortunately this breaks
support for old (hex-based) files, but those should be completed a long time
ago.
2021-07-23 11:57:35 +03:00
Roman Khimov
cbe1eeb08c
smartcontract: add support for valueless Parameters
...
This is fine:
{
"type" : "Signature"
},
2021-07-23 11:57:13 +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
ac126a300b
callflag: add C#-compliant JSONization, fix #2040
2021-07-06 11:17:12 +03:00