Ekaterina Pavlova
baac738ec3
smartcontract: add test of extraToStackItem with double quotes
...
C# double quotes marshalling compatibility test.
Refs #3284
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-01-12 11:18:24 +03:00
Anna Shaleva
910d53b27b
core: do not check manifest size on deploy/update
...
Manifest will be a part of the state.Contract which will be checked on its
way to the storage. Tiny optimisation which allows not to serialize manifest
twice. Ref. https://github.com/nspcc-dev/neo-go/pull/3218#discussion_r1402374232 .
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-22 20:17:09 +03:00
Anna Shaleva
6824bd9f40
smartcontract: require manifest serialization in (*Manifest).IsValid
...
Port the restrictive part of https://github.com/neo-project/neo/pull/2948 .
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-22 19:39:03 +03:00
Anna Shaleva
fdcc369d60
manifest: add compatibility test for Permissions and Trust serialization
...
We already have tests for Permission deserialisation, so port the first
part of https://github.com/neo-project/neo/pull/2948 .
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-18 13:32:28 +03:00
Anna Shaleva
2581146a01
smartcontract: fix wildcard trusts deserialization
...
If manifest trusts presented as Null stackitem, then they should be
treated as wildcard, not as restricted.
It's not the same problem as described and fixed in
https://github.com/neo-project/neo/pull/2901 and
https://github.com/neo-project/neo/pull/2892 , although these
two PRs are related.
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-09-25 11:53:47 +03:00
Anna Shaleva
60795a899f
smartcontract: improve invalid notification error text
...
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-08-18 12:02:43 +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
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
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
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
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
Anna Shaleva
725e8779a1
compiler: always ensure manifest passes base check
2022-08-02 17:37:43 +03:00
Elizaveta Chichindaeva
28908aa3cf
[ #2442 ] English Check
...
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +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
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
Anna Shaleva
c0a2c74e0c
core: maintain a set of NEP17-compliant contracts
2021-07-28 13:22:53 +03:00
Evgeniy Stratonikov
c9e6350915
manifest: fix group permission handling
...
We need to have at least one matching group in the manifest.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-30 11:02:45 +03:00
Evgeniy Stratonikov
4283e1003f
manifest: fix wildcard permission handling
...
Wildcard contract can coexist with restricted set of methods.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-30 11:00:06 +03:00
Evgeniy Stratonikov
9c06ba6b07
smartcontract: marshal manifest Extra
field as object, fix #2021
...
This is needed to strip whitespace which can be present.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-29 11:39:56 +03:00
Roman Khimov
b8ba923874
standard: improve testing code
...
staticcheck: SA4021: x = append(y) is equivalent to x = y
2021-05-12 19:12:09 +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
Anna Shaleva
efe9bee1ff
smartcontract: refactor manifest.FromStackItem test
...
We need a good case to ensure that error cases constructed well.
2021-05-05 18:54:42 +03:00
Anna Shaleva
50fc9bf766
smartcontract: use permission descriptors for manifest's trusts
2021-05-05 17:40:10 +03:00
Evgeniy Stratonikov
bb039ef035
manifest: add features
field
2021-05-04 13:10:46 +03:00
Anna Shaleva
28b78d1a6c
smartcontract: remove NEP10 standard name
...
It's unused.
2021-04-30 11:38:11 +03:00
Evgeniy Stratonikov
1cb25d3190
native: use proper types in manifest
2021-03-11 11:48:38 +03:00
Evgeniy Stratonikov
b38443fe20
smartcontract: add checks for onNEP*Payable methods
...
When they are present in contract, we want them
to have correct signature.
2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
d89f055697
smartcontract: add checks for parameter names
...
It can be annoying to use parameter names as specified by standard,
so a separate `CheckABI` is supported.
2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
9d4ccf0fcc
smartcontract: add test for Optional methods
...
They should be checked only if name + parameter count matches.
This is how methods are identified in NEO.
2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
eb26a61078
smartcontract: remove IsNEP17()
2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
9c0bbd0bfd
smartcontract: add NEP-11 standard check
...
The only method missing is name, because it is
provided in manifest.
2021-02-19 17:06:07 +03:00
Anna Shaleva
0f1473897b
core: temp manifest.Extra marshalling fix
...
Manifest.Extra still serialized as JSON message with undefined order
of items, so it affects contract states dumps.
2021-02-12 23:48:30 +03:00
Roman Khimov
a3abdbd7f0
manifest: add duplicate events/methods checks to ABI
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
dc3967ae7b
manifest: add manifest validity checks
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
284476c070
manifest: add Permission and Permissions validity checks
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
15ed905757
manifest: add validity checks for Parameter
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
f0c3066ef6
manifest: add method validity check
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
f3c761e4c2
manifest: move Parameter into a file of its own
2021-02-09 22:31:26 +03:00
Roman Khimov
0b2e9312af
manifest: add event validity check
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
f78e3fb290
manifest: move Event into a file of its own
2021-02-09 22:31:26 +03:00
Roman Khimov
e9ea89b4e3
manifest: add group signature length check
...
Refs. #1699 .
2021-02-09 22:31:24 +03:00
Roman Khimov
296c7a10fc
manifest: move Group code into a file of its own
2021-02-09 22:31:22 +03:00
Roman Khimov
1a4958b1d5
manifest: add ABI validity check
...
Some methods must be defined in a valid ABI. Refs. neo-project/neo#2263 .
2021-02-08 13:27:39 +03:00
Roman Khimov
5ba074b4cf
manifest: return an error from IsValid
...
Be more specific.
2021-02-08 12:04:57 +03:00
Roman Khimov
211fe307ee
manifest: move ABI code into file of its own
...
Make it a little more convenient to work with it.
2021-02-08 11:55:16 +03:00