-
Notifications
You must be signed in to change notification settings - Fork 50
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
solana: Handle transferring mint authority using SPL Multisig #587
base: main
Are you sure you want to change the base?
Conversation
…ig token authority
…sig` to account for multisig token authority
…ken_authority_from_multisig`
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.
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).
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
solana/tests/anchor.test.ts
Outdated
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 code in here could really profit from a bunch of DRY-ness. See e.g. TBRv3 tests that use various helpers under the hood.
config: NttBindings.Config<IdlVersion>, | ||
args: { | ||
currentMultisigAuthority: PublicKey; | ||
additionalSigners: PublicKey[]; |
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.
additionalSigners: PublicKey[]; | |
additionalSigners: readonly PublicKey[]; |
args: { | ||
rentPayer: PublicKey; | ||
newMultisigAuthority: PublicKey; | ||
additionalSigners: PublicKey[]; |
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.
additionalSigners: PublicKey[]; | |
additionalSigners: readonly PublicKey[]; |
Context:I refactored out the common functions into Example Refactor:
Alternative Refactor:
tl;dr:
|
Context:
Currently, there are instructions to safely handle transferring token mint authority to-and-from the NTT Manager -
token_authority
PDA.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_authority
PDA as one of its required signersTA
=token_authority
PDATA
/Multisig(TA, ...)
= Representation of NTT Managertoken_authority
PDA or SPL Multisig with m = 1 andtoken_authority
PDA 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-signerS
claim_token_authority
: claimed byS
as signerclaim_token_authority_to_multisig
: claimed byS
=Multisig(...)
ctx.remaining_accounts
act 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_accounts
act 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_accounts
is treated as required signerstl;dr:
This PR adds: