-
Notifications
You must be signed in to change notification settings - Fork 664
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: Use handshake version 2 #3157
Conversation
This will allow nodes that are compatible with each other to communicate disregarding who initiated the conversation. This changes needs to be deployed in two step. This PR introduce HandshakeV2 and add ability to nodes to understand and process this types of messages. Later in PR #3157 it is started to use HandshakeV2 as default handshake. Test plan ========= Pass upgradability test
b3d2afe
to
7f8b199
Compare
Codecov Report
@@ Coverage Diff @@
## master #3157 +/- ##
==========================================
- Coverage 87.19% 87.03% -0.17%
==========================================
Files 217 217
Lines 42397 42493 +96
==========================================
+ Hits 36970 36984 +14
- Misses 5427 5509 +82
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run a nayduck run and link here
chain/network/src/types.rs
Outdated
version: handshake_old.oldest_supported_version, | ||
// In previous version of handshake, nodes usually sent the oldest supported version instead of their current version. | ||
// Computing the current version of the other as the oldest version plus 4, but not letting go bigger than 33. | ||
version: std::cmp::min(PROTOCOL_VERSION - 1, handshake_old.version.saturating_add(4)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PROTOCOL_VERSION will be changing. This should be a separate named constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that this changes with as the PROTOCOL_VERSION
changes. This conversion will only be relevant during the transition from Handshake to HandshakeV2, since we were previously sending oldest supported version, we are predicting its version as oldest_supported_version+1
, but we know for sure they should be at least one version lower than current version.
7f8b199
to
23d746e
Compare
|
3c4eaf4
to
ca59279
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to unblock #3283
This will allow nodes that are compatible with each other to communicate disregarding who initiated the conversation. Test plan ========= Pass upgradability test
**DO NOT MERGE** This change is only backward compatible with branch latest_supported_version. We must merge and deploy that branch first. Test plan ========= 1. Check latest_supported_version_2 branch is backward compatible with latest_supported_version branch. Run backward.py with main(near_root, "latest_supported_version", "latest_supported_version_2") 2. handshake.py pass
ca59279
to
b153dc6
Compare
@mfornet looks like upgradability test failed |
deb2d2f
to
002d8f0
Compare
Both It is downloading binary from: https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/ |
… latest_supported_version_2
* fix: Use both version and oldest_supported version This will allow nodes that are compatible with each other to communicate disregarding who initiated the conversation. Test plan ========= Pass upgradability test * Fix failing test * fix: Use handshake version 2 **DO NOT MERGE** This change is only backward compatible with branch latest_supported_version. We must merge and deploy that branch first. Test plan ========= 1. Check latest_supported_version_2 branch is backward compatible with latest_supported_version branch. Run backward.py with main(near_root, "latest_supported_version", "latest_supported_version_2") 2. handshake.py pass * Update handshake.py * Use previous version as default version for incoming handshakes * Use +1 predicted version * Respond with current version to other nodes * Reaction to ProtocolVersionMismatch and better API * Update backward compatible test * Remove Option * Fix codec test * Backward compatible with version bump * hotfix upgradable tests * Address bowen comments * test fix * test another attempt * compile current * add debug info * try again * remove debug info * Remove unnecessary version checks * Add responses to Handshake with future version * Fix test * Don't use match Co-authored-by: Bowen Wang <[email protected]>
* fix: Use both version and oldest_supported version This will allow nodes that are compatible with each other to communicate disregarding who initiated the conversation. Test plan ========= Pass upgradability test * Fix failing test * fix: Use handshake version 2 **DO NOT MERGE** This change is only backward compatible with branch latest_supported_version. We must merge and deploy that branch first. Test plan ========= 1. Check latest_supported_version_2 branch is backward compatible with latest_supported_version branch. Run backward.py with main(near_root, "latest_supported_version", "latest_supported_version_2") 2. handshake.py pass * Update handshake.py * Use previous version as default version for incoming handshakes * Use +1 predicted version * Respond with current version to other nodes * Reaction to ProtocolVersionMismatch and better API * Update backward compatible test * Remove Option * Fix codec test * Backward compatible with version bump * hotfix upgradable tests * Address bowen comments * test fix * test another attempt * compile current * add debug info * try again * remove debug info * Remove unnecessary version checks * Add responses to Handshake with future version * Fix test * Don't use match Co-authored-by: Bowen Wang <[email protected]>
This change is only backward compatible with branch latest_supported_version,
We must merge and deploy that branch first.
Fixes #3136
Test plan
Check latest_supported_version_2 branch is backward compatible with
latest_supported_version branch.
Run
backward.py
withmain(near_root, "latest_supported_version", "latest_supported_version_2")
and check it passes.handshake.py
pass