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
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
d4d8238e91
circleci: fix image build with latest alpine
...
Upgrade Docker, see
https://discuss.circleci.com/t/unable-to-use-make/40552
https://gitlab.alpinelinux.org/alpine/aports/-/issues/12396
2021-07-07 20:21:52 +03:00
Roman Khimov
ab480f78c5
Merge pull request #2045 from nspcc-dev/improve-stackitem-serialization
...
Improve stackitem package
2021-07-07 15:42:41 +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
b345e37b8e
Merge pull request #2041 from nspcc-dev/callflags-json
...
callflag: add C#-compliant JSONization, fix #2040
2021-07-06 14:03:55 +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
e5d26a5df1
Merge pull request #2033 from nspcc-dev/sysgas
...
cli/sc: add sysgas option to add some gas
2021-07-02 12:50:21 +03:00
Roman Khimov
41e0218555
cli/wallet: add sysgas to transfer functions
...
It might also be useful there.
2021-07-02 12:34:18 +03:00
Roman Khimov
2a57e48897
cli/sc: add sysgas option to add some gas
...
Sometimes on-chain invocations need a bit more GAS than expected after test
invocations, so let the user compensate for that. 2.x has similar option since
483fefbb62
.
2021-07-02 11:57:47 +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
Roman Khimov
cf12d00b24
Merge pull request #2030 from nspcc-dev/fix-manifest
...
Fix bugs in manifest permissions
2021-06-30 11:12:02 +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
Roman Khimov
eecb952e15
Merge pull request #2025 from nspcc-dev/compiler-check-calls
...
Check manifest permissions at compile-time
2021-06-28 20:25:10 +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
16a8edaa17
Merge pull request #2023 from alexvanin/fix/example-permissions
...
Fix permissions in example manifests
2021-06-25 10:43:14 +03:00
Alex Vanin
90400d951a
examples: add missing permission methods in manifests
2021-06-24 16:00:45 +03:00
Alex Vanin
5fa000cbae
examples: rename onNEP11Transfer
to onNEP11Payment
in manifests
...
There is no such thing as `onNEP11Transfer` in NEP-11.
2021-06-23 20:48:04 +03:00
Roman Khimov
fecc7a3dd6
keys: simplify code a bit
...
No functional changes.
2021-06-17 21:55:00 +03:00
Roman Khimov
eace588e48
CHANGELOG: release 0.95.3
2021-06-17 15:57:30 +03:00
Roman Khimov
2f462f68cc
Merge pull request #2018 from nspcc-dev/cli/drop-warn
...
cli: remove `Can't find matching token in the wallet` warning
2021-06-17 12:03:51 +03:00
Anna Shaleva
67fe2a82bc
cli: remove Can't find matching token in the wallet
warning
2021-06-17 11:29:16 +03:00
Roman Khimov
880843b17b
Merge pull request #2017 from nspcc-dev/fix-diff-151376
...
core: fix the way candidates are sorted
2021-06-16 19:25:04 +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
Roman Khimov
d5e11e0a75
Merge pull request #2001 from nspcc-dev/tests/fix-failing-workflows
...
crypto: use non-default scrypt parameters for encrypting/decrypting
2021-06-11 17:27:03 +03:00
Roman Khimov
8efb8cfbf0
Merge pull request #2012 from nspcc-dev/improve-badges
...
readme: improve badges
2021-06-11 16:19:43 +03:00
Anna Shaleva
79d2a742a7
readme: unify style of all badges
2021-06-11 15:44:21 +03:00