Polkadot Release Analysis

Over the past few weeks, we have been analyzing and summarizing the last few Polkadot releases. The goal for this exercise is to gain a better understanding of new things coming in the release(s) and their impact on chain builders. The outcome is an analysis report for each Polkadot release. Each analysis report consists of high, medium, and low impact changes from a builders’ perspective. It also contains relevant code snippets and the motivation around these new changes/updates.

We are now ready to share the first report here based on Polkadot v0.9.31 & v0.9.32 releases.

Note: This release analysis report is not a replacement for the release notes and the change log. This is complementary to them, and only mentions some noteworthy PRs and changes from a parachain builders’ point of view. There could be many other changes in the release and we encourage you to also read the release notes to learn about them.

The report will be posted below in this thread.

8 Likes

Polkadot Release Analysis v0.9.31 & v0.9.32

:warning: The following report is not an exhaustive list of changes included in the release, but a set of changes that we felt deserved to be highlighted due to their impact on the Polkadot ecosystem builders.

Please do not stop reading the release notes v0.9.31 & release notes v0.9.32. This report is complementary to the changelogs, not a replacement.

Highlights are categorized into High Impact, Medium Impact, and Low Impact for ease of navigation.

Summary

v0.9.31

This release represents an important step for a diverse set of initiatives arriving on the Polkadot ecosystem. The most exciting (author’s opinion) is that Governance v2 (Gov2) is activated on the Kusama runtime! :tada:

Additionally, this release establishes the proper migration for the new field of Weights v2 (as well as introducing the new field proof_size in the Weight struct) , PoV error preventions around preimages and the introduction of the manual parachain unlocking mechanism among other changes.

v0.9.32

This release can be considered a patch release of the version v0.9.31 and it is mostly focused on solving an issue around the RPC call payment_queryFeeInfo that breaks many integrations with wallets, dapps, etc. It also includes some PRs that are not mentioned in this report.


Runtimes built on release v0.9.31

  • Rococo v9310
  • Westend v9310
  • Kusama v9310
  • Polkadot v9310

:exclamation:Please note runtimes Polkadot v9310 & Kusama v9310 are deprecated and will NOT be proposed for upgrade because of the RPC error mentioned on the #PR 12633:exclamation:

Runtimes built on release v0.9.32

  • Rococo v9320
  • Westend v9320
  • Kusama v9320
  • Polkadot v9320

This runtimes includes the changes from v9310 + the patch for the RPC.


:exclamation:High Impact

Governance v2 (Kusama only)

Link to PR #5205

This PR activates Gov2 on the Kusama runtime! Adding more context to this topic here is replicative as Gavin already explained it. In case you missed the update, here is the blog entry:

https://polkadot.network/blog/gov2-polkadots-next-generation-of-decentralised-governance/

However, we can suppliment with some code related updates pertaining to Gov2:

New pallets added:

  • pallet-conviction-voting
  • pallet-ranked-collective
  • pallet-referenda
  • pallet-whitelist

In the runtime/kusama/src/governance some new files were added:

fellowship.rs

This is a temporary file that contains governance code concerning the Polkadot Fellowship. As stated in the comments at the top of the file:

This is only a temporary arrangement since the Polkadot Fellowship belongs under the Polkadot Relay. However, that is not yet in place, so until then it will need to live here. Once it is in place and there exists a bridge between Polkadot/Kusama then this code can be removed.

origins.rs

This file defines the different Origins involved in Gov2.

In the Origin enum we can get all the different origins defined: https://github.com/paritytech/polkadot/pull/5205/files#diff-e2ff2aad6f036e6418cff48b86e36ce4f37ede962af95486fc046f0021a79f0fR34-R89

tracks.rs

Defines different constants for configuring tracks and exposes the TracksInfo implementation that contains the tracks() and track_for(id: &Self::RuntimeOrigin) functions.

Each track defines all the information per each “Dan” in the fellowship: https://github.com/paritytech/polkadot/pull/5205/files#diff-a24c8d8587aeea476b7282a5fbda68fcfc3d134b8f19ba54084aed4647aa5fc0R42-R65


Bound uses of Call

Link to PR #11649
Polkadot companion PR: PR #5729

This PR introduces a new utility type Bounded<T> and two new traits QueryPreimage and StorePreimage. This change prevents PoV-bloat-attack through the unbounded preimage lookups like PreimageProvider and PreimageRecipient (soon to be deprecated).

A new Scheduler API scheduler::v3 with updated Anon/Named traits is also introduced which uses the Bounded<Call> (rather than the previous ValueOrHash<Call>).

Luckily, this PR is very well documented which includes a brief description as well as specific changes introducing new Runtime primitives, Frame Support, Frame System, Scheduler, Referenda, Preimage and Democracy pallets.

How this impacts the Polkadot builders?

Please pay considerable attention on the Migration notes, which describe in detail how to migrate the storage for pallets Democracy, Preimage and Scheduler.

Additionally, something particularly noteworthy, is that as part of this change the Multisig pallet does not store the Calls in the pallet storage anymore. Check details here: PR #12072


Add storage size component to weights

Link to PR #12277

:warning: This change was reverted from release v0.9.30 because some migrations were needed (now included in the PR #6091)

As a continuation of Weights v1.5 Opaque Struct project that was previously discussed in the release v0.9.29, this PR is effectively introducing the proof_size field that justifies the whole Weights v2 project. This new field tracks the storage bandwidth used.

pub struct Weight {
	#[codec(compact)]
	/// The weight of computational time used based on some reference hardware.
	ref_time: u64,
	#[codec(compact)]
	/// The weight of storage space used by proof of validity.
	proof_size: u64,
}

While this is another bounding step closer to Weights v2 completion, there is still some work to do that will activate this proof_size measure. Please check the remaining items here: Issue #12176


Properly migrate weights to v2

Link to PR #6091

The MigrateToV3<Runtime> migration for Weights v2 was set up in the mod v3 (ask GitHub to load diff).

This PR is adding the migration described above to the relay chain runtimes as well as some pallet adjustments over the XCM configuration.

Following is a code sample of the migration configuration on the Kusama runtime:

https://github.com/paritytech/polkadot/pull/6091/files#diff-0d5d1f76b24989edd69c12c2f482abdf143d8926f1b3191665378b848515d45cR1456

Why is this change interesting for Polkadot builders?

This is one step closer to Weights v2 and it is being naturally implemented on Kusama first. Additionally, the migration definition may serve as a baseline code example for additional migrations required as a result of Weights v2.


Manual Parachain Lock

Link to PR #5451

Typically, a parachain gets locked after securing a slot on Polkadot via crowdloan. In this manner, participants of said crowdloan can be certain that the registered genesis code or state won’t be changed by the controlled account of the parachain, this avoids certain scenarios where users could be exploited.

While a parachain doesn’t have a manager lock; a subset of actions of the parachain remain under the control of a certain account.

Previously, this lock could then only be removed by root which presented some inconveniences under time sensitive circumstances.

This PR implements functionality that enables the parachain to remove the lock itself, and is no longer solely dependent on root/sudo.

This is not the only change included, the following extrinsics have also been exposed:


payment_queryInfo: Make it work with WeightV2 (v0.9.32)

Link to PR #12633

#PR 12277 introduced a Weight format change that makes the RPC Call payment_queryFeeInfo to fail. The query_info runtime api returns RuntimeDispatchInfo which contains the weight and as a result it breaks the decoding for old runtimes. #PR 12633 fixes the issue by forcing the RPC to always return WeightV1.

How can this change affects the Polkadot builders?

The runtime API payment_queryFeeInfo is widely used by wallets and all kind of applications that needs to calculate the fees for a transaction. Without this change several tools would be affected. Even if a workaround was applied in this case the tooling builders should migrate to the state_call(TransactionPaymentCallApi_query_call_info) as soon as possible.

One can find more details about this issue here.

:warning: Medium Impact

Enable collation via RPC relay chain node

Link to PR #1585

How this impacts builders?

Following the effort of decoupling collators and full relay nodes, this PR adds the possibility of pointing the collator to an “external” (non in-process) relay node. This is still considered experimental, and the relay node is suggested to run on the same machine than the collator for the moment.

To specify the relay full node rpc:
polkadot-parachain --alice --collator --relay-chain-rpc-url <rpc-websocket-url>


rpc: Implement transaction RPC API

Link to PR #12328

This PR is part of the RPC API spec described and being tracked in this issue #12328.

This change specifically adds two new methods transaction_unstable_submitAndWatch (Submit and watch an extrinsic via RPC pubsub) and transaction_unstable_unwatch (Unsubscribe) under this new api spec.

The documentation for this can be found specifically in the following link: transaction methods. As well as for the whole rpc spec, please see GitHub - paritytech/json-rpc-interface-spec

Why is this change interesting for the Polkadot builders?

This specification aims at establishing a lingua franca between UIs, tools, etc. that would like to access a Substrate-based blockchain, and node client implementations that actually connect to the blockchain (as stated in the documentation introduction). The transaction RPC calls will be highly used for the day to day calls processing.


frame/utils: introduce substrate-rpc-client crate for RPC utils

Link to PR #12212

This change adds a substrate-rpc-client crate that defines the HeaderProvider, HeaderSubscription, FinalizedHeaders structs and its methods in this crate making them reutilizable across all the code base. Implementation details can be checked in the new file: utils/frame/rpc/client/src/lib.rs

(Also this new crate is replacing utils/frame/remote-externalities/src/rpc_api.rs.)

Polkadot companion PR: PR #6162


Add force_open_hrmp_channel Call

Link to PR #6155

This PR avoids the extra XCM round trip as well as the ability to avoid a deposit when a channel with a common good parachain is opened.

Essentially, the change focuses on the implementation of the force_open_hrmp_channel call that init_open_channel & accept_open_channel in the same call as root.

More details here.


:information_source: Low Impact

Support running the pallet benchmarks analysis without running the benchmarks

Link to PR #12361

This PR adds a new argument to the benchmarking CLI: --json-input <path.json>

Now it is possible to rerun the analysis part of the benchmark as many times as wanted without the need of running the actual benchmarks every time.

As stated on the PR description the expected use is the following:

  • Running the benchmarks once, generating the results with --json-file
  • Then, execute the analysis with the new argument and the generated result.

This introduces certain separation between the values set on the benchmarks and the different configurations used for the analysis of the results.


Vesting pallet - make WithdrawReasons configurable

Link to PR #12109

Polkadot companion PR: PR #5929

Updates the vesting pallet to support custom WithdrawReasons for the vesting lock.

    parameter_types! {
    	pub const MinVestedTransfer: Balance = 100 * DOLLARS;
    	pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
    		WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
    }
    
    impl pallet_vesting::Config for Runtime {
    	...
    	type WeightInfo = pallet_vesting::weights::SubstrateWeight<Runtime>;
    	type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
      ...
    }

macro stubs for all pallet:: macros to improve documentation visibility

Link to PR #12334

Not critically significant, but quite useful to understand what a macro does behind the scenes. This shows the macro documentation when it’s hovered:


Enable the wasmtime-based WASM executor by default

Link to PR #12486

Why is this change interesting for the Polkadot builders?

Before this change only the interpreted WASM executor was included in per default compilations. Making the compiled executor opt-in, now, compiled WASM executor is set by default and an opt-out instead.

How this impacts the Polkadot builders?

Users could see a big performance difference between using these two, as more recent versions of the interpreter see a regression in performance.

An example where this has caused problems for builders: Issue #12320


Rename from_components to from_parts from Weight implementation

Link to PR #12473

Rename from_components from Weight implementation to from_parts. Logic remains the same.

- /// Construct [`Weight`] with weight components, namely reference time and storage size weights.
+ /// Construct [`Weight`] from weight parts, namely reference time and proof size weights.
- pub const fn from_components(ref_time: u64, proof_size: u64) -> Self {
+	pub const fn from_parts(ref_time: u64, proof_size: u64) -> Self {
-		Self { ref_time, proof_size }
+		Self { ref_time, proof_size }
	}

Your friendly neighborhood Polkadot Release Analysis team,
@hbulgarini @alejandro @bruno @ayush.mishra


Help us improve the release analysis by filling out this 6 question survey.

25 Likes

Thank you for sharing this, I have added this link to the contextual information for the proposal aiming to upgrade Kusama to runtime version 9320 - Polkassembly

4 Likes

:warning: Important update about Polkadot and Kusama Runtime upgrades:

As it is mentioned on the release notes for v0.9.34 Release:

Polkadot runtimes v9320 and v9330 are replaced by v9340.

1 Like

Thanks for sharing this.

1 Like