coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.58k stars 1.32k forks source link

Feature Request: Multisig support #3134

Open zpetersen-paxos opened 2 months ago

zpetersen-paxos commented 2 months ago

Hello, it looks like anchor does not support the token program multisig as described here. I see there are some TODOs in the code that are very old.

Is there a workaround to support this? If not can this feature be added?

acheroncrypto commented 2 months ago

Correct, the wrappers in anchor-spl don't support spl-token multisigs, but you should be able to just copy the functions you'd like to use from the file you've linked and specify the signers array as a workaround.

zpetersen-paxos commented 2 months ago

Cool I did that and it's working. To use this in any production grade code though we'd want to avoid this workaround.

I think it wouldn't be too difficult to add, just need a new field in the struct and then reference that. Wdyt?

acheroncrypto commented 2 months ago

I don't know what the initial reasoning was for not supporting multisigs, but adding a new field for all these wrapper instructions would break pretty much everyone's code.

Given most people don't or won't use this feature (I don't think anyone asked about it before even though these functions are quite popular), it would be better to find a way to add this functionality without causing breakage.

zpetersen-paxos commented 2 months ago

Ah right struct fields in rust are required. That definitely makes the backwards compatibility a bit trickier. Any suggestions on how this could be achieved?