Upgrading Your Network 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 network, such as upgrading your Tanssi-powered network's runtime.
In this guide, you'll learn how to use Sudo to upgrade your network's runtime. With Sudo access, upgrading your chain is a quick and easy process. Note that network 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 network (Quick Trial or Dedicated)
- Your network's Sudo account connected to your network's Polkadot.js Apps. You can refer to the Managing Sudo guide for instructions on injecting your Sudo account into Polkadot.js Apps
- 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 network's current runtime version, which you'll find in your Tanssi Dashboard underneath the Properties section. For example, if your runtime version is 300
, you should upgrade first to 400
, then 500
, then 600
, 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 network.
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 Polkadot.js Apps for your Tanssi network. The Polkadot.js Apps link for your Tanssi network can be found in your Tanssi Dashboard underneath the Tooling section.
Warning
If your network 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 Polkadot.js Apps, take the following steps:
- Navigate to the Developer Tab of Polkadot.js Apps for your Tanssi network
- Click on Sudo. If you do not see Sudo in this menu, then you have not associated the Sudo account with Polkadot.js Apps. Make sure that your Sudo account is injected by your wallet and connected to Polkadot.js Apps
- 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, we can see that the Tanssi-powered network'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 network.
| Created: March 13, 2024