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

Add check for mutability of init payer #1271

Merged
merged 5 commits into from
Feb 8, 2022

Conversation

losman0s
Copy link
Contributor

@losman0s losman0s commented Jan 9, 2022

Problem

No compile-time check is done to ensure that an account specified as payer for an init-ed account is mutable.
This leads to confusion, when added to the fact that the Anchor client automatically marks the wallet payer as mutable even when the IDL does not have it marked mutable (often masking the lack of mut attribute in the account validation struct).

Summary of Changes

Add cross-account mutability check between init-ed account and associated payer account.

Fixes #1219

@losman0s losman0s force-pushed the man0s/init-mut-payer-check branch 9 times, most recently from a030d6a to b724f1c Compare January 9, 2022 19:28
@losman0s losman0s force-pushed the man0s/init-mut-payer-check branch 7 times, most recently from babdf55 to 9be57a9 Compare January 11, 2022 17:50
@losman0s losman0s marked this pull request as ready for review January 11, 2022 19:21
@paul-schaaf
Copy link
Contributor

@losman0s had one comment. apart from that, LGTM

@paul-schaaf paul-schaaf merged commit 83121c2 into coral-xyz:master Feb 8, 2022
@fanatid
Copy link
Contributor

fanatid commented Feb 8, 2022

Thanks @losman0s! 🎉

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.

lang: Error if account init payer account is not marked mutable
3 participants