-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
single-pool: add ReactivatePool
instruction
#5488
single-pool: add ReactivatePool
instruction
#5488
Conversation
/// Restake the pool stake account if its validator is force-deactivated and later | ||
/// recreated with the same vote account. |
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.
feel free to suggest different wording for this, im not familiar enough with the mechanism that causes this to happen to craft proper verbiage
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.
Let's call out all the cases: "Restake the pool stake account if it was deactivated. This can happen through the stake program's DeactivateDelinquent
instruction, or during a cluster restart."
// make an individual instruction for all program instructions | ||
// the match is just so this will error if new instructions are added | ||
// if you are reading this because of that error, add the case to the `consistent_account_order` test!!! |
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 may amuse you to hear that i added this comment because i, the author of this file, almost added the new instruction to the match without remembering it also needs to be added to the test
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.
Haha we all have goldfish-brain moments
ughhhh i marked draft thinking i would merge #5183 first because this will be much easier to rebase. but actually nevermind im going to merge this first because i have to rebase #5183 already anyway because dependabot updates mean ci doesnt run on it until i do. so ill fix the js code properly in there because the js code in master is all getting deleted anyway |
9653359
to
58ad6e4
Compare
58ad6e4
to
4f9d242
Compare
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.
Looks really good! Just a few little comments
/// Restake the pool stake account if its validator is force-deactivated and later | ||
/// recreated with the same vote account. |
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.
Let's call out all the cases: "Restake the pool stake account if it was deactivated. This can happen through the stake program's DeactivateDelinquent
instruction, or during a cluster restart."
/// 5. `[]` Stake history sysvar | ||
/// 6. `[]` Stake config sysvar | ||
/// 7. `[]` Stake program | ||
ReactivatePool, |
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.
I got a little tripped up on the name, but I see what you use it, since redelegate
means something else. The only thing I was able to come up with is DelegatePoolStake
which would say literally what's happening, but wouldn't be as clear as to when it would be useful. If you prefer ReactivatePool
, I'm good with it
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.
ReactivateStake
? ReactivatePoolStake
?
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.
last one seems fine
// make an individual instruction for all program instructions | ||
// the match is just so this will error if new instructions are added | ||
// if you are reading this because of that error, add the case to the `consistent_account_order` test!!! |
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.
Haha we all have goldfish-brain moments
context.set_account( | ||
&accounts.stake_account, | ||
&AccountSharedData::from(stake_account), | ||
); |
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.
I should really use this in my testing too, this was a nice reminder, thanks!
single-pool/cli/src/main.rs
Outdated
|
||
Ok(format_output( | ||
config, | ||
"Reactivate".to_string(), |
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.
nit: to be consistent with the instruction name?
"Reactivate".to_string(), | |
"ReactivatePool".to_string(), |
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.
theres a mystery convention in my head where InitializePool
-> Initialize
, DepositStake
-> Deposit
etc because these have longer "instruction" names and shorter "transaction" names, but since this has no multi-instruction transaction i guess that makes more sense
normally id merge because the fixes are trivial but wanna get the stamp because i changed the program. also i copied your fix from #5514 |
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.
Looks great, thanks for integrating all the suggestions!
handles the issue described in #5439. the first commit is the important one (changes the program itself), the others just add to the cli. also i moved half the commands into a subcommand, 99% of users are only ever going to need
deposit
andwithdraw
so im trying to minimize visual clutter