-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow direct replacement of a node in subnet (#3377)
### Summary This PR resolves a long-standing issue faced by many node providers, that a node cannot be replaced if it's currently in a subnet. However, if the IP address of the node matches, this means that the new node is a direct replacement for the old node, which also means that the subnet decentralization is unaffected. Therefore, we now allow a direct replacement of nodes that are in a subnet. Direct removal of such nodes is still not allowed though, since that would change the subnet decentralization. ### Changes - **Node Addition**: - If there is exactly one node with the same IP, prepare node remove mutations `make_remove_or_replace_node_mutations`. - Atomically remove and add nodes (change in behavior compared to before). - Adjusts node allowance based on nodes removed and added. - **Node Removal & Replacement**: - Implements `do_replace_node_with_another` method for replacing nodes within a subnet, for testing purposes. - Adjusts node operator's node allowance after node mutations. - **Tests**: - Enhances test coverage to verify node replacement in subnets. - Adds tests to validate allowance update during node replacements. ### Miscellaneous - Internal private methods adapted to support new logic without breaking existing functionality.
- Loading branch information
1 parent
1187a89
commit de11e79
Showing
4 changed files
with
475 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.