-
Notifications
You must be signed in to change notification settings - Fork 58
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): N-03 remove duplicate logic #845
Conversation
Signed-off-by: Reinis Martinsons <[email protected]>
@@ -13,3 +17,17 @@ pub fn is_local_or_remote_owner(signer: &Signer, state: &Account<State>) -> bool | |||
pub fn is_relay_hash_valid(relay_hash: &[u8; 32], relay_data: &V3RelayData, state: &Account<State>) -> bool { | |||
relay_hash == &get_v3_relay_hash(relay_data, state.chain_id) | |||
} | |||
|
|||
// Implements the same underlying logic as in Anchor's associated_token constraint macro, except for token_program_check | |||
// as that would duplicate Anchor's token constraint macro that the caller already uses. |
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.
as that would duplicate Anchor's token constraint macro that the caller already uses.
You mean that the token constraint macro is already applied here?
token::token_program = token_program, |
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.
Nice! Beautiful refactoring.
Signed-off-by: Reinis Martinsons <[email protected]>
OZ identified following issue:
This PR addresses the issue by consolidating the instructions into a single function that takes additional
refund_address
account. When it is different from thesigner
, the receivingtoken_account
must match ATA for thisrefund_address
. Otherwise it can be any custom token account for the given mint and token program as the claim account would be derived from thesigner
.