nspcc-dev / neo-go

Go Node and SDK for the NEO blockchain
MIT License
118 stars 77 forks source link

Adjust Extensible verification height interval #3466

Open AnnaShaleva opened 1 month ago

AnnaShaleva commented 1 month ago

Based on the recent experiments with time-constrained dBFT, the following behaviour pattern was discovered: with low MillisecondsPerBlock setting often CVs happen due to peer disconnections:

2024-05-17T02:07:23.551+0200    WARN    peer disconnected   {"addr": "65.109.22.38:49298", "error": "handling CMDExtensible message: invalid height", "peerCount": 6}

It's caused by the lack of synchronization between peers and by the fact that network delays are comparable with MillisecondsPerBlock. We need to adjust the rule for Extensible verification and likely do not disconnect from peers that are not far ahead from the node: https://github.com/nspcc-dev/neo-go/blob/0b136c1c9cde3df17c1dff90b2aa25dd4f1d9984/pkg/network/extpool/pool.go#L83-L91

roman-khimov commented 6 days ago

ValidBlockStart is always zero for us, so it's just about ValidBlockEnd, additional tolerance is needed or better a counter of errors (in the upper layer). The purpose of disconnect is mostly to avoid malicious nodes spamming us with bad things. We can tolerate some amount of some errors per some amount of time. There are grave protocol violations (like not performing a handshake properly) and there are these softer ones like someone can send a stale transaction or a too new extensible.