-
Notifications
You must be signed in to change notification settings - Fork 46
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
Transfer helper: support signed transfer hooks #253
Conversation
@@ -473,7 +534,7 @@ mod tests { | |||
|
|||
let extra_account2_info = AccountInfo::new( | |||
&extra_account2_key, | |||
false, | |||
true, |
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.
The key variable change. When making an extra transfer hook account signed, it previously caused the tests to fail.
a27c2cf
to
612ef33
Compare
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.
Just to make sure I understand, the problem is that if you mark an extra transfer hook account as a signer, it mistakenly gets added as a multisig signer as well?
So, for example, if we have two multisig signers and a signed extra hook account:
Instruction: "TransferChecked"
* [w] Source
* [ ] Mint
* [w] Destination
* [ ] Authority (multisig account)
* [s] Multisig signer #1
* [s] Multisig signer #2
* [s] Extra transfer hook meta
* [s] Extra transfer hook meta
* [ ] Validation account
* [ ] Transfer hook program
But where does this throw?
612ef33
to
a5cfb19
Compare
By adding all signed additional accounts to the signer pubkeys vec, you'd get this base instruction:
and then
So the resulting call would look like this:
|
Wow, I guess we really didn't test this thing with multisigs and transfer hooks. 😂 😂 |
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.
Just a few comments, looks good otherwise!
d4e342c
to
2b35332
Compare
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.
A couple more things on my side, then this can go in!
2b35332
to
ea742a7
Compare
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 great!
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.
Lgtm, but I still think we could avoid the vector.
9092f76
to
00e0f47
Compare
03b8c0a
to
00e0f47
Compare
00e0f47
to
c3d5aaa
Compare
Follow up from #233
At the moment the
invoke_transfer_checked()
function is indiscriminately adding signed accounts to the CPI instruction. Normally this is fine, but when a transfer hook is involved, a bug is apparent. It mistakenly gets added to the list of accounts and then later again as it's handled byadd_extra_accounts_for_execute_cpi()
.This PR fixes this bug by parsing multisig accounts specifically versus signed accounts generically.