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

Prevent payer and init on the same constraint? #2222

Closed
Henry-E opened this issue Oct 12, 2022 · 5 comments
Closed

Prevent payer and init on the same constraint? #2222

Henry-E opened this issue Oct 12, 2022 · 5 comments

Comments

@Henry-E
Copy link
Contributor

Henry-E commented Oct 12, 2022

Very weird edge case, someone turned every user's wallet into a program account with this program. Essentially the payer pubkey and the claim_status account's pubkey were the same, and since the payer was signing they were able to convert that account to a program account.

Not really sure what the best way to prevent this would be. payer and init weren't actually used on the same account but the client passed them in as the same pubkey. There would have to be runtime check that the payer and the account being initialized weren't the same? Which of course you might want in certain scenarios, so it would have to be off by default and then enabled using some new constraint.

@omgbbqhaxx
Copy link

@Henry-E
Copy link
Contributor Author

Henry-E commented Oct 31, 2022

So one solution for this would be to check that the payer and [account_to_be_init] pubkeys are not the same and to error if this is the case. Then include a #[account( allow_same_payer = true )] inert attribute if it's desired for this functionality to be disabled.

@Henry-E
Copy link
Contributor Author

Henry-E commented Dec 7, 2022

Closed by #2284

@Henry-E Henry-E closed this as completed Dec 7, 2022
@snawaz
Copy link
Contributor

snawaz commented Feb 10, 2023

The docs do not seem to mention anything about the arguments that can be passed to #[account] , e.g init, user, payer.. etc. Where can I find the details of these arguments and how they should be used, what they actually mean.. and so on? The docs must be updated with these details!

@Henry-E
Copy link
Contributor Author

Henry-E commented Feb 10, 2023 via email

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

No branches or pull requests

3 participants