Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7939

Access violation in unknown section at address 0x0 of size 8

$
0
0

I'm encountering Access violation in unknown section at address 0x0 of size 8 error when I call my initialize instruction. Here is the full error.

Message: Transaction simulation failed: Error processing Instruction 0: Program failed to complete. Logs: ["Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 3903 of 177778 compute units","Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success","Program 11111111111111111111111111111111 invoke [2]","Program 11111111111111111111111111111111 success","Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]","Program log: Instruction: InitializeAccount3","Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 5408 of 163837 compute units","Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success","Program <my programId> consumed 43796 of 200000 compute units","Program <my programId> failed: Access violation in unknown section at address 0x0 of size 8"]. Catch the `SendTransactionError` and call `getLogs()` on it for full details.

At first, I was getting Access violation in unknown section at address 0x8bda9d304831f83a of size 8 error. I've searched about this, and some said this should be because of the stack overflow when calling the instruction. So they suggested to change some big accounts to Box them out. So I did like that, then I'm encountering this 0x0 error.

Here is my initialize instruction.

#[derive(Accounts)]#[instruction(receipt_token_name: String)]pub struct Initialize<'info> {    #[account(mut)]    pub admin: Signer<'info>,    #[account(        init,        payer = admin,        seeds = [b"fund", receipt_token_mint.key().as_ref()],        bump,        space = 8 + 4 + 4 + 914,    )]    pub fund: Box<Account<'info, Fund>>,    #[account(        init,        payer = admin,        seeds = [receipt_token_name.as_bytes().as_ref()],        bump,        mint::token_program = token_program,        mint::decimals = 9,        mint::authority = fund,        mint::freeze_authority = fund,        extensions::transfer_hook::authority = fund,        extensions::transfer_hook::program_id = crate::ID,    )]    pub receipt_token_mint: Box<InterfaceAccount<'info, Mint>>,    #[account(        init,        payer = admin,        seeds = [b"receipt_lock", receipt_token_mint.key().as_ref()],        bump,        token::mint = receipt_token_mint,        token::authority = fund,    )]    pub receipt_token_lock_account: InterfaceAccount<'info, TokenAccount>,    pub token_program: Interface<'info, TokenInterface>,    pub system_program: Program<'info, System>,}#[program]pub mod myProgram {    use super::*;    pub fn initialize(        ctx: Context<Initialize>,        receipt_token_name: String,        default_protocol_fee_rate: u16,        whitelisted_tokens: Vec<Pubkey>,        lst_caps: Vec<u64>,    ) -> Result<()> {        let fund = &mut ctx.accounts.fund;        Ok((fund.initialize( // just stores these values            ctx.accounts.admin.key(),            default_protocol_fee_rate,            whitelisted_tokens,            lst_caps,            ctx.accounts.receipt_token_mint.key(),            ctx.accounts.receipt_token_lock_account.key(),        ))?)    }}

And I'm calling this instruction at my anchor ts test code. Here is the code.

        const tx = await program.methods            .initialize(                receipt_token_name,                default_protocol_fee_rate,                whitelisted_tokens,                lst_caps,            )            .accounts({                admin: admin.publicKey,                // fund: fund_pda,                // receiptTokenMint: receipt_token_mint_pda,                // receiptTokenLockAccount: receipt_token_lock_account_pda,                tokenProgram: TOKEN_2022_PROGRAM_ID,                // systemProgram: anchor.web3.SystemProgram.programId,            })            .signers([admin])            .rpc();

My Versions

  • solana-cli 1.18.15 (src:767d24e5; feat:4215500110, client:SolanaLabs)
  • anchor-cli 0.30.1
  • anchor-spl 0.30.1

Viewing all articles
Browse latest Browse all 7939

Trending Articles