raydium-io / raydium-cp-swap

Revamped constant product AMM - no Openbook ID requirement, Token22 support
Apache License 2.0
66 stars 45 forks source link

How to fix "Stack offset of 4848 exceeded max offset" after building #18

Open benhaben opened 1 month ago

benhaben commented 1 month ago

Error: Function ZN161$LT$raydium_cp_swap..instructions..initialize..Initialize$u20$as$u20$anchor_lang..Accounts$LT$raydium_cp_swap..instructions..initialize..InitializeBumps$GT$$GT$12try_accounts17h1a5660f3939c4019E Stack offset of 4848 exceeded max offset of 4096 by 752 bytes, please minimize large stack variables

TwentyOne37 commented 1 month ago

If you update dependecy for this commit:

raydium-cp-swap = { git = "https://github.com/raydium-io/raydium-cp-swap", rev = "2562fa8d171ecbdbcaff8503d00fa16ca3c74d26", features = [...] }

Anchor should compile the code, however it will be problematic to use on-chain. Probably adding observation_state to Initialize had overflowed stack size.

https://github.com/raydium-io/raydium-cp-swap/commit/2562fa8d171ecbdbcaff8503d00fa16ca3c74d26

me-imfhd commented 2 weeks ago

It's not a problem when you actually invoke the instruction when running test.