-
Notifications
You must be signed in to change notification settings - Fork 157
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
Schedule Coldkey Swap #620
Merged
Merged
Conversation
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
…into arbitrage_coldkeys
…into arbitrage_coldkeys
sam0x17
reviewed
Jul 9, 2024
gztensor
requested changes
Jul 9, 2024
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.
It's a small nit, but if tempo is 0, it means we have 7.2 emissions per day, not 0, because of how blocks_until_next_epoch
function is defined. The code in get_delegate_by_existing_account
should be:
if tempo > U64F64::from_num(0) {
let epochs_per_day: U64F64 = U64F64::from_num(7200).saturating_div(tempo);
emissions_per_day =
emissions_per_day.saturating_add(emission.saturating_mul(epochs_per_day));
} else {
emissions_per_day = emissions_per_day.saturating_add(U64F64.from_num(7.2))
}
keithtensor
approved these changes
Jul 9, 2024
gztensor
approved these changes
Jul 9, 2024
JohnReedV
approved these changes
Jul 9, 2024
camfairchild
approved these changes
Jul 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new extrinsic called schedule_coldkey_swap that allows users to swap their potentially compromised coldkeys while implementing a time-based arbitration mechanism for resolving multiple swap requests.
Motivation for change
The primary motivation for this change is to address a recent security incident where coldkeys were potentially compromised. This feature enhances the security and flexibility of the Subtensor network by providing users with a mechanism to replace compromised coldkeys. It's crucial for maintaining the integrity of user accounts and protecting their assets in case of security breaches or key compromises.
Behaviour pre-change
Before this change, users had no built-in mechanism to swap their coldkeys if they were compromised. This lack of functionality could lead to potential security risks and loss of assets if a coldkey was compromised without any means of replacement. In light of the recent security incident, this limitation posed a significant risk to affected users.
Behaviour post-change
After implementing this feature:
Users can initiate a coldkey swap by calling the schedule_coldkey_swap function, providing the new coldkey and a proof of work.
The system implements an arbitration period to handle multiple swap requests:
The difficulty of the proof of work increases exponentially with each subsequent swap attempt, adding an extra layer of security.
After the arbitration period, the system either performs the swap if there's only one destination coldkey or extends the arbitration period if there are multiple requests.
The swap process includes transferring all associated data and balances from the old coldkey to the new one, including stakes, owned hotkeys, and subnet ownership.
This new functionality allows users affected by the recent security incident to secure their accounts and assets by replacing potentially compromised coldkeys.
Alternatives considered
Immediate swaps without arbitration: This was deemed too risky as it could lead to potential abuse or unauthorized swaps, especially in the context of the recent security incident.
Manual review process: While more secure, this would be less efficient and require more administrative overhead, which could delay the resolution for affected users.
TODO:
Related Issue(s)
Type of Change
Breaking Change
If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.
Checklist
cargo fmt
andcargo clippy
to ensure my code is formatted and linted correctlyScreenshots (if applicable)
Please include any relevant screenshots or GIFs that demonstrate the changes made.
Additional Notes
Please provide any additional information or context that may be helpful for reviewers.