Roman Khimov
e4d821f32d
Merge pull request #546 from nspcc-dev/write-optimizations
...
Write optimizations
2019-12-06 19:40:38 +03:00
Roman Khimov
844491d365
*: use more efficient WriteBytes where appropriate
...
Before this patch on block import we could easily be spending more than 6
seconds out of 30 in Uint256 encoding for UnspentBalance, now it's completely
off the radar.
2019-12-06 18:22:21 +03:00
Evgenii Stratonikov
7179e4ba9f
util: add LE suffix to Uint256 methods
2019-12-06 12:16:55 +03:00
Evgenii Stratonikov
57efad912c
util: add LE suffix to Uint160 methods
2019-12-06 12:16:55 +03:00
Roman Khimov
becd4f2333
vm: force neo-vm tests presence
...
We succeeded this test without running anything real which is certainly not
good and I think we should always run this tests.
2019-12-04 20:30:27 +03:00
Roman Khimov
852e6a335b
compiler: move it up from vm
...
It really deserves it, I think. Especially given that it doesn't have any
direct usage of `vm` package now.
2019-12-03 18:23:46 +03:00
Roman Khimov
8d4dd2d2e1
vm: move opcodes into their own package
...
This allows easier reuse of opcodes and in some cases allows to eliminate
dependencies on the whole vm package, like in compiler that only needs opcodes
and doesn't care about VM for any other purpose.
And yes, they're opcodes because an instruction is a whole thing with
operands, that's what context.Next() returns.
2019-12-03 18:22:14 +03:00
Vsevolod Brekelov
b08387efdb
vm: use BinWriter instead of Buffered version
...
In the future we could reuse emit interface without buf better
2019-12-03 13:50:23 +03:00
Vsevolod Brekelov
f5e2401984
vm: removed logging to fix #457
2019-12-03 13:49:49 +03:00
Vsevolod Brekelov
03ff2976ed
io: refactoring for using WriteVarBytes instead of WriteLE
...
goal is to be consistent with C# implementation.
For writing []byte WriteBytes used and for byte - WriteVarByte.
2019-12-03 13:49:33 +03:00
Vsevolod Brekelov
d02673c112
vm: add bufBinWriter to emit functions in order to catch errors
2019-12-02 13:04:33 +03:00
Roman Khimov
05f3329ec0
vm: add IterBack to the Stack to iterate bottom-to-top
...
And use it to build user-facing stack representation because that's the order
that C# VM uses.
2019-11-27 13:00:11 +03:00
Roman Khimov
f3ed91a1f7
vm: properly convert arrays to stackItems
...
They should be arrays of stackItems, not arrays of values.
2019-11-27 13:00:11 +03:00
Roman Khimov
64e20508e0
vm: use hex for ByteArray JSON marshallization
...
It's way more convenient for different purposes.
2019-11-15 18:04:59 +03:00
Roman Khimov
5ce269c035
core: change notify implementation to save notifications
...
Fixes #453 and makes it possible to refer to these notifications later.
2019-11-15 18:04:59 +03:00
Evgenii Stratonikov
7080b78a6b
vm: fix a bug in collection serialize
...
When encountering already seen stack item we should fail
only if it is a collection. Duplicate Integers or ByteArrays are ok
because they can't lead to recursion.
2019-11-15 12:48:00 +03:00
Evgenii Stratonikov
816d78b5ee
vm: redefine SHL/SHR limits based on integer size
2019-11-07 12:50:11 +03:00
Evgenii Stratonikov
439cd72294
vm: restrict BigInteger item size
2019-11-07 12:34:27 +03:00
Evgenii Stratonikov
6c002297cd
vm: implement json tests from neoVM
...
Add neo-vm submodule @master2.x .
Closes #196 .
2019-11-06 16:22:56 +03:00
Evgenii Stratonikov
7d40d2f71e
vm: make StepOut/StepOver match original VM behavior
2019-11-06 12:25:04 +03:00
Evgenii Stratonikov
9ebb793009
vm: revert SUBSTR offset behavior to NEO 2.x
2019-11-06 12:15:55 +03:00
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