solana: Handle transferring mint authority using SPL Multisig#587
solana: Handle transferring mint authority using SPL Multisig#587
Conversation
nonergodic
left a comment
There was a problem hiding this comment.
Only nits.
One other thing that I noticed that isn't part of the changes here:
The address constraint on the owner signer in RevertTokenAuthority has no custom error, while the other address checks do. I assume this is because usually these type of constraints are checked via has_one which isn't possible here - but I figured I'd flag it here regardless (might be worth a short comment).
Context:I refactored out the common functions into Example Refactor:
Alternative Refactor:
tl;dr:
|
There was a problem hiding this comment.
Code is very neat now!
(at least in as far as Anchor code can be neat 😬)
Regarding the refactor:
I think I'd probably have the ownership ixs and the token authority ixs in two separate files, but that's about it.
What I started doing in the Solidity SDK where I'm facing a similar problem of "lots of code, but not actually a lot of complexity" is just put an overview comment at the top of the file that says "look, all this garbage below really just provides the following ...".
As such, it would imho be justifiable to just keep all the code in admin.rs because the file is so entirely uninspiring and unsurprising.
I think you can really just choose here what you like best.
Yeah, I refactored it the same way - I think lengthy related instructions in individual files makes sense. |
…ig token authority
…sig` to account for multisig token authority
…ken_authority_from_multisig`
f1a084a to
baefdb3
Compare
Context:
Currently, there are instructions to safely handle transferring token mint authority to-and-from the NTT Manager -
token_authorityPDA.However, with SPL Multisig support, these instructions need to be modified to handle all cases.
List of Abbreviations:
Multisig(...)= any generic SPL Multisig with signers …Multisig(TA, ...)= SPL Multisig with m = 1 andtoken_authorityPDA as one of its required signersTA=token_authorityPDATA/Multisig(TA, ...)= Representation of NTT Managertoken_authorityPDA or SPL Multisig with m = 1 andtoken_authorityPDA as one of its required signersNew Proposed Instructions:
Transfer Mint Authority OUT:
set_token_authority_one_step_unchecked:TA/Multisig(TA, ...)-> any non-signerset_token_authority:TA/Multisig(TA, ...)-> non-signerSclaim_token_authority: claimed bySas signerclaim_token_authority_to_multisig: claimed byS=Multisig(...)ctx.remaining_accountsact as required signers ofMultisig(...)revert_token_authority: reverted back toTA/Multisig(TA, ...)Transfer Mint Authority IN:
accept_token_authority: signerS->TA/Multisig(TA, ...)accept_token_authority_from_multisig:Multisig(...)->TA/Multisig(TA, ...)ctx.remaining_accountsact as required signers ofMultisig(...)Implementation Details:
Multisig(TA, ...):Option<InterfaceAccount<'info, SplMultisig>>is used to avoid additional explicit instructionsMultisig(...)needs to sign/validate:ctx.remaining_accountsis treated as required signerstl;dr:
This PR adds:
admin.rsand TS test case refactor