Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not indexing poolPcAmount and poolCoinAmount for some Raydium swap transactions #9

Open
MBakhshi96 opened this issue Jan 16, 2025 · 2 comments

Comments

@MBakhshi96
Copy link

For some transactions, poolPcAmount and poolCoinAmount are missing in the result. For instance, consider this transaction: https://solscan.io/tx/3TN2k6VnthN6hqzMfZFT3irQKjuUYBTbjKaxfYNceszRV9GWN2z5HydW5mHyTyro9omBguEwWESxWZfJqZ2FV5ME

When manually decoding the ray_log, both values can be retrieved, which indicates a potential issue with the indexing logic for such transactions.

@0xpcut
Copy link
Owner

0xpcut commented Jan 19, 2025

That happens because when logs are truncated in the txn, then the log parser ignores all logs. I will fix it in the future.

However, this would still lead to issues, because the logs are truncated, and you have indeed lost information. There are two good solutions to this.

  1. When you want to get poolPcAmount and poolCoinAmount, compute instead the average of the slot, ignoring null values. I do not recommend first or last values in a slot, or even random, because you might get a value right after a big buy by a mev bot.

If you want to completely filter out mev transactions, what you can generally do is something like filtering out users that swap two times in the same slot. You'll rarely see that coming from real users.

  1. Make a script that fills in the values using the SPL Token substream. You have to do some calculation to get the correct pool vault amount (it's not just the balance of the token account) but not that hard. This works fine if you're storing both values in a database, and not doing things in real time.

@MBakhshi96
Copy link
Author

Interestingly, the log for this transaction is not truncated on solana.fm. It seems there’s a configuration in the RPC to increase the log limit, but it looks like StreamingFast is using an RPC with a lower limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants