Evgenii Stratonikov
0dd00a49f5
core: specify require call flags in interop description
...
Related #1026 , #1027 , #1028 , #1031 .
2020-06-11 13:16:07 +03:00
Evgenii Stratonikov
bda94c74c3
vm: check calling flags on syscall invocation
2020-06-11 13:16:07 +03:00
Evgenii Stratonikov
55ab7535be
core: optimize contractCallEx
...
Provide script hash upon script load.
2020-06-11 13:06:10 +03:00
Evgenii Stratonikov
5514b3f52f
smartcontract,vm: remove DynamicInvoke feature
...
It doesn't exist in NEO3.
2020-06-11 10:45:25 +03:00
Evgenii Stratonikov
7256efd1ed
vm: implement (*VM).AddGas
...
Calculating interop prices can be tricky. It is more convenitent to burn
gas inside interops where necessary parameters are popped.
2020-06-11 10:45:25 +03:00
Evgenii Stratonikov
0472a0b0b1
core: move Neo.Runtime/Enumerator/Iterator.* interops to System.*
2020-06-10 12:13:35 +03:00
Anna Shaleva
d0ccf456c4
vm: replace hardcoded Bool type constant with BooleanT type
...
There's no import cycle problem anymore, so we can do this. Part of #912
2020-06-08 13:27:13 +03:00
Anna Shaleva
7ca2807875
vm/encoding: move bigint from vm to encoding package
2020-06-08 13:27:13 +03:00
Anna Shaleva
783f5ecb01
vm: move StackItem to a separate package
...
closes #912
2020-06-08 13:27:08 +03:00
Roman Khimov
35b30ccfdf
core: drop OLDPUSH1, it's no longer needed
...
Fixes #927 .
2020-06-05 19:20:16 +03:00
Evgenii Stratonikov
d26758dd31
vm/tests: restore NEO3 JSON tests
...
The only skipped RN are ROT.json (see #927 ) and MEMCPY.json (not a valid
JSON).
2020-05-22 14:17:15 +03:00
Evgenii Stratonikov
673e6c84d1
vm/tests: preserve order when decoding Map item.
...
When using Go's `map` for decoding, order can change from time to time,
while we may want to check it too. Use custom decoder for saving items
in order.
2020-05-22 14:17:15 +03:00
Evgenii Stratonikov
9dca2288ba
vm: make LEFT fail if count is too big
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
22791272bf
vm/tests: compare static slot contents in JSON tests
...
Make use of "staticFields" test field to compare vm static slots.
Also remove altStack because it is doesn't exist.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
16bf72f9cc
vm/tests: do not load empty script
...
In case we load a zero-length script, VM should end in HALT state.
https://github.com/neo-project/neo-vm/blob/master/tests/neo-vm.Tests/Tests/Others/OtherCases.json#L22
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
86c4f1abc5
vm: do not use State as a mask
...
In NEO2 state could be used as a mask, but now it contains only a single
value.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
063c29636b
vm: fail if NEWSTRUCT/NEWARRAY argument is not an integer
...
NEO3 VM does not support creating new Array from a Struct.
For this purpose CONVERT opcode is used.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
1a0290edc6
vm: copy slice when converting between Array<->Struct
...
Related #437 . Becase in NEO3 NEWSTRUCT/NEWARRAY accept only an integer
change tests too.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
781def735d
vm: use Null item as a default value for Array/Struct elements
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
f4fa712440
vm: make PUSH0 emit Integer
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
820b050b18
vm/tests: make test interop push non-nil InteropItem
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
a44acd25bb
vm/tests: restore JSON tests parsing
...
Make sure we support new test format. Tests itself will be restored
later.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
61b1722745
opcode: swap ROT and OLDPUSH1
...
Because of how stringer generates String() method, the first of them
will be used as the result.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
646c247b31
vm/tests: unmarshal Map keys properly in JSON tests
2020-05-22 14:16:31 +03:00
Evgenii Stratonikov
128a99dec2
vm/tests: unmarshal action in JSON tests properly
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
7ddb23abe3
vm/tests: unmarshal stack items in JSON tests properly
...
New item types were added in NEO3 and they can be capitalized or not.
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
e71cc04c70
vm/tests: unmarshal VM state in JSON tests properly
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
0c7b163280
vm/tests: unmarshal script in JSON tests properly
...
Script is no specified via stringified opcodes and their arguments.
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
1100f629df
opcode: implement FromString()
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
e53055a560
opcode: use underscored names in String()
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
3917b4b4e4
vm: update stack size in SETITEM properly
2020-05-21 18:00:51 +03:00
Anna Shaleva
7acf5b2841
core: add SystemFee and NetworkFee to transaction
...
closes #831
2020-05-20 23:26:48 +03:00
Evgenii Stratonikov
98c508d361
vm: implement MEMCPY opcode
...
MEMCPY copies byte-slice to a destination buffer.
2020-05-20 17:45:56 +03:00
Evgenii Stratonikov
a5f6e0e53d
vm: implement NEWBUFFER opcode
2020-05-20 17:45:56 +03:00
Evgenii Stratonikov
a3a3a77431
vm: make slice opcodes emit Buffer
2020-05-20 17:45:56 +03:00
Evgenii Stratonikov
c3f7832f3b
vm: implement Buffer stack item
...
Buffer is a stack item type introduced in NEO3
which represents mutable byte-array.
2020-05-20 17:45:56 +03:00
Evgenii Stratonikov
ee9adcdc5c
vm: check ByteArray size before converting to Integer
2020-05-20 17:45:56 +03:00
Evgenii Stratonikov
8f5f6fba07
vm: copy slice in (*ByteArrayItem).TryBytes()
2020-05-20 17:45:56 +03:00
Evgenii Stratonikov
0cb6dc47e4
vm: implement slot-related opcodes
...
1. Slot is a new mechanism for storing variables during execution
which is more convenient than alt.stack. This commit implements
support for slot opcodes in both vm and compiler.
2. Remove old alt.stack opcodes.
3. Do not process globals at the start of every function, but instead
load them single time at main.
2020-05-12 16:23:08 +03:00
Evgenii Stratonikov
a6271f6bf2
vm: reorder splice opcodes
2020-05-12 16:15:35 +03:00
Evgenii Stratonikov
2cec088f08
vm: add reference counter to slots
2020-05-12 16:15:14 +03:00
Evgenii Stratonikov
af2abedd86
vm: implement reference counter
...
It is convenient to have all reference-counting logic
in a separate struct.
2020-05-12 16:15:14 +03:00
Evgenii Stratonikov
81cbf183af
vm: implement storage slots
2020-05-12 16:15:14 +03:00
Evgenii Stratonikov
1d3fb3d6f5
vm: implement PUSHA/CALLA opcodes
2020-05-12 12:56:51 +03:00
Evgenii Stratonikov
7fcd537b09
vm: implement Pointer stack item
...
Pointer is a generic address type in VM.
It is used for calling lambda-expressions.
2020-05-12 12:55:31 +03:00
Evgenii Stratonikov
c0147c76ac
emit: remove tailCall argument from AppCall
...
There is no TAILCALL opcode in NEO3.
2020-05-07 14:59:01 +03:00
Evgenii Stratonikov
73c82584a3
vm,compiler: replace APPCALL with System.Contract.Call
...
Contract calls are performed via syscall System.Contract.Call
in NEO3. This implements this in compiler and removes APPCALL from the
VM.
2020-05-07 14:52:03 +03:00
Evgenii Stratonikov
f9f3192b48
vm: move RET and SYSCALL opcodes
2020-05-07 13:23:05 +03:00
Evgenii Stratonikov
977c431bf1
vm: implement ASSERT/ABORT opcodes
...
Rename THROWIFNOT to ASSERT, add ABORT opcode.
ABORT cannot be caught, but the implementation should be postponed until
exception handling is implemented.
2020-05-06 15:54:19 +03:00
Evgenii Stratonikov
dd20320615
vm: remove XSWAP/XTUCK opcodes
...
Regenerate RPC testchain as these were used in compiler.
2020-05-06 13:05:22 +03:00