Roman Khimov
3b19b34122
storage: fix memcached test with boltdb store
...
Everything was wrong here, wrong file used, wrong cleanup procedure, the net
result is this (and some failing tests from time to time):
$ ls -l /tmp/test_bolt_db* | wc -l
30939
2021-07-20 12:35:24 +03:00
Roman Khimov
c88ebaede9
Merge pull request #2075 from nspcc-dev/small-refactoring
...
Array util refactoring and naming improvement
2021-07-20 11:29:59 +03:00
Roman Khimov
7477e2cd9f
Merge pull request #2074 from nspcc-dev/fix-oracle-service-behaviour
...
Fix oracle service behaviour
2021-07-20 11:29:39 +03:00
Roman Khimov
19717dd9a8
slice: introduce common Copy helper
...
It's a bit more convenient to use.
2021-07-19 22:57:55 +03:00
Roman Khimov
a54e3516d1
slice: add Reverse function, deduplicate code a bit
2021-07-19 22:57:55 +03:00
Roman Khimov
100e97d772
util: move ArrayReverse into package of its own
...
Leave just uint160 and uint256 types in util.
2021-07-19 22:57:55 +03:00
Roman Khimov
3a93977b7b
oracle: only process new requests after initial sync
...
If an oracle node is resynchronized from the genesis the service receives all
requests from all blocks via AddRequests() invoked from the native
contract. Almost all of them are long obsolete and need to be removed, native
oracle contract will try to do that with RemoveRequests() calls, but they
won't change anything.
So queue up all "initial" requests in special map and manage it directly
before the module is Run() which happens after synchronization
completion. Then process any requests that are still active and work with new
blocks as usual.
2021-07-19 22:52:59 +03:00
Roman Khimov
588f3fbbd3
state: drop State from NEOBalance and NEP17Balance
...
We're in the `state` package already.
2021-07-19 22:01:07 +03:00
Roman Khimov
f4a9139a05
Merge pull request #2071 from nspcc-dev/fix-more-vm-bugs
...
Fix more VM bugs
2021-07-19 22:00:17 +03:00
Roman Khimov
0bad413e23
oracle: ensure proper ValidUntilBlock for backup tx
...
See neo-project/neo-modules#608 .
2021-07-19 21:58:10 +03:00
Roman Khimov
1568ebc513
stackitem: rework struct cloning protection
...
Count everything, fail early, make it more compatible with
neo-project/neo-vm#423 .
2021-07-19 15:42:42 +03:00
Roman Khimov
79b1bf72aa
native: check that oracle request GAS IsInt64()
...
We use int64 value down below, so check for IsInt64() while MinimumResponseGas
check still covers for values less than zero.
2021-07-19 15:42:42 +03:00
Roman Khimov
5f13de3a76
*: simplify some integer checks with IsUint64()
...
If we need a positive number we can do `IsUint64()` instead of checking that
`Int64()` is `> 0`.
2021-07-19 15:42:42 +03:00
Roman Khimov
233307aca5
stackitem: completely drop MaxArraySize
...
Turns out C# VM doesn't have it since preview2, so our limiting of
MaxArraySize in incompatible with it. Removing this limit shouldn't be a
problem with the reference counter we have, both APPEND and SETITEM add things
to reference counter and we can't exceed MaxStackSize. PACK on the other hand
can't get more than MaxStackSize-1 of input elements.
Unify NEWSTRUCT with NEWARRAY* and use better integer checks at the same time.
Multisig limit is still 1024.
2021-07-19 15:42:42 +03:00
Roman Khimov
ee4a647934
stackitem: limit EQUAL for deeply nested structs
...
See neo-project/neo-vm#428 .
2021-07-19 15:42:42 +03:00
Roman Khimov
f89f0300f6
stackitem: improve test coverage a bit
2021-07-19 15:42:42 +03:00
Roman Khimov
df2430d5e4
stackitem: limit deserialization to MaxDeserialized items
...
Follow neo-project/neo#2531 . Even though it's not strictly required (our node
handles problematic script just fine) we better be compliant wrt
deserialization behavior. MaxDeserialized is introduced to avoid moving
MaxStackSize which is a VM parameter.
2021-07-19 15:42:42 +03:00
Roman Khimov
aab18c3083
stackitem: introduce Convertible interface
...
We have a lot of native contract types that are converted to stack items
before serialization, then deserialized as stack items and converted back to
regular structures. stackitem.Convertible allows to remove a lot of repetitive
io.Serializable code.
This also introduces to/from converter in testserdes which unfortunately
required to change util tests to avoid circular references.
2021-07-19 15:42:42 +03:00
Roman Khimov
2d993d0da5
state: store notary deposit as stackitem
...
Which is less effective, but makes it more similar to other native contracts
that are supposed to be contracts anyway.
2021-07-19 15:42:42 +03:00
Roman Khimov
70ddbf7180
native: reuse stackitem.(De)Serialize more for data structures
...
Less code bloat, no functional changes.
2021-07-19 15:42:42 +03:00
Roman Khimov
4775b513f9
native: do proper error handling when deserializing user data
2021-07-19 15:42:42 +03:00
Roman Khimov
fbe8bd2d9c
stackitem: limit deserialized arrays/maps
...
See neo-project/neo#2531 , even though they use MaxStackSize there resulting
element is not valid unless it has <=MaxArraySize elements.
2021-07-19 15:42:42 +03:00
Roman Khimov
654c4a6589
stackitem: properly pass allowInvalid on binary deserialization
...
Otherwise DecodeBinaryProtected() is broken for arrays/maps.
2021-07-19 15:42:41 +03:00
Roman Khimov
3a991abb62
fee: adjust SQRT price
...
See neo-project/neo#2540 .
2021-07-19 15:42:41 +03:00
Roman Khimov
15be763bb3
vm: limit POW, fix #2060
...
Calculating pow(pow(2, 255), 0xffffffff) takes unknown amount of time. See
also neo-project/neo-vm#422 .
2021-07-19 15:42:41 +03:00
Roman Khimov
5e26170b79
Merge pull request #2072 from nspcc-dev/address-as-account-in-rpc-params
...
rpc/request: support passing accounts as addresses
2021-07-19 10:09:15 +03:00
Roman Khimov
a617390185
rpc/request: support passing accounts as addresses
...
Turns out, it's completely legal in C#, see neo-project/neo#2543 .
2021-07-18 16:45:53 +03:00
Roman Khimov
21e05f5779
Merge pull request #2055 from nspcc-dev/fix-gas-limits
...
Tune fixed GAS limits
2021-07-16 16:53:06 +03:00
Evgeniy Stratonikov
85ce207f40
consensus: add Nonce
to PrepareRequest
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 16:00:02 +03:00
Evgeniy Stratonikov
8077f9232d
interop: implement System.Runtime.GetRandom
...
Our murmur3 implementation is architecture independent and optimized in
assembly.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 16:00:01 +03:00
Evgeniy Stratonikov
fdb54f2dc3
core/test: get rid of empty tx scripts
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 15:58:49 +03:00
Evgeniy Stratonikov
9c5b4e5916
encoding/bigint: allow to convert unsigned integers
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 15:58:49 +03:00
Evgeniy Stratonikov
3a4e0caeb8
core/block: add Nonce
field to header
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 15:58:49 +03:00
Evgeniy Stratonikov
2cd5b63f0b
policy: fix max exec fee
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-14 10:27:09 +03:00
Evgeniy Stratonikov
451b02122a
*: increase GAS for verification
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-14 10:27:09 +03:00
Roman Khimov
2b7abd20e7
Merge pull request #2057 from nspcc-dev/optimize-storage-find
...
Optimize `storageFind`
2021-07-13 12:51:10 +03:00
Roman Khimov
83a557f0eb
Merge pull request #2042 from nspcc-dev/oracle-not-supported
...
Check oracle response Content-Type header
2021-07-13 11:31:37 +03:00
Roman Khimov
d638aee7a1
Merge pull request #2053 from nspcc-dev/stackitem-json
...
Speedup stackitem json serialization
2021-07-13 11:27:33 +03:00
Evgeniy Stratonikov
0611031fd4
stackitem/test: improve coverage for serialization
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-13 11:06:19 +03:00
Evgeniy Stratonikov
8fdc7e32f5
stackitem: cache serialized results in EncodeBinary
...
```
name old time/op new time/op delta
EncodeBinary-8 8.39ms ± 1% 0.05ms ±21% -99.44% (p=0.000 n=10+9)
name old alloc/op new alloc/op delta
EncodeBinary-8 2.24MB ± 0% 0.33MB ± 0% -85.29% (p=0.000 n=9+10)
name old allocs/op new allocs/op delta
EncodeBinary-8 65.6k ± 0% 0.0k ± 0% -99.95% (p=0.000 n=10+10)
```
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-13 11:06:19 +03:00
Evgeniy Stratonikov
17a3f17c74
stackitem: use byte-slice directly during encoding
...
```
name old time/op new time/op delta
EncodeBinary-8 10.6ms ± 1% 8.4ms ± 1% -20.94% (p=0.000 n=9+10)
name old alloc/op new alloc/op delta
EncodeBinary-8 1.64MB ± 0% 2.24MB ± 0% +36.18% (p=0.000 n=8+9)
name old allocs/op new allocs/op delta
EncodeBinary-8 131k ± 0% 66k ± 0% -49.98% (p=0.000 n=10+10)
```
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-13 11:06:18 +03:00
Evgeniy Stratonikov
c4eb7db8a5
stackitem: access value of Array/Struct directly
...
```
name old time/op new time/op delta
ToJSON-8 50.3µs ±34% 47.8µs ± 9% ~ (p=0.971 n=10+10)
name old alloc/op new alloc/op delta
ToJSON-8 396kB ± 0% 396kB ± 0% -0.10% (p=0.000 n=6+10)
name old allocs/op new allocs/op delta
ToJSON-8 34.0 ± 0% 18.0 ± 0% -47.06% (p=0.000 n=10+10)
```
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:40:21 +03:00
Evgeniy Stratonikov
dc0a17dd0e
stackitem: cache visited items while marshaling json
...
```
name old time/op new time/op delta
ToJSON-8 4.52ms ± 4% 0.05ms ±34% -98.89% (p=0.000 n=8+10)
name old alloc/op new alloc/op delta
ToJSON-8 2.13MB ± 0% 0.40MB ± 0% -81.44% (p=0.000 n=9+6)
name old allocs/op new allocs/op delta
ToJSON-8 65.6k ± 0% 0.0k ± 0% -99.95% (p=0.000 n=10+10)
```
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:40:21 +03:00
Evgeniy Stratonikov
69cdd5252a
stackitem: add benchmark for serialization routines
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:40:17 +03:00
Evgeniy Stratonikov
eb7bd7b99b
core: optimize storageFind
...
Because `Map` stores elements in arbitrary order, addition of new
element takes linear time (`Index` iterates over all keys). Thus our
`storageFind` is actually quadratic in time. Optimize this by creating
map from sorted slice.
```
name old time/op new time/op delta
StorageFind-8 157µs ± 2% 112µs ± 1% -28.60% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
StorageFind-8 69.4kB ± 0% 60.5kB ± 0% -12.90% (p=0.000 n=9+10)
name old allocs/op new allocs/op delta
StorageFind-8 2.21k ± 0% 2.00k ± 0% -9.37% (p=0.000 n=10+7)
```
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:22:17 +03:00
Evgeniy Stratonikov
b8b272c8c4
core/test: add benchmark for storageFind
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:20:45 +03:00
Evgeniy Stratonikov
0d5ede0bff
core/test: use testing.TB in constructors
...
This allows to use chain in benchmarks.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:20:45 +03:00
Evgeniy Stratonikov
9f377cde12
storage: convert key once in MemoryStore.seek
...
There is no need in additional allocations.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:14:32 +03:00
Evgeniy Stratonikov
e936e5e295
oracle: set request Content-Type
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 13:13:48 +03:00
Evgeniy Stratonikov
8e9302f40b
oracle: check response Content-Type
...
If not specified everything is allowed.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 13:13:48 +03:00
Roman Khimov
9de5c850e7
Merge pull request #2054 from nspcc-dev/fix-oom-on-struct-cloning
...
Fix OOM on struct cloning
2021-07-12 13:04:12 +03:00
Roman Khimov
fe3c68b92d
vm: panic in cloneIfStruct
...
It's internal, so we can deduplicate code a bit.
2021-07-12 11:52:24 +03:00
Roman Khimov
bc5a1b7bcd
Merge pull request #2043 from nspcc-dev/runtime-getnetwork
...
interop/runtime: add `System.Runtime.GetNetwork`, fix #2038
2021-07-12 10:46:41 +03:00
Roman Khimov
4000dd692c
vm: make cloning limits a bit more effective
...
Take actual reference counter value into account.
2021-07-11 19:37:06 +03:00
Roman Khimov
cfe41abd35
vm: fix OOM during nested structure cloning
...
Resulting item can't have more than MaxStackSize elements. Technically this
limits to MaxStackSize cloned elements but it's considered to be enough to
mitigate the issue (the next size check is going to happen during push to the
stack). See neo-project/neo#2534 , thanks @vang1ong7ang.
2021-07-11 18:47:50 +03:00
Roman Khimov
1853d0c713
core: don't copy config in ApplyPolicyToTxSet
...
Makes no sense, GetConfig() is for external users.
2021-07-09 13:01:42 +03:00
Roman Khimov
fc83b34d02
Merge pull request #2052 from nspcc-dev/fix-state-276
...
vm: copy integers for unary operations, fix #2051
2021-07-08 17:30:02 +03:00
Evgeniy Stratonikov
1863023e27
vm: copy argument in unary opcodes, fix #2051
...
We already do this in binary opcodes, let's be consistent.
This fixes state difference at height 275663
for tx 3c498317684d63849b03e4c58ad57ce4b19bb206b7b01bcc64233de3b3e207f4
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-08 17:09:04 +03:00
Evgeniy Stratonikov
96a42cd011
interop: add System.Runtime.GetNetwork
, fix #2038
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-08 17:02:37 +03:00
Roman Khimov
7bc7457fbe
Merge pull request #2050 from nspcc-dev/fix-network-test-race
...
Fix some test failures
2021-07-08 14:50:50 +03:00
Roman Khimov
b8192d0958
network: optimize waiting in test
...
require.Eventually polls more often reducing average waiting time.
2021-07-08 11:14:35 +03:00
Roman Khimov
9cc4f42a71
network: fix discoverer test
...
Asynchronous tryAddress() routines may get dial result AFTER the switch to
another test, so we need to ensure that they'll get the result intended for
this particular call. Fixes:
2021-07-07T20:25:40.1624521Z === RUN TestDefaultDiscoverer
2021-07-07T20:25:40.1625316Z discovery_test.go:159: timeout expecting for transport dial; i: 2, j: 1
2021-07-07T20:25:40.1626319Z --- FAIL: TestDefaultDiscoverer (1.19s)
2021-07-08 11:03:30 +03:00
Roman Khimov
bd400dfe20
native: copy contract on update
...
It can be a pointer to cached data:
2021-07-07T20:05:24.8508647Z ==================
2021-07-07T20:05:24.8509294Z WARNING: DATA RACE
2021-07-07T20:05:24.8510243Z Write at 0x00c000142cc8 by goroutine 51:
2021-07-07T20:05:24.8511350Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).Update()
2021-07-07T20:05:24.8529622Z /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:335 +0x70a
2021-07-07T20:05:24.8531266Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).updateWithData()
2021-07-07T20:05:24.8532544Z /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:316 +0x1e9
2021-07-07T20:05:24.8533726Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).update()
2021-07-07T20:05:24.8534928Z /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:303 +0x111
2021-07-07T20:05:24.8536123Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).update-fm()
2021-07-07T20:05:24.8537389Z /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:302 +0x34
2021-07-07T20:05:24.8538462Z github.com/nspcc-dev/neo-go/pkg/core/native.Call()
2021-07-07T20:05:24.8539565Z /home/runner/work/neo-go/neo-go/pkg/core/native/interop.go:54 +0x90c
2021-07-07T20:05:24.8540751Z github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler()
2021-07-07T20:05:24.8542177Z /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:262 +0x216
2021-07-07T20:05:24.8543328Z github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler-fm()
2021-07-07T20:05:24.8544586Z /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:250 +0x53
2021-07-07T20:05:24.8545648Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).execute()
2021-07-07T20:05:24.8546635Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:1312 +0xb2d5
2021-07-07T20:05:24.8547632Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Step()
2021-07-07T20:05:24.8548640Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:416 +0x1f2
2021-07-07T20:05:24.8549836Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Run()
2021-07-07T20:05:24.8550852Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:393 +0x195
2021-07-07T20:05:24.8551989Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).runScriptInVM()
2021-07-07T20:05:24.8553174Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:1326 +0x7eb
2021-07-07T20:05:24.8554345Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).invokeFunction()
2021-07-07T20:05:24.8555560Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:1219 +0x50c
2021-07-07T20:05:24.8556616Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleIn()
2021-07-07T20:05:24.8557823Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:345 +0xecb
2021-07-07T20:05:24.8558987Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleRequest()
2021-07-07T20:05:24.8560356Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:315 +0x364
2021-07-07T20:05:24.8561599Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleHTTPRequest()
2021-07-07T20:05:24.8562976Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:309 +0xf9b
2021-07-07T20:05:24.8564208Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleHTTPRequest-fm()
2021-07-07T20:05:24.8565523Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:257 +0x64
2021-07-07T20:05:24.8566348Z net/http.HandlerFunc.ServeHTTP()
2021-07-07T20:05:24.8567290Z /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:2042 +0x51
2021-07-07T20:05:24.8568185Z net/http.serverHandler.ServeHTTP()
2021-07-07T20:05:24.8569130Z /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:2843 +0xca
2021-07-07T20:05:24.8569861Z net/http.(*conn).serve()
2021-07-07T20:05:24.8570634Z /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:1925 +0x84c
2021-07-07T20:05:24.8571139Z
2021-07-07T20:05:24.8571639Z Previous read at 0x00c000142cc8 by goroutine 41:
2021-07-07T20:05:24.8572892Z github.com/nspcc-dev/neo-go/pkg/core/interop/contract.callExFromNative()
2021-07-07T20:05:24.8574265Z /home/runner/work/neo-go/neo-go/pkg/core/interop/contract/call.go:101 +0x2d4
2021-07-07T20:05:24.8575581Z github.com/nspcc-dev/neo-go/pkg/core/interop/contract.callInternal()
2021-07-07T20:05:24.8576951Z /home/runner/work/neo-go/neo-go/pkg/core/interop/contract/call.go:85 +0x1f5
2021-07-07T20:05:24.8578094Z github.com/nspcc-dev/neo-go/pkg/core/interop/contract.Call()
2021-07-07T20:05:24.8579306Z /home/runner/work/neo-go/neo-go/pkg/core/interop/contract/call.go:69 +0x804
2021-07-07T20:05:24.8580514Z github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler()
2021-07-07T20:05:24.8581755Z /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:262 +0x216
2021-07-07T20:05:24.8582907Z github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler-fm()
2021-07-07T20:05:24.8584300Z /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:250 +0x53
2021-07-07T20:05:24.8585422Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).execute()
2021-07-07T20:05:24.8586403Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:1312 +0xb2d5
2021-07-07T20:05:24.8590451Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Step()
2021-07-07T20:05:24.8591549Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:416 +0x1f2
2021-07-07T20:05:24.8592466Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Run()
2021-07-07T20:05:24.8593550Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:393 +0x195
2021-07-07T20:05:24.8594531Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).storeBlock()
2021-07-07T20:05:24.8595708Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:717 +0x1694
2021-07-07T20:05:24.8596793Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).AddBlock()
2021-07-07T20:05:24.8598142Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:579 +0x544
2021-07-07T20:05:24.8599419Z github.com/nspcc-dev/neo-go/pkg/consensus.(*service).processBlock()
2021-07-07T20:05:24.8601093Z /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:521 +0x141
2021-07-07T20:05:24.8602485Z github.com/nspcc-dev/neo-go/pkg/consensus.(*service).processBlock-fm()
2021-07-07T20:05:24.8603809Z /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:517 +0x55
2021-07-07T20:05:24.8604910Z github.com/nspcc-dev/dbft.(*DBFT).checkCommit()
2021-07-07T20:05:24.8606098Z /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/check.go:73 +0xd8a
2021-07-07T20:05:24.8607235Z github.com/nspcc-dev/dbft.(*DBFT).checkPrepare()
2021-07-07T20:05:24.8608551Z /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/check.go:36 +0x677
2021-07-07T20:05:24.8609681Z github.com/nspcc-dev/dbft.(*DBFT).sendPrepareRequest()
2021-07-07T20:05:24.8611016Z /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/send.go:42 +0x47c
2021-07-07T20:05:24.8612107Z github.com/nspcc-dev/dbft.(*DBFT).OnTimeout()
2021-07-07T20:05:24.8613257Z /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/dbft.go:188 +0x68c
2021-07-07T20:05:24.8614499Z github.com/nspcc-dev/neo-go/pkg/consensus.(*service).eventLoop()
2021-07-07T20:05:24.8615712Z /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:274 +0x17ed
2021-07-07T20:05:24.8616284Z
2021-07-07T20:05:24.8616757Z Goroutine 51 (running) created at:
2021-07-07T20:05:24.8617367Z net/http.(*Server).Serve()
2021-07-07T20:05:24.8618159Z /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:2969 +0x5d3
2021-07-07T20:05:24.8619253Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).Start.func2()
2021-07-07T20:05:24.8620437Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:224 +0x85
2021-07-07T20:05:24.8620936Z
2021-07-07T20:05:24.8621405Z Goroutine 41 (running) created at:
2021-07-07T20:05:24.8622393Z github.com/nspcc-dev/neo-go/pkg/consensus.(*service).Start()
2021-07-07T20:05:24.8623562Z /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:250 +0x17c
2021-07-07T20:05:24.8624682Z github.com/nspcc-dev/neo-go/pkg/network.(*Server).tryStartServices()
2021-07-07T20:05:24.8626078Z /home/runner/work/neo-go/neo-go/pkg/network/server.go:445 +0x2e1
2021-07-07T20:05:24.8627226Z github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start()
2021-07-07T20:05:24.8628333Z /home/runner/work/neo-go/neo-go/pkg/network/server.go:268 +0x2af
2021-07-07T20:05:24.8628973Z ==================
2021-07-08 10:40:54 +03:00
Roman Khimov
685ff8bbf6
network: reduce dial timeout in discoverer test
...
We don't care much about dialing, but the same constant is used in outer
discoverer loop in case no connections are established and we have no
connections established.
2021-07-08 10:40:54 +03:00
Roman Khimov
473a1fc24e
rpc/server: fix sporadic test failures
...
It can still be "reading" after test end:
subscription_test.go:24:
Error Trace: subscription_test.go:24
asm_amd64.s:1374
Error: Received unexpected error:
set tcp 127.0.0.1:49874: use of closed network connection
Test: TestFilteredNotaryRequestSubscriptions
==================
WARNING: DATA RACE
Write at 0x00c000e28989 by goroutine 185:
testing.tRunner()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1126 +0x21a
Previous write at 0x00c000e28989 by goroutine 192:
testing.(*common).FailNow()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:731 +0x4f
testing.(*T).FailNow()
<autogenerated>:1 +0x44
github.com/stretchr/testify/require.NoError()
/home/runner/go/pkg/mod/github.com/stretchr/testify@v1.6.1/require/require.go:1038 +0x104
github.com/nspcc-dev/neo-go/pkg/rpc/server.wsReader()
/home/runner/work/neo-go/neo-go/pkg/rpc/server/subscription_test.go:24 +0x187
Goroutine 185 (running) created at:
testing.(*T).Run()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1168 +0x5bb
testing.runTests.func1()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1439 +0xa6
testing.tRunner()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1123 +0x202
testing.runTests()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1437 +0x612
testing.(*M).Run()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1345 +0x3b3
main.main()
_testmain.go:89 +0x236
Goroutine 192 (finished) created at:
github.com/nspcc-dev/neo-go/pkg/rpc/server.initCleanServerAndWSClient()
/home/runner/work/neo-go/neo-go/pkg/rpc/server/subscription_test.go:65 +0x294
github.com/nspcc-dev/neo-go/pkg/rpc/server.TestFilteredNotaryRequestSubscriptions()
/home/runner/work/neo-go/neo-go/pkg/rpc/server/subscription_test.go:348 +0x68d
testing.tRunner()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1123 +0x202
==================
testing.go:1038: race detected during execution of test
2021-07-08 10:40:54 +03:00
Roman Khimov
c2d444ace7
network: don't log transport errors on exit
...
Fix data race
==================
WARNING: DATA RACE
Read at 0x00c00012cca3 by goroutine 208:
testing.(*common).logDepth()
/usr/local/go/src/testing/testing.go:727 +0xa4
testing.(*common).log()
/usr/local/go/src/testing/testing.go:720 +0x8f
testing.(*common).Logf()
/usr/local/go/src/testing/testing.go:766 +0x21
testing.(*T).Logf()
<autogenerated>:1 +0x75
go.uber.org/zap/zaptest.testingWriter.Write()
/go/pkg/mod/go.uber.org/zap@v1.10.0/zaptest/logger.go:130 +0x11f
go.uber.org/zap/zaptest.(*testingWriter).Write()
<autogenerated>:1 +0xa9
go.uber.org/zap/zapcore.(*ioCore).Write()
/go/pkg/mod/go.uber.org/zap@v1.10.0/zapcore/core.go:90 +0x1c3
go.uber.org/zap/zapcore.(*CheckedEntry).Write()
/go/pkg/mod/go.uber.org/zap@v1.10.0/zapcore/entry.go:215 +0x1e7
go.uber.org/zap.(*Logger).Warn()
/go/pkg/mod/go.uber.org/zap@v1.10.0/logger.go:195 +0x95
github.com/nspcc-dev/neo-go/pkg/network.(*TCPTransport).Accept()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/tcp_transport.go:59 +0x8da
Previous write at 0x00c00012cca3 by goroutine 168:
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1036 +0x467
testing.tRunner()
/usr/local/go/src/testing/testing.go:1054 +0x20d
Goroutine 208 (running) created at:
github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/server.go:274 +0x391
Goroutine 168 (running) created at:
testing.(*T).Run()
/usr/local/go/src/testing/testing.go:1095 +0x537
testing.runTests.func1()
/usr/local/go/src/testing/testing.go:1339 +0xa6
testing.tRunner()
/usr/local/go/src/testing/testing.go:1050 +0x1eb
testing.runTests()
/usr/local/go/src/testing/testing.go:1337 +0x594
testing.(*M).Run()
/usr/local/go/src/testing/testing.go:1252 +0x2ff
main.main()
_testmain.go:90 +0x223
==================
2021-07-08 10:40:54 +03:00
Roman Khimov
ea9dde257c
Merge pull request #2047 from nspcc-dev/fix-state
...
Don't create an extension node for the last branch child
2021-07-08 10:20:59 +03:00
Roman Khimov
23fb5dd420
rpc/server: properly shutdown things in subscription test
...
Chain is the last one to Close().
2021-07-07 20:47:34 +03:00
Roman Khimov
f254cdf2db
Merge pull request #2046 from nspcc-dev/oracle-null-filter
...
jsonpath: add tests for `null` objects, fix #2039
2021-07-07 18:08:58 +03:00
Evgeniy Stratonikov
a33e422b79
mpt: do not create an Extension for the last child of a Branch
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-07 15:49:53 +03:00
Evgeniy Stratonikov
25428d53f1
mpt: strip branch node in a simple implementation
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-07 15:47:07 +03:00
Evgeniy Stratonikov
a4c7b3d0cf
jsonpath: add tests for null
objects, fix #2039
...
Turns out, nothing should be changed in our implementation because
nil-check is done implicitly by type casts or type switches.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-07 12:27:10 +03:00
Roman Khimov
0cd9cd0c80
state/result: save/return real JSONization errors
...
Don't hide/obfuscate real problems.
2021-07-07 00:42:36 +03:00
Roman Khimov
e62a766058
state: move nil check down to stackitem JSON processing
...
We want to return real errors, not some generic thing for any kind of thing
happening.
2021-07-07 00:38:19 +03:00
Roman Khimov
5a9efcc654
stackitem: rework error handling
...
Return good named errors everywhere, export appropriate constants, make
errors.Is() work.
2021-07-07 00:18:00 +03:00
Roman Khimov
0de949b575
stackitem: remove Item/StackItem from function names
...
They're useless in a package named 'stackitem', make this package a bit more
user-friendly.
2021-07-06 19:56:23 +03:00
Roman Khimov
b9ff07f32c
stackitem: add limit to serialized items
...
Standard binary serialization/deserialization is mostly used in VM to put/get
elements into/from storage, so they never should exceed MaxSize (otherwise one
won't be able to deserialize these items).
This patch leaves EncodeBinaryStackItem unprotected, but that's a streaming
interface, so it's up to the user of it to ensure its appropriate use (and our
uses are mostly for native contract's data, so they're fine).
2021-07-06 19:34:02 +03:00
Roman Khimov
8472064bbc
stackitem: refactor serialization code, add explicit context
2021-07-06 19:32:52 +03:00
Roman Khimov
1b7b7e4bec
stackitem: don't overwrite error when serializing Item
...
We must get out as quickly as possible.
2021-07-06 17:51:46 +03:00
Roman Khimov
e34fa2e915
stackitem: limit JSONization nesting level
...
We can have very deep reference types and attempt to JSONize them can easily
lead to OOM (even though there are no recursive references inside). Therefore
we have to limit them. While regular ToJSON() is buffer size limited to
MaxSize, ToJSONWithTypes is not and limiting it to MaxSize output will require
substantial rewriting effort while not really providing fair result, MaxSize
is more about stack item size while its JSON representation can be much bigger
because of various overheads.
Initial thought was to limit it by element count based on
MaxIteratorResultItems, but the problem here is that we don't always have this
limit in contexts using ToJSONWithTypes (like notification event
marshaling). Thus we need some generic limit which would be fine for all
users.
We at the same time have maxJSONDepth used when deserializing from JSON, so
it can be used for marshaling as well, it's not often that we have deeper
structures in real results.
Inspired by neo-project/neo#2521 .
2021-07-06 17:33:16 +03:00
Roman Khimov
6879cbcdcc
stackitem: properly detect recursive references during serialization
...
If we're done with element it no longer can lead to recursion error, so fix
cases like `[arr, arr]` where we have two copies of `arr` trigger this error
for no good reason (there is no recursion there).
2021-07-06 17:10:31 +03:00
Roman Khimov
ae8f4ebd5e
Merge pull request #2034 from nspcc-dev/fix-state
...
Fix MPT branch node strip after deletion
2021-07-06 14:05:18 +03:00
Roman Khimov
ac126a300b
callflag: add C#-compliant JSONization, fix #2040
2021-07-06 11:17:12 +03:00
Evgeniy Stratonikov
9691eee10c
mpt: strip branch if 1 child is left
...
If the child left is a hash node, we should retrieve it from store.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-05 11:04:20 +03:00
Evgeniy Stratonikov
d2e8254848
native: fix typo in comments
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-05 11:04:19 +03:00
Evgeniy Stratonikov
a7722f0fa5
native: save balance value in storage for failed transfers
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-05 11:03:42 +03:00
Roman Khimov
e3323faf69
Merge pull request #2032 from nspcc-dev/optimize-restore
...
native: cache GAS per vote values
2021-07-01 15:17:37 +03:00
Evgeniy Stratonikov
0591366f85
native: cache GAS per vote values
...
`storage.Seek()` is rather expensive and we need only last updated value
of gas per block in `PostPersist()`.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-01 10:34:04 +03:00
Roman Khimov
c203995a9b
Merge pull request #2028 from nspcc-dev/core/fix-add-headers
...
core: allow to add several headers with StateRootInHeader on
2021-06-30 17:11:54 +03:00
Anna Shaleva
9673a04009
core: allow to add several headers with StateRootInHeader on
...
Problem: with StateRootInHeader setting on only one header of height N+1
can be added to the chain of height N, because we need local stateroot
to verify headers (which is calculated for the last stored block N).
Thus, adding chunk of headers starting from the current chain's heigh
is impossible and (*Blockchain).AddHeaders doesn't have much sense.
Solution: verify header.PrevStateRoot only for header N+1. Rest of the
headers should be added without PrevStateRoot verification.
2021-06-30 11:56:05 +03:00
Evgeniy Stratonikov
c9e6350915
manifest: fix group permission handling
...
We need to have at least one matching group in the manifest.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-30 11:02:45 +03:00
Evgeniy Stratonikov
4283e1003f
manifest: fix wildcard permission handling
...
Wildcard contract can coexist with restricted set of methods.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-30 11:00:06 +03:00
Roman Khimov
3646270af0
Merge pull request #2026 from nspcc-dev/fix-state
...
Fix manifest `Extra` field marshaling
2021-06-29 15:11:25 +03:00
Evgeniy Stratonikov
9c06ba6b07
smartcontract: marshal manifest Extra
field as object, fix #2021
...
This is needed to strip whitespace which can be present.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-29 11:39:56 +03:00
Evgeniy Stratonikov
8d67a03aec
stackitem: fix Buffer
deserialization
...
Fix incorrect application log for transaction in N3 testnet
8eb4076f1f1c07e693eda7e810779488a2d2b50aba9b727fd237cbc3adbec9e9
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-29 11:39:55 +03:00
Evgeniy Stratonikov
f0100407ee
compiler/test: compile whole directory in examples
...
For `nft-nd-nns` example only `namestate.go` file was compiled which is
certainly not what we want.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-28 11:50:40 +03:00
Evgeniy Stratonikov
aa76383fa7
compiler: extend permission check to runtime hashes
...
If a method is known at compile time we can still check
if it is present in the list of methods of at least one contract.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-28 11:49:30 +03:00
Evgeniy Stratonikov
4249674ddc
compiler: check for contract permissions
...
On many occassions we can determine at compile-time if contract config lacks
some properties it needs. This includes all native contract invocations
through stdlib, as both hashes and methods are known at compile-time
there.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-28 11:49:29 +03:00
Roman Khimov
fecc7a3dd6
keys: simplify code a bit
...
No functional changes.
2021-06-17 21:55:00 +03:00
Anna Shaleva
d49294b046
core: fix the way candidates are sorted
...
(*NEO).GetCandidates along with getCandidatesCall use candidates sorted
by serialized ECPoint bytes.
(*NEO).computeCommitteeMembers use candidates sorted by votes, and then
by deserialized ECPoint, i.e. using default ECPoint comparator.
2021-06-16 17:35:04 +03:00
Anna Shaleva
472a44a464
*: regenerate test wallets with resources-friendly scrypt parameters
2021-06-11 15:22:32 +03:00
Anna Shaleva
50296975e2
crypto: allow to provide non-default scrypt parameters
2021-06-11 15:22:28 +03:00
Roman Khimov
61dfca346c
Merge pull request #2003 from carpawell/update-neofs-api-go
...
Update neofs-api-go
2021-06-11 14:19:12 +03:00
Anna Shaleva
6ff64153db
core: check stored native states against autogenerated ones on start
2021-06-10 22:16:05 +03:00
Pavel Karpy
874c56c77b
oracle/neofs: stop using deprecated types
...
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-10 14:16:07 +03:00
Pavel Karpy
c4f8c7a9b2
oracle/neofs: update neofs-api-go
...
Update neofs-api-go to `v1.27.1`.
Add `WithURIAddress` client option.
Stop using `V2` abstractions outside
of the `api-go` library.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-10 14:16:02 +03:00
Anna Shaleva
be902afe9e
core: do not allow NEP17 roundtrip in case of insufficient funds
...
NEP17 roundtrip is prohibited if from account doesn't have enough funds.
This commit fixes states diff in block 92057 where account
NfuwpaQ1A2xaeVbxWe8FRtaRgaMa8yF3YM initiates two NEO roundtrips with
amount exceeding the account's balance:
block 92057: value mismatch for key +////xTbYWBH3r5qhRKZAPFPHabKfb2vhQ==: QQMhAkwBIQOZZwEA vs QQMhAkwBIQN/ZwEA
block 92057: value mismatch for key +v///ws=: kqlddcitCg== vs tphddcitCg==
block 92057: value mismatch for key +v///xTbYWBH3r5qhRKZAPFPHabKfb2vhQ==: QQEhBUWyDu0W vs QQEhBWmhDu0W
C#'s applog (contains False and False on stack for both transfers):
```
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : {
"executions" : [
{
"gasconsumed" : "11955500",
"exception" : null,
"stack" : [
{
"value" : false,
"type" : "Boolean"
},
{
"value" : false,
"type" : "Boolean"
}
],
"vmstate" : "HALT",
"trigger" : "Application",
"notifications" : []
}
],
"txid" : "0x8e73a7e9a566a514813907272ad65fc965002c3b098eacc5bdda529af19d7688"
}
}
```
Go's applog (both transfers succeeded and GAS minted):
```
{
"result" : {
"executions" : [
{
"gasconsumed" : "11955500",
"trigger" : "Application",
"stack" : [
{
"type" : "Boolean",
"value" : true
},
{
"type" : "Boolean",
"value" : true
}
],
"vmstate" : "HALT",
"notifications" : [
{
"eventname" : "Transfer",
"contract" : "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"state" : {
"value" : [
{
"type" : "Any"
},
{
"value" : "22FgR96+aoUSmQDxTx2myn29r4U=",
"type" : "ByteString"
},
{
"value" : "4316",
"type" : "Integer"
}
],
"type" : "Array"
}
},
{
"state" : {
"type" : "Array",
"value" : [
{
"value" : "22FgR96+aoUSmQDxTx2myn29r4U=",
"type" : "ByteString"
},
{
"type" : "ByteString",
"value" : "22FgR96+aoUSmQDxTx2myn29r4U="
},
{
"type" : "Integer",
"value" : "1111111111"
}
]
},
"contract" : "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
"eventname" : "Transfer"
},
{
"contract" : "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
"state" : {
"type" : "Array",
"value" : [
{
"value" : "22FgR96+aoUSmQDxTx2myn29r4U=",
"type" : "ByteString"
},
{
"type" : "ByteString",
"value" : "22FgR96+aoUSmQDxTx2myn29r4U="
},
{
"type" : "Integer",
"value" : "1111111"
}
]
},
"eventname" : "Transfer"
}
]
}
],
"txid" : "0x8e73a7e9a566a514813907272ad65fc965002c3b098eacc5bdda529af19d7688"
},
"id" : 1,
"jsonrpc" : "2.0"
}
```
2021-06-09 13:36:50 +03:00
Anna Shaleva
f95bdd9cb5
vm: serialize +
rune as \u002B
for byte-contained stackitems
...
This commit fixes the following Go vs C# state diff:
block 74613: value mismatch for key EwAAAHN0cmVhbXMvDg==: eyJpZCI6MTQsInN0YXJ0IjoxNjIyNTAwMjAwMDAwLCJzdG9wIjoxNjIyNTAyMDAwMDAwLCJkZXBvc2l0IjoxMDAwMDAwMDAsInJlbWFpbmluZyI6MTAwMDAwMDAwLCJzZW5kZXIiOiJmeEY4RDl2ZFU3K0gwcDV3NTlyWllMNytNSlE9IiwicmVjaXBpZW50IjoiSVV6c3pveFV0S1NGVnlZRGczSmdTQTFlbTFNPSJ9 vs eyJpZCI6MTQsInN0YXJ0IjoxNjIyNTAwMjAwMDAwLCJzdG9wIjoxNjIyNTAyMDAwMDAwLCJkZXBvc2l0IjoxMDAwMDAwMDAsInJlbWFpbmluZyI6MTAwMDAwMDAwLCJzZW5kZXIiOiJmeEY4RDl2ZFU3XHUwMDJCSDBwNXc1OXJaWUw3XHUwMDJCTUpRPSIsInJlY2lwaWVudCI6IklVenN6b3hVdEtTRlZ5WURnM0pnU0ExZW0xTT0ifQ==
I.e.:
```
{"id":14,"start":1622500200000,"stop":1622502000000,"deposit":100000000,"remaining":100000000,"sender":"fxF8D9vdU7+H0p5w59rZYL7+MJQ=","recipient":"IUzszoxUtKSFVyYDg3JgSA1em1M="}
```
vs
```
{"id":14,"start":1622500200000,"stop":1622502000000,"deposit":100000000,"remaining":100000000,"sender":"fxF8D9vdU7\u002BH0p5w59rZYL7\u002BMJQ=","recipient":"IUzszoxUtKSFVyYDg3JgSA1em1M="}
```
2021-06-08 16:40:38 +03:00
Anna Shaleva
20e0a0d746
core: add price for CALLT instruction
2021-06-07 19:17:22 +03:00
Roman Khimov
352450d25a
Merge pull request #1988 from nspcc-dev/cli-permission
...
cli,compiler: allow to specify manifest permissions
2021-06-07 10:27:29 +03:00
Roman Khimov
2837b98eb3
Merge pull request #1993 from nspcc-dev/mpt-tests
...
Add MPT compatibility tests
2021-06-07 10:24:59 +03:00
Roman Khimov
a6fc5d9fe4
Merge pull request #1998 from nspcc-dev/fix-calculatenetworkfee-result
...
rpc: wrap calculatenetworkfee result in a structure
2021-06-07 09:53:48 +03:00
Roman Khimov
efb814a97e
Merge pull request #1995 from nspcc-dev/compiler-verify-notify
...
compiler: disallow `runtime.Notify` in `Verify` function
2021-06-06 11:34:42 +03:00
Evgeniy Stratonikov
1578904da2
compiler: disallow runtime.Notify
in Verify
function
...
Only direct invocations are considered. The check can be disabled
with '--no-events' compiler option.
2021-06-06 09:34:24 +03:00
Roman Khimov
1cea0dd894
Merge pull request #1997 from nspcc-dev/drop-syncreached-check
...
network: drop useless flag check
2021-06-04 23:39:34 +03:00
Roman Khimov
6a61e86d12
rpc: wrap calculatenetworkfee result in a structure
...
C#:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"networkfee": "1185120"
}
}
Go:
{
"id": 2,
"jsonrpc": "2.0",
"result": 1185120
}
Thanks @csmuller for finding it.
2021-06-04 23:38:35 +03:00
Roman Khimov
f6da88af0d
network: drop useless flag check
...
It's the first thing done in tryStartServices(), so checking it here doesn't
make much sense.
2021-06-04 20:29:47 +03:00
Evgeniy Stratonikov
4467e2cbfd
cli,compiler: allow to specify manifest permissions
2021-06-04 11:16:22 +03:00
Evgeniy Stratonikov
f3d02b9fef
mpt/tests: add compatibility tests
2021-06-04 11:09:17 +03:00
Evgeniy Stratonikov
e833d333fe
mpt: disallow empty keys
...
This is not a problem in practice, as all keys are prefixed
by a contract ID. However in theory it can lead to a different
state root after new portion of changes thus this fix.
2021-06-04 11:09:17 +03:00
Evgeniy Stratonikov
5b1f6207de
mpt: reduce max key length
...
The constant used is actually a nibbled-path restriction.
Clarify this and make them private.
2021-06-04 11:09:17 +03:00
Evgeniy Stratonikov
1d6d7206e9
compiler: inline expressions with type conversions, fix #1879
...
Don't count `string(data)` or `[]byte(data)` as function calls.
2021-06-04 11:08:00 +03:00
Evgeniy Stratonikov
6b3afe9131
compiler: inline all expression with no side-effects, fix #1881
...
This has the drawback of traversing expression each time the argument is
used. However this is not the case in our syscall/native wrappers.
The old behaviour can be restored by explicit local assignment.
2021-06-04 11:07:59 +03:00
Evgeniy Stratonikov
3749f38720
compiler/test: add more tests for inline behaviour
2021-06-04 11:06:09 +03:00
Evgeniy Stratonikov
c538512e60
compiler/test: check Main
locals in inline tests
2021-06-04 11:06:09 +03:00
Evgeniy Stratonikov
5e92a254b2
compiler: check event name length in runtime.Notify
2021-06-03 10:32:56 +03:00
Evgeniy Stratonikov
1a5e656d38
compiler: restore event check warnings
...
It was broken after changes for inlining. Add tests.
2021-06-03 10:32:56 +03:00
Anna Shaleva
b14fc5da7c
vm: increase waiting time for vm cli program
2021-06-01 16:29:08 +03:00
Anna Shaleva
1dbf1d4310
rpc: allow to track notary requests via Notification subsystem
2021-06-01 16:29:04 +03:00
Anna Shaleva
b8e96ac82b
core: move mempool.Event to a separate package
...
And write a marshaller for EventType, it'll be reused by the Notification
subsystem.
2021-06-01 12:24:28 +03:00
Anna Shaleva
999fba81cd
core: export (*NEOBalanceState).FromStackItem
2021-05-31 11:18:54 +03:00
Roman Khimov
b858be63b4
Merge pull request #1969 from nspcc-dev/examples/nns-fix
...
examples: fix IPv6 bounds check
2021-05-28 14:29:54 +03:00
Anna Shaleva
e3611bfa4c
vm, cli: allow to specify flags while loading VM
2021-05-28 12:07:41 +03:00
Anna Shaleva
2a9ce03376
examples: fix IPv6 bounds check
2021-05-28 11:31:09 +03:00
Evgeniy Stratonikov
233996eec0
native/neo: add getAccountState
method, close #1975
2021-05-27 10:59:38 +03:00
Evgeniy Stratonikov
e314e55a1b
compiler: add Base58Check*
interop wrappers
...
Missing piece from #1977 .
2021-05-25 18:06:40 +03:00
Roman Khimov
8a55bd528d
Merge pull request #1977 from nspcc-dev/interop-base58check
...
native/std: add base58Check* methods
2021-05-25 17:57:23 +03:00
Evgeniy Stratonikov
192771a58a
native/std: add base58Check* methods, close #1974
2021-05-25 17:32:19 +03:00
Evgeniy Stratonikov
c8ddc790d9
rpc/request: handle bool parameters correctly
2021-05-25 11:24:28 +03:00
Evgeniy Stratonikov
60a3e0d778
compiler: count auxiliary locals introduced by inlining
...
During initialization of globals no function scope is present thus
locals number is not saved anywere. Save it in `codegen` directly.
2021-05-19 11:50:07 +03:00
Evgeniy Stratonikov
87a69b13f1
compiler/test: add test for inlining with local alias
...
INITSLOT count should be 1 more than for the same test with global.
2021-05-19 11:50:07 +03:00
Evgeniy Stratonikov
b693d54282
compiler: count local variables on the go
...
Create local variables as they are needed and remove `INITSLOT`
if there were no locals. This helps to eliminate a whole class
of bugs when calculated and real amount mismatched.
2021-05-19 11:50:07 +03:00
Evgeniy Stratonikov
bfa2bafb04
compiler: optimize jumps in tests
...
Jump target shortening affects manifest, so we better be sure.
2021-05-19 09:54:10 +03:00
Evgeniy Stratonikov
2aaaf30db7
compiler: remove finallyProcessIndex
from funcScope
2021-05-19 09:54:10 +03:00
Roman Khimov
e0779f2d6e
Merge pull request #1965 from nspcc-dev/native/remove_nns
...
native: remove NNS contract
2021-05-17 22:51:58 +03:00
Anna Shaleva
2d20b0fa23
core: remove nnsrecords package from native
...
Use nns from examples instead.
2021-05-17 22:24:56 +03:00
Anna Shaleva
c9099fa555
core: remove native nonfungible token
2021-05-17 22:22:07 +03:00
Anna Shaleva
99b37efc31
core: remove native NNS
2021-05-17 22:22:07 +03:00
Anna Shaleva
4c4361b2c6
native: move\remove native NNS tests
...
Record types test is moved to non-native NNS tests and adjusted
according to the non-native implementation behavior.
NEP11-compliance test is removed (non-native NNS is checked against
NEP11 standard during examples compilation test).
Domain name test is removed (we already have the same non-native
NNS tests).
2021-05-17 22:22:03 +03:00
Anna Shaleva
bfda758221
core: replace native NNS with non-native NNS in core tests
2021-05-17 22:12:38 +03:00