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

Stack offset of 4608 exceeded max offset of 4096 by 512 bytes, please minimize large stack variables

$
0
0

Tried Box to add Account State data on heap on build

Anchor Version: 0.28.0Solana-cli Version: 1.18.25

Error: Function _ZN112_$LT$solana_program..instruction..InstructionError$u20$as$u20$solana_frozen_abi..abi_example..AbiEnumVisitor$GT$13visit_for_abi17h39952282aec2bd99E Stack offset of 4608 exceeded max offset of 4096 by 512 bytes, please minimize large stack variables

declare_id!("H3jJR4g9m3Q8HGFagfAsdubqJTXHiMChZi4G5JdpjGtt");#[program]pub mod readmint {    use super::*;    pub fn create_book(ctx: Context<CreateBook>, title: String, _aname: String) -> Result<()> {        let book = &mut ctx.accounts.book;        book.author = ctx.accounts.author.key();        book.total_pages = 0;        book.title = title;        Ok(())    }}#[derive(Accounts)]#[instruction(title: String, aname: String)]pub struct CreateBook<'info> {    #[account(mut)]    pub author: Signer<'info>,    pub system_program: Program<'info, System>,    #[account(        init,        payer = author,        space = 8 + Book::INIT_SPACE,        seeds = [title.as_bytes(), aname.as_bytes()],        bump,    )]    pub book: Box<Account<'info, Book>>,}#[account]#[derive(InitSpace)]pub struct Book {    pub author: Pubkey,    #[max_len(32)]    pub title: String,    pub total_pages: u32,}```

Viewing all articles
Browse latest Browse all 8004

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>