-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 seeds::program constraint for PDAs. #1197
Add seeds::program constraint for PDAs. #1197
Conversation
@@ -182,6 +182,15 @@ pub fn parse_token(stream: ParseStream) -> ParseResult<ConstraintToken> { | |||
}; | |||
ConstraintToken::Bump(Context::new(ident.span(), ConstraintTokenBump { bump })) | |||
} | |||
"program_id" => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the other name that the solana sdk uses for this is base
. I don't have a preference though.
Build failing due to clippy warnings. |
pls also add a line to the changelog |
@@ -182,6 +182,15 @@ pub fn parse_token(stream: ParseStream) -> ParseResult<ConstraintToken> { | |||
}; | |||
ConstraintToken::Bump(Context::new(ident.span(), ConstraintTokenBump { bump })) | |||
} | |||
"program_seed" => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any place in the existing solana sdk that uses the term "program_seed"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tag @jstarry. Any ideas for an accurate keyword to refer to the base program id for PDAs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah tbh I also find that term a little odd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other words mentioned in discord: seeds::program
, program
, derive_from
, seed_program
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline. Let's do seeds::program
.
ee911d0
to
676b934
Compare
CHANGELOG.md
Outdated
#### Fixes | ||
### Fixes | ||
|
||
### Features | ||
|
||
*lang: Improved error msgs when required programs are missing when using the `init` constraint([#1257](https://github.com/project-serum/anchor/pull/1257)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used the opportunity to move this into feature section (wasnt really a bug fix)
took over with alan's permission |
closes #1131 |
/// #[account( | ||
/// seeds = [b"other_seed], | ||
/// bump = second_bump, | ||
/// seeds::program = other_program.key() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit ugly now that I look at this next to seeds, bump. We'll want to rethink this in the future. Potentially just solved by the constraint grouping work, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea once we group them it can just be program
cause it will be clear which constraint it belongs to
This addresses #1131
@paul-schaaf I should have double-checked about the desired name for the attribute—happy to change from
program_id
to something else, just wanted to hurry up and get a PR started.