Commit graph

440 commits

Author SHA1 Message Date
Evgenii Stratonikov
b53f0257f5 stackitem: change ByteArray type to ByteString
Adjust only string representation.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 16:07:16 +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
fyrchik
5cf4481331
Merge pull request #1228 from nspcc-dev/fix/contractcall
Adjust `System.Contract.Call.*` interops
2020-07-28 13:18:24 +03:00
Evgenii Stratonikov
5fe8095cee vmcli: implement parse command
Implement parse command for converting arbitrary values to other
formats. It supports Integer, String, Hex, Base64 and
Address representations.
2020-07-27 13:05:37 +03:00
Evgenii Stratonikov
b3e166aeff vmcli: remove unused method 2020-07-27 13:04:52 +03:00
Evgenii Stratonikov
466af55dea vm: isolate stack in LoadScript
When calling contract it must be provided with a new stack containing
only it's arguments. The result is then copied back on RET.

Fix #1220.
2020-07-27 13:00:35 +03:00
Evgenii Stratonikov
13b9eda08d vm: allow to call VM methods from outside
Abstract out (*VM).Call method and use in in CALL* opcodes.
2020-07-27 13:00:35 +03:00
Evgenii Stratonikov
6ecd1ae437 vm: allow to initialize static slot in method 2020-07-27 13:00:35 +03:00
Evgenii Stratonikov
d2ddf7b7cb *: support invoking methods by offset
Allow to invoke methods by offset:
1. Every invoked contract must have manifest.
2. Check arguments count on invocation.
3. Change AppCall to a regular syscall.
4. Add test suite for `System.Contract.Call`.
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
Evgenii Stratonikov
797324cb04 vm: support exceptions
Implement 3 new instructions: TRY,ENDTRY,ENDFINALLY.
1. TRY marks the start of the block where exceptions are catched.
    It has 2 arguments which are relative offsets of exception handler
    and the end of the whole try/catch construction.
2. ENDTRY denotes either end of try or catch block.
3. ENDFINALLY denotes end of finally block which is executed
    irregardless of whether an exception has occured.
2020-07-24 10:41:41 +03:00
Evgenii Stratonikov
c0d7b9d234 vm: clear references on context unload
Remove argument and local references from the reference counter when
returning from function.
2020-07-24 10:41:40 +03:00
Evgenii Stratonikov
aec9111961 vm: replace jumpIf with jump
`jumpIf` is used only once with non-constant condition.
2020-07-24 10:36:51 +03:00
Roman Khimov
a45c160f10
Merge pull request #1225 from nspcc-dev/fix/equal
vm: make EQUAL type strict
2020-07-23 23:42:22 +03:00
Roman Khimov
2800179ce0
Merge pull request #1226 from nspcc-dev/fix/pusha
vm: make offset in PUSHA relative
2020-07-23 23:40:21 +03:00
Anna Shaleva
8fde41001e core, vm: remove allowed triggers from syscalls
Closes #1205.
2020-07-23 20:44:39 +03:00
Evgenii Stratonikov
b8843a2dfa vm: make offset in PUSHA relative
Follow neo-project/neo-vm#317 .
2020-07-23 13:07:30 +03:00
Evgenii Stratonikov
9252ef65bb vm: make EQUAL type strict
Do not perform type conversions when comparing elements.
2020-07-23 13:01:43 +03:00
Roman Khimov
18dcc16553
Merge pull request #1222 from nspcc-dev/fix/rvcount
Remove return value count
2020-07-23 10:34:34 +03:00
Evgenii Stratonikov
58a594e3d4 vm: remove rvcount
It isn't used anymore.
2020-07-23 10:29:05 +03:00
Anna Shaleva
c9ef7425ac core: adjust System.Iterator.Create interop
Closes #1201.

It should be able to iterate over primitive byte-array-like types also.
2020-07-23 07:51:55 +03:00
Anna Shaleva
459ac34839 core: adjust System.Enumerator.Create interop
Part of #1201.

It should be able to create enumerator from primitive byte-array-like
stack items too.
2020-07-23 07:51:24 +03:00
Evgenii Stratonikov
261ff3c655 vm: remove alt.stack
It is no longer present in NEO3.
2020-07-22 13:20:31 +03:00
Evgenii Stratonikov
3d7fa9de93 *: make Notify interop accept event name 2020-07-20 13:33:32 +03:00
Anna Shaleva
a3e306ff78 core: implement Secp256k1 Verify and CheckMultisig interops
Closes #918.
2020-07-14 16:21:34 +03:00
Anna Shaleva
5326fc587a core: rename Neo.Crypto.CheckMultisig to Neo.Crypto.CheckMultisigWithECDsaSecp256r1
Part of #918
2020-07-14 16:19:12 +03:00
Anna Shaleva
17233e1d8e core: rename Neo.Crypto.Verify to Neo.Crypto.VerifyWithECDsaSecp256r1
Part of #918
2020-07-14 16:19:12 +03:00
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