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

Upgrade to Polkadot-v1.7.2 #1833

Merged
merged 78 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
d6e0bf4
set dependency versions
lemunozm May 9, 2024
07bb334
upgrade libs/*
lemunozm May 10, 2024
446439a
upgrade pallet-anchors
lemunozm May 10, 2024
52d1b85
upgrade pallet-fees
lemunozm May 10, 2024
7183815
upgrade pallet-bridge
lemunozm May 13, 2024
3374bac
migrate simple pallets
lemunozm May 13, 2024
b161119
migrate pallet-order-book
lemunozm May 13, 2024
9fc71f5
migrated collator-allowlist & swaps
lemunozm May 13, 2024
f302388
upgrade rewards
lemunozm May 13, 2024
a38bfb6
upgraded pallet-mux
lemunozm May 13, 2024
5ccb3d0
upgrade transfer-allowlist
lemunozm May 13, 2024
056d942
Merge remote-tracking branch 'origin/main' into polkadot-v1.7.2
lemunozm May 13, 2024
5940897
fix hold reason in restricted tokens
lemunozm May 13, 2024
7d3335f
simplify set_balance removing the holding part
lemunozm May 13, 2024
3c2bb34
upgrade restricted-xtokens
lemunozm May 13, 2024
da56ef2
upgrade some pallets
lemunozm May 13, 2024
8ad0451
upgrade pallet-ethereum-transaction
lemunozm May 13, 2024
8461f41
upgrade pallet-loans
lemunozm May 13, 2024
873507d
upgrade pool-system
lemunozm May 14, 2024
3ae8b03
upgrade pool-fees
lemunozm May 14, 2024
4a2b98b
upgrade pool-registry
lemunozm May 14, 2024
3f94ea2
upgrade liquidity-pools stuffs
lemunozm May 14, 2024
45ca1c4
avoid duplicated polkadot-sdk repos
lemunozm May 16, 2024
45b3f11
minor fixes
lemunozm May 16, 2024
a783c9f
upgraded runtime-common
lemunozm May 17, 2024
1f70efe
CfgLocation to RestrictedTransferLocation
lemunozm May 17, 2024
f713417
restricted tokens with NativeIndex for native fungibles
lemunozm May 20, 2024
9f12a65
rename dependency
lemunozm May 20, 2024
f84ac93
upgraded development-runtime
lemunozm May 21, 2024
769afc5
fix partially benchmarks
lemunozm May 21, 2024
5f5f7b6
fix benchmarks
lemunozm May 22, 2024
aaceaf9
overpass xcmp-queue integrity tests
lemunozm May 22, 2024
1a23394
minor coments
lemunozm May 22, 2024
3a0e1cd
upgrade altair & centrifuge
lemunozm May 23, 2024
a259be5
remove some benchmarking pallets that are not needed
lemunozm May 23, 2024
c9729ef
fix runtime upgrades
lemunozm May 23, 2024
65b32a1
upgrade integration-test proc
lemunozm May 24, 2024
ed5b888
upgrade integration-tests framework
lemunozm May 27, 2024
493a602
upgraded all tests except liquidity pools
lemunozm May 27, 2024
55d28ee
99% upgraded liquidity-pools tests
lemunozm May 27, 2024
f172b1d
fix lookup
lemunozm May 28, 2024
b886c46
Merge remote-tracking branch 'origin/main' into polkadot-v1.7.2
lemunozm May 28, 2024
9c27823
cargo fmt
lemunozm May 28, 2024
55bfab5
taplo fmt
lemunozm May 28, 2024
75ae4a4
using nightly cargo in CI
lemunozm May 28, 2024
38377a9
restore set_balance as it was
lemunozm May 28, 2024
8071ffe
allow nightly support in CI
lemunozm May 28, 2024
338a573
use restricted_tokens again to fetch from investement portfolio
lemunozm May 28, 2024
8c92688
Install rust-src for docs
lemunozm May 28, 2024
625f9d2
fix tests
lemunozm May 28, 2024
1bd859b
remove unused restricted tokens
lemunozm May 28, 2024
a304d7f
fix block rewards
lemunozm May 28, 2024
99b4abc
fix WrongWitness for some tests in IT
lemunozm May 29, 2024
17a180c
fix liquidity-pools
lemunozm May 29, 2024
aa40ed0
minor fixes
lemunozm May 29, 2024
7b1b7e2
fix clippy
lemunozm May 30, 2024
a5dbd56
remove unneeded tests
lemunozm May 30, 2024
bc17d18
feat: Update client to Polkadot v1.7.2 (#1844)
wischli May 30, 2024
a95459b
cargo fmt
lemunozm May 30, 2024
3e44ef9
fix clippy
lemunozm May 30, 2024
f83d95f
feat: Polkadot v1.7.2 migrations (#1849)
wischli May 31, 2024
fb52bc4
last William iteration review
lemunozm Jun 3, 2024
988fcbb
increase passed blocks
lemunozm Jun 5, 2024
8410d16
use rococo instead of polkadot-test-runtime
lemunozm Jun 5, 2024
db844a5
fix tests
lemunozm Jun 5, 2024
beb13f0
remove line
lemunozm Jun 5, 2024
7e69e68
dirty fix to fix Hrmp test issue
lemunozm Jun 6, 2024
1c96ae1
use default weights for treasury
lemunozm Jun 6, 2024
7edbc3a
remove getrandom unused dep
lemunozm Jun 6, 2024
e1bad5f
upgrade to last polkadot-sdk version
lemunozm Jun 6, 2024
43f7c48
Polkadot-1.7.2: restricted transfer location changes (#1853)
lemunozm Jun 6, 2024
43fbab5
Merge remote-tracking branch 'origin/main' into polkadot-v1.7.2
lemunozm Jun 6, 2024
dde6ca4
fix: collator selection v2 storage migration (#1862)
wischli Jun 6, 2024
519e998
using latest fudge version
lemunozm Jun 6, 2024
5baab79
protect againts crash in RtAPI
lemunozm Jun 7, 2024
b5a7d89
add dmp-queue to the lazy migration, use better weights
lemunozm Jun 7, 2024
e7f9c27
fix clippy
lemunozm Jun 7, 2024
d2072ce
Merge remote-tracking branch 'origin/main' into polkadot-v1.7.2
lemunozm Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16,616 changes: 2,708 additions & 13,908 deletions Cargo.lock

Large diffs are not rendered by default.

501 changes: 238 additions & 263 deletions Cargo.toml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion libs/mocks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ std = [
"sp-runtime/std",
"orml-traits/std",
"staging-xcm/std",
"mock-builder/std",
]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
Expand Down
18 changes: 9 additions & 9 deletions libs/mocks/src/asset_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod pallet {
use mock_builder::{execute_call, register_call};
use orml_traits::asset_registry::{AssetMetadata, Inspect, Mutate};
use sp_std::fmt::Debug;
use staging_xcm::{v3::prelude::MultiLocation, VersionedMultiLocation};
use staging_xcm::{v4::Location, VersionedLocation};
lemunozm marked this conversation as resolved.
Show resolved Hide resolved

#[pallet::config]
pub trait Config: frame_system::Config {
Expand All @@ -21,7 +21,7 @@ pub mod pallet {
type CallIds<T: Config> = StorageMap<_, _, String, mock_builder::CallId>;

impl<T: Config> Pallet<T> {
pub fn mock_asset_id(f: impl Fn(&MultiLocation) -> Option<T::AssetId> + 'static) {
pub fn mock_asset_id(f: impl Fn(&Location) -> Option<T::AssetId> + 'static) {
register_call!(f);
}

Expand All @@ -36,15 +36,15 @@ pub mod pallet {

pub fn mock_metadata_by_location(
f: impl Fn(
&MultiLocation,
&Location,
) -> Option<AssetMetadata<T::Balance, T::CustomMetadata, T::StringLimit>>
+ 'static,
) {
register_call!(f);
}

pub fn mock_location(
f: impl Fn(&T::AssetId) -> Result<Option<MultiLocation>, DispatchError> + 'static,
f: impl Fn(&T::AssetId) -> Result<Option<Location>, DispatchError> + 'static,
) {
register_call!(f);
}
Expand All @@ -66,7 +66,7 @@ pub mod pallet {
Option<BoundedVec<u8, T::StringLimit>>,
Option<BoundedVec<u8, T::StringLimit>>,
Option<T::Balance>,
Option<Option<VersionedMultiLocation>>,
Option<Option<VersionedLocation>>,
Option<T::CustomMetadata>,
) -> DispatchResult
+ 'static,
Expand All @@ -81,7 +81,7 @@ pub mod pallet {
type CustomMetadata = T::CustomMetadata;
type StringLimit = T::StringLimit;

fn asset_id(a: &MultiLocation) -> Option<Self::AssetId> {
fn asset_id(a: &Location) -> Option<Self::AssetId> {
execute_call!(a)
}

Expand All @@ -92,12 +92,12 @@ pub mod pallet {
}

fn metadata_by_location(
a: &MultiLocation,
a: &Location,
) -> Option<AssetMetadata<Self::Balance, Self::CustomMetadata, Self::StringLimit>> {
execute_call!(a)
}

fn location(a: &Self::AssetId) -> Result<Option<MultiLocation>, DispatchError> {
fn location(a: &Self::AssetId) -> Result<Option<Location>, DispatchError> {
execute_call!(a)
}
}
Expand All @@ -116,7 +116,7 @@ pub mod pallet {
c: Option<BoundedVec<u8, Self::StringLimit>>,
d: Option<BoundedVec<u8, Self::StringLimit>>,
e: Option<Self::Balance>,
g: Option<Option<VersionedMultiLocation>>,
g: Option<Option<VersionedLocation>>,
h: Option<Self::CustomMetadata>,
) -> DispatchResult {
execute_call!((a, b, c, d, e, g, h))
Expand Down
33 changes: 5 additions & 28 deletions libs/mocks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ macro_rules! make_runtime_for_mock {
($runtime_name:ident, $mock_name:ident, $pallet:ident, $externalities:ident) => {
use $crate::reexport::{
frame_support,
frame_support::traits::{ConstU16, ConstU32, ConstU64, Everything},
frame_support::derive_impl,
frame_system,
sp_core::H256,
sp_io,
sp_runtime::traits::{BlakeTwo256, IdentityLookup},
};

frame_support::construct_runtime!(
Expand All @@ -71,31 +69,10 @@ macro_rules! make_runtime_for_mock {
}
);

impl frame_system::Config for Runtime {
type AccountData = ();
type AccountId = u64;
type BaseCallFilter = Everything;
type Block = frame_system::mocking::MockBlock<Runtime>;
type BlockHashCount = ConstU64<250>;
type BlockLength = ();
type BlockWeights = ();
type DbWeight = ();
type Hash = H256;
type Hashing = BlakeTwo256;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type Nonce = u64;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
type PalletInfo = PalletInfo;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type SS58Prefix = ConstU16<42>;
type SystemWeightInfo = ();
type Version = ();
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type Block = frame_system::mocking::MockBlock<Runtime>;
}

pub fn $externalities() -> sp_io::TestExternalities {
sp_io::TestExternalities::default()
Expand Down
27 changes: 12 additions & 15 deletions libs/test-utils/src/mocks/orml_asset_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

pub mod reexport {
pub use staging_xcm::{
v3::prelude::MultiLocation as __private_MultiLocation,
VersionedMultiLocation as __private_VersionedMultiLocation,
v4::prelude::Location as __private_Location,
VersionedLocation as __private_VersionedLocation,
};
}

Expand All @@ -36,7 +36,7 @@ macro_rules! impl_mock_registry {
};
use sp_runtime::{BoundedVec, BuildStorage};
use $crate::mocks::orml_asset_registry::reexport::{
__private_MultiLocation, __private_VersionedMultiLocation,
__private_Location, __private_VersionedLocation,
};

use super::*;
Expand All @@ -49,7 +49,7 @@ macro_rules! impl_mock_registry {
type CustomMetadata = $custom_metadata;
type StringLimit = $string_limit;

fn asset_id(location: &__private_MultiLocation) -> Option<Self::AssetId> {
fn asset_id(location: &__private_Location) -> Option<Self::AssetId> {
__private::STATE.with(|s| s.borrow().get_asset_from_location(location))
}

Expand All @@ -62,7 +62,7 @@ macro_rules! impl_mock_registry {
}

fn metadata_by_location(
location: &__private_MultiLocation,
location: &__private_Location,
) -> Option<
__private_AssetMetadata<Self::Balance, Self::CustomMetadata, Self::StringLimit>,
> {
Expand All @@ -71,7 +71,7 @@ macro_rules! impl_mock_registry {

fn location(
asset_id: &Self::AssetId,
) -> Result<Option<__private_MultiLocation>, __private_DispatchError> {
) -> Result<Option<__private_Location>, __private_DispatchError> {
let maybe_location =
__private::STATE.with(|s| s.borrow().get_location(asset_id));

Expand Down Expand Up @@ -103,7 +103,7 @@ macro_rules! impl_mock_registry {
name: Option<BoundedVec<u8, Self::StringLimit>>,
symbol: Option<BoundedVec<u8, Self::StringLimit>>,
existential_deposit: Option<Self::Balance>,
location: Option<Option<__private_VersionedMultiLocation>>,
location: Option<Option<__private_VersionedLocation>>,
additional: Option<Self::CustomMetadata>,
) -> __private_DispatchResult {
__private::STATE.with(|s| {
Expand Down Expand Up @@ -192,7 +192,7 @@ macro_rules! impl_mock_registry {
use super::*;

pub struct RegistryState {
pub location_to_asset: Vec<(__private_MultiLocation, $asset_id)>,
pub location_to_asset: Vec<(__private_Location, $asset_id)>,
pub metadata: Vec<(
$asset_id,
__private_AssetMetadata<$balance, $custom_metadata, $string_limit>,
Expand Down Expand Up @@ -230,10 +230,7 @@ macro_rules! impl_mock_registry {
Ok(())
}

pub fn get_location(
&self,
asset_id: &$asset_id,
) -> Option<__private_MultiLocation> {
pub fn get_location(&self, asset_id: &$asset_id) -> Option<__private_Location> {
for (curr_id, meta) in &self.metadata {
if curr_id == asset_id {
return meta
Expand All @@ -249,7 +246,7 @@ macro_rules! impl_mock_registry {

pub fn get_asset_from_location(
&self,
location: &__private_MultiLocation,
location: &__private_Location,
) -> Option<$asset_id> {
for (curr_location, asset_id) in &self.location_to_asset {
if curr_location == location {
Expand All @@ -262,7 +259,7 @@ macro_rules! impl_mock_registry {

pub fn get_meta_from_location(
&self,
location: &__private_MultiLocation,
location: &__private_Location,
) -> Option<__private_AssetMetadata<$balance, $custom_metadata, $string_limit>>
{
let asset_id = self.get_asset_from_location(location)?;
Expand All @@ -276,7 +273,7 @@ macro_rules! impl_mock_registry {
name: Option<BoundedVec<u8, $string_limit>>,
symbol: Option<BoundedVec<u8, $string_limit>>,
existential_deposit: Option<$balance>,
location: Option<Option<__private_VersionedMultiLocation>>,
location: Option<Option<__private_VersionedLocation>>,
additional: Option<$custom_metadata>,
) -> __private_DispatchResult {
for (curr_id, curr_meta) in &mut self.metadata {
Expand Down
9 changes: 5 additions & 4 deletions libs/types/src/locations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_core::{crypto::AccountId32, H256};
use sp_runtime::traits::{BlakeTwo256, Hash};
use staging_xcm::VersionedMultiLocation;
use staging_xcm::VersionedLocation;

use crate::domain_address::DomainAddress;
/// Location types for destinations that can receive restricted transfers
Expand All @@ -39,8 +39,8 @@ impl From<AccountId32> for Location {
}
}

impl From<VersionedMultiLocation> for Location {
fn from(vml: VersionedMultiLocation) -> Self {
impl From<VersionedLocation> for Location {
fn from(vml: VersionedLocation) -> Self {
// using hash here as multilocation is significantly larger than any other enum
// type here -- 592 bytes, vs 40 bytes for domain address (next largest)
Self::XCM(BlakeTwo256::hash(&vml.encode()))
Expand All @@ -63,7 +63,8 @@ mod test {

#[test]
fn from_xcm_versioned_address_works() {
let xa = VersionedMultiLocation::V3(MultiLocation::default());
// TODO-1.7: Must be changed to V4?
lemunozm marked this conversation as resolved.
Show resolved Hide resolved
let xa = VersionedLocation::V3(MultiLocation::default());
let l = Location::from(xa.clone());
assert_eq!(
l,
Expand Down
2 changes: 1 addition & 1 deletion libs/types/src/portfolio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sp_std::{cmp::Ordering, marker::PhantomData, vec::Vec};
/// The total NAV is based on the reserve, the assets under management (AUM) and
/// pool fees:
///
/// ```ignore
/// ```text
/// NAV = PoolReserve + AUM - PoolFees
/// ```
///
Expand Down
1 change: 0 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ pallet-evm = { workspace = true, default-features = true }

[build-dependencies]
substrate-build-script-utils = { workspace = true, default-features = true }
vergen = { workspace = true, default-features = true }

[features]
default = []
Expand Down
14 changes: 1 addition & 13 deletions pallets/anchors/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,11 @@ frame_support::construct_runtime!(
impl frame_system::Config for Runtime {
type AccountData = pallet_balances::AccountData<Balance>;
type Block = frame_system::mocking::MockBlock<Runtime>;
type RuntimeEvent = ();
}

#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig as pallet_balances::DefaultConfig)]
impl pallet_balances::Config for Runtime {
type AccountStore = System;
type Balance = Balance;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ConstU32<1>;
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = ();
type RuntimeEvent = ();
type RuntimeHoldReason = ();
type WeightInfo = ();
}

impl pallet_timestamp::Config for Runtime {
Expand Down
1 change: 0 additions & 1 deletion pallets/block-rewards/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use frame_support::{
};
use frame_system::RawOrigin;
use sp_runtime::traits::Zero;
use sp_std::vec; // required for #[benchmarks]

use super::*;
use crate::{pallet::Config, Pallet as BlockRewards};
Expand Down
21 changes: 4 additions & 17 deletions pallets/block-rewards/src/migrations.rs
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need this migraiton at all?

Copy link
Contributor

Choose a reason for hiding this comment

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

See above

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use parity_scale_codec::{Decode, Encode};
use sp_runtime::FixedPointNumber;
#[cfg(feature = "try-runtime")]
use sp_runtime::TryRuntimeError;
use sp_std::{marker::PhantomData, vec::Vec};
use sp_std::marker::PhantomData;

use crate::{pallet, Config, Pallet, SessionData};

Expand All @@ -31,7 +31,7 @@ fn inflation_rate<T: Config>(percent: u32) -> T::Rate {
pub mod init {
use cfg_traits::rewards::{AccountRewards, CurrencyGroupChange, GroupRewards};
use num_traits::Zero;
use sp_runtime::{BoundedVec, SaturatedConversion};
use sp_runtime::SaturatedConversion;

use super::*;

Expand All @@ -40,19 +40,6 @@ pub mod init {
PhantomData<(T, CollatorReward, AnnualTreasuryInflationPercent)>,
);

fn get_collators<T: pallet_collator_selection::Config>() -> Vec<T::AccountId> {
lemunozm marked this conversation as resolved.
Show resolved Hide resolved
let candidates = BoundedVec::<
T::AccountId,
<T as pallet_collator_selection::Config>::MaxCandidates,
>::truncate_from(
pallet_collator_selection::Pallet::<T>::candidates()
.into_iter()
.map(|c| c.who)
.collect(),
);
pallet_collator_selection::Pallet::<T>::assemble_collators(candidates)
}

impl<T, CollatorReward, AnnualTreasuryInflationPercent> OnRuntimeUpgrade
for InitBlockRewards<T, CollatorReward, AnnualTreasuryInflationPercent>
where
Expand All @@ -63,7 +50,7 @@ pub mod init {
{
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
let collators = get_collators::<T>();
let collators = pallet_collator_selection::Pallet::<T>::assemble_collators();
assert!(!collators.is_empty());

assert!(!CollatorReward::get().is_zero());
Expand All @@ -85,7 +72,7 @@ pub mod init {
pallet::ActiveSessionData::<T>::get() != Default::default();

log::info!("{LOG_PREFIX} Getting list of collators");
let collators = get_collators::<T>();
let collators = pallet_collator_selection::Pallet::<T>::assemble_collators();

let collators_are_staked = collators.clone().into_iter().all(|c| {
log::info!("{LOG_PREFIX} Checking stake of collator {c:?}");
Expand Down
Loading
Loading