Roman Khimov
fc1075bf75
vm: protect PUSHDATA from short reads
...
Same thing done in a2a8981979
for PUSHBYTES,
failing to read the amount of bytes specified should lead to FAULT. Also
makes readUint16() and readUint32() panic as this is the behavior we want in
these cases. Add some tests along the way.
2019-09-11 12:35:37 +03:00
Evgenii Stratonikov
31f4c7486b
vm: add tests for CAT
2019-09-10 17:33:42 +03:00
Evgenii Stratonikov
1289d0f7e9
vm: add tests for NOT
2019-09-10 17:29:10 +03:00
Evgenii Stratonikov
9b10b4c4d8
vm: add tests for SIGN
2019-09-10 15:08:42 +03:00
Evgenii
0b58ed4a22
vm: do not fault on LEFT with big index
...
Fixes #378 .
2019-09-09 17:29:31 +03:00
Roman Khimov
a039ae6cdb
Merge pull request #374 from nspcc-dev/makefile-and-gofmt
...
Makefile convenience targets and gofmt
2019-09-09 15:05:12 +03:00
Roman Khimov
a2a8981979
vm: fix not failing PUSHBYTES* on short read
...
Add some tests also. Fixes #361 .
2019-09-09 12:09:05 +03:00
Roman Khimov
fabd11699a
*: gofmt -s
...
Appy gofmt for all the source tree.
2019-09-09 12:02:24 +03:00
Evgenii
bcc8234155
vm: implement Array <-> Struct conversion
...
Reference VM implementation supports convertation from
Struct to Array via NEWARRAY and vice versa.
https://github.com/neo-project/neo-vm/pull/91
2019-09-08 13:40:21 +03:00
Roman Khimov
aefe572df3
vm: implement UNPACK, REVERSE, REMOVE opcodes
...
Also expand makeStackItem() to accept slices of int for testing
convenience. Fixes #195 .
2019-09-06 19:00:34 +03:00
Roman Khimov
5bd50c7bcd
vm: add some tests for PACK instruction
2019-09-06 13:15:30 +03:00
Roman Khimov
b3ed3d24ee
vm: implement CAT, SUBSTR, LEFT and RIGHT
...
String instruction set.
2019-09-06 12:41:27 +03:00
Roman Khimov
59de72f446
vm: implement INVERT instruction
2019-09-05 17:35:30 +03:00
Roman Khimov
b494e094c0
vm: add XDROP implementation
2019-09-05 17:35:30 +03:00
Roman Khimov
974f5db6bc
vm: add a TUCK implementation with tests
...
Also fix stack's InsertAt for the edge case of inserting into a position that
currently is empty (the first good TUCK test illustrates this).
2019-09-05 17:35:30 +03:00
Roman Khimov
eb224aeebe
vm: add some checks for OVER and PICK, add OVER tests
...
These actually behaved correctly because of deferred sigsegv recover, but I
think it would be nice to print something more meaningful for users.
2019-09-05 17:35:30 +03:00
Roman Khimov
85831e3e92
vm: fix XTUCK implementation, add tests
...
The code that we have actually implements XTUCK and not TUCK. And it's a bit
broken, so fix it and add some tests. The most interesting one (that required
to touch stack code) is the one when we have 1 element on the stack and are
trying to tell XTUCK to push 2 elements deep.
2019-09-05 17:34:25 +03:00
Roman Khimov
5f0f9e1638
vm: implement PICK instruction
2019-09-05 15:18:04 +03:00
Roman Khimov
b34a1b6c25
vm: harden tests against VM failures
...
Add a check for failed VM state, some of tests using logic values (like NZ
test) can succeed even with VM in FAULT state otherwise.
2019-09-05 15:09:08 +03:00
Roman Khimov
fcf9c1213b
vm: implement the NZ opcode
2019-09-05 15:05:44 +03:00
Roman Khimov
33c512032f
vm: switch from Opcode to Instruction
...
Which matches the changes done in neo-storm and also make this codebase closer
to the `dev` branch (that also uses Instruction).
2019-08-14 15:40:31 +03:00
Evgeniy Kulikov
f000b76879
[FIX] Formatting and code-style ( #118 )
...
* [FIX] Formatting and code-style
- gofmt
- import resort
- prealloc slices
- simplify code
* fix vet
2019-01-25 12:20:35 +01:00
Anthony De Meulemeester
4bd5b2812e
Optimisations and API changes for smart contracts ( #67 )
...
* support VM to pass method and arguments to a script.
* added support for type assertions in smartcontracts.
* added native vm support for print.
* moved VM API packages to vm -> API
* reverted the native Print opcode in favor of runtime.Log
* added support for registering custom interop hooks in the VM.
* Updated README
* Updated compiler with @OPTIMIZE tags
* Moved more tests to VM package.
* optimized and refactored compiler and vm API
* updated README with new smartcontract apis
* bumped version
2018-04-10 11:45:31 +02:00