Commit graph

188 commits

Author SHA1 Message Date
Evgenii Stratonikov
bdaffe75cb vm: extend PrintOps() with INITSSLOT & INITSLOT 2020-06-26 19:35:03 +03:00
Evgenii Stratonikov
82417499d7 vm: beautify PrintOps() output for JMP* instructions 2020-06-26 19:34:58 +03:00
Evgenii Stratonikov
709f656bcf vm: remove unused parameter from getJumpOffset 2020-06-26 19:17:17 +03:00
Roman Khimov
a77357227a vm: fix caller's script hash returned from VM
Regular CALLs don't update it, only Contract.Call does. Fixes the following
mismatch on preview2 testnet:

file BlockStorage_100000/dump-block-49000.json: block 48644, changes number mismatch: 6 vs 4
2020-06-24 10:22:21 +03:00
Evgenii Stratonikov
a7d4fff897 vm: make (*VM).GasLimit public
VM is inherently single-threaded and replacing setter/getter methods
with public field simplifies code a bit.
2020-06-16 15:13:20 +03:00
Evgenii Stratonikov
f2f01a08c9 vm: move MaxArraySize and MaxItemSize to stackitem package 2020-06-16 11:32:16 +03:00
Evgenii Stratonikov
4dfce07d11 vm: provide trigger upon VM creation 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
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
Evgenii Stratonikov
9dca2288ba vm: make LEFT fail if count is too big 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
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
3917b4b4e4 vm: update stack size in SETITEM properly 2020-05-21 18:00:51 +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
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
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
1d3fb3d6f5 vm: implement PUSHA/CALLA opcodes 2020-05-12 12:56:51 +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
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
Evgenii Stratonikov
d18199ce42 vm: implement REVERSE* opcodes
Use new opcodes in the compiler instead of XSWAP/ROLL.
2020-05-06 13:03:49 +03:00
Evgenii Stratonikov
c8a1188ee1 vm: implement CLEAR opcode 2020-05-06 13:02:57 +03:00
Evgenii Stratonikov
525527f750 vm: reorder stack opcodes
Leave *ALTSTACK opcodes for now as they are needed in compiler while
slot opcodes are not yet here.
2020-05-06 13:02:14 +03:00
Evgenii Stratonikov
115919aaf7 vm: process OLDPUSH1 at the context level
The only usecase for this opcode is single-byte verification scripts.
2020-05-06 13:00:00 +03:00
Anna Shaleva
5ece9922c1 vm: hide GetContextScriptHash() method
After adding ScriptHashGetter interface to vm, there's no need in
GetContextScriptHash() to be exported.
2020-05-04 11:53:31 +03:00
Anna Shaleva
73167999cc core: add cosigners field to transaction
closes #864
2020-05-04 11:53:31 +03:00
Evgenii Stratonikov
9081211f12 vm: implement NOTEQUAL opcode 2020-04-30 18:00:15 +03:00
Evgenii Stratonikov
70f0c656b0 vm: check Integer size on creation 2020-04-30 18:00:15 +03:00
Evgenii Stratonikov
a64a0f2681 vm: reorder arithmetic opcodes 2020-04-30 18:00:15 +03:00
Evgenii Stratonikov
519b31a704 vm: remove crypto-related opcodes
All cryptography has moved to interops in NEO3.
There is no SHA256 interop RN, but it is to appear later.
Closes #777.
2020-04-29 19:16:38 +03:00
Evgenii Stratonikov
7e98a2ffa0 vm: implements CONVERT opcode 2020-04-28 16:38:52 +03:00
Evgenii Stratonikov
7c3d7c0261 vm: implement NEWARRAYT opcode 2020-04-27 09:06:48 +03:00
Evgenii Stratonikov
d3b9aef8e2 vm: implement ISTYPE opcode
Also make StackItemType public and reorder it according to NEO3.
2020-04-27 09:01:26 +03:00
Evgenii Stratonikov
48a41bd737 vm: implement CLEARITEMS opcode 2020-04-27 09:01:26 +03:00
Evgenii Stratonikov
9fd04aefa5 vm: implement NEWARRAY0 and NEWSTRUCT0 opcodes 2020-04-24 13:49:10 +03:00
Evgenii Stratonikov
03761421f8 vm: reorder Array/Map opcodes
Also SIZE can be used for both Arrays/Maps and ByteArrays.
2020-04-24 13:48:44 +03:00
Evgenii Stratonikov
d6624a92ca vm: implement new JMP* and CALL* opcodes
In compiler JMP*_L opcodes are always used, as this requires less effort.
2020-04-24 10:16:41 +03:00
Evgenii Stratonikov
fba185cd99 vm: remove stack isolation opcodes
They are not present in NEO3 and will be creating additional difficulties
during future flow-control opcodes implementation.
2020-04-24 10:15:14 +03:00
Evgenii Stratonikov
008e6eb233 vm: implement new PUSH opcodes 2020-04-23 10:52:28 +03:00
Evgenii Stratonikov
cde4ccf01c vm: remove CHECKSIG/VERIFY/CHECKMULTISIG opcodes 2020-04-20 11:55:24 +03:00
Evgenii Stratonikov
4740d937aa vm: dont use SetCheckedHash outside of vm package 2020-04-20 11:55:24 +03:00