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

idl: Disallow all zero account discriminators #3159

Conversation

acheroncrypto
Copy link
Collaborator

Problem

Setting account discriminators to all zeros conflicts with the zero account constraint (which checks the discriminator bytes to be all zeros). For example:

#[account(discriminator = 0)]
pub struct MyAccount {}

#[derive(Accounts)]
pub struct MyIx<'info> {
    #[account(zero)]
    pub my_account: Account<'info, MyAccount>,
}

Summary of changes

Return an error during IDL generation if an account has all zero discriminator.


Note: This PR is part of a greater effort explained in #3097.

Copy link

vercel bot commented Aug 8, 2024

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added idl related to the IDL, either program or client side feature labels Aug 8, 2024
@acheroncrypto acheroncrypto mentioned this pull request Aug 8, 2024
26 tasks
@acheroncrypto acheroncrypto merged commit 033b71f into coral-xyz:master Aug 8, 2024
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature idl related to the IDL, either program or client side
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant