raydium-io / raydium-sdk

An SDK for building applications on top of Raydium.
https://sdk.raydium.io
GNU General Public License v3.0
340 stars 134 forks source link

Simulate transaction hiding rpc error #77

Closed mdatsev closed 5 months ago

mdatsev commented 5 months ago

Sometimes while calling Liquidity.fetchInfo a simulation fails but instead of rethrowing the error a new error with only a string message is thrown, thereby hiding the details from the rpc of why it failed. I am not sure how to reproduce the error because it only happens sometimes, but here is the relevant code: https://github.com/raydium-io/raydium-sdk/blob/master/src/common/web3.ts#L264

rudy5348 commented 5 months ago

The high probability of an error is due to the rpc rate limit.
You can increase the rate limit or reduce the number of data fetched at a time with paid rpc

mcfriend99 commented 3 months ago

I can confirm that this has nothing to do with the rpc rate limit. I went into the raydium SDK section that produces the error and output the error and I got the following:

{ InstructionError: [ 0, 'ProgramFailedToComplete' ] }

This looks like a program panic.

mdatsev commented 3 months ago

I still think it would be better if the actual error message from the rpc was shown instead of trying to guess 😒

rudy5348 commented 3 months ago

Hi, we've released sdk-v2 and don't recommend using simulate to get the pool info. You can switch the version to sdk-v2 and try again.