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

failed: Access violation in stack frame 5 at address 0x200005ee0 of size 8 #3332

Closed
cxp-13 opened this issue Oct 27, 2024 · 2 comments
Closed
Labels
duplicate This issue or pull request already exists lang

Comments

@cxp-13
Copy link

cxp-13 commented Oct 27, 2024

Version:

cxp@R9000P:~/solana_learn/xenobunny/xenobunny-new/xenobunny-rust$ rustc -V
rustc 1.75.0 (82e1608df 2023-12-21)
cxp@R9000P:~/solana_learn/xenobunny/xenobunny-new/xenobunny-rust$ solana -V
solana-cli 1.17.22 (src:dbf06e25; feat:3580551090, client:SolanaLabs)
cxp@R9000P:~/solana_learn/xenobunny/xenobunny-new/xenobunny-rust$ anchor -V
anchor-cli 0.30.1

Code:

#[derive(Accounts)]
#[instruction(collection_nft_mint: Pubkey)]
pub struct MintNft<'info> {
    #[account(
        init,
        seeds = [nft_mint.key().as_ref(), WARRITOR_CARD_STATE.as_bytes()],
        bump,
        payer = user,
        space = 8 + std::mem::size_of::<WarriorCardState>()
    )]
    pub warrior_card_state: Box<Account<'info, WarriorCardState>>,
    #[account(
        init,
        seeds = [
            user.key().as_ref(),
            collection_nft_mint.as_ref(),
            WARRITOR_CARDS_USAGE_TRACKER.as_bytes(),
        ],
        bump,
        payer = user,
        space = 8 + std::mem::size_of::<WarriorCardsUsageTracker>()
    )]
    pub warrior_cards_usage_tracker: Box<Account<'info, WarriorCardsUsageTracker>>,
    #[account(seeds = [MINT_NFT_CONFIG.as_bytes()], bump)]
    pub nft_mint_config: Box<Account<'info, NFTMintConfig>>,
    #[account(
        init,
        payer = user,
        mint::decimals = 0,
        mint::authority = mint_authority,
        mint::freeze_authority = mint_authority
    )]
    pub nft_mint: Box<Account<'info, Mint>>,
    // #[account(
    //     mint::decimals = 0,
    //     mint::authority = mint_authority,
    //     mint::freeze_authority = mint_authority,
    //     seeds = [XENOBUNNY_NFT_COLLECTION.as_bytes()],
    //     bump
    // )]
    // pub collection_nft_mint: Account<'info, Mint>,
    #[account(
        init,
        payer = user,
        associated_token::mint = nft_mint,
        associated_token::authority = user
    )]
    pub user_ata: Box<Account<'info, TokenAccount>>,
    /// CHECK: This is a PDA account, safe to skip verification
    #[account(seeds = [MINT_AUTHORITY.as_bytes()], bump)]
    pub mint_authority: UncheckedAccount<'info>,
    /// CHECK: Created by the metadata program and does not require checking
    #[account(mut)]
    pub metadata_account: UncheckedAccount<'info>,
    #[account(mut)]
    pub user: Signer<'info>,
    pub token_program: Program<'info, Token>,
    /// CHECK: This is a PDA account, safe to skip verification
    #[account(address = TOKEN_METADATA_ID)]
    pub token_metadata_program: UncheckedAccount<'info>,
    pub system_program: Program<'info, System>,
    pub associated_token_program: Program<'info, AssociatedToken>,
}

I referred the previous suggestion(#3089) and Box some account, but it still show
failed: Access violation in stack frame 5 at address 0x200005ee0 of size 8

when I try to using Solana CLI 1.17.22

[dependencies]
anchor-lang = { version = "0.30.1", features = ["init-if-needed"] }
anchor-spl = "0.30.1"
spl-token-2022 = "3.0.4"
solana-program = "1.18.20"
mpl-token-metadata = "4.1.2"

That is my actions

cxp@R9000P:~/solana_learn/xenobunny/xenobunny-new/xenobunny-rust$ solana-install init 1.17.22
  ✨ 1.17.22 initialized
cxp@R9000P:~/solana_learn/xenobunny/xenobunny-new/xenobunny-rust$ anchor build
info: uninstalling toolchain 'solana'
info: toolchain 'solana' uninstalled
error: package `num_enum_derive v0.7.3` cannot be built because it requires rustc 1.70.0 or newer, while the currently active rustc version is 1.68.0-dev
Either upgrade to rustc 1.70.0 or newer, or use
cargo update -p [email protected] --precise ver
where `ver` is the latest version of `num_enum_derive` supporting rustc 1.68.0-dev
@acheroncrypto acheroncrypto added duplicate This issue or pull request already exists lang labels Oct 27, 2024
@acheroncrypto
Copy link
Collaborator

This will be fixed in the next version (#3259). See Stack memory improvements if you want to learn more.

@cxp-13
Copy link
Author

cxp-13 commented Oct 27, 2024

This will be fixed in the next version (#3259). See Stack memory improvements if you want to learn more.
I optimized the program and successfully compiled it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists lang
Projects
None yet
Development

No branches or pull requests

2 participants