Evgenii Stratonikov
4c688355bc
vm: revert bool -> []byte conversion to NEO 2.x
2019-11-06 12:15:48 +03:00
067d9655bf
vm: restrict total stack item count
2019-11-06 11:03:43 +03:00
ed758458d5
vm: implement serialization interops in core package
2019-11-05 17:10:52 +03:00
412582dc78
vm: add more serialization tests
2019-11-05 17:04:14 +03:00
59f9c2bddc
vm: implement Array and Struct item serialization
2019-11-05 16:58:09 +03:00
e1d019e087
vm: implement Map item serialization
2019-11-05 16:57:48 +03:00
cd690803cf
vm: implement BigInteger item serialization
2019-11-05 15:15:43 +03:00
25f77257ce
vm: implement Boolean and ByteArray item serialization
2019-11-05 15:15:39 +03:00
Roman Khimov
2f6e678a19
Merge pull request #463 from nspcc-dev/smartcontract-fixes
...
Smartcontract RPC fixes
2019-10-29 20:54:46 +03:00
Roman Khimov
94776b8a1f
vm: add MarshalJSON to the Stack
...
To easily dump it in a known format.
2019-10-29 18:26:59 +03:00
Roman Khimov
47f66dfbf3
vm: add State() method to get a state description
2019-10-29 18:26:04 +03:00
c7f0b7bd68
vm: restrict max invocation stack size
2019-10-29 15:09:17 +03:00
Roman Khimov
579aa31ddd
compiler: drop useless options parameter to Compile()
...
It's not used in any way there.
2019-10-29 13:02:54 +03:00
Roman Khimov
e319c6c638
cli: move avm inspect from vm to contract command
...
Make inspect work with avms by default and with go files if told so. In the
end this makes our CLI interface more consistent and usable. Drop useless
CompileAndInspect() compiler method along the way.
2019-10-29 12:56:44 +03:00
Roman Khimov
ae7687422c
vm: clear state in Load()
...
Make VM usable after the first run.
2019-10-29 12:53:09 +03:00
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