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

stake-pool: DecreaseAdditionalValidatorStake does not work #6275

Open
joncinque opened this issue Feb 20, 2024 · 0 comments
Open

stake-pool: DecreaseAdditionalValidatorStake does not work #6275

joncinque opened this issue Feb 20, 2024 · 0 comments

Comments

@joncinque
Copy link
Contributor

Problem

From bji's comment:

The DecreaseAdditionalValidatorStake instruction does not work despite the fact that the unit test succeeds. The stake program does not allow a stake account that has active stake and deactivating stake to be merged into; it's very clear about this both in comments and in the code of the MergeKind::get_if_mergeable function.

IncreaseAdditionalValidatorStake works because the stake pool's transient stake account after an increase instruction has zero active stake (since the transient stake account was created from reserve SOL as a new stake account) so it's fine to be merged into.

But if the transient stake account were created by a Decrease instruction, then it will have active stake (having been split off of an active stake pool vote account) and deactivating stake (since the Decrease put the new stake account in a deactivating state). According to the comments and logic of MergeKind::get_if_mergeable, this transient stake account can never be merged into, so subsequent DecreaseAdditionalValidatorStake instructions fail when they try to merge the ephemeral stake account into the transient stake account.

Solution

Either fix the stake program to allow merging deactivating stakes, or add a new version of the decrease instruction to the stake pool program which will split the ephemeral stake, activate the transient stake, merge the ephemeral into the transient, then deactivate the merged stake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant