Skip to content

cli: Handle Solana initialization flow for undeployed program and SPL Multisig mint authority#649

Merged
nvsriram merged 6 commits into
mainfrom
cli-solana-fix-mint-authority-initialization-flow
Jul 10, 2025
Merged

cli: Handle Solana initialization flow for undeployed program and SPL Multisig mint authority#649
nvsriram merged 6 commits into
mainfrom
cli-solana-fix-mint-authority-initialization-flow

Conversation

@nvsriram

@nvsriram nvsriram commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

This PR adds:

  • Update set-mint-authority command to work as described in this comment
  • Update create-spl-multisig command to work similar to set-mint-authority and is described in the same comment
  • Update deploySolana to handle NTT initialization with current mint authority being valid SPL Multisig
  • Add checkSolanaValidSplMultisig helper that checks if address corresponds to valid SPL Multisig

@nvsriram

nvsriram commented Jul 3, 2025

Copy link
Copy Markdown
Contributor Author

Updated set-mint-authority command usage:

If the program is not yet deployed:

set-mint-authority --token <TOKEN> --manager <MANAGER>  # set token_authority as mint authority
set-mint-authority --token <TOKEN> --manager <MANAGER> --multisig <MULTISIG> # set valid SPL Multisig as mint authority
  • --token and --manager need to be provided; --path to deployment.json only needs to be provided if not at default location
  • Calls spl.setAuthority wrapper with additional safety checks
  • To set mint authority as token_authority, the PDA will be derived from the manager and be set on the token
  • To set mint authority as valid SPL Multisig, the command assumes version is compatible and requests user confirmation to avoid setting token authority to SPL Multisig for unsupported version

If the program is deployed and initialized:

set-mint-authority # set token_authority as mint authority
set-mint-authority --multisig <MULTISIG> # set valid SPL Multisig as mint authority
  • --path to deployment.json only needs to be provided if not at default location
  • Calls spl.setAuthority if version < 3.x.x; Otherwise calls acceptTokenAuthority
  • The token and manager values from the deployment.json file

Updated create-spl-multisig command usage:

If the program is not yet deployed:

create-spl-multisig <MULTISIG_MEMBER_PUBKEY...> --token <TOKEN> --manager <MANAGER> 
  • --token and --manager need to be provided; --path to deployment.json only needs to be provided if not at default location
  • token is used to fetch the Token Program used; manager is used to fetch the token_authority PDA
  • The command assumes version is compatible and requests user confirmation to avoid creating SPL Multisig for unsupported version

If the program is deployed and initialized:

create-spl-multisig <MULTISIG_MEMBER_PUBKEY...>
  • --path to deployment.json only needs to be provided if not at default location
  • Token Program used and token_authority PDA is derived from on-chain via the manager value in deployment.json file

@nvsriram
nvsriram requested a review from evgeniko July 3, 2025 18:45
@evgeniko

evgeniko commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

What do you think about adding some consistent formatting rules to not run into indentation with different PRs? Will make readability of new PRs also easier.
Maybe we add a prettierrc or eslintrc.json?

@nvsriram

nvsriram commented Jul 3, 2025

Copy link
Copy Markdown
Contributor Author

What do you think about adding some consistent formatting rules to not run into indentation with different PRs? Will make readability of new PRs also easier. Maybe we add a prettierrc or eslintrc.json?

Yes, I agree. This was something I had messed around with briefly. However, I believe that would be its own cleanup PR as it affects all TS files across all directories.

evgeniko
evgeniko previously approved these changes Jul 4, 2025
@evgeniko

evgeniko commented Jul 7, 2025

Copy link
Copy Markdown
Contributor

tested:
set-mint-authority :
1.Passing only one of --token and --manager -- should error saying pass both
2. Undeployed program: Not passing both -- should error saying chain not found
3- Undeployed program: Passing --multisig with no input -- should error saying this value is missing
4. Undeployed program: Passing --multisig with invalid input -- should show version warning and request confirmation (if --yes is not passed). On confirming, this should fail saying SPL Multisig is not valid
5. Undeployed program: Passing --multisig and --yes with valid input (token & manager flags) -- should set to valid SPL Multisig without confirmation request
6. Different Undeployed program: Passing nothing extra should set to token_authority PDA
7. Deployed program: Without passing --token and --manager -- should set to token_authority PDA
8. Deployed program: Without passing --token and --manager and just --multisig with valid input -- should set to valid SPL Multisig

@nvsriram
nvsriram force-pushed the cli-solana-fix-mint-authority-initialization-flow branch 2 times, most recently from 255248c to 2d38b1e Compare July 9, 2025 19:12
@nvsriram
nvsriram force-pushed the cli-solana-fix-mint-authority-initialization-flow branch from 2d38b1e to 5f94da9 Compare July 9, 2025 21:20
@nvsriram
nvsriram merged commit d4e3994 into main Jul 10, 2025
9 checks passed
@nvsriram
nvsriram deleted the cli-solana-fix-mint-authority-initialization-flow branch July 10, 2025 15:46
dimpar pushed a commit to mezo-org/ntt-bridge-musd-testnet that referenced this pull request Mar 12, 2026
… Multisig mint authority (#649)

This PR adds:
* Update `set-mint-authority` command to work as described in [this comment](wormhole-foundation/native-token-transfers#649 (comment))
* Update `create-spl-multisig` command to work similar to `set-mint-authority` and is described in the same comment
* Update `deploySolana` to handle NTT initialization with current mint authority being valid SPL Multisig
* Add `checkSolanaValidSplMultisig` helper that checks if address corresponds to valid SPL Multisig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants