Commit graph

5862 commits

Author SHA1 Message Date
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
AnnaShaleva
5a6cda329a github: add ability to manually trigger publishing workflow with latest tag
In case if something goes wrong during release version publishing.
2022-05-07 11:55:06 +03:00
AnnaShaleva
af7e4ce4fd github: adjust Docker image publishing workflows 2022-05-07 11:54:45 +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
Roman Khimov
697c73626a
Merge pull request #2465 from nspcc-dev/get-candidates
core: refactor native Neo's GetCandidates
2022-05-06 14:02:54 +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
0d0659cadf examples: update neo-go dependency 2022-05-06 13:45:58 +03:00
Anna Shaleva
8802dcf054 gomod: update interop dependency 2022-05-06 13:44:21 +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
Roman Khimov
4adb2b95c1
Merge pull request #2462 from nspcc-dev/block-destroyed
core: block destroyed contracts and restrict maximum contract updates
2022-05-04 14:43:51 +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
Roman Khimov
7f8b259994
Merge pull request #2457 from nspcc-dev/t5-testnet
T5 testnet
2022-05-04 10:44:55 +03:00
Roman Khimov
3c0ee9c3a3 config: switch to T5 testnet
See neo-project/neo-node#852, neo-project/neo-node#859.
2022-05-04 10:22:27 +03:00
Roman Khimov
450ca61a4e config: tune max block sysfee/size and number of tx
See neo-project/neo-modules#688, neo-project/neo-node#850 and
neo-project/neo-modules#703.
2022-05-04 10:21:55 +03:00
Roman Khimov
bde0a4367f
Merge pull request #2456 from nspcc-dev/oracle-2-redirections
oracle: limit the number of redirections to 2
2022-05-04 10:10:56 +03:00
Roman Khimov
f9c7693677 oracle: limit the number of redirections to 2
Be compatible with neo-project/neo-modules#698.
2022-05-03 23:18:53 +03:00
Roman Khimov
19eb976166
Merge pull request #2455 from nspcc-dev/pass
cli: unify password-related prompts
2022-04-29 18:46:29 +03:00
Anna Shaleva
79f377d0f0 cli: ensure wallet is non-empty while changing password
Close #2429.
2022-04-29 18:42:42 +03:00
Anna Shaleva
19e4c679d3 cli: unify password-related prompts
Close #2419.
2022-04-29 18:35:26 +03:00
Roman Khimov
83f8ecf2e0
Merge pull request #2431 from nspcc-dev/rpc/historicall
rpc: support historic calls
2022-04-29 18:24:51 +03:00
Anna Shaleva
473955c2d6 core: use proper current block height/hash for interop API 2022-04-29 18:00:46 +03:00
Anna Shaleva
9cc41528ef core: avoid unnecessary NEO cached values copying 2022-04-29 16:10:04 +03:00
Anna Shaleva
335c1ee369 core: optimize access to NEO cache
Do not copy RW cache each block. Instead we should get RO cache and
change it only if there's a necessity.
2022-04-29 16:10:04 +03:00
Anna Shaleva
a6a0c1eb12 core: avoid lock copy in private DAO constructor
Fix the following linter warning:
```
pkg/core/dao/dao.go:101:7  govet  copylocks: assignment copies lock value to *d: github.com/nspcc-dev/neo-go/pkg/core/dao.Simple contains sync.RWMutex
```
2022-04-29 16:10:04 +03:00
Anna Shaleva
8d2d48f360 core: move native cache from MemCachedStore to DAO 2022-04-29 16:10:04 +03:00
Anna Shaleva
b77b412b04 core: refactor signature of (*NEO).dropCandidateIfZero
It never returns an error.
2022-04-29 16:10:04 +03:00
Anna Shaleva
c36448f27e core: don't reset NEO's registerPrice cache 2022-04-29 16:10:04 +03:00
Anna Shaleva
adec635f0e core: don't reset NEO's gasPerBlock cache 2022-04-29 16:10:04 +03:00
Anna Shaleva
35d160075d core: keep Policy cache always valid and up-to-date 2022-04-29 16:10:04 +03:00
Anna Shaleva
78b584053d core: keep Oracle cache always valid and up-to-date 2022-04-29 16:10:04 +03:00