-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
token / ata: Use upgradeable loader to save copies during CPI #26823
Comments
I believe this isn't required because all programs, even ones on the old loader, don't have their bytecode copied in and out of instruction contexts during CPI. @Lichtso can you confirm? |
The bytecode is not copied during CPI for the program that is being called. |
Ah I think I see, so if I have:
When |
Correct.
All loaders behave the same in terms of what they copy, so no benefit there. |
Ah ok, sounds like this is very closable then, thanks! |
Problem
When executable accounts are passed into a program for CPI, their entire program data is copied over as well. This can create overhead for programs using the non-upgradeable loader. Programs using the upgradeable loader aren't affected, since only 36 bytes are in the program account.
The token / associated-token-account use the non-upgradeable loader, which makes them susceptible to this issue.
They should use the upgradeable loader (as finalized programs, of course)! The current upgrade method, however, only swaps the program accounts, which would cause an issue for the program data account associated with the program, since that's derived from the program address.
Proposed Solution
During the next upgrade, use the upgradeable loader for the program, and in the runtime, move the program and program data accounts.
The text was updated successfully, but these errors were encountered: