Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Upgrade to v0.9.40 #171

Merged
merged 20 commits into from
May 19, 2023
Merged

Upgrade to v0.9.40 #171

merged 20 commits into from
May 19, 2023

Conversation

valentinfernandez1
Copy link
Contributor

Upgrades from polkadot-v0.9.37 to polkadot-v0.9.40 introducing XCM V3 and Weights V2. The detailed description of changes can be found here.

Polkadot v0.9.38
Polkadot v0.9.39
Polkadot v0.9.40

The upgrade introduced a lot of changes so feel free to comment on anything that could be improved or revised before the merge.

Significant Changes and Future Improvements

Replaced AssetIdfor AssetIdForTrustBackedAssets .

Modified in version v0.9.38 AssetId changed name implying that the Id comes from a TrustBackedAsset which based on the fact that this are intended to be minted on statemine would make sense.

impl pallet_assets::Config for Runtime {
	...
	type AssetId = AssetIdForTrustBackedAssets;
	...
}

In case we wanted to add assets from an untrusted source we could take some inspiration from cumulus where there's 2 instances of pallet_assets (Trusted and ForeignAssets)

pub type TrustBackedAssetsInstance = pallet_assets::Instance1;
type TrustBackedAssetsCall = pallet_assets::Call<Runtime, TrustBackedAssetsInstance>;
impl pallet_assets::Config<TrustBackedAssetsInstance> for Runtime {
   ...
}
...
pub type ForeignAssetsInstance = pallet_assets::Instance2;
impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
	type AssetId = MultiLocationForAssetId;
	type AssetIdParameter = MultiLocationForAssetId;
	type CreateOrigin = ForeignCreators<
		(FromSiblingParachain<parachain_info::Pallet<Runtime>>,),
		ForeignCreatorsSovereignAccountOf,
		AccountId,
	>;
	type AssetDeposit = ForeignAssetsAssetDeposit;
	type MetadataDepositBase = ForeignAssetsMetadataDepositBase;
	type MetadataDepositPerByte = ForeignAssetsMetadataDepositPerByte;
	type ApprovalDeposit = ForeignAssetsApprovalDeposit;
	type StringLimit = ForeignAssetsAssetsStringLimit;
	type AssetAccountDeposit = ForeignAssetsAssetAccountDeposit;
	...
}

Modified use of Weights

As part of the update to Weights V2 that introduced a new 2D system the functions and parameters using 1 dimensional weight were updated to include the new proof_size value. Egg:

pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000,0);

Contracts Pallet

Updated to follow paritytech/cumulus#2108

Added new fields for XCMv3

Configure pallet_xcm and xcm_executor with the new fields added in the newest XCM version.

impl pallet_xcm::Config for Runtime {
	...
	type Currency = Balances;
	type CurrencyMatcher = ();
	type MaxLockers = ();
	type SovereignAccountOf = ();
	type TrustedLockers = ();
	type UniversalLocation = UniversalLocation;
	// TODO: pallet-xcm weights
	type WeightInfo = pallet_xcm::TestWeightInfo;
	#[cfg(feature = "runtime-benchmarks")]
	type ReachableDest = ReachableDest;
}

Note: WeightInfo should be updated with the proper weights after benchmarking on #141.

Updated Pallets

Pallet-dex was updated to match Trappist version and weights were benchmarked again to match new weights format. Chess Pallet was removed due to errors causing large WASM files that would conflict with Validators on the relay chain.

Refactor of Node Service
The library for cumulus_client_service was modified so the Node service had to be changed following Parachain template update to v0.9.40 PR

Closes #164

@valentinfernandez1 valentinfernandez1 requested review from kalaninja, stiiifff and hbulgarini and removed request for stiiifff May 10, 2023 18:17
@valentinfernandez1
Copy link
Contributor Author

I suggest opening a separate issue to address the WeightToFee implementation. This will prevent this PR from becoming too bloated. By separating them, we can focus on each issue independently, making it easier for reviewers to understand and provide feedback.

That way we can discuss and collaborate specifically on the WeightToFee implementation there.

@valentinfernandez1 valentinfernandez1 changed the base branch from main to xcmv3-dev May 11, 2023 12:37
Copy link
Contributor

@kalaninja kalaninja left a comment

Choose a reason for hiding this comment

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

I checked the changes made for parachain-template while migrating. LGTM. The only thing that caught my eye was that they added a hardware check. Might be worth having it too.

node/service/src/lib.rs Show resolved Hide resolved
node/service/src/lib.rs Show resolved Hide resolved
@valentinfernandez1
Copy link
Contributor Author

I checked the changes made for parachain-template while migrating. LGTM. The only thing that caught my eye was that they added a hardware check. Might be worth having it too.

Good catch, I missed that!

@stiiifff stiiifff mentioned this pull request May 16, 2023
18 tasks
Copy link
Contributor

@hbulgarini hbulgarini left a comment

Choose a reason for hiding this comment

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

Besides my comments i would like to add some items needed for migration that were not in the list and explain the reason why:

LocalFungiblesTransactor: Replace Nothing for xcm_builder::NoChecking.
CheckAccount: Add the MintLocation.
Adding GlobalConsensus for UniversalLocation type.

pallets/asset-registry/src/weights.rs Show resolved Hide resolved
pallets/asset-registry/src/lib.rs Show resolved Hide resolved
runtime/stout/src/lib.rs Show resolved Hide resolved
runtime/stout/src/lib.rs Outdated Show resolved Hide resolved
runtime/trappist/src/lib.rs Outdated Show resolved Hide resolved
runtime/trappist/src/xcm_config.rs Outdated Show resolved Hide resolved
runtime/trappist/src/xcm_config.rs Outdated Show resolved Hide resolved
runtime/trappist/src/xcm_config.rs Show resolved Hide resolved
runtime/trappist/src/xcm_config.rs Outdated Show resolved Hide resolved
node/service/Cargo.toml Outdated Show resolved Hide resolved
(cherry picked from commit d826938)
@stiiifff
Copy link
Contributor

FYI I cherry-picked @kalaninja CI fixes so we get CI checks on this PR and on the xcmv3-dev branch.

@valentinfernandez1
Copy link
Contributor Author

Had to the CI because currently it runs out of memory and fails. I'm working on a fix for this but I will add it alongside #175 .

Copy link
Contributor

@hbulgarini hbulgarini left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for addressing the feedback valentin.

@stiiifff
Copy link
Contributor

FYI I ran the CI tasks locally just to be sure. All is green ✅️
LGTM

@stiiifff stiiifff merged commit 6cd2ee6 into xcmv3-dev May 19, 2023
0 of 3 checks passed
@stiiifff stiiifff deleted the vf-v9.40 branch May 19, 2023 09:01
@stiiifff stiiifff mentioned this pull request May 19, 2023
10 tasks
hbulgarini added a commit that referenced this pull request Jul 31, 2023
* Upgrade to v0.9.40 (#171)

* Upgraded to 9-40 missing some fixes

* Added XCM v3 Traits (Need to configure)

* Added fee per MB

* Added XCM V3 Configs

* Fix XCM_config and node service

* Removed chess pallet

* pallet_contracts and pallet_xcm fix

* rust fmt

* Quick fix to contracts on stout and pallet-dex dependancie

* Added hardware check to service

* Fixed stout service

* Review fixes

* run tests on CI (#174)
(cherry picked from commit d826938)

* fmt

* review fix

* review fix

* fmt

* Fixed xcm-playground error

---------

Co-authored-by: Valentin Fernandez <valentin@parity.io>
Co-authored-by: Alexander Kalankhodzhaev <kalansoft@gmail.com>

* Backport Drop Assets (#189)

Backport PR #165 (cherry picked from commit 3f1c483) in Trappist v0.9.40 and updates it to match the changes included in polkadot v0.9.38 to v0.9.40. Weights were re benchmarked to match weightsV2.
---------

Co-authored-by: Valentin Fernandez <valentin@parity.io>

* asset-registry backport (#193)

Backport PR #173 (cherry picked from commit 24552f3) in Trappist v0.9.40 and updates it to match the changes included in polkadot v0.9.38 to v0.9.40. Weights were re benchmarked to match weightsV2.

Co-authored-by: Valentin Fernandez <valentin@parity.io>

* fix CI for substrate version update (#198)

* Backport Zombienet and CI testing (#194)

* zombienet refactor and ci fix

* swap-storage removed from CI

* ci fix

* CI fix

---------

Co-authored-by: Valentin Fernandez <valentin@parity.io>

* Backport Lockdown-pallet  (#191)

* lockdown-pallet backport

* Add lockdown mode activation to lockdown-mode pallet's `GenesisConfig` (#176)

* add activating lockdown mode to GenesisConfig

* add activating lockdown mode to test ext

* add tests for activating lockdown mode in GenesisConfig

* cargo fmt -p pallet-lockdown-mode

* fix linting

* add activated to benchmark

* removing, as this is already in another test

* setting initial state to true, therefore no longer need to manually change state

* rename activated in genesisConfig to initial_status

---------

Co-authored-by: Valentin Fernandez <valentin@parity.io>
Co-authored-by: Bruno Galvao <brunopgalvao@gmail.com>

* [Backport] #185  XCM benchmarks from `pallet_xcm_benchmarks` to v0.9.40 (#201)

* backport xcm_benchmarks

* Co-Authored-By: hbulgarini <hbulgarini@gmail.com>

* fix

* add profile "production" (#187)

---------

Co-authored-by: Alexander Kalankhodzhaev <kalansoft@gmail.com>

* [Backport] #206 Trappist node and #207 workspace refactor to v0.9.40 (#209)

* cherry-picked changes

* WIP fixing node service¨

* Upgrade fixes, missing stout trait bound error

* workspace refactor

* added dex to stout

* fmt

---------

Co-authored-by: Hector Bulgarini <hbulgarini@gmail.com>

* Query account balances using `accounts_common` (#202)

* query_account_balances added

* fmt

* Added assets-common dependency from Cumulus

---------

Co-authored-by: Steve Degosserie <steve@parity.io>

* [Backport] #220 Apache License and #223 Minor Refactoring (#228)

* backport apache license

* backport minor refactoring PR #223

* fmt

* Refactor `WeightToFee` to include ProofSize (#215)

* Removed FixedRateOfFungibles

* fmt

* added comments

* fmt

* removed unused imports

* fmt

* removed allow unpaid execution from rockmine following PR #211

* Include new traders from PR #221

* minor fixes

* minor fixes

* fmt

* [Backport] Asset-registry fix,  Bump Docker and add preimage to benchmarks (#229)

* Validate `MultiLocation` for asset-registry  (#224)

* Validate location for register_reserve_asset

* fmt

* fmt

* fmt

* validator refactor

* fmt

* fix `pallet_xcm_benchmarks::generic::claim_asset` benchmark (#226)

* Bump docker/login-action from 2.1.0 to 2.2.0 (#219)

Bumps [docker/login-action](https://github.com/docker/login-action) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@f4ef78c...465a078)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump docker/metadata-action from 4.4.0 to 4.5.0 (#218)

Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Commits](docker/metadata-action@c4ee3ad...2c0bd77)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix network id in tests

* fix network id in tests

* Add missing import

* include preimage to benchmarks

* Bump docker/metadata-action from 4.5.0 to 4.6.0 (#233)

Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Commits](docker/metadata-action@2c0bd77...818d4b7)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump docker/build-push-action from 4.0.0 to 4.1.1 (#232)

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4.0.0 to 4.1.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](docker/build-push-action@3b5e802...2eb1c19)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Alexander Kalankhodzhaev <kalansoft@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* WIP

* WeightToFee updated to use FeePolynomial. Based on the implementation in the asset-hub

* finish upgrade

* update deps

* Addressing check account

* Fix

* fmt

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: valentinfernandez1 <33705477+valentinfernandez1@users.noreply.github.com>
Co-authored-by: Valentin Fernandez <valentin@parity.io>
Co-authored-by: Alexander Kalankhodzhaev <kalansoft@gmail.com>
Co-authored-by: Bruno Galvao <brunopgalvao@gmail.com>
Co-authored-by: Steve Degosserie <steve@parity.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Valentin Fernandez <tinchofernandez8@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to v0.9.40
4 participants