Anna Shaleva
a0774a2194
core: pop native call arguments after call invocation
...
Close #2489 .
2022-05-16 09:39:17 +03:00
Roman Khimov
058a7eff90
Merge PR #2488 from nspcc-dev/reorder-neo-gas-distribution
2022-05-13 19:36:34 +03:00
Roman Khimov
54d8a37f3b
native: make it mergeable with master again
2022-05-13 18:51:27 +03:00
Roman Khimov
85fe111aea
neo: mint GAS after NEO transfer processing
...
See neo-project/neo#2734 .
2022-05-13 18:05:27 +03:00
Anna Shaleva
6020ca9ae8
crypto: adjust Checksum documentation
2022-05-13 13:20:40 +03:00
Anna Shaleva
e31f4ca331
interop: add interop API for MODMUL, MODPOW opcodes
2022-05-12 14:31:24 +03:00
Anna Shaleva
e66e82278c
vm: upgrade submodule
2022-05-12 14:25:14 +03:00
Anna Shaleva
a94ccf9236
vm: add MODMUL and MODPOW opcodes
...
Close #2470 .
2022-05-12 14:25:14 +03:00
Roman Khimov
7fd0eb14b5
Merge pull request #2469 from nspcc-dev/hardfork
...
core: add ability to create hard-forks
2022-05-12 14:05:48 +03:00
Roman Khimov
e7a0722849
rpc: bump getversion compat again
...
Version 0.98.4 is officially released with the old behaviour. The same thing
as #2472 .
2022-05-12 10:37:56 +03:00
Roman Khimov
c6f8c33e66
Merge pull request #2478 from nspcc-dev/mainnet-fixes
...
Mainnet fixes
2022-05-12 10:04:53 +03:00
Roman Khimov
64baa309cb
Merge pull request #2475 from nspcc-dev/vm/fix-jump
...
vm: check instruction offset is valid before subsequent IP move
2022-05-12 10:04:04 +03:00
Roman Khimov
621db8c832
stackitem: allow to unJSONize big numbers (>int64), fix #2477
...
100000000000000000000 overflows int64 and NeoGo returns some garbage to
contracts instead of a proper number.
2022-05-11 21:03:10 +03:00
Roman Khimov
3d1a81df1f
native: std.itoa uses lower-cased letters, fix #2476
2022-05-11 19:33:17 +03:00
Anna Shaleva
5505acf10e
core: change Create[Standard, Multisig]Account prices
...
And make a hard-fork from this change.
2022-05-11 14:21:43 +03:00
Anna Shaleva
e70bf7d12e
core: allow to create hard-fork
2022-05-11 14:21:38 +03:00
Anna Shaleva
3be37e8c5b
vm: check instruction offset is valid before subsequent IP move
...
Reference implementation:
e167f03e25/src/neo-vm/ExecutionContext.cs (L77)
.
Turns out that exception-related code (try\finally handling) is the only
place where next instruction pointer bounds are not pre-checked before
assignment. This statement is true for both go and C# implementations.
However, C# code has duplicate check located inside the
InstructionPointer setter for all instructions except the
exception-related ones. Neo-go code doesn't perform this duplicate check.
Thus, C# VM FAULTs execution in case of invalid TRY/FINALLY offsets, and
neo-go VM does not.
This commit reverts a part of
https://github.com/nspcc-dev/neo-go/pull/2396 . This bug is discovered
thanks to test added in https://github.com/neo-project/neo-vm/pull/453 .
2022-05-11 14:04:02 +03:00
Anna Shaleva
d88ca102c6
services: forbid insecure Oracle request redirects
2022-05-11 09:45:44 +03:00
Roman Khimov
d1588115a2
Merge pull request #2473 from nspcc-dev/fix-gosimple-wrn
...
services: fix gosimple warning
2022-05-11 09:22:05 +03:00
Roman Khimov
483130fa7c
Merge pull request #2472 from nspcc-dev/shift-getversion-compat
...
rpc: move latest getversion compat to 0.98.3
2022-05-11 08:10:07 +03:00
Anna Shaleva
48ee33fd61
services: fix gosimple warning
...
Fix the following warning:
```
S1001: should use copy() instead of a loop (gosimple)
```
2022-05-11 07:39:27 +03:00
Roman Khimov
2b79a162ce
Merge pull request #2467 from nspcc-dev/limit-eq
...
vm: adjust comparable limit for ByteArray
2022-05-10 19:53:20 +03:00
Roman Khimov
bb0efed8b7
rpc: move latest getversion compat to 0.98.3
...
Version 0.98.3 is officially released with the old behavior.
2022-05-07 22:34:40 +03:00
Roman Khimov
711e21709f
rpc/notary: make this branch mergeable with master
2022-05-07 18:38:50 +03:00
Anna Shaleva
8af043520d
vm: adjust MaxByteArrayComparableSize value
...
https://github.com/neo-project/neo-vm/pull/454#discussion_r857533800 .
2022-05-07 12:56:09 +03:00
Anna Shaleva
23b78b0be2
vm: limit ByteArray comparable length
...
Close #2460 .
2022-05-07 12:56:04 +03:00
Roman Khimov
7dc0404306
transaction: fix maxSubitems handling in JSON scope unmarshaller
...
Notice that binary deserializer (readArrayOfConditions) does it correctly. Can
be checked with neo-project/neo#2720 case.
2022-05-07 12:05:34 +03:00
Roman Khimov
c410219cba
transaction: fix Rules stringer, it's WitnessRules in C#
...
See neo-project/neo#2720 .
2022-05-07 12:05:25 +03:00
Anna Shaleva
b1f74b549d
rpc: avoid panic during request after WS connection is closed
...
Fix the following panic:
```
panic: assignment to entry in nil map
goroutine 131 [running]:
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).registerRespChannel(0xc00033c240, 0x0, 0xc00003e2a0)
/home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/wsclient.go:244 +0x96
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).makeWsRequest(0xc00033c240, 0xc002080000)
/home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/wsclient.go:264 +0x69
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).performRequest(0xc00033c240, {0xc9f173, 0xd}, {{0x13d09d0, 0x0, 0x0}}, {0xb44120, 0xc00147a000})
/home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/client.go:186 +0x15d
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).GetBlockCount(0xc001fb5440)
/home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/rpc.go:73 +0x69
...
```
2022-05-07 12:02:42 +03:00
Anna Shaleva
a7fe85a2d8
services: fix changing of main tx size of Notary request
2022-05-07 12:00:16 +03:00
Anna Shaleva
d68f57b9f9
rpc: avoid panic on double-call to *WSClient.Close()
...
Although it's the caller's duty to avoid WSClient re-closing, we
still can handle it.
Fixes the following neofs-node error:
```
panic: close of closed channel
goroutine 98 [running]:
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).Close(...)
github.com/nspcc-dev/neo-go@v0.98.3-pre.0.20220321144433-3b639f518ebb/pkg/rpc/client/wsclient.go:120
github.com/nspcc-dev/neofs-node/pkg/morph/subscriber.(*subscriber).Close(0x13)
github.com/nspcc-dev/neofs-node/pkg/morph/subscriber/subscriber.go:108 +0x29
github.com/nspcc-dev/neofs-node/pkg/morph/event.listener.Stop(...)
github.com/nspcc-dev/neofs-node/pkg/morph/event/listener.go:573
created by github.com/nspcc-dev/neofs-node/pkg/innerring.(*Server).Stop
github.com/nspcc-dev/neofs-node/pkg/innerring/innerring.go:285 +0x12f
```
2022-05-07 11:59:55 +03:00
Evgeniy Stratonikov
92a2ec5848
network: check compressed payload size in decompress
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-05-07 11:57:48 +03:00
Anna Shaleva
11bfb55b81
core: consider Rules witness scope as valid
2022-05-07 10:50:11 +03:00
Roman Khimov
7a2c7fa0bf
Merge pull request #2468 from nspcc-dev/rpc/improve-init
...
rpc: improve RPC Client initialization
2022-05-06 15:04:48 +03:00
Anna Shaleva
1782e16be4
rpc: improve RPC Client initialization
...
Thanks to #2463 .
2022-05-06 14:15:59 +03:00
Anna Shaleva
a427411a57
core: fix race during native cache persist
...
Fixes the following race:
```
2022-05-06T06:51:33.3980029Z WARNING: DATA RACE
2022-05-06T06:51:33.3980178Z Read at 0x00c0007e02a0 by goroutine 96:
2022-05-06T06:51:33.3980338Z runtime.mapaccess2_fast32()
2022-05-06T06:51:33.3980863Z /opt/hostedtoolcache/go/1.17.9/x64/src/runtime/map_fast32.go:52 +0x0
2022-05-06T06:51:33.3981249Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).getCache()
2022-05-06T06:51:33.3982707Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:905 +0x64
2022-05-06T06:51:33.3983443Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).GetROCache()
2022-05-06T06:51:33.3983900Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:889 +0xd4
2022-05-06T06:51:33.3984231Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).getCache()
2022-05-06T06:51:33.3984869Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:913 +0x196
2022-05-06T06:51:33.3985254Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).GetROCache()
2022-05-06T06:51:33.3985756Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:889 +0xd4
2022-05-06T06:51:33.3986167Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Policy).isBlockedInternal()
2022-05-06T06:51:33.3986824Z /home/runner/work/neo-go/neo-go/pkg/core/native/policy.go:258 +0x6a
2022-05-06T06:51:33.3987264Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Policy).IsBlocked()
2022-05-06T06:51:33.3987743Z /home/runner/work/neo-go/neo-go/pkg/core/native/policy.go:250 +0x2f7
2022-05-06T06:51:33.3988155Z github.com/nspcc-dev/neo-go/pkg/core/native.(*NEO).getAllCandidatesCall.func1()
2022-05-06T06:51:33.3988645Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_neo.go:948 +0x109
2022-05-06T06:51:33.3989053Z github.com/nspcc-dev/neo-go/pkg/core/native.(*NEO).getAllCandidatesCall.func2()
2022-05-06T06:51:33.3989550Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_neo.go:959 +0x137
2022-05-06T06:51:33.3989561Z
2022-05-06T06:51:33.3989735Z Previous write at 0x00c0007e02a0 by goroutine 40:
2022-05-06T06:51:33.3989891Z runtime.mapassign_fast32()
2022-05-06T06:51:33.3990260Z /opt/hostedtoolcache/go/1.17.9/x64/src/runtime/map_fast32.go:92 +0x0
2022-05-06T06:51:33.3990640Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).persistNativeCache()
2022-05-06T06:51:33.3991084Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:876 +0x12d
2022-05-06T06:51:33.3991411Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).Persist()
2022-05-06T06:51:33.3991852Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:850 +0x1d4
2022-05-06T06:51:33.3992186Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).runPersist()
2022-05-06T06:51:33.3992650Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:1285 +0x28a
2022-05-06T06:51:33.3992971Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).storeBlock()
2022-05-06T06:51:33.3993845Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:1143 +0x1b9c
2022-05-06T06:51:33.3994241Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).AddBlock()
2022-05-06T06:51:33.3994707Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:910 +0x791
2022-05-06T06:51:33.3995053Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).AddNewBlock()
2022-05-06T06:51:33.3995492Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:334 +0xa7
2022-05-06T06:51:33.3995842Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).InvokeScript()
2022-05-06T06:51:33.3996288Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:178 +0x169
2022-05-06T06:51:33.3996725Z github.com/nspcc-dev/neo-go/pkg/core/native/native_test_test.TestNEO_GetCandidates.func2()
2022-05-06T06:51:33.3997253Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_test/neo_test.go:549 +0x4cb
2022-05-06T06:51:33.3997672Z github.com/nspcc-dev/neo-go/pkg/core/native/native_test_test.TestNEO_GetCandidates()
2022-05-06T06:51:33.3998404Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_test/neo_test.go:574 +0x2103
2022-05-06T06:51:33.3998751Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).AddNewBlock()
2022-05-06T06:51:33.3999193Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:334 +0xa7
2022-05-06T06:51:33.3999541Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).InvokeScript()
2022-05-06T06:51:33.3999988Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:178 +0x169
2022-05-06T06:51:33.4000305Z github.com/nspcc-dev/neo-go/pkg/neotest.AddSystemFee()
2022-05-06T06:51:33.4000733Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:291 +0x85
2022-05-06T06:51:33.4001062Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).SignTx()
2022-05-06T06:51:33.4001509Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:111 +0x109
2022-05-06T06:51:33.4001885Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).PrepareInvocation()
2022-05-06T06:51:33.4002435Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:191 +0x1b2
2022-05-06T06:51:33.4002808Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).InvokeScript()
2022-05-06T06:51:33.4003249Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:177 +0xed
2022-05-06T06:51:33.4003685Z github.com/nspcc-dev/neo-go/pkg/core/native/native_test_test.TestNEO_GetCandidates.func2()
2022-05-06T06:51:33.4004216Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_test/neo_test.go:549 +0x4cb
2022-05-06T06:51:33.4004634Z github.com/nspcc-dev/neo-go/pkg/core/native/native_test_test.TestNEO_GetCandidates()
2022-05-06T06:51:33.4005165Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_test/neo_test.go:558 +0x1bbb
2022-05-06T06:51:33.4005298Z testing.tRunner()
2022-05-06T06:51:33.4005674Z /opt/hostedtoolcache/go/1.17.9/x64/src/testing/testing.go:1259 +0x22f
2022-05-06T06:51:33.4005916Z testing.(*T).Run·dwrap·21()
2022-05-06T06:51:33.4006298Z /opt/hostedtoolcache/go/1.17.9/x64/src/testing/testing.go:1306 +0x47
...
```
2022-05-06 13:46:17 +03:00
Anna Shaleva
ce35e69460
rpc: update testdata
...
Fix failing historic test.
2022-05-06 13:46:17 +03:00
Anna Shaleva
5123b88c36
core: extend native Neo interop API
...
Add GetAllCandidates and GetCandidateVote methods.
2022-05-06 13:43:12 +03:00
Anna Shaleva
5e2a81ad03
interop: fix the signature of Neo's GetCandidates interop API
2022-05-06 13:43:12 +03:00
Anna Shaleva
2a8ffd9318
core: refactor (*NEO).GetCandidates and add (*NEO).GetAllCandidates
2022-05-06 13:43:12 +03:00
Roman Khimov
75d06d18c9
Merge pull request #2466 from nspcc-dev/rules-fixes
...
Rules scope fixes
2022-05-06 11:09:39 +03:00
Roman Khimov
acb1151d71
transaction: fix maxSubitems handling in JSON scope unmarshaller
...
Notice that binary deserializer (readArrayOfConditions) does it correctly. Can
be checked with neo-project/neo#2720 case.
2022-05-06 10:20:55 +03:00
Roman Khimov
bd352daab4
transaction: fix Rules stringer, it's WitnessRules in C#
...
See neo-project/neo#2720 .
2022-05-06 10:08:09 +03:00
Roman Khimov
7b1943a6e5
rpc/server: return original error for invoke* param errors
2022-05-06 10:07:34 +03:00
Roman Khimov
740488f7f3
Merge pull request #2442 from EliChin/feature/eng_review
...
English Check
2022-05-05 17:12:37 +03:00
Elizaveta Chichindaeva
28908aa3cf
[ #2442 ] English Check
...
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
Roman Khimov
58bda8be78
Merge pull request #2461 from nspcc-dev/rpc-json-error-in-exception
...
rpc: signal JSON marshalling errors through exception
2022-05-04 17:22:05 +03:00
Anna Shaleva
ffdcdf4a95
core: restrict the maximum number of contract updates
2022-05-04 13:56:52 +03:00
Anna Shaleva
42e4021898
core: block destroyed contracts
2022-05-04 13:56:45 +03:00
Roman Khimov
930c439900
rpc: signal JSON marshalling errors through exception
...
See neo-project/neo-modules#696 . Unmarshaller is left unchanged to be
compatible.
2022-05-04 13:13:21 +03:00