Commit graph

377 commits

Author SHA1 Message Date
Evgeniy Stratonikov
cf459002f7 compiler: allow to inline global variables 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
6e560c6c9f compiler: allow to inline var arg functions 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
339187a56d compiler: count locals number properly 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
57a0377c81 compiler: load nil directly on inline 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
3484025065 compiler: load constants directly on inline 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
27e60455c7 compiler: do not introduce excessive locals on inline
When function call-site parameter is an identifier,
we may load it directly. Currently it can be also modified,
this will be fixed in a separate commit.
2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
1ae0d022dd compiler: support basic inlining 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
1f238ce6fd compiler: do not emit RET twice for nested BlockStmt
When function finishes with `*ast.BlockStmt`, last return
in that block should be looked for.
2021-02-15 18:48:33 +03:00
Roman Khimov
754c985424
Merge pull request #1736 from nspcc-dev/preview5-compatibility-fixes
core: preview-5 states difference fixes
2021-02-12 23:58:22 +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
ca08a559fa interop: allow transfer calls to read states
Follow-up to #1734.
2021-02-12 12:56:15 +03:00
Evgeniy Stratonikov
560aff6155 compiler: adjust init/_deploy method offsets during optimization
Because `_initialize` and `_deploy` methods encompass multiple
Go functions, their offsets are stored differently and need
special treatment.
2021-02-11 15:59:02 +03:00
Evgeniy Stratonikov
e1d2a5b5b7 state: split ContractBase and UpdateCounter
Latter doesn't make sense for native contracts.
2021-02-11 12:24:09 +03:00
Evgeniy Stratonikov
18b7584cb4 compiler/interop: add Manifest to Contract struct 2021-02-08 13:13:11 +03:00
Evgeniy Stratonikov
6cf40749a9 compiler: add tests for native wrappers 2021-02-08 13:13:10 +03:00
Evgeniy Stratonikov
73a75cc27a compiler: do not convert interop types on assertion 2021-02-08 13:11:39 +03:00
Evgeniy Stratonikov
2f6345f2d9 compiler: add Hash compatibility test 2021-02-08 13:09:41 +03:00
Evgeniy Stratonikov
69c011b3e7 compiler: implement Ledger contract wrapper 2021-02-08 13:09:41 +03:00
Evgeniy Stratonikov
2f26490e59 compiler: implement RoleManagement contract wrapper 2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
3c237e2a29 compiler: implement NameService contract wrapper 2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
6e866b622a compiler: implement NEO contract wrapper 2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
e5d8c1c985 compiler: allow conversion to types from external packages 2021-02-08 11:02:45 +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
Evgeniy Stratonikov
f0fe03117a compiler: optimize struct copy a bit
POPITEM is cheaper than PUSH + PICKITEM.
2021-01-19 09:46:01 +03:00
Evgeniy Stratonikov
9b1a7021ba core: add PickN flags to Storage.Find
Allow to pick items by index from serialized struct or array.
2021-01-15 21:12:10 +03:00
Evgeniy Stratonikov
44af99fd07 core: add Deserialize flag to Storage.Find
Allow to deserialize values being iterated over.
2021-01-15 21:12:10 +03:00
Evgeniy Stratonikov
7fc0c04dba core: add flags to Storage.Find
It can be iterated over keys, values or both.
Prefix can be stripped.
2021-01-15 21:12:08 +03:00
Evgeniy Stratonikov
2130e17f0c core,vm: remove System.Enumerator.* interops
Map iterator now returns key-value pair, while array/byte-array
iterators work like old enumerators.
Follow neo-project/neo#2190.
2021-01-15 21:11:32 +03:00
Evgeniy Stratonikov
d04b000748 vm: remove iterator/enumerator Concat API
Follow neo-project/neo#2170.
2021-01-15 21:08:59 +03:00
Evgenii Stratonikov
1c0c331e25 core: update System.Contract.Call syscall
1. Remove `System.Contract.CallEx`.
2. Extend number of parameters.
3. Add return value count to `VM.Context`.
2021-01-14 18:23:36 +03:00
Evgenii Stratonikov
dbe81f9b80 smartcontract: move flags to a separate package 2021-01-14 17:52:09 +03:00
Evgeniy Stratonikov
0b26b46234 state: store NEF instead of script for contract
NEFs for native contracts are set statically, thus
field values are taken from the reference implementation.
2021-01-13 15:34:10 +03:00
Roman Khimov
459ad521ab *: fix misspellings spotted by goreportcard 2020-12-28 17:27:04 +03:00
Roman Khimov
811f38eaed *: gofmt -s 2020-12-28 17:23:30 +03:00
Roman Khimov
ab12eee346 native: move contract deployment to management contract
See neo-project/neo#2119.
2020-12-14 15:23:46 +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
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
Roman Khimov
a3f91ba8c5
Merge pull request #1603 from nspcc-dev/compiler/types
compiler: enforce `Hash160` and `Hash256` size in literals
2020-12-10 14:55:03 +03:00
Roman Khimov
f3e64e08d7
Merge pull request #1602 from nspcc-dev/fix/test
vmcli/test: run shell after providing input
2020-12-10 14:42:30 +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
37a8550215 compiler: add contract.CallEx interop 2020-12-10 13:45:10 +03:00
Evgenii Stratonikov
ec58bec803 compiler: fix global constant traversal
There can be no global variables, but some global constants.
Introduced in 0b44a430.
2020-12-10 13:45:10 +03:00
Evgenii Stratonikov
b807fd9e7f compiler: rename engine.AppCall() to contract.Call() 2020-12-10 13:45:10 +03:00
Evgenii Stratonikov
c7ce9cd4f6 compiler: defer dir removal right after creation 2020-12-10 13:40:29 +03:00
Roman Khimov
d828096cbf
Merge pull request #1599 from nspcc-dev/compiler/debuginfo
compiler: save both VM and smartcontract types
2020-12-09 23:30:59 +03:00