blockdeep
Wed, 02 Oct 2024 14:22:53 +0000
Ecosystem

Polkadot Release Analysis: Polkadot stable2409

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 stable2409. 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.

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 stable2409. 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.2.0

TxWrapper - v7.5.1

PolkadotJS - v13.2.1

Asset Transfer Api - v0.3.1

Parachain-template: genesis config presets added - As a part of this release, Genesis config presets have been moved to the Parachain template runtime from node binary.

Use umbrella crate for minimal template. - In this release, the umbrella crate has been added to minimal template, so we can have a very small Cargo.toml file that only has one dependency, the umbrella crate.

Enhancing solochain template - Solochain template has been enhanced as a part of this PR. For ex: frame-metadata-hash-extension has been introduced to solochain template.

Medium Impact

[S] [Assets] Call implementation for transfer_all

PR: https://github.com/paritytech/polkadot-sdk/pull/4527

Why is this important?

Currently, Assets pallet has transfer extrinsic to move the transferable sender’s assets to another account. As a part of this PR, a new extrinsic transfer_all has been added into the Assets pallet, which will transfer the entire balance from the sender’s assets account except the balance held, frozen, or minimum balance (when keep_alive is true).

How does this impact Polkadot builders?

This function is similar to transfer_all of the Balances pallet. If we want the sender asset account to keep alive, we can pass keep_alive as true.

Related Issue: #4517

[S] [Pools] Fix issues with member migration to DelegateStake

PR: https://github.com/paritytech/polkadot-sdk/pull/4822

Why is this important?

In the release 1.13.0, a new staking strategy DelegateStake was introduced, which allows delegators to delegate the funds to the pool account while the tokens stay locked in the delegator account itself. The pool can then delegate the stake to validators.

Currently, there are some issues when using DelegateStake. For example: pool members are not able to use their total balance while joining pool with DelegateStake. As a part of this PR, these issues have been fixed.

How does this impact Polkadot builders?

As a part of this PR, new runtime APIs have been introduced for reading pool and member balance in the Nomination-Pool pallet. This could be a breaking change if you are using the Nomination-Pool runtime APIs in your runtime.

To avoid this breaking change, please add the following code in your runtime:

impl pallet_nomination_pools_runtime_api::NominationPoolsApi<Block, AccountId, Balance> for Runtime {
 ....

               fn member_total_balance(member: AccountId) -> Balance {
			NominationPools::api_member_total_balance(member)
		}

		fn pool_balance(pool_id: pallet_nomination_pools::PoolId) -> Balance {
			NominationPools::api_pool_balance(pool_id)
		}

}

[S] [Pools] Ensure members can always exit the pool gracefully

PR: https://github.com/paritytech/polkadot-sdk/pull/4998

Why is this important?

This release has one more important change related to Nomination-Pool and DelegateStake.

Currently, when a member exits or is removed from the pool, they don’t receive all the funds. This PR fixes the issues.

How does this impact Polkadot builders?

After this PR, if a member exits from the pool, that member will be able to withdraw the maximum allowed amount of their locked funds. If the member is removed, any fund that is still delegated will be released and will be represented by released_balance in MemberRemoved event.

[S] Tx Payment: drop ED requirements for tx payments with exchangeable asset

PR: https://github.com/paritytech/polkadot-sdk/pull/4488

Why is this important?

Builders use Asset Conversion Transaction Payment Pallet to convert and pay transaction fees in any non-native token of the chain. At the moment, users have to meet the Existential Deposit (ED) requirement for the asset amount exchangeable for the fee asset during transaction payments. Due to this limitation, users are neither able to transfer their entire balance nor close their accounts.

As a part of this PR, this limitation has been removed. Now users don’t need to maintain a temporary balance account within the transaction payment.

How does this impact Polkadot builders?

This PR introduces breaking changes in Asset Conversion Transaction Payment Pallet. Configuration parameters of this pallet have been modified.
To avoid breaking changes, please apply the following changes in your runtime:

impl pallet_asset_conversion_tx_payment::Config for Runtime {
	....
	type AssetId = NativeOrWithId<u32>;
	type OnChargeAssetTransaction = SwapAssetAdapter<
		Native,
		NativeAndAssets,
		AssetConversion,
		ResolveAssetTo<TreasuryAccount, NativeAndAssets>,
	>;


    pub type NativeAndAssets =
	UnionOf<Balances, Assets, NativeFromLeft, NativeOrWithId<u32>, AccountId>;

For more details, please go through the code changes in the PR.

Low Impact

[S] Add initial version of pallet_revive

PR: Add initial version of `pallet_revive` by athei · Pull Request #5293 · paritytech/polkadot-sdk · GitHub

Why is this important?

As a part of this release, a new pallet Revive has been introduced, which is a modified version of the Contracts pallet. The purpose of this pallet is to run cross-compiled YUL contracts instead of wasmi to execute contracts.

How does this impact Polkadot builders?

This pallet is experimental and not recommended for production as it is a work in progress. As mentioned above, it is a heavily modified version of the Contracts pallet. There are many changes introduced, if we compare them with the Contracts pallet. You can find the list in the PR’s description. Since this pallet focuses on running PolkaVM contracts which were recompiled from YUL using the revive compiler, the code that was necessary to support Wasm execution has been removed.

[S] Coretime auto-renew

PR: https://github.com/paritytech/polkadot-sdk/pull/4424

Why is this important?

Agile Coretime replaces the parachain auction model with a more agile core acquisition method.

At the moment, coretime can be renewed manually. There is no way to make this process automatic. As a part of this PR, a functionality has been added to auto-renew coretime. The cost of renewal will be paid from the task’s sovereign account.

How does this impact Polkadot builders?

As a part of this PR, two new extrinsic have been added:

enable_auto_renew: Extrinsic for enabling auto-renewal.

disable_auto_renew: Extrinsic for disabling auto-renewal.

Apart from the above changes, there is a breaking change as well. Two new configuration types have been added in the Broker pallet.

pub struct SovereignAccountOf;
// Dummy implementation which converts `TaskId` to `AccountId`.
impl MaybeConvert<TaskId, AccountId> for SovereignAccountOf {
	fn maybe_convert(task: TaskId) -> Option<AccountId> {
		let mut account: [u8; 32] = [0; 32];
		account[..4].copy_from_slice(&task.to_le_bytes());
		Some(account.into())
	}
}
impl pallet_broker::Config for Runtime {
	// Other configs
	type SovereignAccountOf = SovereignAccountOf;
	type MaxAutoRenewals = ConstU32<10>;

}

Related Issue: #4351

[C,P,S] Add an adapter for configuring AssetExchanger

PR: https://github.com/paritytech/polkadot-sdk/pull/5130

Why is this important?

XCM-executor is a Cross-Consensus Virtual Machine (XCVM) implementation and is responsible for executing XCM messages. It has a config AssetExchanger, which is a handler for exchanging assets and implements the AssetExchange trait.

In this release, a new adapter SingleAssetExchangeAdapter has been added to XCM-Builder to use pallet-asset-conversion for configuring the AssetExchanger.

How does this impact Polkadot builders?

This new adapter is applicable only for exchanging single assets. If we try to exchange more than one asset, it will give an error.

This PR also introduces a new function quote_exchange_price for quoting the exchange price of two asset collections. If you are using the AssetExchange trait, this would be a breaking change. To avoid this breaking change, builders need to also implement this new function.

Here is a mock implementation, which is taken from xcm_builder>>mock.rs:

fn quote_exchange_price(give: &Assets, want: &Assets, maximal: bool) -> Option<Assets> {
		let mut have = EXCHANGE_ASSETS.with(|l| l.borrow().clone());
		if !have.contains_assets(want) {
			return None;
		}
		let get = if maximal {
			have.saturating_take(give.clone().into())
		} else {
			have.saturating_take(want.clone().into())
		};
		let result: Vec<Asset> = get.fungible_assets_iter().collect();
		Some(result.into())
	}

Related PRs: #5131, #4375

[C] Migrate foreign assets v3::Location to v4::Location

PR: https://github.com/paritytech/polkadot-sdk/pull/4129

Why is this important?

To handle foreign assets, we create an instance of the Assets pallet, which is called a Foreign Assets pallet. The assets, that are stored in this pallet, are identified by their XCM multilocation. At the moment, ForeignAssets in asset-hub-rococo and asset-hub-westend are using v3::Location instead of v4::Location.

As a part of this release, foreign assets have been migrated to use v4::Location.

How does this impact Polkadot builders?

After this PR, builders will be able to use v4::Location for foreign assets. There is no data migration required since the encoding of v3::Location and v4::Location are the same.

Related Issue: #4128

[C,P] Clear other messages before dry-run to get only the ones produced during

PR: https://github.com/paritytech/polkadot-sdk/pull/5581

Why is this important?

XCM’s DryRunApi is used for dry-running XCM-related extrinsic or for double-checking or testing. When given an extrinsic or an XCM program, it returns the outcome of its execution.

Currently, when we call DryRunApi, it returns all the messages in forwarded_xcms, which are in the queue. There is a possibility to get irrelevant non-XCM related messages. As a part of this PR, this issue has been fixed.

How does this impact Polkadot builders?

After this PR, when builders will call DryRunApi, all existing irrelevant/non-XCM messages will be removed from the queue and only relevant messages will be returned as a part of forwarded_xcms.

[S] Umbrella crate: exclude chain-specific crates

PR: Umbrella crate: exclude chain-specific crates by ggwpez · Pull Request #5173 · paritytech/polkadot-sdk · GitHub

Why is this important?

The Umbrella crate helps to reduce the size of Cargo.toml of Polkadot-based chains, since it re-exports all published crates of the Polkadot-SDK.

As a part of this PR, the following chain-specific crates have been excluded from Umbrella crate:

bp-asset-hub-rococo

bp-asset-hub-westend

bp-bridge-hub-cumulus

bp-bridge-hub-kusama

bp-bridge-hub-polkadot

bp-bridge-hub-rococo

bp-bridge-hub-westend

bp-kusama

bp-polkadot-bulletin

bp-rococo

bp-westend

rococo-runtime-constants

westend-runtime-constants

How does this impact Polkadot builders?

If you still want to use chain-specific umbrella crates, please visit Polkadot SDK Version Manager.

[C] Polkadot-Parachain: compile separate lib and bin

PR: https://github.com/paritytech/polkadot-sdk/pull/5288

Why is this important?

As a part of this PR, a new helper library polkadot-parachain-lib has been introduced that can be used to build a parachain node. This helper binary is also available under Umbrella crate.

How does this impact Polkadot builders?

Builders can use this helper binary to build a parachain node without embedded chainspecs.

Related Issue: #5210

[S] Balances Pallet: Emit events when TI is updated in currency impl

PR: https://github.com/paritytech/polkadot-sdk/pull/4936

Why is this important?

Presently, when TotalIssuance is updated in the Balances pallet, there is no event emitted. It’s hard to track whether ED is updated.

As a part of this PR, two new events Issued and Rescinded have been added, which will be triggered upon any update to the TotalIssuance.

Related Issue: #4028

[S] Add an utility function to get the first timestamp of a slot

PR: Add an utility function to get the first timestamp of a slot by LGLO · Pull Request #5316 · paritytech/polkadot-sdk · GitHub

Why is this important?

sp-consensus-slots provides primitives for slots-based consensus. As a part of this PR, a utility function timestamp has been added to provide the first timestamp of the given slot.

[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-Treasury

Pallet-Balances

Pallet-Proxy

Pallet-Election-Provider-Multi-Phase

Pallet-Identity

Related Issue: #3326

1 post - 1 participant