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: Deduplicate zero accounts against init accounts #3422

Conversation

acheroncrypto
Copy link
Collaborator

@acheroncrypto acheroncrypto commented Dec 10, 2024

Problem

Same as #3409 with the difference being the init constraint combined with zero (rather than all zero):

#[derive(Accounts)]
pub struct TestInitAndZero<'info> {
    #[account(init, ...)]
    pub init: Account<'info, Data>,
    #[account(zero)]
    pub zero: Account<'info, Data>,
    #[account(mut)]
    pub payer: Signer<'info>,
    pub system_program: Program<'info, System>,
}

Summary of changes

Deduplicate accounts with the zero constraint against accounts with the init constraint. Note that this only applies to init accounts that are declared before zero accounts, as initialization fails on its own if the order is reversed.

Additionally, this change only concerns the zero constraint, as passing the same account for multiple inits fails without needing additional checks due to the account already being created after the initial init.

Copy link

vercel bot commented Dec 10, 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.

Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
anchor-docs ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 4:53am

@acheroncrypto acheroncrypto added lang fix Bug fix PR labels Dec 10, 2024
@acheroncrypto acheroncrypto merged commit 2ae3774 into coral-xyz:master Dec 12, 2024
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix PR lang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant