Polkadot Release Analysis: Polkadot stable2407

Polkadot Release Analysis: Polkadot stable2407

IMP: From this release onwards, the new release process is in effect, as mentioned here. Every three months, a stable release will be published. According to the naming convention of the new process, this stable release has been named as Polkadot stable2407.

: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 Polkadot stable2407. This report is complementary to the changelogs, not a replacement.

Highlights are categorised into High Impact, Medium Impact, and Low Impact for ease of navigation. There is also a section related to all note worthy changes related to integration tooling.

Summary

In the following report, we are featuring some of the changes included in the Polkadot stable2407. Runtime changes that are part of this release will be included in the corresponding runtime release done by the fellowship.

Next to every PR name you can find the code base related to these changes. The notation is as follows:

  • [S]: Changes related to Substrate
  • [P]: Changes related to Polkadot
  • [C]: Changes related to Cumulus
  • [S/P/C]: Changes related to a combination of the noted code bases.

:hammer_and_wrench: Tooling & Documentation Updates


:information_source: Low Impact

[S] Try State Hook for Bounties

PR: Try State Hook for Bounties by dharjeezy · Pull Request #4563 · paritytech/polkadot-sdk · GitHub

Why is this important?

Substrate’s Bounties-Pallet is used to manage bounties, which are rewards that users receive for performing tasks. As a part of this PR, try_state hook has been enabled in Bounties-Pallet. This hook executes the sanity checks for this pallet, per block.

How does this impact Polkadot builders?

In this PR, the following invariants have been added to ensure that the internal state of Bounties-Pallet is consistent:

1.BountyCount should be greater or equals to the length of the number of items in Bounties.
2.BountyCount should be greater or equals to the length of the number of items in BountyDescriptions.
3. Number of items in Bounties should be the same as BountyDescriptions length.

Related Issue: #239

[S] Use sp_runtime::traits::BadOrigin

PR: Use sp_runtime::traits::BadOrigin by jasl · Pull Request #5011 · paritytech/polkadot-sdk · GitHub

Why is this important?

Substrate’s BadOrigin error type is used to indicate that you are not allowed to perform a particular operation if you do not have the necessary permissions.

As a part of this PR, deprecated frame_support::error::BadOrigin has been replaced with sp_runtime::traits::BadOrigin.

How does this impact Polkadot builders?

This is not a breaking change because the deprecated error will still work. However, it is recommended to use sp_runtime::traits::BadOrigin rather than frame_support::error::BadOrigin.

[P] Add MAX_INSTRUCTIONS_TO_DECODE to XCMv2

PR: Add `MAX_INSTRUCTIONS_TO_DECODE` to XCMv2 by franciscoaguirre · Pull Request #4978 · paritytech/polkadot-sdk · GitHub

Why is this important?

The Cross-Consensus Message Format, or XCM, is a messaging format and language used to communicate between consensus systems. New enhancements are added to XCM from time to time. That’s why, XCM has a versioning system, VersionedXcm. While using XCM, we have to make sure which version of XCM we are using prior to the actual message content. This ensures that systems are able to safely receive a message, or alternatively, recognize that a message’s format is unsupported.

As a part of this PR, a decoding limit MAX_INSTRUCTIONS_TO_DECODE has been added to XCM V2 to ensure the maximum number of instructions before the decoding fails.

How does this impact Polkadot builders?

Although XCM V2 has been deprecated and it is recommended to use V3 or V4, if you are still using V2, you need to take this new limit into account. It has been set to 100.

[P] Allow clear_origin in safe XCM builder

PR: allow clear_origin in safe xcm builder by orgr · Pull Request #4777 · paritytech/polkadot-sdk · GitHub

Why is this important?

This release also adds one more important change to XCM. XCM messaging has the concept of Origin, which is the starting point for a series of actions and instructions. XCM supports different types of Origins. For more details, please read here.

As a part of this PR, clear_origin has been allowed as a part of XCM builder pattern, so that builders can clear the origin register safely.

How does this impact Polkadot builders?

Presently, Builders can use unsafe_builder to call clear_origin. Now it has been added to the safe XCM builder. You can use ClearOrigin to prevent the original origin from being used to execute the instruction.

let xcm = Xcm::builder()
          .withdraw_asset((Parent, 100u128))
          .clear_origin()
          .buy_execution((Parent, 1u128))
          .deposit_asset(All, [0u8; 32])
          .build();

Related Issue: #3770

[P,C,S] Remove most all usage of sp-std

PR: Remove most all usage of `sp-std` by jasl · Pull Request #5010 · paritytech/polkadot-sdk · GitHub

Why is this important?

The sp_std library exports primitives from the Rust standard library to make them usable with any code that depends on the runtime. This library will be deprecated as a part of #2101. Currently sp_std only reexports a few things from core/alloc.

How does this impact Polkadot builders?

Builders can refactor their code base by directly using core/alloc instead of sp_std. You can remove sp-std from Cargo.Toml and start using core/alloc crate from Rust ecosystem.

-use sp_std::{marker::PhantomData, vec, vec::Vec};
+extern crate alloc;
+use core::marker::PhantomData;
+use alloc::{vec, vec::Vec};

Related Issue: #2101

[S] Assets: can_decrease/increase for destroying asset is not successful

PR: Assets: can_decrease/increase for destroying asset is not successful by muharem · Pull Request #3286 · paritytech/polkadot-sdk · GitHub

Why is this important?

The Assets pallet has functions can_decrease and can_increase. Builders use these functions to check whether the balance of an account can be decreased or increased by an amount.

Previously, these functions did not check if the given asset was undergoing destruction. As a part of this PR, a validation check has been introduced in these functions, which will check if the given asset is undergoing destruction or not. If it is, it will return DepositConsequence::UnknownAsset error.

[S] Optimize finalization performance

PR: Optimize finalization performance by nazar-pc · Pull Request #4922 · paritytech/polkadot-sdk · GitHub

Why is this important?

An issue was encountered while upgrading the chain from Substrate 1.10.1 to 1.13.0. While finalizing a large number of blocks, chain was getting stuck.

As a part of this PR, the finalization algorithm has been refactored to fix this issue. PR is well described, please take a look here.

Related Issue: #4903

[S] [Pallet-Contracts] Add support for transient storage in contracts host functions

PR: [pallet_contracts] Add support for transient storage in contracts host functions by smiasojed · Pull Request #4566 · paritytech/polkadot-sdk · GitHub

Why is this important?

As a part of this PR, the following host functions have been added in Contracts-Pallet to support transient storage.

  • get_transient_storage
  • set_transient_storage
  • take_transient_storage
  • clear_transient_storage
  • contains_transient_storage

Transient Storage is a temporary data storage area. Memory and disk caches are examples of transient storage. Unlike permanent storage, which retains data indefinitely, Transient Storage preserves data only during the transaction’s execution.

How does this impact Polkadot builders?

Transient Storage lowers transaction costs, making blockchain interactions more affordable. After this PR, Smart Contract builders will have the option to store data temporarily during a transaction. This PR also adds a new config type MaxTransientStorageSize in Contracts-Pallet to define the maximum size of the transient storage.

If you are using the Contracts-Pallet this is a breaking change. To avoid issues as a result of this change, add the following code to your runtime:

impl pallet_contracts::Config for Runtime {
    // Other config...
    
    type MaxTransientStorageSize = ConstU32<{ 1 * 1024 * 1024 }>;
}

[S] Deprecated pallet::getter has been removed from several pallets

Why is this important?

In this release, deprecated pallet::getter has been removed from several pallets:

Related Issue: #3326


3 Likes