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: Add DecreaseAdditionalValidatorStake instruction #3925

Merged
merged 2 commits into from Dec 23, 2022

Conversation

joncinque
Copy link
Contributor

Problem

It's possible to do multiple increases in a stake pool with #3924, but this is also possible with decreases!

Solution

There's nothing technically stopping two deactivating stakes from merging, so introduce a new instruction on the stake pool program which allows for more decreases in an epoch.

The normal instruction splits into the transient account and then deactivates it, so this instruction:

  • splits into an ephemeral stake account
  • if the transient account exists: merges the ephemeral stake account into the transient stake account
  • if the transient account doesn't exist: splits from ephemeral into transient, so pools can transition to always using this new instruction

The implementation is extremely similar to #3924, and this instruction is less important, so be sure to check this out afterwards.

Comment on lines 1250 to 1251
if let Some(ephemeral_stake_seed) = maybe_ephemeral_stake_seed {
let ephemeral_stake_account_info = maybe_ephemeral_stake_account_info.unwrap();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

presume you want to port trents suggestion here also

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll merge the other one first, rebase, then make that change, thanks for spotting

@2501babe
Copy link
Member

lgtm!

@joncinque
Copy link
Contributor Author

Merging this to give auditors a clean commit hash to look at -- post-merge reviews are always welcome!

@joncinque joncinque merged commit ef17887 into solana-labs:master Dec 23, 2022
@joncinque joncinque deleted the sp-redecrease branch December 23, 2022 16:27
HaoranYi pushed a commit to HaoranYi/solana-program-library that referenced this pull request Jul 19, 2023
…a-labs#3925)

* stake-pool: Add `DecreaseAdditionalValidatorStake` instruction

* Update checks for deduping
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

Successfully merging this pull request may close these issues.

None yet

2 participants