blockdeep
Fri, 02 Aug 2024 10:53:42 +0000
Ecosystem

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.

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.

Tooling & Documentation Updates

Sidecar - v19.0.2

TxWrapper - v7.5.1

PolkadotJS - v12.2.1

Asset Transfer Api - v0.3.1

Add Async Backing guide: In this release, the Asynchronous Backing guide has been upgraded to work with the latest parachain template.

Pallet Name Customisation: If you are using minimal-template from Polkadot-SDK, you can refer this guide for changing pallet name.

Elastic scaling MVP guide: As a part of this release, a guide for enabling elastic scaling MVP has been added.

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: https://github.com/paritytech/polkadot-sdk/pull/5011

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: https://github.com/paritytech/polkadot-sdk/pull/5010

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: https://github.com/paritytech/polkadot-sdk/pull/4922

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: https://github.com/paritytech/polkadot-sdk/pull/4566

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:

Pallet-Vesting

Pallet-Babe

Pallet-Insecure-Randomness-collective-flip

Pallet-Session

Pallet-Transaction-Storage

Pallet-Membership

Pallet-Tips

Related Issue: #3326

1 post - 1 participant