Commit graph

712 commits

Author SHA1 Message Date
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
Roman Khimov
14c02cb3b1
Merge pull request #385 from nspcc-dev/vm-contract-invoke-parameters-332-part1
VM CLI improvements, part 1 of #332 work.
2019-09-10 23:55:23 +03:00
Roman Khimov
9193ec45de
Merge pull request #383 from nspcc-dev/fix_blockchain_test
unitTests: fix for failing test
2019-09-10 23:53:50 +03:00
Roman Khimov
392a4c4f39 vm/cli: add some convenience heuristic to ease 'run' use 2019-09-10 23:31:06 +03:00
Roman Khimov
c5911c2f10 vm/cli: add support for bool type as 'run' parameter 2019-09-10 23:31:06 +03:00
Roman Khimov
982bdcd704 vm/cli: make operation mandatory if anything added to run
Matches neo-cli behavior.
2019-09-10 23:31:06 +03:00
Roman Khimov
5bd666b786 vm: return NOP as current instruction for just loaded VM
Before:
NEO-GO-VM > loadgo h.go
READY: loaded 16 instructions
NEO-GO-VM > ip
instruction pointer at -1 (PUSH0)

After:
NEO-GO-VM > loadgo h.go
READY: loaded 16 instructions
NEO-GO-VM > ip
instruction pointer at -1 (NOP)

I think NOP is a little less scary.
2019-09-10 23:31:06 +03:00
Roman Khimov
e872b6b421 vm/cli: redo the whole thing using abiosoft/ishell
Adds history support, better editing and way better help system. Expand on
some helps while at it.
2019-09-10 23:31:06 +03:00
Vsevolod Brekelov
0f31e7bf7f unitTests: fix for failing test
should fix circleCI and now these tests using inmemory db
2019-09-10 23:21:26 +03:00
Roman Khimov
d51ab52a5e
Merge pull request #386 from nspcc-dev/drop-go-1.11-support
update minimum supported version of Go to 1.12
2019-09-10 22:55:44 +03:00
Roman Khimov
00a290de07 update minimum supported version of Go to 1.12
Go 1.11 is not supported upstream and it also breaks our precious VM for some
reason, so use better versions of Go. Fixes #384.
2019-09-10 20:30:54 +03:00
Roman Khimov
4d7456903b
Merge pull request #377 from nspcc-dev/config_for_db
storage: support of Redis and configuration for DB

Closes #336.
2019-09-10 17:46:31 +03:00
Roman Khimov
c6d3313f82
Merge pull request #382 from nspcc-dev/feature/implicit-stackitem-conversion
VM: implement stack item conversion

Fixes #372.

Also added tests for NOT and SIGN to check new behavior.
Also fixed a bug with Bool casting: it should be != 0 instead of == 1.
2019-09-10 17:42:40 +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
f2393e5efc vm: implement * -> Boolean conversion 2019-09-10 17:29:10 +03:00
Evgenii Stratonikov
7e14c5a274 vm: implement * -> ByteArray conversion 2019-09-10 17:29:07 +03:00
Vsevolod Brekelov
06ecb1855e storage: redis db unit test 2019-09-10 17:22:45 +03:00
Vsevolod Brekelov
4f680703a4 storage: multiple DB support and Redis support
add config which closes #336
add redis db support
2019-09-10 17:22:21 +03:00
Evgenii Stratonikov
9b10b4c4d8 vm: add tests for SIGN 2019-09-10 15:08:42 +03:00
Evgenii Stratonikov
52b0d661e0 vm: implement BigInt -> Boolean conversion 2019-09-10 14:19:36 +03:00
Roman Khimov
33bb371f9b
Merge pull request #380 from nspcc-dev/drop-endpoint-fix-321
util: drop Endpoint structure, fix #321
2019-09-09 19:39:49 +03:00
Roman Khimov
8d9bc83214 util: drop Endpoint structure, fix #321
I think it's useless, buggy and hides parsing errors for no good reason.
2019-09-09 17:54:38 +03:00
Roman Khimov
0055701ec0
Merge pull request #379 from nspcc-dev/fix/left-with-big-index
vm: do not fault on LEFT with big index
2019-09-09 17:39:59 +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
b5d3c37a01
Merge pull request #375 from nspcc-dev/pushbytes-short-read-fix-361
vm: fix not failing PUSHBYTES* on short read
2019-09-09 15:02:56 +03:00
Roman Khimov
c59b51e7ab
Merge pull request #376 from nspcc-dev/use-mr-tron-base58-fix-355
crypto: use mr-tron/base58 for base58
2019-09-09 15:02:24 +03:00
Roman Khimov
bd2e347928 circleci: add Go 1.13 support, use as a reference for coverage
But don't use it for binary builds at the moment.
2019-09-09 14:59:09 +03:00
Roman Khimov
b8b26d8e79 core: fix 'implementation' misspell in test code
Found in the Go report card.
2019-09-09 14:53:50 +03:00
Roman Khimov
8db9d2a976 crypto: use mr-tron/base58 for base58
Use more fast and reliable implementation. Add some tests for our wrappers,
deduplicate code in PublicKey.Adress(). Fixes #355.
2019-09-09 13:12:55 +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
Roman Khimov
90469399d7 Makefile: declare our targets as PHONY
As they are.
2019-09-09 12:02:24 +03:00
Roman Khimov
8de080f6ec Makefile: add some convenience targets
Tiny wrappers to quickly do things needed. Some of them are not that simple to
type into the CLI manually every time.
2019-09-09 12:02:24 +03:00
Roman Khimov
450063de7d
Merge pull request #362 from nspcc-dev/add-missing-opcodes-into-the-list
Add missing opcodes into the list
2019-09-09 11:24:39 +03:00
Roman Khimov
7b0c2781d2 vm: expand instruction list with commands from current VM spec
Current NEO documentation lists them:
https://docs.neo.org/docs/en-us/tooldev/advanced/neo_vm.html

CALL_* instructions were left out because of conflict with golint (but they're
removed in NEO 3.0 anyway, so wasting time on them makes no sense).

Update autogenerated instruction_string.go accordingly.
2019-09-08 20:46:35 +03:00
Roman Khimov
726245c1ec
Merge pull request #360 from nspcc-dev/feature/struct2array
vm: implement Array <-> Struct conversion
2019-09-08 18:38:42 +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
8fac66d4af
Merge pull request #371 from nspcc-dev/fix-some-todo-items
Fix some easy TODO items, refs. #244.
2019-09-07 15:35:36 +03:00
Roman Khimov
8c448ab890 util: add some tests to make GetVarSize() fully covered 2019-09-07 10:28:00 +03:00
Roman Khimov
7e8dc9ad66 vm: uncomment TestForLoopBigIter
It works just fine.
2019-09-07 10:10:11 +03:00
Roman Khimov
1c7d203993 compiler: drop TODO comment, #294 was fixed a while ago 2019-09-07 10:09:42 +03:00
Roman Khimov
8169edf04c vm: expand PUSHBYTES instructions
Allows to reliably use String() on any of those. Update autogenerated
instruction_string.go accordingly.
2019-09-06 19:14:47 +03:00
Roman Khimov
dd357c9119
Merge pull request #357 from nspcc-dev/complete-vm-array-instructions
Add UNPACK, REVERSE, REMOVE, plus some tests for PACK. Fixes #195.
2019-09-06 19:13:03 +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
f362ffcf3c
Merge pull request #358 from nspcc-dev/drop-redundant-dev-code-part-8
_pkg.dev: drop vm. This is the last one in series of #315, #318, #322, #328, #330, #338 and #351, so if finally fixes #307.
2019-09-06 18:54:30 +03:00
Roman Khimov
d4d1c79546 _pkg.dev: drop vm
This is a nice VM, it has an interesting stack items model, better separation
of elements from stack implementation, simpler stack implementation and a bit
nicer opcode implementation mechanism. At the same time it lacks so many
features and is so differing from our current VM (that is closely tied to the
compiler) that it makes its code very hard to reuse for master's VM
improvement.

Also, some differences are non-obvious to judge in terms of better or
worse. Stack item model seems to be more extensible, but at the same time we
know very well what kind of stack items we have and this doesn't change a
lot. Slice-based stack is simple but it's hard to say which one would perform
better for real-world smart contracts (it has different tradeoffs in
operations complexity).

Based on that, I'm dropping it. Some ideas will be reused during VM
refactoring, but no more than that. Refs. #307.
2019-09-06 15:02:18 +03:00
Roman Khimov
5bd50c7bcd vm: add some tests for PACK instruction 2019-09-06 13:15:30 +03:00
Roman Khimov
0feaaabe61
Merge pull request #356 from nspcc-dev/add-vm-string-instructions
vm: implement CAT, SUBSTR, LEFT and RIGHT
2019-09-06 13:14:44 +03:00