Upgrading Your Appchain Runtime with Sudo¶
Introduction¶
Sudo is a module that enables privileged runtime calls to be dispatched when called from the Sudo account. Sudo is sometimes colloquially referred to as a superuser or god-like account. This enables you to perform privileged actions in the course of managing your appchain, such as upgrading your Tanssi-powered appchain's runtime.
In this guide, you'll learn how to use Sudo to upgrade your appchain's runtime. With Sudo access, upgrading your chain is a quick and easy process. Note that appchain teams in production will have the option to phase out Sudo access and rely on governance to process runtime upgrades.
Checking Prerequisites¶
For the example in this guide, you will need to have the following:
- A Tanssi-powered appchain (Quick Trial, Dedicated, or MainNet).
- Your appchain's Sudo account connected to your appchain's developer portal. You can refer to the Managing Sudo guide for instructions on injecting your Sudo account into the developer portal.
- The new Wasm runtime binary file, built with a higher version than the current one.
If you're unsure what your Tanssi network's Sudo account is, you can find it in your Tanssi Dashboard underneath the Properties section.
Warning
It's critical to protect your Sudo account key with the utmost security precautions, as it grants privileged access to your Tanssi network.
Obtaining the Wasm Runtime¶
If your chain is based on one of the official templates, you can download the official Wasm runtime binary file from the table below. The official releases are published in the releases section in the Tanssi repository.
You should always upgrade the runtime following the releases in an orderly fashion, applying one release after another without skipping any of them. To do so, you need to know your appchain's current runtime version, which you'll find in your Tanssi Dashboard underneath the Properties section. For example, if your runtime version is 1000
, you should upgrade first to 1100
, then 1201
, then 1300
, and so on until the latest available version.
Warning
Applying the upgrades in order ensures that the changes (migrations) in the internal data structures are applied, preserving data consistency. Doing otherwise might stall your appchain.
Note
If you are compiling the runtime manually, make sure to use the Wasm version compact
and compressed
, which is optimized and lighter.
Upgrading Your Runtime¶
To get started, head to the developer portal for your Tanssi appchain, which can be found in your Tanssi Dashboard underneath the Tooling section.
Warning
If your appchain was deployed using an official template and the intended upgrade is a custom runtime, make sure to have changed the default spec name (frontier-template or container-chain-template) to a different one before building the Wasm file. You'll also need to execute the setCodeWithoutChecks
extrinsic instead of setCode
.
With your Wasm runtime ready to upload and your Sudo account accessible in the developer portal, take the following steps:
- Navigate to the Developer tab of the developer portal for your Tanssi appchain.
- Click on Sudo. If you do not see Sudo in this menu, then you have not associated the Sudo account with the developer portal. Make sure that your Sudo account is injected by your wallet and connected to the developer portal.
- Select the system pallet.
- Select setCode.
- Toggle the fileUpload switch to enable uploading your Wasm runtime file.
- Upload your Wasm runtime.
- Press Submit Sudo and confirm the transaction in your wallet.
You can verify that your runtime upgrade was successful by checking the runtime version in the upper left-hand corner. In this case, you can see that the Tanssi-powered appchain's runtime was successfully upgraded to version 400
.
And that's it! The developer portal section has plenty more guides on how to manage your Tanssi appchain.
| Created: March 13, 2024