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 account discriminators that can conflict with the zero constraint #3365

Conversation

acheroncrypto
Copy link
Collaborator

Problem

In the following scenario:

  1. Account 1's discriminator starts with 0

  2. Account 2's discriminator is a 1-byte custom discriminator

  3. Account 2 gets initialized using the zero constraint:

    #[account(zero)]
    pub account2: AccountLoader<'info, Account2>

It's possible to pass an already initialized Account 1 to a place that expects non-initialized Account 2, because the first byte of Account 1 is also 0, which is what the zero constraint checks.

Summary of changes

Disallow account discriminators that can conflict with the zero constraint.

Copy link

vercel bot commented Nov 14, 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 Nov 14, 2024
@acheroncrypto acheroncrypto merged commit c4ce2d7 into coral-xyz:master Nov 14, 2024
2 of 3 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