Roman Khimov
db027ad9c5
vm: zero GAS means no GAS, use fee data to properly limit execution
...
We were accepting transactions with zero system fee, but we shouldn't do
that. Also, transaction's verification execution has to be limited by network
fee.
2020-07-14 08:37:29 +03:00
Roman Khimov
15c6cc932d
vm: drop checkedhash, it's an unused NeoVM 2 remnant
2020-07-09 15:05:14 +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
Anna Shaleva
29f1e646ed
vm: fix stackitem serialisation
...
We're able to serialise Buffer stackitem, but can not deserealise it
which leads to errors. Fixed.
2020-07-06 15:04:19 +03:00
Roman Khimov
08c516014f
Merge pull request #1132 from nspcc-dev/neo3/rpc/fixed8_marshalling
...
*: switch from Fixed8 to int64
2020-06-29 21:44:40 +03:00
Anna Shaleva
73b630db9b
*: switch from fixed8 to int64
...
Follow C# implementation, we have to marshall JSON Fixed8 fields without
taking into account decimals.
2020-06-29 21:39:27 +03:00
Roman Khimov
372dd71708
Merge pull request #1108 from nspcc-dev/neo3/compiler/nef
...
compiler: support *.nef and *.manifest.json generation
2020-06-29 20:55:47 +03:00
Anna Shaleva
1c1818d97e
vm: fix typoes in cli
package
2020-06-29 09:15:29 +03:00
Anna Shaleva
b387deaa05
vm: switch from .avm to .nef
2020-06-29 09:15:29 +03:00
Evgenii Stratonikov
bdaffe75cb
vm: extend PrintOps() with INITSSLOT & INITSLOT
2020-06-26 19:35:03 +03:00
Evgenii Stratonikov
82417499d7
vm: beautify PrintOps() output for JMP* instructions
2020-06-26 19:34:58 +03:00
Evgenii Stratonikov
709f656bcf
vm: remove unused parameter from getJumpOffset
2020-06-26 19:17:17 +03:00
Roman Khimov
32b0936499
vm/cli: improve loadhex example
...
It was using Neo 2 opcodes.
2020-06-25 18:33:46 +03:00
Roman Khimov
003daf37cf
vm/cli: add parameter checks for load* commands
...
Prevent failing like this:
NEO-GO-VM > loadhex
panic: runtime error: index out of range
...
2020-06-25 18:33:46 +03:00
Roman Khimov
5d63ff100e
vm/cli: add support for loadbase64 command
...
Neo3 outputs scripts in base64 for transactions and contracts, to quickly
parse them add a special `loadbase64` command.
2020-06-25 18:33:46 +03:00
Roman Khimov
a77357227a
vm: fix caller's script hash returned from VM
...
Regular CALLs don't update it, only Contract.Call does. Fixes the following
mismatch on preview2 testnet:
file BlockStorage_100000/dump-block-49000.json: block 48644, changes number mismatch: 6 vs 4
2020-06-24 10:22:21 +03:00
Evgenii Stratonikov
47f53e612e
vm: fix Log and Notify default interop prices
2020-06-19 12:58:33 +03:00
Evgenii Stratonikov
a980cac0b3
stackitem: support Null item (de-)serialization
...
It's binary representation contains just type (AnyT).
2020-06-19 11:38:56 +03:00
Evgenii Stratonikov
a7d4fff897
vm: make (*VM).GasLimit public
...
VM is inherently single-threaded and replacing setter/getter methods
with public field simplifies code a bit.
2020-06-16 15:13:20 +03:00
Evgenii Stratonikov
d836233352
stackitem: allow to (de-)serialize items to JSON
...
This commit implements behavior identical to that of C# `System.Json.*` interops.
2020-06-16 11:34:01 +03:00
Evgenii Stratonikov
f2f01a08c9
vm: move MaxArraySize and MaxItemSize to stackitem package
2020-06-16 11:32:16 +03:00
Evgenii Stratonikov
aae312d408
core,vm: adjust prices for iterator/enumerator syscalls
...
Closes #1027 .
2020-06-16 11:05:26 +03:00
Evgenii Stratonikov
18066143bd
core,vm: adjust binary (de-)serialization syscalls
...
Related #1027 .
1. Move System.Runtime.(De)serialize to System.Binary.*
2. Rename compiler stubs.
3. Adjust opcode prices.
2020-06-16 11:00:38 +03:00
Evgenii Stratonikov
4dfce07d11
vm: provide trigger upon VM creation
2020-06-11 13:16:07 +03:00
Evgenii Stratonikov
0dd00a49f5
core: specify require call flags in interop description
...
Related #1026 , #1027 , #1028 , #1031 .
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
Evgenii Stratonikov
55ab7535be
core: optimize contractCallEx
...
Provide script hash upon script load.
2020-06-11 13:06:10 +03:00
Evgenii Stratonikov
5514b3f52f
smartcontract,vm: remove DynamicInvoke feature
...
It doesn't exist in NEO3.
2020-06-11 10:45:25 +03:00
Evgenii Stratonikov
7256efd1ed
vm: implement (*VM).AddGas
...
Calculating interop prices can be tricky. It is more convenitent to burn
gas inside interops where necessary parameters are popped.
2020-06-11 10:45:25 +03:00
Evgenii Stratonikov
0472a0b0b1
core: move Neo.Runtime/Enumerator/Iterator.* interops to System.*
2020-06-10 12:13:35 +03:00
Anna Shaleva
d0ccf456c4
vm: replace hardcoded Bool type constant with BooleanT type
...
There's no import cycle problem anymore, so we can do this. Part of #912
2020-06-08 13:27:13 +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
9dca2288ba
vm: make LEFT fail if count is too big
2020-05-22 14:16:32 +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
16bf72f9cc
vm/tests: do not load empty script
...
In case we load a zero-length script, VM should end in HALT state.
https://github.com/neo-project/neo-vm/blob/master/tests/neo-vm.Tests/Tests/Others/OtherCases.json#L22
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
86c4f1abc5
vm: do not use State as a mask
...
In NEO2 state could be used as a mask, but now it contains only a single
value.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
063c29636b
vm: fail if NEWSTRUCT/NEWARRAY argument is not an integer
...
NEO3 VM does not support creating new Array from a Struct.
For this purpose CONVERT opcode is used.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
1a0290edc6
vm: copy slice when converting between Array<->Struct
...
Related #437 . Becase in NEO3 NEWSTRUCT/NEWARRAY accept only an integer
change tests too.
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
781def735d
vm: use Null item as a default value for Array/Struct elements
2020-05-22 14:16:32 +03:00
Evgenii Stratonikov
f4fa712440
vm: make PUSH0 emit Integer
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
61b1722745
opcode: swap ROT and OLDPUSH1
...
Because of how stringer generates String() method, the first of them
will be used as the result.
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