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

fix: disallow target account when creating position for integrity pool #506

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

keyvankhademi
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Aug 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 29, 2024 3:39pm
staking-devnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 29, 2024 3:39pm

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#[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

Copy link
Contributor Author

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!(
Copy link
Contributor

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

Copy link
Contributor Author

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
);
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

@guibescos guibescos left a 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.
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.

2 participants