-
Notifications
You must be signed in to change notification settings - Fork 684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix large nonce issue #3013
Fix large nonce issue #3013
Conversation
Are we certain it will not cause issues? |
It shouldn't be a problem, since nodes will be out of sync very short amount of time |
On Hanndshake peers checked to larger nonce than previously known nonce to them, but they were not checking and controlling larger nonce, hence accepting every edge as long as the nonce was increasing. While this is not fundamentally wrong it can be abused, provoking overflow and eventually crashing the node. Test plan ========= This behavior was created in - tests/spec/network/controlled_edge_nonce Now this test should pass
Codecov Report
@@ Coverage Diff @@
## master #3013 +/- ##
=======================================
Coverage 87.59% 87.59%
=======================================
Files 212 212
Lines 41269 41269
=======================================
Hits 36151 36151
Misses 5118 5118 Continue to review full report at Codecov.
|
Nonces within edges are used for nodes to determine the status of the communication between a pair of nodes. The higher the nonce, the more recent the information is. Nodes should update nonce +2 on each creation, so there is no problem with overflow using u64, but there was an issue that nodes were accepting higher nonce without checking edge with previous nonce existed.
The fix is just not accepting edge proposals with higher nonce, honest nodes will never try to send higher nonce than expected since the way syncing edges is working today new nodes joining the network, even if they loose the information about old connections they will learn nonce immediately after connecting to other nodes via RoutingTable Syncing
Test plan
pytest/tests/sanity/controlled_edge_nonce.py should pass