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
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
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
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
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
Anna Shaleva
1dbf1d4310
rpc: allow to track notary requests via Notification subsystem
2021-06-01 16:29:04 +03:00
Roman Khimov
9d2712573f
*: enable godot linter and fix all its warnings
...
It's important for NeoGo to have clean documentation. No functional changes.
2021-05-12 23:17:03 +03:00
Roman Khimov
c4e084b0d8
*: fix whitespace errors
...
leading/trailing newlines
2021-05-12 22:51:41 +03:00
Roman Khimov
99108c620f
network: fix errcheck warning
2021-05-12 20:14:35 +03:00
Roman Khimov
601841ef35
*: drop unused structure fields
...
Found by structcheck:
`good` is unused (structcheck)
and alike.
2021-05-12 19:41:23 +03:00
Roman Khimov
78bf172108
network: drop some not really useful test code
...
SA4010: this result of append is never used, except maybe in other appends (staticcheck)
2021-05-12 19:29:45 +03:00
Roman Khimov
0178594850
*: simpilfy make() invocations
...
gosimple: S1019: should use make([]byte, 64) instead
2021-05-12 18:36:45 +03:00
Roman Khimov
cfc067dd24
*: remove dead code
...
Found by deadcode via golangci-lint.
2021-05-12 18:13:14 +03:00
Evgeniy Stratonikov
275a5c9daa
network: limit message number from the same sender
2021-05-12 10:52:11 +03:00
Evgeniy Stratonikov
35cdf0447c
extpool/test: remove debug print
2021-05-11 12:16:24 +03:00
Anna Shaleva
09bb162de0
network: add ability to specify port for P2P version exchange
2021-04-30 11:27:55 +03:00
Roman Khimov
99b71bbbd1
network: move service starts to tryStartServices
...
All of them only make sense on a fully synchronized node, doing anything
during the initial sync is just a waste of time.
2021-04-02 13:12:06 +03:00
Roman Khimov
690a1db589
network: replace consensusStarted/canHandleExtens with syncReached flag
...
They're essentially the same.
2021-04-02 12:55:56 +03:00
Roman Khimov
a01636a1b0
stateroot: set networking callback in a more straightforward way
2021-04-02 12:12:36 +03:00
Roman Khimov
546faf5e70
Merge pull request #1859 from nspcc-dev/rework-signing-fix-stateroots
...
Rework signing, fix stateroots
2021-03-26 14:04:23 +03:00
Roman Khimov
0888cf9ed2
network: drop Network from Message
...
It's not used any more.
2021-03-26 13:45:18 +03:00
Roman Khimov
c789431402
payload: drop Network from P2PNotaryRequest
...
It's not needed now.
2021-03-26 13:45:18 +03:00
Roman Khimov
f91ff78918
payload: drop Network from Extensible
...
It's only used to sign/verify it and is not a part of the structure. It's
still neded in consensus.Payload though because that's the way dbft library
is.
2021-03-26 13:45:18 +03:00
Roman Khimov
95c279325a
block: drop Network from the Header
...
It's not network-tied any more, network is only needed to
sign/verify. Unfortunately we still have to keep network in consensus data
structures because of dbft library interface.
2021-03-26 13:45:18 +03:00
Roman Khimov
d314f82db3
transaction: drop Network from Transaction
...
We only need it when signing/verifying.
2021-03-26 13:45:18 +03:00
Roman Khimov
df12adaa9e
crypto: remove crypto.Verifiable interface
...
We can now verify any hash.Hashable thing.
2021-03-26 13:45:18 +03:00
Roman Khimov
fa4380c9da
network: prevent putting duplicate addresses into pool from peer's data
...
It can't be trusted.
2021-03-26 12:31:07 +03:00
Roman Khimov
d0634a7829
network: don't attempt to connect to the same node twice
...
We can have multiple copies of the same address in the pool and we should only
proceed to connect once per attempt.
2021-03-26 12:26:45 +03:00
Anna Shaleva
23a3514cc0
consensus: store ProtocolConfiguration in consensus config
2021-03-15 16:58:27 +03:00
Roman Khimov
7730aef0ec
payload: adapt notary payloads to new hashing too
2021-03-12 14:14:22 +03:00
Roman Khimov
4462a6a6b7
change block/tx/extensible signing process, fix #1741
...
Sign [magic, hash], see neo-project/neo#2314 .
2021-03-12 11:27:50 +03:00
Evgeniy Stratonikov
f83b376181
block: replace Base
with Header
2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
4df8a2ad36
block: remove MaxContentsPerBlock
2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
2f3abf95a2
stateroot: broadcast state on new blocks
2021-03-09 13:51:11 +03:00
Evgeniy Stratonikov
3c65ed1507
stateroot: allow to sign new roots
2021-03-09 13:51:11 +03:00
Evgeniy Stratonikov
ac227a80fe
stateroot: use RoleStateValidator for verification
2021-03-09 13:51:10 +03:00
Anna Shaleva
2c81fc8b8e
*: upgrade tests to use T.Cleanup()
2021-03-01 17:08:00 +03:00
Anna Shaleva
94430ef3ca
network: refactor RelayTx error handling
...
We don't need to wrap different core errors in server. Also it would be
good to provede more error info to the user.
2021-02-18 12:40:40 +03:00
Roman Khimov
608df7fb21
Merge pull request #1747 from nspcc-dev/default-notary-config
...
notary: usability improvements
2021-02-17 14:21:47 +03:00
Anna Shaleva
9a8a19d2f2
network: optimise NotaryPayload decoding
...
We have scripts length check during transaction decoding, so don't need
to check it twice.
2021-02-17 13:19:26 +03:00
Anna Shaleva
a6d4a266b9
core: check transaction's scripts length during decoding
2021-02-17 13:19:23 +03:00
Anna Shaleva
9f6fba5926
network: specify error message
...
For better user experience.
2021-02-16 14:11:42 +03:00
Anna Shaleva
bcb82b457d
config: move notary module config to ApplicationConfiguration
2021-02-16 13:58:25 +03:00
Anna Shaleva
3fed06989a
network: allow larger extensible payload
2021-02-15 15:19:05 +03:00
Anna Shaleva
a237e34c1f
rpc: add test for submitNotaryRequest
2021-02-11 17:15:59 +03:00
Anna Shaleva
8444f3d816
network: refactor notary service's PostBlock
...
There was a deadlock while trying to finalize transaction during
PostBlock:
1) (*Notary).PostBlock is called under the blockchain lock
2) (*Notary).onTransaction is called inside the PostBlock
3) (*Notary).onTransaction needs to RLock the blockchain to add
completed transaction to the memory pool (and the blockchain is Lock'ed
by this moment)
The problem is fixed by using notifications subsistem, because it's not
required to call (*Notary).PostBlock under the blockchain lock.
2021-02-11 17:11:36 +03:00
Anna Shaleva
5d6fdda664
network: fix P2PNotaryRequest payload broadcaster
2021-02-11 17:11:36 +03:00
Anna Shaleva
5c2ea2d5bb
network: refactor P2PNotaryRequest decoding
...
We need to provide magic for both main and fallback transactions during
decoding, because transactions hashes depend on it.
2021-02-11 17:11:33 +03:00
Anna Shaleva
c14e34cdb5
network: add RelayP2PNotaryRequest method
2021-02-11 16:56:24 +03:00