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

fix(svm): consistent anchor token constraints #694

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

Reinis-FRP
Copy link
Contributor

@Reinis-FRP Reinis-FRP commented Oct 25, 2024

We were unnecessarily restricting relayer token account in the fill instruction to be canonically derived from the relayer and mint addresses. By replacing associated_token constraints with token constraints this would allow the relayer to pass any token account as long as its mint and authority matches.

Overall, we want to use canonical token accounts for vault and fill/slow fill recipients (hence, associated_token constraints) and any valid token accounts for all others.

Also, some of mint accounts were incorrectly using token constraints for their program account checks. Event the checks are implemented the same way (account being owned by the token program), Anchor error message is slightly different.

Fixes: https://linear.app/uma/issue/ACX-2925/instructionsfillrs-consistent-token-imports

Copy link

linear bot commented Oct 25, 2024

Signed-off-by: Reinis Martinsons <[email protected]>
@Reinis-FRP Reinis-FRP marked this pull request as ready for review October 25, 2024 14:09
@Reinis-FRP Reinis-FRP requested review from chrismaree and md0x October 25, 2024 14:09
Signed-off-by: Reinis Martinsons <[email protected]>
@@ -390,4 +391,34 @@ describe("svm_spoke.fill", () => {
"Token Program should not be invoked"
);
});

it("Fills a V3 relay from custom relayer token account", async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

@Reinis-FRP Reinis-FRP merged commit ad00ab2 into master Oct 28, 2024
9 checks passed
@Reinis-FRP Reinis-FRP deleted the reinis-frp/consistent-token-constraints branch October 28, 2024 13:33
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

Successfully merging this pull request may close these issues.

3 participants