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

Remove path from fields in Accounts struct #56

Closed
wants to merge 1 commit into from
Closed

Remove path from fields in Accounts struct #56

wants to merge 1 commit into from

Conversation

mcintyre94
Copy link
Contributor

This PR updates the fields of an account struct from eg:

pub post: Box<Account<'info, dot::program::Post>>,

To eg:

pub post: Box<Account<'info, Post>>,

This works correctly because lib.rs includes use dot::program::*;, so either form is equivalent.

This is a workaround for an issue parsing seeds in Anchor: coral-xyz/anchor#2268

In short, Anchor reads the imported Post struct as just being called Post, but reads the account as dot::program::Post, which doesn't match and errors. By just generating it as Post in Seahorse we avoid this issue.

Full details in the Anchor PR description + Seahorse Discord: https://discord.com/channels/1005658120548270224/1005658120988655647/1043989626114814012

@ameliatastic
Copy link
Owner

Mentioned in Discord, but would it be feasible to also use each account struct? Just to prevent the problem where somebody makes an account in a separate module and tries to use it in an instruction but can't.

@mcintyre94
Copy link
Contributor Author

Closing this for now, opened issue #60. Also opened #59 as a prerequisite. Since that's definitely a lot bigger than this PR I don't think it's worth keeping this one open for now.

@mcintyre94 mcintyre94 closed this Nov 25, 2022
@mcintyre94 mcintyre94 mentioned this pull request Dec 16, 2022
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