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

lang: Error if account init payer account is not marked mutable #1219

Closed
armaniferrante opened this issue Jan 1, 2022 · 8 comments · Fixed by #1271
Closed

lang: Error if account init payer account is not marked mutable #1219

armaniferrante opened this issue Jan 1, 2022 · 8 comments · Fixed by #1271
Labels

Comments

@armaniferrante
Copy link
Member

This coincidentally works if the account is not marked mutable since the client will use the provider to pay for the transaction (and thus it is mutable). However, we should require the developer to explicitly mark these paying accounts mutable.

@losman0s
Copy link
Contributor

losman0s commented Jan 2, 2022

I'm up for giving this a spin. First time I dive into this part of Anchor though, so do you have a specific place where adding this logic would be best, maybe?

I see there seems to be constraint checks done here, but they seem limited to per-account checks (e.g. payer attribute unique per account), and I have not found an instance of cross-account check yet.

Would it make sense to add these checks here?

@paul-schaaf
Copy link
Contributor

@losman0s are you still interesting in doing this?

If so, you can add the checks in this new function https://github.com/project-serum/anchor/blob/01ff03b09b30b974f2854dd0b0b9a958dd509622/lang/syn/src/parser/accounts/mod.rs#L40

@losman0s
Copy link
Contributor

losman0s commented Jan 8, 2022

@paul-schaaf yes, been a bit tied up the last few days but I'll get to it soon. Thanks for the update.

@adimnaka
Copy link

Hi guys im experiencing this error, can any one help

thread 'main' panicked at 'Code not parseable: Error("the payer specified for an init constraint must be mutable.")', lang/syn/src/idl/file.rs:360:58
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

@losman0s
Copy link
Contributor

losman0s commented Apr 17, 2022

Hi guys im experiencing this error, can any one help

thread 'main' panicked at 'Code not parseable: Error("the payer specified for an init constraint must be mutable.")', lang/syn/src/idl/file.rs:360:58 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

It should pretty much be what the error describes. You are likely init-ing an account through the init macro, but forgot to mark the payer account you specified as mut.
Even if this does not fix your issue, please post your question on Discord instead.

@adimnaka
Copy link

Oh thanks, that solved the issue. but im finally trying to deploy to dev net but i get this error again

error: Custom: Invalid blockhash
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.

@losman0s
Copy link
Contributor

Even if this does not fix your issue, please post your question on Discord instead.

@adimnaka
Copy link

Whats the link to the discord channel seems the one i'm on wont allow me post anything
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants