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 76 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
5,673 changes: 2,985 additions & 2,688 deletions Cargo.lock

Large diffs are not rendered by default.

502 changes: 241 additions & 261 deletions Cargo.toml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion ci/run-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ case $TARGET in
;;

lint-fmt)
cargo fmt -- --check
# We need the `+nightly` as long as the used toolchain is the stable version
# in order to allow using the formatter unstable options
cargo +nightly fmt -- --check
;;

lint-taplo)
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose-local-relay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: '3.4'
services:
node_alice:
container_name: alice
image: "parity/polkadot:v1.0.0"
image: "parity/polkadot:v1.7.2"
platform: "linux/x86_64"
ports:
- "30333:30333"
Expand All @@ -30,7 +30,7 @@ services:

node_bob:
container_name: bob
image: "parity/polkadot:v1.0.0"
image: "parity/polkadot:v1.7.2"
platform: "linux/x86_64"
ports:
- "30344:30333"
Expand Down
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
67 changes: 8 additions & 59 deletions libs/types/src/locations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,76 +14,25 @@ use cfg_primitives::AccountId;
use frame_support::RuntimeDebugNoBound;
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 sp_core::crypto::AccountId32;
use sp_std::boxed::Box;
use staging_xcm::VersionedLocation;

use crate::domain_address::DomainAddress;

/// Location types for destinations that can receive restricted transfers
#[derive(Clone, RuntimeDebugNoBound, Encode, Decode, Eq, PartialEq, MaxEncodedLen, TypeInfo)]
pub enum Location {
pub enum RestrictedTransferLocation {
/// Local chain account sending destination.
Local(AccountId),
/// XCM MultiLocation sending destinations.
/// Using hash value here as Multilocation is large -- v1 is 512 bytes, but
/// next largest is only 40 bytes other values aren't hashed as we have
/// blake2 hashing on storage map keys, and we don't want the extra overhead
XCM(H256),
/// XCM Location sending destinations.
Xcm(Box<VersionedLocation>),
/// DomainAddress sending location from a liquidity pools' instance
Address(DomainAddress),
}

impl From<AccountId32> for Location {
impl From<AccountId32> for RestrictedTransferLocation {
fn from(value: AccountId32) -> Self {
Self::Local(value)
}
}

impl From<VersionedMultiLocation> for Location {
fn from(vml: VersionedMultiLocation) -> 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()))
}
}

impl From<DomainAddress> for Location {
fn from(da: DomainAddress) -> Self {
Self::Address(da)
}
}

#[cfg(test)]
mod test {

use hex::FromHex;
use staging_xcm::v3::MultiLocation;

use super::*;

#[test]
fn from_xcm_versioned_address_works() {
let xa = VersionedMultiLocation::V3(MultiLocation::default());
let l = Location::from(xa.clone());
assert_eq!(
l,
Location::XCM(sp_core::H256(
<[u8; 32]>::from_hex(
"a943e30c855a123a9506e69e678dc65ae9f5b70149cb6b26eb2ed58a59b4bf77"
)
.unwrap()
))
);
}

#[test]
fn from_domain_address_works() {
let da = DomainAddress::EVM(
1284,
<[u8; 20]>::from_hex("1231231231231231231231231231231231231231").unwrap(),
);
let l = Location::from(da.clone());

assert_eq!(l, Location::Address(da))
}
}
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
4 changes: 3 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ jsonrpsee = { workspace = true, default-features = true }
log = { workspace = true, default-features = true }
parity-scale-codec = { default-features = true, workspace = true }
serde = { workspace = true, default-features = true }
serde_json = { workspace = true, default-features = true }
url = { workspace = true, default-features = true }

# client dependencies
pallet-transaction-payment-rpc = { workspace = true, default-features = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true, default-features = true }
sc-basic-authorship = { workspace = true, default-features = true }
sc-chain-spec = { workspace = true, default-features = true }
sc-cli = { workspace = true, default-features = true, features = ["rocksdb"] }
Expand Down Expand Up @@ -106,6 +108,7 @@ pallet-pool-system = { workspace = true, default-features = true }
runtime-common = { workspace = true, default-features = true }

# frontier
fc-api = { workspace = true, default-features = true }
fc-consensus = { workspace = true, default-features = true }
fc-db = { workspace = true, default-features = true, features = ["rocksdb"] }
fc-mapping-sync = { workspace = true, default-features = true }
Expand All @@ -121,7 +124,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
Loading
Loading