Roman Khimov
f7cb00b82d
Merge pull request #1678 from nspcc-dev/nameservice
...
Implement NameService
2021-02-01 22:52:59 +03:00
Evgeniy Stratonikov
e4ff8326b5
native: add NameService
2021-02-01 21:40:21 +03:00
Roman Khimov
d822e8dc21
vm: add test for neo-project/neo-vm#393
2021-02-01 16:39:54 +03:00
Evgeniy Stratonikov
73f888f02e
core: allow to overload contract methods
...
Multiple methods with different parameter count can co-exist.
2021-01-27 12:51:07 +03:00
Evgeniy Stratonikov
49de8161ef
core: implement LoadToken handler
2021-01-22 09:04:37 +03:00
Evgenii Stratonikov
bb706aa55b
vm: implement CALLT opcode
2021-01-21 19:30:04 +03:00
Evgeniy Stratonikov
324107b31e
vm: implement POPITEM opcode
2021-01-19 09:46:01 +03:00
Roman Khimov
f39ede9869
opcode: add CALLT opcode, move ABORT/ASSERT
...
Refs. #1644 . Hash compatibility test temporarily disabled, to be enabled when
it's up to date with current C# master.
2021-01-18 00:14:52 +03:00
Evgeniy Stratonikov
2130e17f0c
core,vm: remove System.Enumerator.*
interops
...
Map iterator now returns key-value pair, while array/byte-array
iterators work like old enumerators.
Follow neo-project/neo#2190 .
2021-01-15 21:11:32 +03:00
Evgeniy Stratonikov
d04b000748
vm: remove iterator/enumerator Concat API
...
Follow neo-project/neo#2170 .
2021-01-15 21:08:59 +03:00
Evgenii Stratonikov
1c0c331e25
core: update System.Contract.Call
syscall
...
1. Remove `System.Contract.CallEx`.
2. Extend number of parameters.
3. Add return value count to `VM.Context`.
2021-01-14 18:23:36 +03:00
Evgenii Stratonikov
dbe81f9b80
smartcontract: move flags to a separate package
2021-01-14 17:52:09 +03:00
Evgenii Stratonikov
1d4d93b3eb
vmcli: use manifest for method execution
2021-01-11 10:45:42 +03:00
Anna Shaleva
be3692136e
vm: adjust default VM interops prices
...
It might be not so important, because we use them only for VM-CLI, but
let's keep them equal to the standard interops prices.
2020-12-29 11:11:56 +03:00
Evgenii Stratonikov
8c22d27acc
state: allow to encode AppExecResult with recursive items
...
1. Encode them to a special type, decode to `nil`.
2. `Interop` can be encoded in JSON, this info should also be preserved.
2020-12-18 13:04:31 +03:00
Evgenii Stratonikov
18b331d765
stackitem: fix JSON encoding
...
Encode both `Buffer` and `ByteString` to UTF-8 bytes.
Follow https://github.com/neo-project/neo/pull/1715 .
2020-12-11 13:30:47 +03:00
Evgenii Stratonikov
e63191d31f
core: hangle CallingScriptHash correctly
...
When using native contracts, script hash of second-to-top context
on invocation stack does not always correspond to a real calling
contract.
2020-12-10 16:52:36 +03:00
Evgenii Stratonikov
e903e40085
core: call from native contracts synchronously
...
Follow neo-project/neo#2130 .
2020-12-10 16:43:46 +03:00
Evgenii Stratonikov
76a6ddc3a4
vmcli/test: run shell after providing input
...
In some cases, `Run()` can read from input before we have written
anything to it.
2020-12-10 13:35:52 +03:00
Evgenii Stratonikov
e4ee7cd407
vm: improve coverage for default interops
2020-12-02 15:54:03 +03:00
Evgenii Stratonikov
33f13ab1c0
vmcli: add tests
2020-12-02 10:49:37 +03:00
Evgenii Stratonikov
f8728e4f44
vmcli: unify error messages
2020-12-02 10:49:37 +03:00
Evgenii Stratonikov
bea5125d42
vmcli: return after error in break
2020-12-02 10:49:37 +03:00
Evgenii Stratonikov
d7ffa89811
vmcli: set breakpoint before the instruction
...
Breakpoint should occur before actual instruction execution.
2020-12-02 10:49:37 +03:00
Evgenii Stratonikov
2f39701d76
vm: provide writer in PrintOps()
...
Make it more flexible and testable. Fallback to using
stdout if no writer is provided.
2020-12-02 10:49:37 +03:00
Roman Khimov
d93aa745bb
contract: avoid going to the DB for entry scripts
...
This optimizes out DB access for non-deployed contracts under the assumption
that deployed ones are always loaded via `LoadScriptWithHash` (and if they're
not --- it's a bug anyway with the new hashing model) which actually is a very
popular case (every entry script does that).
2020-11-27 21:47:08 +03:00
Anna Shaleva
0f68528095
core: add callback to VM context
2020-11-25 18:37:29 +03:00
Evgenii Stratonikov
7d91a3a89e
pkg: move internal/ package to the root directory
...
This way we can use it in scripts and cli.
2020-11-24 16:39:56 +03:00
Evgenii Stratonikov
42ae226f9e
native: use proper stack for result
...
When native method calls other contract result should be put
on the stack of current context. With oracles this problem wasn't
noticed because of void return type.
2020-11-24 12:17:28 +03:00
Evgenii Stratonikov
4de233b339
emit: allow to emit nested arrays
2020-11-24 11:23:44 +03:00
Roman Khimov
bf9ecc2bd3
vm: improve REVERSEITEMS for 1M Buffer
...
Before:
BenchmarkOpcodes/REVERSEITEMS/buffer/1M-8 1680 758747 ns/op
After:
BenchmarkOpcodes/REVERSEITEMS/buffer/1M-8 2649 442720 ns/op
2020-11-06 23:31:26 +03:00
Roman Khimov
2522271161
vm: use Application trigger by default
...
Don't mess with System, it's too powerful to be the default.
2020-10-29 19:17:07 +03:00
Roman Khimov
6849499f56
Merge pull request #1493 from nspcc-dev/vm-opcode-bench
...
vm: add opcode benchmark
2020-10-16 11:02:04 +03:00
Roman Khimov
0709e20fbb
vm: add opcode benchmark
...
For future optimizations and price adjustments.
2020-10-15 16:27:36 +03:00
Roman Khimov
27a01c7759
vm: optimize stack traversal on exception handling
...
Before:
BenchmarkOpcodes/THROW/0/1-8 10000 506 ns/op
BenchmarkOpcodes/THROW/0/16-8 10000 524 ns/op
BenchmarkOpcodes/THROW/255/0-8 10000 49363 ns/op
BenchmarkOpcodes/THROW/1023/0-8 10000 1628480 ns/op
After:
BenchmarkOpcodes/THROW/0/1-8 10000 575 ns/op
BenchmarkOpcodes/THROW/0/16-8 10000 516 ns/op
BenchmarkOpcodes/THROW/255/0-8 10000 8290 ns/op
BenchmarkOpcodes/THROW/1023/0-8 10000 34605 ns/op
2020-10-15 16:20:34 +03:00
Roman Khimov
3d8434a50c
vm: fix invocation stack checks
...
It should be done on every new context push.
2020-10-15 16:20:34 +03:00
Roman Khimov
fe0ec91636
vm: optimize reversing items on the stack
...
Before:
BenchmarkOpcodes/REVERSE3/null-8 10000 335 ns/op
BenchmarkOpcodes/REVERSE3/integer-8 10000 355 ns/op
BenchmarkOpcodes/REVERSE3/big_bytes-8 10000 344 ns/op
BenchmarkOpcodes/REVERSE4/null-8 10000 353 ns/op
BenchmarkOpcodes/REVERSE4/integer-8 10000 336 ns/op
BenchmarkOpcodes/REVERSE4/big_bytes-8 10000 324 ns/op
BenchmarkOpcodes/REVERSEN/5/null-8 10000 350 ns/op
BenchmarkOpcodes/REVERSEN/5/integer-8 10000 358 ns/op
BenchmarkOpcodes/REVERSEN/5/big_bytes-8 10000 351 ns/op
BenchmarkOpcodes/REVERSEN/1024/null-8 10000 982413 ns/op
BenchmarkOpcodes/REVERSEN/1024/integer-8 10000 994926 ns/op
BenchmarkOpcodes/REVERSEN/1024/big_bytes-8 10000 992951 ns/op
After:
BenchmarkOpcodes/REVERSE3/null-8 10000 241 ns/op
BenchmarkOpcodes/REVERSE3/integer-8 10000 255 ns/op
BenchmarkOpcodes/REVERSE3/big_bytes-8 10000 249 ns/op
BenchmarkOpcodes/REVERSE4/null-8 10000 249 ns/op
BenchmarkOpcodes/REVERSE4/integer-8 10000 267 ns/op
BenchmarkOpcodes/REVERSE4/big_bytes-8 10000 292 ns/op
BenchmarkOpcodes/REVERSEN/5/null-8 10000 337 ns/op
BenchmarkOpcodes/REVERSEN/5/integer-8 10000 327 ns/op
BenchmarkOpcodes/REVERSEN/5/big_bytes-8 10000 293 ns/op
BenchmarkOpcodes/REVERSEN/1024/null-8 10000 5414 ns/op
BenchmarkOpcodes/REVERSEN/1024/integer-8 10000 5487 ns/op
BenchmarkOpcodes/REVERSEN/1024/big_bytes-8 10000 5609 ns/op
2020-10-15 16:19:59 +03:00
Anna Shaleva
fe1f0a7245
core: introduce CheckReturnState constants
...
At the moment we should have 3 possible options to check return state
during vm context unloading:
* no check
* ensure the stack is empty
* ensure the stack is not empty
It is necessary to distinguish them because new _deploy method shouldn't
left anything on stack. Example: if we use _deploy method before some
ordinary contract method which returns one value. Without these changes
the contract invocation will fail due to 2 elements on stack left after
invocation (the first `null` element is from _deploy, the second element
is return-value from the ordinary contract method).
2020-10-13 19:14:44 +03:00
Roman Khimov
124ce9d247
Merge pull request #1455 from nspcc-dev/get_invocation_counter
...
core: remove error from runtime.GetInvocationCounter
2020-10-08 16:34:40 +03:00
Anna Shaleva
cbf89fbb19
vm: add Call method which increments invocation counter
2020-10-08 16:25:45 +03:00
Anna Shaleva
6ce00fde82
vm, core: move invocation counter from InteropContext to VM
2020-10-08 11:33:26 +03:00
Roman Khimov
0120a8f239
stackitem: limit buffer/bytearray reads upon deserialization
...
This is not the way it's done in C#, but that's the most sensible approach to
me.
2020-10-07 23:08:20 +03:00
Roman Khimov
64e9775707
vm/stackitem: limit reads for bigint values
...
They can't exceed 33 bytes.
2020-10-07 23:07:10 +03:00
Evgenii Stratonikov
96bca91e4b
vm: handle very big int creation properly
...
Determine size as in reference implementation instead of
`big.Int.BitLen()`
Close #1437 .
2020-10-07 11:50:42 +03:00
Roman Khimov
d6a1a22afa
Merge pull request #1452 from nspcc-dev/contract/deploy
...
Support `_deploy` method
2020-10-06 19:54:14 +03:00
Evgenii Stratonikov
b2a3a0851e
emit: accept multiple opcodes in Opcode()
2020-10-06 18:03:25 +03:00
Evgenii Stratonikov
0b76f875c7
core: allow Null in System.Contract.Update
...
Null means absense of script or manifest, empty
byte-slice is an error.
Related #1459 .
2020-10-06 10:34:45 +03:00
Anna Shaleva
6761c297b5
vm: add test to check reference counter after PACK-UNPACK
...
Related issue: https://github.com/neo-project/neo-vm/pull/370
2020-09-29 18:46:20 +03:00
Anna Shaleva
66ca654b07
vm: refactor ISNULL opcode handling
2020-09-29 18:46:20 +03:00
Anna Shaleva
543fd58e93
vm: restrict map key size
2020-09-29 18:46:15 +03:00