Commit graph

199 commits

Author SHA1 Message Date
Evgeniy Stratonikov
7a176727ca smartcontract: add GetMajorityNodeCount() 2021-03-09 13:46:44 +03:00
Roman Khimov
abee3b5b05
Merge pull request #1722 from nspcc-dev/fix/nep11
smartcontract: add NEP-11 standard check
2021-02-22 22:27:09 +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
488e75a246 cli: add filebytes parameter type 2021-02-19 10:52:45 +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
Roman Khimov
60dfffc574 manifest: remove no longer used Serializable interface
It was used when manifests were saved into JSON.
2021-02-08 10:52:53 +03:00
Roman Khimov
e4b5b59663
Merge pull request #1704 from nspcc-dev/binary_manifest
core: serialise manifest as stackitem
2021-02-05 23:58:07 +03:00
Roman Khimov
cd9b34416e native: call onNEP11Transfer for NEP-11 transfers
See neo-project/neo#2287.
2021-02-05 20:48:45 +03:00
Anna Shaleva
a2715404d0 core: serialise manifest as stackitem 2021-02-05 19:10:15 +03:00
Roman Khimov
a442e1530d native: rename onPayment into onNEP17Payment
Follow neo-project/neo#2287.
2021-02-05 16:09:51 +03:00
Evgeniy Stratonikov
73f888f02e core: allow to overload contract methods
Multiple methods with different parameter count can co-exist.
2021-01-27 12:51:07 +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
dbe81f9b80 smartcontract: move flags to a separate package 2021-01-14 17:52:09 +03:00
Evgeniy Stratonikov
11191c0a08 nef: support JSON serialization 2021-01-13 15:26:35 +03:00
Roman Khimov
2e0fe370cf nef: lower MaxScriptLength
Follow neo-project/neo#2119 changes.
2020-12-14 15:24:15 +03:00
Roman Khimov
fc361213a7
Merge pull request #1608 from nspcc-dev/core/callflags
core: adjust call flags
2020-12-11 19:23:15 +03:00
Anna Shaleva
fadbae8997 core: rename call flags
Also new States flag is added and ReadOnly flag is adjusted.
2020-12-11 10:34:01 +03:00
Evgenii Stratonikov
ec1ff42872 manifest: add Safe flag for NEP-17 methods 2020-12-10 18:04:49 +03:00
Evgenii Stratonikov
ea4d14d20d manifest/standard: check Safe flag in Comply() 2020-12-08 13:47:05 +03:00
Evgenii Stratonikov
b7e86fa6a3 manifest: add Safe flag to method descriptor
`interop.Contex.AddMethod` sets `Safe` flag for native
contracts. This allows not to forget to change manifest
when changing call flags.
Also fixed invalid `Safe` flags for `Notary` and `Designate` contracts.
2020-12-08 13:27:43 +03:00
Roman Khimov
1672887123 nef: increase version field to 32 bytes
Follow recent C# changes.
2020-11-30 11:26:29 +03:00
Roman Khimov
4d0eaef510 nef: treat Version as string
Following changes in C# code and simpilifying things a lot.
2020-11-27 21:47:08 +03:00
Roman Khimov
e12c52f588 nef: change checksum calculation scheme
It's now being calculated for whole file, not just header.
2020-11-27 21:47:08 +03:00
Roman Khimov
0c7e727859 nef: drop scripthash
It's no longer a part of the file.
2020-11-27 21:47:08 +03:00
Roman Khimov
c5e39dfabf nef: forbid NEFs with zero-length scripts 2020-11-26 18:30:53 +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
Roman Khimov
34d2eaf00e manifest: update maximum possible length
As per neo-project/neo#2002.
2020-11-26 18:07:20 +03:00
Evgenii Stratonikov
279b769fa3 manifest: support interface checking
There are some standards (NEP5, etc.) which impose
some restrictions on what methods and events a contract
must contain and their signatures. This commit supports
checking if arbitrary manifest complies with the standard.
2020-11-26 12:50:29 +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
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