Roman Khimov
f0cffe0d3f
vm: implement stack isolation opcodes, fix #192
...
No tests yet.
2019-10-25 18:25:12 +03:00
Roman Khimov
1250bf9579
Merge pull request #443 from nspcc-dev/spellcheck
...
spellcheck and comments fix
2019-10-22 18:01:40 +03:00
Vsevolod Brekelov
8ee421db14
fix spelling and godoc comments
2019-10-22 17:56:03 +03:00
Roman Khimov
a9a2a3c711
vm: fix tests failing, follow-up to #426
...
Deal with input and transitional VM states properly.
2019-10-22 15:20:44 +03:00
Roman Khimov
3cbb699eb7
Merge pull request #426 from nspcc-dev/logger_247
...
Change fmt.Println to log, close #247 .
2019-10-22 14:41:30 +03:00
Roman Khimov
558a25cbd2
Merge pull request #438 from nspcc-dev/fix/437
...
vm: copy slice in NEWARRAY/NEWSTRUCT
Fixes #437 .
2019-10-22 14:36:32 +03:00
Vsevolod Brekelov
e2bfff8666
vm: removed mute mode and pushed logging to upper lvl
...
VM should be responsible for code execution and in case anyone interested in additional logging or errors they could handle them like we do it iin cli.
2019-10-22 13:44:14 +03:00
Evgenii Stratonikov
b2609786e9
vm: copy slice in NEWARRAY/NEWSTRUCT
...
When performing NEWARRAY on a Struct or NEWSTRUCT on a Array,
underlying slice needs to be copied, because when it's capacity
doesn't matches it's length, underlying storage will be used
for appends even if it is already pointed at by another slice.
2019-10-22 13:34:35 +03:00
Vsevolod Brekelov
f2805541cb
vm: fix style and comments
2019-10-21 14:22:17 +03:00
Vsevolod Brekelov
fe39c565b9
codestyle: redundant type conversion
2019-10-18 18:39:31 +03:00
Vsevolod Brekelov
1afdb895a1
codestyle: declare empty slice
...
https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
2019-10-18 18:38:33 +03:00
Vsevolod Brekelov
3560ada669
codestyle: use camel case
2019-10-18 18:36:54 +03:00
Vsevolod Brekelov
59e3bd2fa9
codestyle: fix error string should not be capitalized
2019-10-18 18:34:58 +03:00
Vsevolod Brekelov
0daef50b9d
cli: fix for error wrapping
2019-10-17 18:23:49 +03:00
Vsevolod Brekelov
5b81110d16
cli: print logo via shell
2019-10-17 18:23:49 +03:00
Evgenii Stratonikov
487570153b
vm: restrict max item size in PUSHDATA4
2019-10-17 17:10:00 +03:00
Evgenii Stratonikov
cae431b844
vm: restrict max item size in CAT
2019-10-17 17:09:42 +03:00
Evgenii Stratonikov
6d7016c3b9
vm: restrict max size in SETITEM
2019-10-17 12:17:06 +03:00
Evgenii Stratonikov
6f1f9e56bb
vm: restrict max size in PACK
2019-10-17 12:17:06 +03:00
Evgenii Stratonikov
2d56c66bde
vm: restrict max size in APPEND
2019-10-17 12:17:01 +03:00
Evgenii Stratonikov
8abcaeee6f
vm: restrict max size in NEWARRAY/NEWSTRUCT
2019-10-17 11:48:48 +03:00
Roman Khimov
4822c736bb
Merge pull request #418 from nspcc-dev/various-verification-fixes2
...
Transaction verification fixes, interops and block verification. Fixes #12 .
2019-10-15 19:11:00 +03:00
Roman Khimov
d007cc00cc
vm: add script check functions
...
These are required for future interops.
2019-10-15 12:56:25 +03:00
Roman Khimov
acb7ef7fbd
vm: support uint8 and uint64 in makeStackItem()
...
Convenience to avoid casts, uint64 is also a bit special in that it can't be
converted to int64 without data loss.
2019-10-15 12:56:25 +03:00
Roman Khimov
782ca64d92
vm: accept uint16 in makeStackItem()
2019-10-15 12:56:25 +03:00
Vsevolod Brekelov
5109b2e3e7
vm: fix cli comment
2019-10-14 18:38:05 +03:00
Vsevolod Brekelov
591d5eafbe
vm: add stepInto,stepOver,stepOut
...
Original C# vm debugger behavior
2019-10-14 18:37:11 +03:00
Roman Khimov
dca332f333
vm: use new Context.Next() to properly dump programs
...
Fix #295 , deduplicate code and add `inspect` parameter to the vm command to
dump AVMs (`contract inspect` works with Go code).
2019-10-04 16:13:39 +03:00
Roman Khimov
53a3b18652
vm: completely separate instruction read and execution phases
...
Make Context.Next() return both opcode and instruction parameter if any. This
simplifies some code and needed to deal with #295 .
2019-10-04 16:13:39 +03:00
Roman Khimov
1bf232ad50
vm: introduce TryBool() for Element and use it in VerifyWitnesses
...
Script can return non-bool results that can still be converted to bool
according to the usual VM rules. Unfortunately Bool() panics if this
conversion fails which is OK for things done in vm.execute(), but certainly
not for VerifyWitnesses(), thus there is a need for TryBool() that will just
return an error in this case.
2019-10-04 16:13:39 +03:00
Roman Khimov
8441b31b4b
vm: accept uint32 in makeStackItem()
...
Interop services routinely push such things (block index, blockchain height)
onto the stack.
2019-10-04 16:13:39 +03:00
Roman Khimov
d62a367900
vm: add Value() method to Element
...
It gives access to the internal value's Value() which is essential for interop
functions that need to get something from InteropItems. And it also simplifies
some already existing code along the way.
2019-10-04 16:13:39 +03:00
Roman Khimov
0c963875af
vm: check for fault flag first in Run()
...
Switch cases are evaluated sequentially and the fault case is top-priority to
handle.
2019-10-04 16:13:39 +03:00
Roman Khimov
705c7f106f
vm: don't panic if there is no result in PopResult()
...
This function is intended to be ran outside of the execute's panic recovery
mechanism, so it shouldn't panic if there is no result.
2019-10-04 16:13:39 +03:00
Roman Khimov
a357d99624
vm: introduce MaxArraySize constant
...
This is both for #373 and for interop functions that have to check some
inputs.
2019-10-04 16:13:39 +03:00
Roman Khimov
cfa0c13322
vm: add InteropItem type for interop data
...
This is an opaque data item that is to be used by the interop functions.
2019-10-04 16:13:39 +03:00
Roman Khimov
da2156f955
vm: add batched RegisterInteropFuncs
2019-10-04 16:13:39 +03:00
Roman Khimov
26e3b6abbe
vm: extend interops to contain price
...
The same way C# node does.
2019-10-04 16:13:39 +03:00
Roman Khimov
ceca9cdb67
core/vm: implement contract storage and script retrieval
...
Fixes script invocations via the APPCALL instruction. Adjust contract state
field types accordingly.
2019-10-04 16:13:39 +03:00
Roman Khimov
c3591d8897
vm: fix CHECKMULTISIG to comply with NEO VM implementation
...
Testing with testnet quickly revealed that our code has an issue when the key
count doesn't equal signature count, fix it and add some comments.
2019-10-01 13:41:26 +03:00
Evgenii Stratonikov
c7c4291774
vm: simplify APPEND implementation a bit
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
13d7770c68
vm: support Map in ARRAYSIZE
...
Also make logic the same as in reference implementation
and add tests.
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
c66f493017
vm: compare Map by reference in EQUAL
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
c0be2b2a99
vm: support Map in REMOVE
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
8b6bddca3c
vm: support Map in PICKITEM and SETITEM
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
d7bb50c609
vm: implement VALUES opcode
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
2da64267b0
vm: implement KEYS opcode
2019-09-25 17:53:34 +03:00
Evgenii Stratonikov
0fb4bb05cf
vm: implement HASKEY opcode
2019-09-25 12:08:41 +03:00
Evgenii Stratonikov
df18da0ac9
vm: implement NEWMAP opcode
2019-09-24 17:06:17 +03:00
Roman Khimov
ca9c9be71f
vm: add CHECKSIG/VERIFY/CHECKMULTISIG implementations
...
Fix #269 .
2019-09-24 13:01:54 +03:00