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

PDA Handling Might Be Off with Different Token Programs in Escrow Tests #3268

Open
techvoyagerX opened this issue Sep 23, 2024 · 0 comments
Open

Comments

@techvoyagerX
Copy link

PDA Handling Might Be Off with Different Token Programs in Escrow Tests

Issue

In the escrow tests (./tests/escrow/tests/escrow.ts), I noticed something odd when using different token programs (TOKEN_PROGRAM_ID and TOKEN_2022_PROGRAM_ID). The tests seem to use the same Program Derived Address (PDA) for both, even though they have distinct IDs. This feels like it could cause issues if each program is supposed to have its own PDA.

How to Reproduce

  • Run the escrow tests using both token programs.
  • You'll see that the PDA is the same in both cases, which might be wrong when initializing escrow and handling token accounts.

Why This Might Be a Problem

If the PDA should be different for each token program, we could end up with conflicts around ownership or authority during token transfers or other actions, especially when both token programs are in play.

What Could Fix It

We might need to derive separate PDAs for each token program to keep things clean and avoid any potential authority mix-ups.

Context

The key parts in the tests that seem affected:

  • Deriving the PDA during Initialize escrow and Exchange escrow.
  • The way token programs are passed in during the RPC calls might need to reflect the difference between the two programs better.

Let me know if you think this is a valid concern or if I’m missing something about how PDAs work here!

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

1 participant