Skip to content
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

Nodes should not be able to unbond when in the wrong state. #233

Closed
GrassRootsCrypto opened this issue May 13, 2024 · 0 comments · Fixed by #267
Closed

Nodes should not be able to unbond when in the wrong state. #233

GrassRootsCrypto opened this issue May 13, 2024 · 0 comments · Fixed by #267
Labels
enhancement New feature or request
Milestone

Comments

@GrassRootsCrypto
Copy link
Collaborator

GrassRootsCrypto commented May 13, 2024

Description

Current

Can Unbond a node in any state, e.g. active. THORNodes returns an error which is not seen by the user. Modal hangs (#192) so the user is confused about what is going on.

Desired

Do not allow Nodes Operators to Unbond when Nodes are in the following status:

  1. Active
  2. Ready
  3. Unknown
  4. Standby when retiring

Active and Ready Code Ref
https://gitlab.com/thorchain/thornode/-/blob/develop/x/thorchain/handler_unbond.go?ref_type=heads#L73

Standby when retiring Code Ref
https://gitlab.com/thorchain/thornode/-/blob/develop/x/thorchain/handler_unbond.go?ref_type=heads#L137

The user should be informed when on the Unbond page if they cannot Unbond. Users can only unbond if their node is in the standby state and their node is retired.

A Retiring Node

Retring is not Node Status, it is a state a node is in during a churn. It is migrating funds from an old vault to a new vault and thornode prohibits unbond till the migration is completed.

Something like the below should be implemented to see if a node in the Standy state is retiring.

If NodeStatus === NodeStatusEnum.Standby { 
  Get Vaults Info from https://thornode.ninerealms.com/thorchain/vaults/asgard - xchainjs should have this
  
  Then do
  
  function checkNodeRetirement(nodeAddress, vaultsData) {
      for (const vault of vaultsData) {
          if (vault.membership && vault.membership.includes(nodeAddress)) {
              return true; // Node is Retiring, cannot unbond
          }
      }
      return false; // Node is not Retiring, unbond is allowed. 
  }

}
@GrassRootsCrypto GrassRootsCrypto added the enhancement New feature or request label May 13, 2024
@GrassRootsCrypto GrassRootsCrypto added this to the 1.21.8 milestone May 13, 2024
@Thorian1te Thorian1te linked a pull request May 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant