<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pablo Andrés Dorado Suárez</title>
    <description>The latest articles on DEV Community by Pablo Andrés Dorado Suárez (@pandres95).</description>
    <link>https://dev.to/pandres95</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F52245%2F49103373-5181-4104-8ee6-24afd657c8cf.jpg</url>
      <title>DEV Community: Pablo Andrés Dorado Suárez</title>
      <link>https://dev.to/pandres95</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pandres95"/>
    <language>en</language>
    <item>
      <title>How to upgrade your runtime to the latest version of Polkadot SDK and not die trying</title>
      <dc:creator>Pablo Andrés Dorado Suárez</dc:creator>
      <pubDate>Wed, 21 May 2025 01:52:11 +0000</pubDate>
      <link>https://dev.to/pandres95/how-to-upgrade-your-runtime-to-the-latest-version-of-polkadot-sdk-and-not-die-trying-1k3p</link>
      <guid>https://dev.to/pandres95/how-to-upgrade-your-runtime-to-the-latest-version-of-polkadot-sdk-and-not-die-trying-1k3p</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;💡 Note: This tutorial focuses on MacOS and Linux development environments. If you are using Windows, please consider running Linux under WSL or having a dedicated Linux distro on your computer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Polkadot SDK is one of the most advanced tooling sets for writing a blockchain that works. Whether you run a solo chain or a parachain part of the Polkadot network, the SDK is a Swiss knife that you can find helpful in building a functioning blockchain.&lt;/p&gt;

&lt;p&gt;However, blockchains are not set in stone. Eventually, you'll need to upgrade to the next version to get the latest updates and the best features or fix potential vulnerabilities that might have been found since your last upgrade.&lt;/p&gt;

&lt;p&gt;This article serves as a guide to almost infallibly migrate your runtime between your current Polkadot SDK version and the latest available version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Polkadot SDK versioning
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fparitytech%2Frelease-registry%2Fraw%2Fmain%2F.assets%2Ftimeline-gantt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fparitytech%2Frelease-registry%2Fraw%2Fmain%2F.assets%2Ftimeline-gantt.png" alt="Polkadot SDK Release Timeline" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we talk about Polkadot versioning, we find two versioning conventions.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;stable&lt;/em&gt; convention follows &lt;code&gt;stableYYMM-PATCH&lt;/code&gt;, where &lt;code&gt;YYMM&lt;/code&gt; is a short date format (YY/MM) marking the month when this version was initially published. Polkadot SDK versions are published around the end of every quarter, and &lt;code&gt;PATCH&lt;/code&gt; versions are released monthly.&lt;/p&gt;

&lt;p&gt;The semver convention follows &lt;code&gt;1.XX.PATCH&lt;/code&gt;. In this case, the minor version is tied to a stable release, and &lt;code&gt;PATCH&lt;/code&gt; is the same patch version, defaulting to &lt;code&gt;0&lt;/code&gt; if it's the initial release.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🗒️ There are other variations of the versioning (like pre-releases and RC releases, but we're not interested in these right now).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can find more information about the release schedule for Polkadot SDK &lt;a href="https://github.com/paritytech/release-registry" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Determine the PSDK version you plan to update
&lt;/h2&gt;

&lt;p&gt;The above is just a hint to help you understand which version you might be in and which one you plan to update.&lt;/p&gt;

&lt;p&gt;Ideally, you'll want to update to the latest version available, as you'll immediately get all the latest goodies and security fixes. However, this is not generally recommended, as you'll deal with huge changes.&lt;/p&gt;

&lt;p&gt;The best advice is to upgrade one stable version at a time. This is the safest way to prevent unwanted behaviours due to bumping multiple versions while incorrectly handling migrations between versions.&lt;/p&gt;

&lt;p&gt;There's one big exception to this: when your current version and the following ones are past the End of Life.&lt;/p&gt;

&lt;p&gt;Here are some quick steps on how to perform the usual upgrades. Look them up in the future, and go further to check on details if you forgot something:&lt;/p&gt;

&lt;h3&gt;
  
  
  Updating to your latest patch version
&lt;/h3&gt;

&lt;p&gt;This is by far the most straightforward process. No breaking changes expected (typically), no XCM version updates, no changes in &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Determine your current stable version.

&lt;ol&gt;
&lt;li&gt;Read the &lt;em&gt;Release Notes&lt;/em&gt; to know what changed between patch versions.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;Upgrade dependencies to the latest patch of the stable version.&lt;/li&gt;

&lt;li&gt;Sometimes, you might need to adjust some configuration changes.&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;Optionally, you can &lt;code&gt;try-runtime&lt;/code&gt; and run benchmarks, but this is not usually expected on patch releases. These are expected to be non-breaking, and changes tend to be minimal, mostly fixes and/or reversions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Updating to your next stable version
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Determine your next stable version.

&lt;ol&gt;
&lt;li&gt;Read the &lt;em&gt;Release Notes&lt;/em&gt; to know what changed between patch versions.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;Upgrade dependencies to the latest patch of the stable version.&lt;/li&gt;

&lt;li&gt;You must adjust some configuration changes.

&lt;ol&gt;
&lt;li&gt;(Optional) If you use XCM types in your storage configuration, you must review possible XCM migrations. Coding a custom migration script might be necessary if these are unavailable in the XCM crates or elsewhere.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;try-runtime&lt;/code&gt; to check the needed migrations.

&lt;ol&gt;
&lt;li&gt;Once you do that, check whether the pallet needing migration has a migration script.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;You don't need to run benchmarks using the reference benchmarks provided by the pallet crate. Otherwise, run benchmarks to get updated weights.&lt;/li&gt;

&lt;/ol&gt;

&lt;h3&gt;
  
  
  Updating to the latest stable version
&lt;/h3&gt;

&lt;p&gt;Repeat the process above until you reach the latest stable version. Then, follow the first process if patch releases exist for that stable version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reading the Release Notes
&lt;/h3&gt;

&lt;p&gt;An important part of upgrading is reading the &lt;em&gt;Release Notes&lt;/em&gt;. Each note summarises the changelog between two versions of the Polkadot SDK and includes a list of changes for different audiences. The audiences&lt;sup id="fnref1"&gt;1&lt;/sup&gt; are:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Audience&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Node Dev&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Those who build around the client side code. Alternative client builders, SMOLDOT, those who consume RPCs. These are people who are oblivious to the runtime changes. They only care about the meta-protocol, not the protocol itself.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Runtime Dev&lt;/strong&gt;.&lt;/td&gt;
&lt;td&gt;&lt;em&gt;All of those who rely on the runtime. A parachain team that is using a pallet. A DApp that is using a pallet. These are people who care about the protocol (WASM), not the meta-protocol (client).&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Node Operator&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Those who don't write any code and only run code.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Runtime User&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Anyone using the runtime. This can be a token holder or a dev writing a front end for a chain.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In our case, you should be mainly interested in the updates regarding &lt;strong&gt;Runtime Dev&lt;/strong&gt;. If you run a custom node, and can't execute your blockchain using the &lt;code&gt;omni-node&lt;/code&gt; (maybe because you use a non-standard consensus algorithm), also &lt;strong&gt;Node Dev&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Hint&lt;/strong&gt; If you've been operating a blockchain that operates in a &lt;em&gt;standard way&lt;/em&gt; (i.e. using consensus algorithms like &lt;strong&gt;AURA&lt;/strong&gt; or &lt;strong&gt;GRANDPA&lt;/strong&gt;), I strongly recommend you use the &lt;code&gt;polkadot&lt;/code&gt; (for operating solochains) or &lt;code&gt;polkadot-parachain&lt;/code&gt; (for operating parachains). This will reduce the code you must maintain and the time required to migrate further.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ultimately, check out &lt;strong&gt;Node Operator&lt;/strong&gt; for updates regarding infrastructure operators and your DevOps teams. And &lt;strong&gt;Runtime User&lt;/strong&gt; to see if your dApps and client applications need upgrades.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using &lt;code&gt;psvm&lt;/code&gt; to manage upgrading the dependencies
&lt;/h3&gt;

&lt;p&gt;The Polkadot SDK is a set of thousands of crates comprising Substrate (the bare bones), FRAME (to construct the runtime logic), Cummulus and Polkadot (to interact with Polkadot).&lt;/p&gt;

&lt;p&gt;This means that every crate is versioned differently, and there's no easy way to determine which crate version is related to which SDK version.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🗒️ An exception to this is the umbrella crate (&lt;a href="https://crates.io/crates/polkadot-sdk" rel="noopener noreferrer"&gt;&lt;code&gt;polkadot-sdk&lt;/code&gt;&lt;/a&gt;) for which versioning is aligned to the stable versioning (i.e. &lt;code&gt;v2503.0.0&lt;/code&gt; points to &lt;code&gt;stable2503&lt;/code&gt;) starting with the latest published in March 2025. The easiest way to migrate is just using &lt;code&gt;polkadot-sdk&lt;/code&gt; as the only dependency, which we'll cover in a follow-up post.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once you've determined your version and plan to upgrade, we'll use &lt;a href="https://crates.io/crates/psvm" rel="noopener noreferrer"&gt;&lt;code&gt;psvm&lt;/code&gt;&lt;/a&gt; (short for Polkadot SDK Version Manager), a CLI tool designed to facilitate this process.&lt;/p&gt;

&lt;p&gt;Follow the steps to install it on your machine, and once you're ready, go to your project, then run &lt;code&gt;psvm&lt;/code&gt; to upgrade your project's dependencies to the latest version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;psvm &lt;span class="nt"&gt;-v&lt;/span&gt; stableYYMM-ZZ
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your dependencies are correctly configured, you should be able to see how they change versions. &lt;/p&gt;

&lt;h2&gt;
  
  
  Adjusting your runtime configuration
&lt;/h2&gt;

&lt;p&gt;The next step is to adjust the configuration changes. Multiple strategies can achieve this: we can run a checklist, use &lt;code&gt;cargo check,&lt;/code&gt; or both.&lt;/p&gt;

&lt;h3&gt;
  
  
  Run a checklist
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Make a list of the pallet setups in your runtime.&lt;/li&gt;
&lt;li&gt;Compare with the list of changes defined by the &lt;em&gt;Release Notes&lt;/em&gt; of the SDK version you aim to upgrade to.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By doing this, you'll be able to build a checklist of pallets that might require configuration adjustments or changes.&lt;/p&gt;

&lt;p&gt;The next step is locating a reference configuration for each pallet. Depending on which pallets you're trying to configure, you can check the configuration for either &lt;a href="https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs" rel="noopener noreferrer"&gt;Westend Asset Hub&lt;/a&gt; or &lt;a href="https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/westend/src/lib.rs" rel="noopener noreferrer"&gt;Westend&lt;/a&gt; runtime.&lt;/p&gt;

&lt;p&gt;Finally, you'll be able to spot the configuration differences that need to be adjusted for each configuration trait associated with your Runtime.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use &lt;code&gt;cargo check&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;If you use workspaces, point &lt;code&gt;cargo check&lt;/code&gt; directly to your project. Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo +nightly-2025-01-30 check &lt;span class="nt"&gt;-p&lt;/span&gt; your-chain-runtime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach is helpful as it usually tracks the configuration changes first. However, it must be used carefully, often in conjunction with the checklist approach, to get the best results. Sometimes, as trait bounds are not met for some outer enums of the runtime, the whole runtime construction might fail, leaving a trail of hundreds of errors that are just the same thing (&lt;em&gt;trait bounds not met&lt;/em&gt;), which can add an extra unnecessary burden.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cargo checks with a checklist
&lt;/h3&gt;

&lt;p&gt;The best approach is to have a list of config traits to adjust, aided by &lt;code&gt;cargo check&lt;/code&gt;. You can achieve this by letting an IDE (like RustRover, or any code editor with &lt;code&gt;rust-analyzer&lt;/code&gt;) highlight the configuration errors for you, while knowing where to look for (in runtimes, config traits are usually placed in a known place). This is one of the most useful, giving you a better workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Including new goodies
&lt;/h2&gt;

&lt;p&gt;Now that you have adjusted the configuration, it's time to check for new goodies. Each Polkadot SDK version usually introduces new features, such as new pallets, improvements in UX, and better extensions.&lt;/p&gt;

&lt;p&gt;Read your desired SDK version's &lt;em&gt;Release Notes&lt;/em&gt; for better information about these changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ensuring migrations and &lt;code&gt;try-runtime&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;This is a necessary step, as preserving the integrity of your runtime storage ensures that no unintended behaviours or issues occur.&lt;/p&gt;

&lt;p&gt;First, install &lt;code&gt;try-runtime-cli&lt;/code&gt;. You'll need to figure out the &lt;a href="https://github.com/paritytech/try-runtime-cli" rel="noopener noreferrer"&gt;latest release&lt;/a&gt;, then run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--git&lt;/span&gt; https://github.com/paritytech/try-runtime-cli &lt;span class="nt"&gt;--tag&lt;/span&gt; vX.Y.Z &lt;span class="nt"&gt;--locked&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, download the latest binary from the &lt;a href="https://github.com/paritytech/try-runtime-cli/releases" rel="noopener noreferrer"&gt;Releases&lt;/a&gt; page on the &lt;code&gt;try-runtime&lt;/code&gt; repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Use `try-runtime-x86_64-unknown-linux-musl` if on Linux, &lt;/span&gt;
&lt;span class="c"&gt;# or `try-runtime-x86_64-apple-darwin` otherwise if on Mac.&lt;/span&gt;
curl &lt;span class="nt"&gt;-o&lt;/span&gt; try-runtime &lt;span class="nt"&gt;-L&lt;/span&gt; https://github.com/paritytech/try-runtime-cli/releases/download/v0.8.0/try-runtime-x86_64-unknown-linux-musl 
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x ./try-runtime
./try-runtime &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, you'll need to build your runtime using the &lt;code&gt;try-runtime&lt;/code&gt; feature.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo build &lt;span class="nt"&gt;--release&lt;/span&gt; &lt;span class="nt"&gt;--features&lt;/span&gt; try-runtime &lt;span class="nt"&gt;-p&lt;/span&gt; my-runtime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once built, you'd be able to use &lt;code&gt;try-runtime-&lt;/code&gt;. The most common way to use &lt;code&gt;try-runtime&lt;/code&gt; is to test a runtime upgrade, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./try-runtime &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--runtime&lt;/span&gt; target/release/wbuild/my-runtime/my-runtime.wasm &lt;span class="se"&gt;\&lt;/span&gt;
    on-runtime-upgrade &lt;span class="se"&gt;\&lt;/span&gt;
    live &lt;span class="nt"&gt;--uri&lt;/span&gt; wss://your-chain-node.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should hint at which migrations need to be executed to preserve the integrity of your chain's storage. FRAME pallets often come with &lt;code&gt;VersionedMigration&lt;/code&gt;s whenever there are breaking changes in the storage types they support. Importing them to your runtime is usually as simple as declaring a &lt;code&gt;Migrations&lt;/code&gt; type (a tuple, or a tuple of tuples) that you'll attach to your runtime's &lt;code&gt;Executive&lt;/code&gt; handler.&lt;/p&gt;

&lt;p&gt;This is an example of a runtime that requires multiple migrations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="cd"&gt;/// A list of migrations that need to undergo.&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Migrations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="c1"&gt;// Unreleased&lt;/span&gt;
    &lt;span class="nn"&gt;pallet_collator_selection&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;migration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;v2&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;MigrationToV2&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nn"&gt;pallet_session&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;v1&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;MigrateV0ToV1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;
        &lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nn"&gt;pallet_session&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;v1&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;InitOffenceSeverity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nn"&gt;cumulus_pallet_aura_ext&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;migration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;MigrateV0ToV1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nn"&gt;cumulus_pallet_xcmp_queue&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;migration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;v4&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;MigrationToV4&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nn"&gt;cumulus_pallet_xcmp_queue&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;migration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;v5&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;MigrateV4ToV5&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// Permanent&lt;/span&gt;
    &lt;span class="nn"&gt;pallet_xcm&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;migration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;MigrateToLatestXcmVersion&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// ...&lt;/span&gt;

&lt;span class="cd"&gt;/// Executive: handles dispatch to the various modules.&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Executive&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;frame_executive&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Executive&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;
    &lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Block&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nn"&gt;frame_system&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ChainContext&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;AllPalletsWithSystem&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Migrations&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, you can check out &lt;a href="https://github.com/paritytech/try-runtime-cli?tab=readme-ov-file#examples" rel="noopener noreferrer"&gt;more examples&lt;/a&gt; on the &lt;code&gt;try-runtime&lt;/code&gt; repository to see the possibilities of using this tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmarking and weights
&lt;/h2&gt;

&lt;p&gt;Refreshing your runtime's weights to keep them current is essential, especially if you use custom types or special configurations not considered in the reference benchmarking included with your pallets in FRAME.&lt;/p&gt;

&lt;p&gt;To do so, you'll need &lt;code&gt;frame-omni-bencher&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Note: it says `--profile=production` in the GitHub README, but this tends&lt;/span&gt;
&lt;span class="c"&gt;# to fail MacOS machines.&lt;/span&gt;
cargo &lt;span class="nb"&gt;install &lt;/span&gt;frame-omni-bencher &lt;span class="nt"&gt;--profile&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, you'll need to build your runtime with the &lt;code&gt;runtime-benchmarks&lt;/code&gt; feature.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo build &lt;span class="nt"&gt;--release&lt;/span&gt; &lt;span class="nt"&gt;--features&lt;/span&gt; runtime-benchmarks &lt;span class="nt"&gt;-p&lt;/span&gt; my-runtime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Hint: &lt;code&gt;try-runtime&lt;/code&gt; and &lt;code&gt;runtime-benchmarks&lt;/code&gt; are not mutually exclusive. So, you can build a runtime with both features at the same time, so you'll save time building runtimes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Finally, if your runtime supports genesis config via Runtime APIs, ensure a &lt;code&gt;dev&lt;/code&gt; (not &lt;code&gt;development&lt;/code&gt;) configuration because the bencher CLI uses that one to initialise your runtime when running benchmarks.&lt;/p&gt;

&lt;p&gt;Ensure your benchmarks work, using this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;frame-omni-bencher v1 benchmark pallet &lt;span class="nt"&gt;--runtime&lt;/span&gt; target/release/wbuild/my-runtime/my-runtime.wasm &lt;span class="nt"&gt;--all&lt;/span&gt; &lt;span class="nt"&gt;--steps&lt;/span&gt; 2 &lt;span class="nt"&gt;--repeat&lt;/span&gt; 1 &lt;span class="nt"&gt;--quiet&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the setup, execution, or verification code fails for some &lt;em&gt;extrinsic&lt;/em&gt;, you can catch it. In that case, you might need to work on a fix by going to the configuration of the failed pallet and checking on the benchmark helper or types (sometimes, it's an incorrectly configured origin, sometimes it's a misconfigured benchmark helper, or sometimes both).&lt;/p&gt;

&lt;p&gt;Once you can adjust the &lt;em&gt;bencher&lt;/em&gt; usage to refresh the weight files. This is even automatable on your CI (if you can afford a dedicated machine matching the minimum requirements).&lt;/p&gt;

&lt;p&gt;Here's an example of an automated benchmarking execution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;frame-omni-bencher v1 benchmark pallet &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--runtime&lt;/span&gt; &lt;span class="o"&gt;{{&lt;/span&gt;runtime&lt;span class="o"&gt;}}&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--pallet&lt;/span&gt; &lt;span class="s2"&gt;"{{pallet}}"&lt;/span&gt; &lt;span class="nt"&gt;--extrinsic&lt;/span&gt; &lt;span class="s2"&gt;"*"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--steps&lt;/span&gt; 50 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--repeat&lt;/span&gt; 20 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--output&lt;/span&gt; ./my-runtime/src/weights/ | &lt;span class="se"&gt;\&lt;/span&gt;
    save &lt;span class="nt"&gt;--force&lt;/span&gt; .benchmarking-logs/&lt;span class="o"&gt;{{&lt;/span&gt;pallet&lt;span class="o"&gt;}}&lt;/span&gt;.out.txt &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--stderr&lt;/span&gt; .benchmarking-logs/&lt;span class="o"&gt;{{&lt;/span&gt;pallet&lt;span class="o"&gt;}}&lt;/span&gt;.log.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Advanced topics
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Upgrading the Polkadot Fellowship &lt;code&gt;runtimes&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Updating runtimes is no easy feat. And it gets worse when maintaining the Polkadot and Kusama network &lt;a href="https://github.com/polkadot-fellows/runtimes/" rel="noopener noreferrer"&gt;&lt;code&gt;runtimes&lt;/code&gt;&lt;/a&gt;, a task assigned to the &lt;a href="https://polkadot-fellows.xyz" rel="noopener noreferrer"&gt;Polkadot Fellowship&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I've been personally in charge of leading the upgrade of the Polkadot SDK on the whole runtimes a couple times, and while most of these steps apply, you'll &lt;strong&gt;always&lt;/strong&gt; need extra help, due to the complexity, and the multiple contexts and things you need to understand and manage to configure everything alright (i.e. there are people in the Fellowship working on specialised topics like Bridges and XCM, or you might need help from the maintainers of Encointer) all of which escape from a generalist knowledge.&lt;/p&gt;

&lt;p&gt;However, if followed appropriately, a series of steps might increase the chance of getting to the point where you need help after performing most of the bump correctly.&lt;/p&gt;

&lt;p&gt;For this guide, I'll mention tasks (such as &lt;em&gt;adjust configs&lt;/em&gt;) as single steps, considering you've read the entire post so far and have some comprehension about what's needed to upgrade a single runtime successfully.&lt;/p&gt;

&lt;h3&gt;
  
  
  Update dependencies
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;psvm -v stableXXYY&lt;/code&gt; as indicated above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Formatting (after each step)
&lt;/h3&gt;

&lt;p&gt;We run &lt;code&gt;zepter&lt;/code&gt;, &lt;code&gt;taplo&lt;/code&gt; for TOML formatting, &lt;code&gt;cargo fmt -p {runtime}&lt;/code&gt; for code formatting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Disable Encointer (and request for help)
&lt;/h3&gt;

&lt;p&gt;Comment out every reference to Encointer in the following places:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Workflows:&lt;/strong&gt; This is optional, and works to ensure you can see the CI checks.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chain-spec-generator&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Cargo.toml&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After this, reach one of the &lt;a href="https://encointer.org/" rel="noopener noreferrer"&gt;Encointer&lt;/a&gt; maintainers available on the &lt;a href="https://matrix.to/#/#fellowship-open-channel:parity.io" rel="noopener noreferrer"&gt;Fellowship Channel&lt;/a&gt; and request for help.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Do this on a &lt;strong&gt;single&lt;/strong&gt; commit, so the Encointer maintainer you reach can revert the changes with a single step.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Adjust runtime configurations
&lt;/h3&gt;

&lt;p&gt;Follow this order to adjust configs on the runtimes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;staging-kusama-runtime&lt;/code&gt; (&lt;code&gt;relay/kusama&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;polkadot-runtime&lt;/code&gt; (&lt;code&gt;relay/polkadot&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;asset-hub-kusama-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/asset-hubs/asset-hub-kusama&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;asset-hub-polkadot-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/asset-hubs/asset-hub-polkadot&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bridge-hub-kusama-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/bridge-hubs/bridge-hub-kusama&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bridge-hub-polkadot-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/bridge-hubs/bridge-hub-polkadot&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;collectives-polkadot-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/collectives/collectives-polkadot&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;coretime-kusama-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/coretime/coretime-kusama&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;coretime-polkadot-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/coretime/coretime-polkadot&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;glutton-kusama-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/gluttons/glutton-kusama&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;people-kusama-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/people/people-kusama&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;people-polkadot-runtime&lt;/code&gt; (&lt;code&gt;system-parachains/people/people-polkadot&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: This order is not just appropriate lexicographically but also ensures you're following the appropriate comparable codebase (Rococo for most Kusama changes, Westend for Polkadot changes).&lt;/p&gt;

&lt;p&gt;Also, if changes are only related to Kusama, this order will indicate what to do at each runtime.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Run &lt;code&gt;cargo check&lt;/code&gt; and &lt;code&gt;cargo clippy&lt;/code&gt; after adjusting every runtime. &lt;/p&gt;

&lt;p&gt;Adjust configs one runtime at a time. This and committing the changes for one runtime at a time ensure &lt;code&gt;git&lt;/code&gt; atomicity, so in case you need to revert some commits or even rebase, this will make things easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adjust Integration Tests
&lt;/h3&gt;

&lt;p&gt;Follow the same order as indicated in the adjust runtime configurations step, starting with &lt;code&gt;integrated-tests/emulated/chains&lt;/code&gt;, then &lt;code&gt;integrated-tests/emulated/tests&lt;/code&gt;. Sometimes, you must change something on &lt;code&gt;emulated/helpers&lt;/code&gt; or &lt;code&gt;zombienet&lt;/code&gt;, but that's more unusual.&lt;/p&gt;

&lt;h3&gt;
  
  
  Migrations and Benchmarks
&lt;/h3&gt;

&lt;p&gt;The CI will tell you, but you must also check on Migrations and (if needed) adjust benchmark configs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bench Bot
&lt;/h3&gt;

&lt;p&gt;Finally, once you open the PR, and have everything set up (all green checks) run the bench bot, as a comment on your PR.&lt;/p&gt;

&lt;p&gt;Run this command for every chain (in the same order as stated above, ideally).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/cmd bench &lt;span class="nt"&gt;--runtime&lt;/span&gt; polkadot &lt;span class="nt"&gt;--pallet&lt;/span&gt; pallet_rc_migrator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;According to PRDoc &lt;a href="https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json" rel="noopener noreferrer"&gt;schema&lt;/a&gt; ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>polkadot</category>
      <category>web3</category>
      <category>substrate</category>
      <category>rust</category>
    </item>
  </channel>
</rss>
