I want to deploy my own instance of the Raydium cp-swap program on Solana's devnet. After cloning the repo and building clean with anchor and no trouble, followed by a successful deployment and running of the initialize.test.ts
script, i end up with an access violation.
Steps:
- I clone this repo: https://github.com/raydium-io/raydium-cp-swap/
- I run anchor build it
- I deploy the program using anchor deploy
- I run: yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/initialize.test.ts
- The initialize test script calls the createAmmConfig function successfully, the ammConfig PDA gets created (i verified this)
- But then the initialize test script fails to create the pool in the first test
Error messages:
Message: Transaction simulation failed: Error processing Instruction 0: Program failed to complete.
Logs:
[
"Program AywUGda6ZMcRHMt9XqEdvZ1L8eY3zFfsKGLv7xG57WSq invoke [1]",
"Program log: Instruction: Initialize",
"Program AywUGda6ZMcRHMt9XqEdvZ1L8eY3zFfsKGLv7xG57WSq consumed 6029 of 200000 compute units",
"Program AywUGda6ZMcRHMt9XqEdvZ1L8eY3zFfsKGLv7xG57WSq failed: Access violation in stack frame 5 at address 0x200005ff8 of size 8"
].
Catch the `SendTransactionError` and call `getLogs()` on it for full details.
Under this program id (HPUJeMcNgwNjrnNpGBpMXZjQpMpBdJ1viFd7PgVdjkbC) you can find my program deployed on the Devnet
Interestingly, when compiling the program straight from the repo, i get this error:
# anchor build
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: /dev/raydium-cp-swap/programs/cp-swap/Cargo.toml
workspace: /dev/raydium-cp-swap/Cargo.toml
Error: Function _ZN112_$LT$solana_program..instruction..InstructionError$u20$as$u20$solana_frozen_abi..abi_example..AbiEnumVisitor$GT$13visit_for_abi17h43ecb57923db73a1E Stack offset of 4608 exceeded max offset of 4096 by 512 bytes, please minimize large stack variables
Compiling raydium-cp-swap v0.1.0 (/dev/raydium-cp-swap/programs/cp-swap)
Finished release [optimized] target(s) in 3.28s
Are the two errors related?
If yes, how can the problem be fixed in the program? And if not, what am i doing wrong, what am i missing? Shouldn't the test scripts work with the repo as is?
I lack the necessary rust skills to start debugging this. Also it should work out of the box, or something else is wrong.
Please Note: The program id is correctly set everywhere and i changed the admin id declarations to match my deployment wallet's public key.