Solana Guidance
This page provides development guidance for building on Solana. While some entries are LayerZero-specific, others cover general topics and tooling relevant to the Solana ecosystem.
Deploying Solana programs with a priority fee
This section applies if you are unable to land your deployment transaction due to network congestion.
Priority Fees are Solana's mechanism to allow transactions to be prioritized during periods of network congestion. When the network is busy, transactions without priority fees might never be processed. It is then necessary to include priority fees, or wait until the network is less congested.
Priority fees are calculated as follows: priorityFee = compute budget * compute unit price. We can make use of priority fees by attaching the --with-compute-unit-price flag to our solana program deploy command. Note that the flag takes in a value in micro lamports, where 1 micro lamport = 0.000001 lamport.
For example:
solana program deploy --program-id target/deploy/oft-keypair.json target/verifiable/oft.so -u devnet --with-compute-unit-price <COMPUTE_UNIT_PRICE_IN_MICRO_LAMPORTS>
You can refer QuickNode's Solana Priority Fee Tracker to know what value you'd need to pass into the --with-compute-unit-price flag.
Previewing Solana rent costs
Most of the SOL you spend during a program deployment goes toward rent so the program account can remain rent-exempt. This cost scales with the size (in bytes) of the compiled .so artifact, while the additional accounts you create (for example, PDAs or configuration accounts) typically contribute only a small fraction of the total.
You can preview the rent-exempt minimum required for your compiled program with the Solana CLI:
solana rent $(wc -c < target/verifiable/<PROGRAM_SO_PATH>)
Expect the total SOL needed for deployment to be slightly higher than the returned rent figure so you can cover the other accounts that get created as part of your setup.
Transferring OFT ownership on Solana
There are six roles regarding OFT ownership/authority on Solana:
- owner
- delegate
- upgrade authority
- token metadata update authority
- (if applicable) mint authority
- (if applicable) anchor IDL authority
- (if applicable) freeze authority
When you deploy a Solana OFT, the deployer wallet is automatically set as the owner and delegate. The deployer wallet would also have been made as the upgrade authority of your OFT program.
Owner and delegate are specific to the LayerZero OFT context whereas upgrade authority is generic to Solana. The transfer of owner and delegate are separate from the transfer of upgrade authority.
The steps below are identical regardless if the new owner and delegate are Multisig accounts.
Transferring Owner and Delegate
The transfer of both require modifying your LZ Config file and running helper tasks.
Overall, you should carry out these steps:
- Modify LZ Config to include only the new delegate address
- Run
pnpm hardhat lz:oapp:wire --oapp-config layerzero.config.ts - Modify LZ Config to include the new owner address
- Run
pnpm hardhat lz:ownable:transfer-ownership --oapp-config layerzero.config.ts
You have now transferred both owner and delegate of your Solana OFT.
Transferring the OFT Program Upgrade Authority
The steps vary based on whether the current Upgrade Authority is your local keypair or a Squads Multisig.
When the current Upgrade Authority is your local keypair
The steps for when the current Upgrade Authority is your local keypair then also differ depending on whether (1) the new upgrade authority is a regular account that you control or whether (2) the new upgrade authority is a Multisig or an account that you do not control.
They differ in whether the new upgrade authority's keypair is included or whether you use the --skip-new-upgrade-authority-signer-check param.
The new upgrade authority is an account that you control
Run the follwowing:
solana program set-upgrade-authority --keypair <NEW_UPGRADE_AUTHORITY_KEYPAIR> <PROGRAM_ADDRESS> --new-upgrade-authority <NEW_UPGRADE_AUTHORITY>
The new upgrade authority is a Squads Multisig or an account that you do not control
The steps below are identical whether your new upgrade authority is a Squads Multisig or whether it's an account that you do no control.
If it is a Squads Multisig, note that the address you want to pass in is the Vault Account address.
This differs from the current
--multisigparam required by LayerZero helpers which requires the Multisig account address
With the correct new upgrade authority address prepared, run the following:
solana program set-upgrade-authority --skip-new-upgrade-authority-signer-check <PROGRAM_ADDRESS> --new-upgrade-authority <NEW_UPGRADE_AUTHORITY>