If you’ve been building on Solana, you would know that almost all smart contracts (programs) are not immutable, in other words, they are upgradable. Each smart contract has an upgrade authority which allows the person holding the private key to perform such upgrade and mutate the state of the on-chain program.
Snowflake Safe helps to secure and streamline the process of program upgrade and eliminate the single point of failure by using a highly intuitive and easy-to-use multisig workflow.
Step 1 - Create a safe
Step 2 - Transfer your program authority into Snowflake Safe
In your safe, go to Apps > Solana Program > Transfer In
After you execute the command successfully in the terminal, your program will have been listed in Snowflake UI and Snowflake Safe can now manage the upgrade process for you.
Step 3 - Perform program upgrade from Snowflake Safe
The first step is to upload your program new build to a Solana buffer account. The command to upload your build to a buffer account is:
solana program write-buffer <PROGRAM_FILEPATH>
(where PROGRAM_FILEPATH is the path to your build file (eg. ./target/deploy/your_program.so)
After the command above completes successfully, it will return the address of the Buffer Account. You can transfer the Buffer Account authority to the Safe by using the command below:
solana program set-buffer-authority <BUFFER_ADDRESS> — new-buffer-authority <SAFE_VAULT_ADDRESS>
* BUFFER_ADDRESS: is the address of the Buffer Account create above
* SAFE_VAULT_ADDRESS: is your Snowflake Safe Vault Address
Once the Buffer Authority is transferred to your Safe, you can click on the "Upgrade" button to create a new program upgrade proposal.
Once the Proposal is submitted and received enough approvals, your program will be upgraded with the code from the Buffer Account. After that, Solana will close the Buffer Account and all its SOL balance will be deposited to the Safe.
In the first step, your wallet will need enough balance to create a new buffer account (the balance is depending on your program build size).
If there are any issues with buffer account creation (eg. network issue), Solana command will return the instruction to reclaim the buffer account balance.
At the end of this process, after the program is deployed successfully, the buffer account will be closed and its balance will be deposited to the Safe.
Schedule program deployment
Snowflake Safe also comes with automation capabilities that allow you to schedule deployment in advance. To schedule a deployment, go to New Transaction > Custom Action, select a time in the future that you wish to deploy and submit the transaction. Once it's approved, Snowflake will execute the deployment on your behalf at the exact time that you specified.