Commit graph

74 commits

Author SHA1 Message Date
Roman Khimov
de665b5567 *: use slices.Sort() where appropriate
It's always faster for simple types.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 08:24:52 +03:00
Roman Khimov
341d978e5b compiler: walk over functions in reproducible order, fix #3219
It affects both Debug data and bindings, otherwise two unnamed structures can
get any of unnamed/unnamedx names depending on particular invocation.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-23 13:21:51 +03:00
Roman Khimov
a5d041a1ac compiler: check range first, analyze funcs then
Type data is added while walking through function ins/outs even if we're to
throw this function away. But we don't need it, these types are not used, so
we can deal with the main part of #3071 by optimizing this out.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-21 17:52:17 +03:00
Anna Shaleva
d1fe64470d compiler: fix sequence point boundaries
Thanks to @fyrchik, see the
https://github.com/neo-project/neo-devpack-dotnet/pull/154/files#diff-ebf53d00d5ba1f1197fedd2b8111fe9a8f44fb96699ef1314d54d05d5ceeb3f3R27

See also the standard:
https://github.com/neo-project/proposals/blob/master/nep-19.mediawiki#method.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-08-11 20:16:02 +03:00
Anna Shaleva
6379bcc15a compiler: properly set extended type name for unnamed structs
After the struct was registered as "unnamed", it has the own unique name.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-31 15:53:43 +03:00
Anna Shaleva
e2580187a1 cli: fetch extended evet types from contract config
The user should specify it via parameter's `extendedtype` field and
via upper-level `namedtypes` field of the contract configuration YAML.

Also, as we have proper event structure source, make the `--guess-eventtype`
compilation option and make event types guess optional.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-31 15:53:41 +03:00
Anna Shaleva
194639bb15 compiler: fix typo in the method description
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-31 15:52:41 +03:00
Anna Shaleva
044ae477ca smartconract: generate RPC binding wrappers for events
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-31 15:52:39 +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
2bcf3a4ad5 compiler: unwrap pointers for debug types
We have almost no difference between Type and *Type.
2022-12-06 13:15:10 +03:00
Roman Khimov
d7fafea328 compiler: handle ledger/management enums better for debug
Fix scAndVMInteropTypeFromExpr(), these types are not structures at all.
2022-12-06 13:15:10 +03:00
Roman Khimov
0f61a13006 compiler: Contract type is in the management package 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
Elizaveta Chichindaeva
28908aa3cf [#2442] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
Roman Khimov
e390981747 compiler: add hash field to debug info
New debugger won't work without it.
2022-04-06 15:27:01 +03:00
Evgeniy Stratonikov
a2cef15932 compiler: emit bindings configuration
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-28 15:36:14 +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
Evgeniy Stratonikov
9871dc8f5a compiler: update x/tools package
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:26 +03:00
Evgeniy Stratonikov
7758378d28 compiler: allow to overload methods in manifest
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-29 20:15:21 +03:00
Evgeniy Stratonikov
4249674ddc compiler: check for contract permissions
On many occassions we can determine at compile-time if contract config lacks
some properties it needs. This includes all native contract invocations
through stdlib, as both hashes and methods are known at compile-time
there.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-28 11:49:29 +03:00
Evgeniy Stratonikov
4467e2cbfd cli,compiler: allow to specify manifest permissions 2021-06-04 11:16:22 +03:00
Roman Khimov
834743ec88
Merge pull request #1958 from nspcc-dev/linter
Linter improvements
2021-05-13 10:52:58 +03:00
Roman Khimov
9d2712573f *: enable godot linter and fix all its warnings
It's important for NeoGo to have clean documentation. No functional changes.
2021-05-12 23:17:03 +03:00
Evgeniy Stratonikov
7b638d5489 compiler: emit debug variable info for _deploy() 2021-05-12 16:04:11 +03:00
Evgeniy Stratonikov
b72f6be9e9 compiler: emit debug variable info for init() 2021-05-12 16:04:06 +03:00
Evgeniy Stratonikov
7afca7f8e5 compiler: add support for static-variables in debug info 2021-05-12 15:05:39 +03:00
Evgeniy Stratonikov
69c011b3e7 compiler: implement Ledger contract wrapper 2021-02-08 13:09:41 +03:00
Roman Khimov
ac527650eb native: add Ledger contract, fix #1696
But don't change the way we process/store transactions and blocks. Effectively
it's just an interface for smart contracts that replaces old syscalls.

Transaction definition is moved temporarily to runtime package and Block
definition is removed (till we solve #1691 properly).
2021-02-04 13:12:11 +03:00
Evgeniy Stratonikov
c1cc7e6f9d native: add additional parameters to deploy
1. Management contract has 2 overloads of `deploy` method.
2. Normal contracts should have `_deploy` with 2 parameters.
2021-01-29 12:19:08 +03:00
Roman Khimov
459ad521ab *: fix misspellings spotted by goreportcard 2020-12-28 17:27:04 +03:00
Evgenii Stratonikov
4dc5877674 compiler: remove unused code and simplify error handling
After cbf26f3 some errors can't occur.
2020-12-10 18:56:08 +03:00
Evgenii Stratonikov
2341ae0c53 compiler: specify safe methods in config 2020-12-10 18:00:43 +03:00
Evgenii Stratonikov
d7194e4da5 compiler: do not check for main package in ConvertToManifest 2020-12-10 17:45:23 +03:00
Evgenii Stratonikov
9fd8577dd9 compiler: use Options in ConvertToManifest() 2020-12-10 17:43:25 +03:00
Evgenii Stratonikov
ff4880249d compiler: enforce Hash160 and Hash256 size in literals
Can be useful to prevent small typos.
2020-12-10 14:11:28 +03:00
Evgenii Stratonikov
cbf26f315c compiler: save both VM and smartcontract types
VM types are used in debugger, while smartcontract ones are used in
manifest. We can't save only one of them, because conversion in either
side is lossy:
1. VM has `Array` and `Struct` but smartcontract only has `Array`.
2. Smartcontract has `Hash160` etc, which are all `ByteString` or
`Buffer` in VM.

And to spice things a bit more, return type in debugger can be `Void`,
which corresponds to no real stackitem type (as it must exist).
2020-12-09 22:35:22 +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
Evgenii Stratonikov
75a9a42403 compiler: check emitted event names
Check that all `Notify` invocations in source correspond to some event
in manifest.
Helpful for typos such as `transfer` instead of `Transfer`.
2020-11-26 13:49:58 +03:00
Evgenii Stratonikov
c849176be7 manifest: include contract Name 2020-11-24 11:23:44 +03:00
Roman Khimov
286d9185f4 smartcontract: remove contract features
We're featureless now, all contracts have access to storage and payable status
is to be determined via new NEP. Follow neo-project/neo#2060.
2020-11-13 21:26:23 +03:00
Evgenii Stratonikov
c4a8770215 compiler: support _deploy method 2020-10-06 19:12:35 +03:00
Evgenii Stratonikov
25f8545cdf compiler: extend manifest generation with custom types 2020-09-09 13:06:44 +03:00
Anna Shaleva
70a58b6522 compiler: do not convert methods to manifest methods
Close #1381
2020-09-02 22:41:54 +03:00
Anna Shaleva
9456f729be compiler: generate methods names with lowercased first letter
Methods names from debuginfo should match methods names from manifest.
Original method names are stored in ID field.
2020-08-13 13:28:20 +03:00
Anna Shaleva
3c170271c4 compiler: provide namespace for events names
For proper NEO3 debugger work we should provide namespaces for events
names in .debug.json files. But we don't have namespaces in .yml
configuration files and don't need this information for .manifest.json
generation, so let's just keep namespaces empty. This do not prevents
debugger from accepting our .debug.json files.
2020-08-13 10:44:46 +03:00
Roman Khimov
c3f7a419a0
Merge pull request #1296 from nspcc-dev/smartcontract/examples
examples: update examples
2020-08-11 19:09:13 +03:00
Anna Shaleva
b5494320f9 compiler, cli: support events from .yml config file
We currently can't process events in codegen, so we have to provide
them via .yml config file. Do not delete the rest of the code connected
with conversion of MethodDebugInfo.Event into manifest.Event as we have
issue #1038.
2020-08-11 13:42:06 +03:00
Evgenii Stratonikov
128626de5c compiler: save sequence points for init function 2020-08-11 11:12:30 +03:00
Evgenii Stratonikov
40fa7c0f6e compiler: emit all used files in DebugInfo.Documents 2020-08-11 11:12:29 +03:00
Roman Khimov
ef53a45e7a
Merge pull request #1264 from nspcc-dev/smartcontract/manifest/supported_standards
smartcontract: add list of supported standards to manifest
2020-08-04 22:17:00 +03:00