-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 2022: add new offchain helper #6100
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
buffalojoec
force-pushed
the
01-09-token_2022_add_new_offchain_helper
branch
2 times, most recently
from
January 10, 2024 14:16
9f760e1
to
0c3b21e
Compare
joncinque
approved these changes
Jan 10, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks perfect! Just a micro-nit to fixup, then this can go in. This is all much more legible too
buffalojoec
force-pushed
the
01-09-token_2022_add_new_offchain_helper
branch
2 times, most recently
from
January 10, 2024 21:18
95bbbbd
to
2fa3ac2
Compare
This was referenced Jan 10, 2024
joncinque
previously approved these changes
Jan 10, 2024
buffalojoec
force-pushed
the
01-09-transfer_hook_add_new_offchain_helper
branch
from
January 11, 2024 16:35
262663a
to
3700ef4
Compare
buffalojoec
force-pushed
the
01-09-token_2022_add_new_offchain_helper
branch
from
January 11, 2024 16:35
2fa3ac2
to
8c04474
Compare
Merge activity
|
Base automatically changed from
01-09-transfer_hook_add_new_offchain_helper
to
master
January 11, 2024 21:15
buffalojoec
force-pushed
the
01-09-token_2022_add_new_offchain_helper
branch
from
January 11, 2024 21:15
8c04474
to
006e8fc
Compare
mergify
bot
dismissed
joncinque’s stale review
January 11, 2024 21:16
Pull request has been modified.
buffalojoec
pushed a commit
that referenced
this pull request
Jan 11, 2024
Following up from the new helpers added in #6099 and #6100, there's a transfer hook test in `program-2022-test` that's using the now-deprecated helper to build a swap instruction for the test program. This PR replaces that bit of code to use the new helper from `spl_transfer_hook_interface`. Note: The test in question is designed to test Token2022's `invoke_transfer_checked(..)` on-chain helper, *not* the offchain helpers. So, it's appropriate to use the offchain helper directly from the interface crate for this step.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new offchain helper for creating a
TransferChecked
instructionwith the necessary accounts metas for a transfer hook
ExecuteInstruction
toToken2022, deprecating the old one.
As described in #6064, the original offchain helper in Token2022 was being used
incorrectly to resolve extra account metas. Rather than providing the SPL
Transfer Hook interface helper with a valid
ExecuteInstruction
, the originalToken2022 helper was actually providing it with a transfer instruction, causing
erroneous account resolution.
Taking advantage of the more secure SPL Transfer Hook interface offchain helper
provided in #6099, this new offchain helper creates a
TransferChecked
instruction and calls
add_extra_account_metas_for_execute(..)
, providing thekeys used to build the transfer instruction.
Note: unlike the deprecated helper in #6099, the deprecated offchain helper in
Token2022 is in fact inaccurately resolving account metas for certain use
cases, thus it should be vigilantly avoided.