-
Notifications
You must be signed in to change notification settings - Fork 49
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
fix: disallow target account when creating position for integrity pool #506
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -82,6 +82,8 @@ pub enum ErrorCode { | |||
MissingTargetAccount, | |||
#[msg("The slash ratio should be between 0 and 1")] // 6038 | |||
InvalidSlashRatio, | |||
#[msg("Other")] //6039 | |||
#[msg("The target account is not allowed for this operation")] // 6039 |
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.
#[msg("The target account is not allowed for this operation")] // 6039 | |
#[msg("The target account is only expected when dealing with the governance target")] // 6039 |
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.
done
@@ -189,6 +189,10 @@ pub mod staking { | |||
} | |||
|
|||
if let TargetWithParameters::IntegrityPool { .. } = target_with_parameters { | |||
require!( |
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.
need to update close_position
as well
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.
done
svm.send_transaction(create_position_tx), | ||
ErrorCode::UnexpectedTargetAccount, | ||
0 | ||
); |
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.
this test is duplicated below
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.
the name was wrong, it is actually testing close position. Fixed.
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.
had one nitpick
The code changes refactor the `close_position` function to use the `close_position_ix` instruction instead of the `create_position_ix` instruction. This improves code clarity and consistency.
No description provided.