Commit graph

444 commits

Author SHA1 Message Date
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
Roman Khimov
eecd71abeb payload: treat zero-length headers as error
See neo-project/neo#2259.
2021-02-06 00:06:01 +03:00
Roman Khimov
a87b8578b2 network: stub "StateService" payloads out for now
And stop dropping connections if we're to receive them. Proper handling is
subject of #1701, but we need at least some connection-level stability for
now.
2021-02-05 14:59:41 +03:00
Roman Khimov
686f983ccf network: prevent disconnects during initial sync
Node receiving extensible payload from the future is confused and drops
connection. Note that this can still happen if the node is to loose its
synchrony.

Calling `IsInSync()` is quite expensive, so we stop doing that once synchrony
is reached (hence bool flag).
2021-02-05 14:54:43 +03:00
Roman Khimov
6fd5f4e86d payload: extensible payload hashes are network-dependent
Of course they are. Fixes

2021-02-04T13:39:02.351Z        WARN    peer disconnected       {"addr": "172.29.0.4:20333", "reason": "handling CMDExtensible message: signature check failed: invalid signature", "peerCount": 3}
2021-02-04T13:39:02.352Z        WARN    peer disconnected       {"addr": "172.29.0.3:20334", "reason": "handling CMDExtensible message: signature check failed: invalid signature", "peerCount": 2}

in 2+2 setting.
2021-02-04 16:50:51 +03:00
Anna Shaleva
4ad9c7929b internals: move testchain from network to internals
It'll be useful for tests outside of the network pkg.
2021-02-02 22:01:32 +03:00
Anna Shaleva
bfbd096fed core: introduce mempool notifications 2021-02-02 22:01:32 +03:00
Anna Shaleva
19fa0daaa6 core, network: add Notary module 2021-02-02 22:01:20 +03:00