Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to polkadot v1.11.0 #889

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Conversation

Roznovjak
Copy link
Contributor

@Roznovjak Roznovjak commented Aug 7, 2024

NOTES:
All changes can be found here:

Breaking changes:

Notable changes

  • System Callbacks: The system pallet gets five new config items - all of which can be safely set to () as default.

    • SingleBlockMigrations: replaces the Executive now for configuring migrations.
    • MultiBlockMigrator: the pallet-migrations would be set here, if deployed.
    • PreInherents: a hook that runs before any inherent.
    • PostInherents: a hook to run between inherents and poll/MBM logic.
    • PostTransactions: a hook to run after all transactions but before on_idle.
  • Add the ability for MessageQueue to process enqueued messages on idle

  • Rate limiting for RPC server which can be utilized by the CLI --rpc-rate-limit

  • Adds pallet-parameters that allows to have parameters for pallet configs that dynamically change at runtime

  • pallet-migrations is introduced that can be configured in the System of a runtime to act as multi-block migrator.

  • Add claim_assets extrinsic to pallet-xcm

  • The construct_runtime macro now generates a test to assert that all GenesisConfigs of all pallets can be build within the runtime.

  • XCM fee payment API: A runtime API was added for estimating the fees required for XCM execution and delivery.

    • fn query_acceptable_payment_assets(xcm_version: Version) -> Result<Vec, Error>;
    • fn query_xcm_weight(message: VersionedXcm) -> Result<Weight, Error>;
    • fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, Error>;
    • fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result<VersionedAssets, Error>;
  • pallet-xcm's extrinsics teleport_assets and reserve_transfer_assets have been marked as deprecated. Please change their usage to the limited_teleport_assets and limited_reserve_transfer_assets, respectively; or use the generic/flexible transfer_assets extrinsic.

  • pallet-xcm's extrinsics execute and send have been marked as deprecated. Please change their usage to the new execute_blob and send_blob. There's a new utility in PolkadotJS Apps for encoding XCMs you can use: https://polkadot.js.org/apps/#/utilities/xcm

  • Migrations: prevent accidentally using inner unversioned migration instead of VersionedMigration

  • Adds optional HRMP notification handlers to the xcm-executor. These handlers are 3 new config types on the xcm-executor Config trait:

    • HrmpNewChannelOpenRequestHandler
    • HrmpChannelAcceptedHandler
    • HrmpChannelClosingHandler
  • The runtime now can provide a number of predefined presets of RuntimeGenesisConfig struct. This presets are intended to be used in different deployments, e.g.: local, staging, etc, and should be included into the corresponding chain-specs.
Having GenesisConfig presets in runtime allows to fully decouple node from runtime types (the problem is described in #1984).

    • The GenesisBuilder API was adjusted to enable this functionality,
    • (Breaking change) Old create_default_config method was removed, build_config was renamed to build_state. As a consequence a node won't be able to interact with genesis config for older runtimes. The cleanup was made for sake of API simplicity.
  • New call hrmp.establish_channel_with_system to allow parachains to establish a channel with a system parachain

  • (Breaking change) For all authority nodes, the node binary now enforces the presence of a network key, instead of auto-generating when it is absent.

  • pallet-xcm has a new extrinsic transfer_assets_using_type_and_then for transferring assets from local chain to destination chain using an explicit XCM transfer types for transferring the assets and the fees:

    • TransferType::LocalReserve: transfer assets to sovereign account of destination
chain and forward a notification XCM to dest to mint and deposit reserve-based
assets to beneficiary.
    • TransferType::DestinationReserve: burn local assets and forward a notification to
dest chain to withdraw the reserve assets from this chain's sovereign account and
deposit them to beneficiary.
    • TransferType::RemoteReserve(reserve): burn local assets, forward XCM to reserve
chain to move reserves from this chain's SA to dest chain's SA, and forward another
XCM to dest to mint and deposit reserve-based assets to beneficiary. Typically
the remote reserve is Asset Hub.
    • TransferType::Teleport: burn local assets and forward XCM to dest chain to
mint/teleport assets and deposit them to beneficiary.
By default, an asset's reserve is its origin chain. But sometimes we may want to explicitly use another chain as reserve (as long as allowed by runtime IsReserve filter).
This is very helpful for transferring assets with multiple configured reserves (such as Asset Hub ForeignAssets), when the transfer strictly depends on the used reserve location.
      E.g. For transferring a bridged Foreign Assets between local parachains, Asset Hub or the parachain that bridged the asset over must be used as the reserve location. Same when transferring bridged assets back across the bridge, the local bridging parachain must be used as the explicit reserve location.
      The new method takes a custom_xcm_on_dest parameter allowing the caller to specify what should happen to the transferred assets once they reach the dest chain. The custom_xcm_on_dest parameter should contains the instructions to execute on dest as a final step. Usually as simple as:
 Xcm(vec![DepositAsset { assets: Wild(AllCounted(assets.len())), beneficiary }]),
 but could be something more exotic like sending the assets even further.
  • Remove XCM SafeCallFilter for chains using Weights::v3

    • SafeCallFilter was removed from Rococo and Westend relay and system chains as they all now use Weights::v3 which already accounts for call PoV size.
This effectively removes artificial limitations on what users can XCM::Transact on these chains (blockspace limitations are still upheld).

@Roznovjak Roznovjak self-assigned this Aug 7, 2024
@dmoka dmoka mentioned this pull request Sep 6, 2024
1 task
Copy link

github-actions bot commented Sep 9, 2024

Crate versions that have been updated:

  • runtime-integration-tests: v1.23.4 -> v1.23.5
  • hydra-dx-math: v8.1.2 -> v8.1.3
  • hydradx: v13.1.2 -> v14.0.0
  • pallet-asset-registry: v3.2.4 -> v3.2.5
  • pallet-bonds: v2.2.3 -> v2.2.4
  • pallet-circuit-breaker: v1.1.25 -> v1.1.26
  • pallet-claims: v3.4.9 -> v3.4.10
  • pallet-collator-rewards: v1.0.8 -> v1.0.9
  • pallet-currencies: v2.1.1 -> v2.1.2
  • pallet-dca: v1.5.1 -> v1.5.2
  • pallet-democracy: v4.3.0 -> v4.3.1
  • pallet-duster: v3.2.5 -> v3.2.6
  • pallet-dynamic-evm-fee: v1.0.2 -> v1.0.3
  • pallet-dynamic-fees: v1.0.4 -> v1.0.5
  • pallet-ema-oracle: v1.3.2 -> v1.3.3
  • pallet-evm-accounts: v1.1.2 -> v1.1.3
  • pallet-evm-accounts-rpc-runtime-api: v1.0.0 -> v1.0.1
  • pallet-genesis-history: v2.1.2 -> v2.1.3
  • pallet-lbp: v4.8.4 -> v4.8.5
  • pallet-liquidity-mining: v4.4.0 -> v4.4.1
  • pallet-nft: v7.1.4 -> v7.1.5
  • pallet-omnipool: v4.3.3 -> v4.3.4
  • pallet-omnipool-liquidity-mining: v2.2.0 -> v2.2.1
  • pallet-otc: v2.0.1 -> v2.0.2
  • pallet-otc-settlements: v1.0.3 -> v1.0.4
  • pallet-referrals: v1.2.5 -> v1.2.6
  • pallet-relaychain-info: v0.3.4 -> v0.3.5
  • pallet-route-executor: v2.6.0 -> v2.6.1
  • pallet-stableswap: v3.6.4 -> v3.6.5
  • pallet-staking: v3.1.1 -> v3.1.2
  • pallet-transaction-multi-payment: v10.0.4 -> v10.0.5
  • pallet-transaction-pause: v1.0.3 -> v1.0.4
  • pallet-xyk: v6.4.5 -> v6.4.6
  • pallet-xyk-liquidity-mining: v1.1.12 -> v1.1.13
  • pallet-evm-precompile-call-permit: v0.1.1 -> v0.1.2
  • precompile-utils: v0.1.1 -> v0.1.2
  • primitives: v6.0.3 -> v6.0.4
  • runtime-mock: v1.0.0 -> v1.0.1
  • hydradx-adapters: v1.3.5 -> v1.3.6
  • hydradx-runtime: v257.0.0 -> v258.0.0
  • module-evm-utility: v2.21.0 -> v2.21.1
  • scraper: v1.2.4 -> v1.2.5
  • hydradx-traits: v3.6.0 -> v3.6.1
  • hydra-dx-build-script-utils: v1.0.3 -> v1.0.4
  • test-utils: v1.1.1 -> v1.1.2

Runtime version has been increased.

@Roznovjak Roznovjak marked this pull request as ready for review September 11, 2024 12:12
@green-jay
Copy link
Contributor

@Roznovjak xcm pallet can be removed from call filter?

@Roznovjak
Copy link
Contributor Author

@Roznovjak xcm pallet can be removed from call filter?

#909

@@ -330,7 +330,7 @@ fn transfer_and_swap_should_work_with_4_hops() {

assert_eq!(
hydradx_runtime::Currencies::free_balance(IBTC, &AccountId::from(BOB)),
549839246387064
549813213291742
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems we still have some leftover tests that break when weight changes. Instead of exact balance checks, we could just check if the balance is bigger than 0, given the assumption that the balance was zero beforehand.

Also for other tests that needed to be adjusted in this file

#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(clippy::unnecessary_cast)]
#![allow(missing_docs)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason that we started having these missing docs warnings for our weight files? Things seem to be documented with doc comments

if Whitelist::contains(account) {
return Err(sp_runtime::DispatchError::Other("Account is already in the whitelist"));
}
// TODO: verify that the following check can be removed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo

}
}

impl xcm_fee_payment_runtime_api::XcmPaymentApi<Block> for Runtime {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some integration tests for this XcmPaymentApi to document how it works?

I don't think we need something complex like this, but some simple one for usage would be handy.

// Standard Error: 2_626
.saturating_add(Weight::from_parts(3_897_612, 0).saturating_mul(c.into()))
// Minimum execution time: 6_583_000 picoseconds.
Weight::from_parts(499_280, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a significant change from 7_618_449, like 15x less, do we know why?

jsonrpsee = { version = "0.15.1", features = ["server", "macros"] }
serde = { version = "1.0.136", features = ["derive"] }
codec = { workspace = true }
jsonrpsee = { version = "0.23.2", features = ["server", "macros"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is used both in scraper and in node projects, we could do the same as with others

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants