You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: