coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.36k stars 1.25k forks source link

lang: Make stack frames slimmer on ATA creation #3065

Closed andreisilviudragnea closed 3 days ago

andreisilviudragnea commented 4 days ago

Initializing many associated token accounts in the same instruction can result in too large stack frames at compile time:

    #[account(
        init,
        payer = payer,
        associated_token::authority = system_program,
        associated_token::mint = mint,
    )]
Error: Function _ZN137_$LT$pda_derivation..AssociatedTokenResolution$u20$as$u20$anchor_lang..Accounts$LT$pda_derivation..AssociatedTokenResolutionBumps$GT$$GT$12try_accounts17hddc314f570fb4fb5E Stack offset of 7696 exceeded max offset of 4096 by 3600 bytes, please minimize large stack variables

The problem has been fixed similar to #2913 by inlining local variables created while generating associated token account creation code.

vercel[bot] commented 4 days ago

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

A member of the Team first needs to authorize it.

andreisilviudragnea commented 16 hours ago

@acheroncrypto When will a new Anchor version be released? This fix is quite important for me.

acheroncrypto commented 10 hours ago

Not sure, but we might need to make a patch release depending on the resolution of https://github.com/coral-xyz/anchor/issues/3044.

Do you publish your crates? If not, you can just depend on the git version until the next release.