Evgeniy Stratonikov
cff8b1c24e
stackitem: use Bool
item directly
...
It is always copied.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-12 17:53:36 +03:00
Roman Khimov
de5e61588d
vm: simplify some test code
...
gosimple: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix`
2021-05-12 18:44:35 +03:00
Evgenii Stratonikov
dbe81f9b80
smartcontract: move flags to a separate package
2021-01-14 17:52:09 +03:00
Roman Khimov
77ea3d361b
vm: update neo-vm tests, simplify parsing
...
We no longer have "*N" notation, see neo-project/neo-vm#326 .
2020-08-22 23:35:29 +03:00
Roman Khimov
0e2784cd2c
always wrap errors when creating new ones with fmt.Errorf()
...
It doesn't really change anything in most of the cases, but it's a useful
habit anyway.
Fix #350 .
2020-08-07 12:21:52 +03:00
Roman Khimov
5ef08f60ae
remove github.com/pkg/errors from dependencies
...
It's not needed any more with Go 1.13 as we have wrapping/unwrapping in base
packages. All errors.Wrap calls are replaced with fmt.Errorf, some strings are
improved along the way.
2020-08-07 12:21:52 +03:00
Evgenii Stratonikov
51ae12e4fd
*: move syscall handling out of VM
...
Remove interop-related structures from the `vm` package.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-29 13:41:08 +03:00
fyrchik
b187dfe3ce
Merge pull request #1236 from nspcc-dev/rpc/getrawmempool
...
rpc: update `getrawmempool` and `getrawtransaction` RPC-calls
2020-07-29 10:18:51 +03:00
Anna Shaleva
70ef733ce7
core, vm: store VMState as byte instead of string
...
Part of #1183
2020-07-29 10:14:08 +03:00
Evgenii Stratonikov
6ecd1ae437
vm: allow to initialize static slot in method
2020-07-27 13:00:35 +03:00
Evgenii Stratonikov
299491080a
vm: simplify interop id in json tests
2020-07-24 10:44:02 +03:00
Evgenii Stratonikov
68ad620af0
vm: update json tests to master
2020-07-24 10:44:02 +03:00
Anna Shaleva
8fde41001e
core, vm: remove allowed triggers from syscalls
...
Closes #1205 .
2020-07-23 20:44:39 +03:00
Roman Khimov
1bb26dcdc1
vm: fix INITSSLOT, it's context-wide, not VM-wide
...
It's tied to the current contract, not to VM.
2020-07-09 15:00:49 +03:00
Evgenii Stratonikov
4dfce07d11
vm: provide trigger upon VM creation
2020-06-11 13:16:07 +03:00
Evgenii Stratonikov
bda94c74c3
vm: check calling flags on syscall invocation
2020-06-11 13:16:07 +03:00
Anna Shaleva
7ca2807875
vm/encoding: move bigint from vm to encoding package
2020-06-08 13:27:13 +03:00
Anna Shaleva
783f5ecb01
vm: move StackItem to a separate package
...
closes #912
2020-06-08 13:27:08 +03:00
Roman Khimov
35b30ccfdf
core: drop OLDPUSH1, it's no longer needed
...
Fixes #927 .
2020-06-05 19:20:16 +03:00
Evgenii Stratonikov
d26758dd31
vm/tests: restore NEO3 JSON tests
...
The only skipped RN are ROT.json (see #927 ) and MEMCPY.json (not a valid
JSON).
2020-05-22 14:17:15 +03:00
Evgenii Stratonikov
673e6c84d1
vm/tests: preserve order when decoding Map item.
...
When using Go's `map` for decoding, order can change from time to time,
while we may want to check it too. Use custom decoder for saving items
in order.
2020-05-22 14:17:15 +03:00
Evgenii Stratonikov
22791272bf
vm/tests: compare static slot contents in JSON tests
...
Make use of "staticFields" test field to compare vm static slots.
Also remove altStack because it is doesn't exist.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
820b050b18
vm/tests: make test interop push non-nil InteropItem
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
a44acd25bb
vm/tests: restore JSON tests parsing
...
Make sure we support new test format. Tests itself will be restored
later.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
646c247b31
vm/tests: unmarshal Map keys properly in JSON tests
2020-05-22 14:16:31 +03:00
Evgenii Stratonikov
128a99dec2
vm/tests: unmarshal action in JSON tests properly
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
7ddb23abe3
vm/tests: unmarshal stack items in JSON tests properly
...
New item types were added in NEO3 and they can be capitalized or not.
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
e71cc04c70
vm/tests: unmarshal VM state in JSON tests properly
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
0c7b163280
vm/tests: unmarshal script in JSON tests properly
...
Script is no specified via stringified opcodes and their arguments.
2020-05-22 13:36:11 +03:00
Evgenii Stratonikov
f5933c83c6
vm: update json tests to neo3 branch
...
Skip them until all opcodes will be implemented.
2020-04-17 11:46:31 +03:00
Roman Khimov
8318adac56
vm: add support for dynamic invocations in APPCALL
...
Fixes #740 .
2020-03-10 17:17:36 +03:00
Roman Khimov
e41d434a49
*: move all packages from CityOfZion to nspcc-dev
2020-03-03 17:21:42 +03:00
Evgenii Stratonikov
a3dacd3b74
tests: replace t.Fatal with require where possible
...
This makes tests less verbose and unifies the style
they are written in.
2020-03-02 17:22:27 +03:00
Evgenii Stratonikov
c821e1c4c8
vm: move IntToBytes and BytesToInt to emit package
2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
f15ceff592
vm: make IntToBytes, BytesToInt public
...
VM serialization format should be able to be reused.
2020-01-28 16:39:19 +03:00
Evgenii Stratonikov
f0083b94c5
vm: use new big.Int (de-)serialization routines
...
Also fix a test with CAT.
2020-01-17 17:37:50 +03:00
Roman Khimov
a7457d08a1
vm/core: add ID support for SYSCALL, redo interop registration
...
This solves two problems:
* adds support for shortened SYSCALL form that uses IDs (similar to #434 , but
for NEO 2.0, supporting both forms), which is important for compatibility
with C# node and mainnet chain that uses it from some height
* reworks interop plugging to use callbacks rather than appending to the map,
these map mangling functions are clearly visible in the VM profiling
statistics and we want spawning a VM to be fast, so it makes sense
optimizing it. This change moves most of the work to the init() phase
making VM setup cheaper.
Caveats:
* InteropNameToID accepts `[]byte` because that's the thing we have in
SYSCALL processing and that's the most often usecase for it, it leads to
some conversions in other places but that's acceptable because those are
either tests or init()
* three getInterop functions are: `getDefaultVMInterop`, `getSystemInterop`
and `getNeoInterop`
Our 100K (1.4M->1.5M) block import time improves by ~4% with this change.
2019-12-19 13:35:42 +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
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
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