Skip to content

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 appchain's runtime.

In this guide, you'll learn how to use Sudo to upgrade your Tanssi 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 appchain (Snap or Dedicated)
  • Your appchain's Sudo account connected to your appchain'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 appchain's Sudo account is, you can find it in your Tanssi Dashboard underneath the Properties section.

Locating your Sudo address on apps.tanssi.network

Warning

It's critical to protect your Sudo account key with the utmost security precautions, as it grants privileged access to your Tanssi appchain.

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.

Version EVM Template Substrate Template
700 Download EVM V700 Wasm file Download Substrate V700 Wasm file
600 Download EVM V600 Wasm file Download Substrate V600 Wasm file
500 Download EVM V500 Wasm file Download Substrate V500 Wasm file
400 Download EVM V400 Wasm file Download Substrate V400 Wasm file
300 Download EVM V300 Wasm file Download Substrate V300 Wasm file
200 Download EVM V200 Wasm file Download Substrate V200 Wasm file
101 Download EVM V101 Wasm file Download Substrate V101 Wasm file
100 Download EVM V100 Wasm file Download Substrate V100 Wasm file

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 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 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 Polkadot.js Apps for your Tanssi appchain. The Polkadot.js Apps link for your Tanssi appchain can be found in your Tanssi Dashboard underneath the Tooling section.

Locating your Polkadot.js Apps Link on apps.tanssi.network

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 Polkadot.js Apps, take the following steps:

  1. Navigate to the Developer Tab of Polkadot.js Apps for your Tanssi appchain
  2. 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
  3. Select the system pallet
  4. Select setCode
  5. Toggle the fileUpload switch to enable uploading your Wasm runtime file
  6. Upload your Wasm runtime
  7. Press Submit Sudo and confirm the transaction in your wallet

Upgrading your Runtime on Polkadot.js Apps

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 appchain's runtime was successfully upgraded to version 400.

Check Runtime version on Polkadot.js Apps

And that's it! The Developer Portal section has plenty more guides on how to manage your Tanssi appchain.

The information presented herein has been provided by third parties and is made available solely for general information purposes. Tanssi does not endorse any project listed and described on the Tanssi Doc Website (https://docs.tanssi.network/). Tanssi Foundation does not warrant the accuracy, completeness or usefulness of this information. Any reliance you place on such information is strictly at your own risk. Tanssi Foundation disclaims all liability and responsibility arising from any reliance placed on this information by you or by anyone who may be informed of any of its contents. All statements and/or opinions expressed in these materials are solely the responsibility of the person or entity providing those materials and do not necessarily represent the opinion of Tanssi Foundation. The information should not be construed as professional or financial advice of any kind. Advice from a suitably qualified professional should always be sought in relation to any particular matter or circumstance. The information herein may link to or integrate with other websites operated or content provided by third parties, and such other websites may link to this website. Tanssi Foundation has no control over any such other websites or their content and will have no liability arising out of or related to such websites or their content. The existence of any such link does not constitute an endorsement of such websites, the content of the websites, or the operators of the websites. These links are being provided to you only as a convenience and you release and hold Tanssi Foundation harmless from any and all liability arising from your use of this information or the information provided by any third-party website or service.
Last update: June 21, 2024
| Created: March 13, 2024