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
Roman Khimov
91f8626c42
vm: disallow negative shifts for SHL/SHR
...
Follow neo-project/neo-vm#257 change for Neo 3.
2020-04-19 19:15:00 +03:00
Evgenii Stratonikov
ceff8736f2
vm: use ID-based syscalls
...
In NEO3 SYSCALL opcode has 4-byte ID parameter.
This commit removes support for string-based syscalls and
changes SYSCALL's parameter to be fixed 4-byte value.
2020-04-17 11:46:31 +03:00
Evgenii Stratonikov
bfbbef952a
vm: move InteropNameToID to emit package
2020-04-17 11:46:31 +03:00
Evgenii Stratonikov
2fd26287c5
vm: update SUBSTR to NEO3 version
...
This reverts commit 9ebb793009
.
2020-04-17 11:46:31 +03:00
Evgenii Stratonikov
948729137f
vm: remove HASH160/HASH256 opcodes
2020-04-13 13:47:39 +03:00
Evgenii Stratonikov
c23af595c9
core: implement Neo.Crypto.ECDsaCheckMultisig interop
2020-04-13 13:47:39 +03:00
Evgenii Stratonikov
1611ede58c
crypto/keys: implement NewPublicKeyFromBytes()
...
It is convenient to have a single function instead of
allocating new `PublicKey` and using `DecodeBytes()` on it.
2020-04-13 13:13:15 +03:00
Roman Khimov
5a22651e36
Merge pull request #784 from nspcc-dev/neo3/null
...
vm: support NULL stack item
2020-04-10 10:38:17 +03:00
Evgenii Stratonikov
96806262bf
vm: handle negative arguments in SHL/SHR
...
Do it as in reference implementation: a >> -b == a << b.
2020-04-06 10:46:35 +03:00
Evgenii Stratonikov
0023c4f1f6
vm: use truncated division in MOD
...
Mimic C#'s `%` behavior.
Related 4b44190
(#773 ).
2020-04-06 09:30:48 +03:00
Evgenii Stratonikov
f7f48d0048
vm: implement ISNULL opcode
2020-04-02 14:15:17 +03:00
Evgenii Stratonikov
3db030bbb6
vm: implement PUSHNULL opcode
2020-04-02 14:15:17 +03:00
Roman Khimov
2d0ad30fcf
vm: rework Map with internal slice representation
...
Which makes iterating over map stable which is important for serialization and
and even fixes occasional test failures. We use the same ordering here as
NEO 3.0 uses, but it should also be fine for NEO 2.0 because it has no
defined order.
2020-04-01 19:33:53 +03:00
Evgenii Stratonikov
4522eed1bb
vm: fix offset for CALLI opcode
...
It is different from other JMP* and +2 should be added to the parameter.
2020-03-26 13:09:55 +03:00
Evgenii Stratonikov
4b44190485
vm: use truncated division for Integers
...
When divisor is negative, the result is truncated towards
zero.
2020-03-17 15:45:56 +03:00
Roman Khimov
1b5dd53e07
Merge pull request #746 from nspcc-dev/fix/equal
...
vm: implement EQUAL opcode properly
Fixes #745 , #749 .
2020-03-12 11:46:51 +03:00
Evgenii Stratonikov
dfc59129c7
vm: implement EQUAL opcode properly
...
When comparing elements of different types, conversions
should be performed. This commit implement custom equality
predicate for each stack item type.
2020-03-11 17:19:10 +03:00
Roman Khimov
8318adac56
vm: add support for dynamic invocations in APPCALL
...
Fixes #740 .
2020-03-10 17:17:36 +03:00
Roman Khimov
e41d434a49
*: move all packages from CityOfZion to nspcc-dev
2020-03-03 17:21:42 +03:00
Roman Khimov
56e37ad6ba
vm: drop duplicating stackItem structure, build JSON from Parameters
...
smartcontract.Parameter has everything needed now.
2020-03-03 15:38:03 +03:00
Evgenii Stratonikov
2a86149c82
vm: leave single CHECKMULTISIG implementation
...
Remove sequential implementation and benchmarks.
They will be still present in commit history.
2020-02-05 17:17:22 +03:00
Roman Khimov
02a5e036fc
vm: deduplicate checkMultisigPar
...
Make its logic more clear.
2020-02-05 17:12:23 +03:00
Evgenii Stratonikov
d93d060010
vm: parallelize CHECKMULTISIG
2020-02-05 17:12:18 +03:00