From b1c86f6e6cc6ea3fbf3345f4d077582d00a2b144 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Rios Date: Thu, 16 Jan 2025 16:36:17 +0100 Subject: [PATCH] bugfixes (#438) ## What? - Fix lingering bugs in compilation, and tests - Fmt - Clippy --- integration-tests/src/constants.rs | 4 ++-- integration-tests/src/tests/ct_migration.rs | 4 ++-- integration-tests/src/tests/otm_edge_cases.rs | 2 +- nodes/parachain/src/chain_spec/common.rs | 5 +--- .../funding/src/functions/1_application.rs | 18 ++++---------- pallets/funding/src/functions/2_evaluation.rs | 5 +--- .../funding/src/functions/7_ct_migration.rs | 23 ++++++++---------- pallets/funding/src/functions/misc.rs | 1 - pallets/funding/src/lib.rs | 22 +++++++++++------ pallets/funding/src/runtime_api.rs | 1 - pallets/oracle-ocw/src/lib.rs | 4 ++-- pallets/oracle-ocw/src/mock.rs | 19 ++++++++++----- .../custom_migrations/asset_id_migration.rs | 24 +++++++++---------- runtimes/polimec/src/lib.rs | 11 ++++++--- 14 files changed, 72 insertions(+), 71 deletions(-) diff --git a/integration-tests/src/constants.rs b/integration-tests/src/constants.rs index 7c73efcec..dd4f8d821 100644 --- a/integration-tests/src/constants.rs +++ b/integration-tests/src/constants.rs @@ -89,7 +89,7 @@ impl PricesBuilder { Self { dot: None, usdc: None, usdt: None, plmc: None, weth: None } } - pub fn default() -> Prices { + pub fn default_prices() -> Prices { Prices { dot: FixedU128::from_rational(69, 1), usdc: FixedU128::from_rational(1, 1), @@ -198,6 +198,7 @@ pub mod collators { pub mod validators { use super::*; + #[allow(clippy::type_complexity)] pub fn initial_authorities() -> Vec<( AccountId, AccountId, @@ -484,7 +485,6 @@ pub mod polimec { (dave_account.clone(), 0), (eve_account.clone(), 0), ], - ..Default::default() }, democracy: Default::default(), parachain_system: Default::default(), diff --git a/integration-tests/src/tests/ct_migration.rs b/integration-tests/src/tests/ct_migration.rs index 95d1e66c4..47acb4ac3 100644 --- a/integration-tests/src/tests/ct_migration.rs +++ b/integration-tests/src/tests/ct_migration.rs @@ -190,7 +190,7 @@ fn create_settled_project() -> (ProjectId, Vec) { #[test] fn full_pallet_migration_test() { - polimec::set_prices(PricesBuilder::default()); + polimec::set_prices(PricesBuilder::default_prices()); let (project_id, participants) = create_settled_project(); let _project_status = PolimecNet::execute_with(|| pallet_funding::ProjectsDetails::::get(project_id).unwrap().status); @@ -296,7 +296,7 @@ fn create_project_with_unsettled_participation(participation_type: Participation #[test] fn cannot_start_pallet_migration_with_unsettled_participations() { - polimec::set_prices(PricesBuilder::default()); + polimec::set_prices(PricesBuilder::default_prices()); let tup_1 = create_project_with_unsettled_participation(ParticipationType::Evaluation); let tup_2 = create_project_with_unsettled_participation(ParticipationType::Bid); diff --git a/integration-tests/src/tests/otm_edge_cases.rs b/integration-tests/src/tests/otm_edge_cases.rs index b02769463..bc07c13dc 100644 --- a/integration-tests/src/tests/otm_edge_cases.rs +++ b/integration-tests/src/tests/otm_edge_cases.rs @@ -121,7 +121,7 @@ fn after_otm_fee_user_goes_under_ed_reverts() { let issuer: PolimecAccountId = ISSUER.into(); let bobert: PolimecAccountId = BOBERT.into(); - polimec::set_prices(PricesBuilder::default()); + polimec::set_prices(PricesBuilder::default_prices()); PolimecNet::execute_with(|| { let project_metadata = default_project_metadata(issuer.clone()); diff --git a/nodes/parachain/src/chain_spec/common.rs b/nodes/parachain/src/chain_spec/common.rs index 6c436386e..599b7eef2 100644 --- a/nodes/parachain/src/chain_spec/common.rs +++ b/nodes/parachain/src/chain_spec/common.rs @@ -13,10 +13,7 @@ use polimec_runtime::{ AccountId, AuraId as AuthorityId, Balance, BlockchainOperationTreasury, ContributionTreasuryAccount, ExistentialDeposit, FeeRecipient, OracleProvidersMembershipConfig, Runtime, TreasuryAccount, PLMC, }; -use sp_core::{ - crypto::{Ss58AddressFormat, UncheckedInto}, - sr25519, -}; +use sp_core::{crypto::UncheckedInto, sr25519}; use sp_runtime::{traits::AccountIdConversion, Perbill, Percent}; pub type ChainSpec = sc_service::GenericChainSpec; diff --git a/pallets/funding/src/functions/1_application.rs b/pallets/funding/src/functions/1_application.rs index e7397c5b7..ae9d17a99 100644 --- a/pallets/funding/src/functions/1_application.rs +++ b/pallets/funding/src/functions/1_application.rs @@ -1,7 +1,6 @@ #![allow(clippy::wildcard_imports)] #![allow(clippy::type_complexity)] -use sp_runtime::offchain::http::Method::Post; use super::*; impl Pallet { @@ -92,10 +91,7 @@ impl Pallet { // * Emit events * Self::deposit_event(Event::ProjectCreated { project_id, issuer: issuer.clone(), metadata: project_metadata }); - Ok(PostDispatchInfo{ - actual_weight: None, - pays_fee: Pays::No, - }) + Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) } #[transactional] @@ -123,10 +119,8 @@ impl Pallet { // * Emit events * Self::deposit_event(Event::MetadataEdited { project_id, metadata: new_project_metadata }); - Ok(PostDispatchInfo{ - actual_weight: None, - pays_fee: Pays::No, - }) } + Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) + } #[transactional] pub fn do_remove_project(issuer: AccountIdOf, project_id: ProjectId, did: Did) -> DispatchResultWithPostInfo { @@ -146,8 +140,6 @@ impl Pallet { // * Emit events * Self::deposit_event(Event::ProjectRemoved { project_id, issuer }); - Ok(PostDispatchInfo{ - actual_weight: None, - pays_fee: Pays::No, - }) } + Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) + } } diff --git a/pallets/funding/src/functions/2_evaluation.rs b/pallets/funding/src/functions/2_evaluation.rs index ba04e0879..a859dc519 100644 --- a/pallets/funding/src/functions/2_evaluation.rs +++ b/pallets/funding/src/functions/2_evaluation.rs @@ -26,10 +26,7 @@ impl Pallet { false, )?; - Ok(PostDispatchInfo{ - actual_weight: None, - pays_fee: Pays::No, - }) + Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) } #[transactional] diff --git a/pallets/funding/src/functions/7_ct_migration.rs b/pallets/funding/src/functions/7_ct_migration.rs index 17f7d3f62..e5bac6ec8 100644 --- a/pallets/funding/src/functions/7_ct_migration.rs +++ b/pallets/funding/src/functions/7_ct_migration.rs @@ -21,10 +21,8 @@ impl Pallet { false, )?; - Ok(PostDispatchInfo{ - actual_weight: None, - pays_fee: Pays::No, - }) } + Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) + } #[transactional] pub fn do_confirm_offchain_migration( @@ -85,10 +83,8 @@ impl Pallet { false, )?; - Ok(PostDispatchInfo{ - actual_weight: None, - pays_fee: Pays::No, - }) } + Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) + } /// Handle the channel open request from the relay on behalf of a parachain. /// If the parachain id belongs to a funded project with the same project id, then send an acceptance message and a request for a @@ -210,7 +206,10 @@ impl Pallet { /// After the bidirectional HRMP channels are established, check that the project chain has the Polimec receiver pallet, /// and has minted the amount of CTs sold to the Polimec sovereign account. #[transactional] - pub fn do_start_pallet_migration_readiness_check(caller: &AccountIdOf, project_id: ProjectId) -> DispatchResultWithPostInfo { + pub fn do_start_pallet_migration_readiness_check( + caller: &AccountIdOf, + project_id: ProjectId, + ) -> DispatchResultWithPostInfo { // * Get variables * let mut project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let Some(MigrationType::Pallet(ref mut migration_info)) = project_details.migration_type else { @@ -302,10 +301,8 @@ impl Pallet { // * Emit events * Self::deposit_event(Event::::MigrationReadinessCheckStarted { project_id, caller: caller.clone() }); - Ok(PostDispatchInfo{ - actual_weight: None, - pays_fee: Pays::No, - }) } + Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) + } /// Handle the migration readiness check response from the project chain. #[transactional] diff --git a/pallets/funding/src/functions/misc.rs b/pallets/funding/src/functions/misc.rs index a440538fc..8e477d897 100644 --- a/pallets/funding/src/functions/misc.rs +++ b/pallets/funding/src/functions/misc.rs @@ -456,7 +456,6 @@ impl Pallet { frame_system::Pallet::::account_nonce(polimec_account), ); - let ecdsa_signature = EcdsaSignature::from_slice(&signature_bytes).unwrap(); let public_compressed: EcdsaPublic = ecdsa_signature.recover_prehashed(&hashed_message).unwrap(); let public_uncompressed = k256::ecdsa::VerifyingKey::from_sec1_bytes(&public_compressed).unwrap(); diff --git a/pallets/funding/src/lib.rs b/pallets/funding/src/lib.rs index aa0b82d64..8fe01544e 100644 --- a/pallets/funding/src/lib.rs +++ b/pallets/funding/src/lib.rs @@ -706,7 +706,7 @@ pub mod pallet { origin: OriginFor, jwt: UntrustedToken, project: ProjectMetadataOf, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { let (account, did, investor_type, _cid) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; ensure!(investor_type == InvestorType::Institutional, Error::::WrongInvestorType); @@ -715,7 +715,11 @@ pub mod pallet { #[pallet::call_index(1)] #[pallet::weight(WeightInfoOf::::remove_project())] - pub fn remove_project(origin: OriginFor, jwt: UntrustedToken, project_id: ProjectId) -> DispatchResult { + pub fn remove_project( + origin: OriginFor, + jwt: UntrustedToken, + project_id: ProjectId, + ) -> DispatchResultWithPostInfo { let (account, did, investor_type, _cid) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; ensure!(investor_type == InvestorType::Institutional, Error::::WrongInvestorType); @@ -730,7 +734,7 @@ pub mod pallet { jwt: UntrustedToken, project_id: ProjectId, new_project_metadata: ProjectMetadataOf, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { let (account, _did, investor_type, _cid) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; ensure!(investor_type == InvestorType::Institutional, Error::::WrongInvestorType); @@ -740,7 +744,11 @@ pub mod pallet { /// Starts the evaluation round of a project. It needs to be called by the project issuer. #[pallet::call_index(3)] #[pallet::weight(WeightInfoOf::::start_evaluation())] - pub fn start_evaluation(origin: OriginFor, jwt: UntrustedToken, project_id: ProjectId) -> DispatchResult { + pub fn start_evaluation( + origin: OriginFor, + jwt: UntrustedToken, + project_id: ProjectId, + ) -> DispatchResultWithPostInfo { let (account, _did, investor_type, _cid) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; ensure!(investor_type == InvestorType::Institutional, Error::::WrongInvestorType); @@ -1024,7 +1032,7 @@ pub mod pallet { origin: OriginFor, jwt: UntrustedToken, project_id: ProjectId, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { let (account, _did, investor_type, _cid) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; ensure!(investor_type == InvestorType::Institutional, Error::::WrongInvestorType); @@ -1051,7 +1059,7 @@ pub mod pallet { jwt: UntrustedToken, project_id: ProjectId, para_id: ParaId, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { let (account, _did, investor_type, _cid) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; ensure!(investor_type == InvestorType::Institutional, Error::::WrongInvestorType); @@ -1065,7 +1073,7 @@ pub mod pallet { origin: OriginFor, jwt: UntrustedToken, project_id: ProjectId, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { let (account, _did, investor_type, _cid) = T::InvestorOrigin::ensure_origin(origin, &jwt, T::VerifierPublicKey::get())?; ensure!(investor_type == InvestorType::Institutional, Error::::WrongInvestorType); diff --git a/pallets/funding/src/runtime_api.rs b/pallets/funding/src/runtime_api.rs index 1c7a12433..3412c7649 100644 --- a/pallets/funding/src/runtime_api.rs +++ b/pallets/funding/src/runtime_api.rs @@ -1,4 +1,3 @@ -use crate::traits::BondingRequirementCalculation; #[allow(clippy::wildcard_imports)] use crate::{traits::BondingRequirementCalculation, *}; use alloc::{collections::BTreeMap, string::String}; diff --git a/pallets/oracle-ocw/src/lib.rs b/pallets/oracle-ocw/src/lib.rs index bbf784d6f..b563c6b56 100644 --- a/pallets/oracle-ocw/src/lib.rs +++ b/pallets/oracle-ocw/src/lib.rs @@ -189,7 +189,7 @@ pub mod pallet { None } }) - .collect::>(); + .collect::>(); if assets.is_empty() { log::trace!(target: LOG_TARGET, "Assets to fetch list is empty :c"); @@ -221,8 +221,8 @@ pub mod pallet { impl Pallet { fn fetch_prices(assets: Vec) -> BTreeMap { let fetchers = vec![ - KrakenFetcher::get_moving_average, BitFinexFetcher::get_moving_average, + KrakenFetcher::get_moving_average, BitStampFetcher::get_moving_average, CoinbaseFetcher::get_moving_average, XTFetcher::get_moving_average, diff --git a/pallets/oracle-ocw/src/mock.rs b/pallets/oracle-ocw/src/mock.rs index bc8e41cfd..9d8f5a88e 100644 --- a/pallets/oracle-ocw/src/mock.rs +++ b/pallets/oracle-ocw/src/mock.rs @@ -185,25 +185,26 @@ pub fn new_test_ext_with_offchain_storage( // Store the expected responses in the order we expect, to later assert as part of the request processing. pub fn price_oracle_response(state: &mut testing::OffchainState) { - for (asset, response) in KRAKEN_RESPONSES.iter() { + for (asset, response) in BITFINEX_RESPONSES.iter() { state.expect_request(testing::PendingRequest { method: "GET".into(), - uri: format!("https://api.kraken.com/0/public/OHLC?pair={}&interval=1", asset), + uri: format!("https://api-pub.bitfinex.com/v2/candles/trade%3A1m%3At{}/hist?limit=15", asset), response: Some(response.to_vec()), sent: true, ..Default::default() }); } - for (asset, response) in BITFINEX_RESPONSES.iter() { + for (asset, response) in KRAKEN_RESPONSES.iter() { state.expect_request(testing::PendingRequest { method: "GET".into(), - uri: format!("https://api-pub.bitfinex.com/v2/candles/trade%3A1m%3At{}/hist?limit=15", asset), + uri: format!("https://api.kraken.com/0/public/OHLC?pair={}&interval=1", asset), response: Some(response.to_vec()), sent: true, ..Default::default() }); } + for (asset, response) in BITSTAMP_RESPONSES.iter() { state.expect_request(testing::PendingRequest { method: "GET".into(), @@ -222,6 +223,7 @@ pub fn price_oracle_response(state: &mut testing::OffchainState) { ..Default::default() }); } + state.expect_request(testing::PendingRequest { method: "GET".into(), uri: "https://sapi.xt.com/v4/public/kline?symbol=plmc_usdt&interval=30m&limit=10".into(), @@ -229,6 +231,7 @@ pub fn price_oracle_response(state: &mut testing::OffchainState) { sent: true, ..Default::default() }); + state.expect_request(testing::PendingRequest { method: "GET".into(), uri: "https://api.mexc.com/api/v3/klines?symbol=PLMCUSDT&interval=30m&limit=10".into(), @@ -265,8 +268,12 @@ pub fn assert_close_enough(a: FixedU128, b: FixedU128) { } } -pub(crate) const KRAKEN_RESPONSES: &[(&str, &[u8])] = - &[("USDTZUSD", KRAKEN_USDT_CORRECT), ("USDCUSD", KRAKEN_USDC_CORRECT), ("DOTUSD", KRAKEN_DOT_CORRECT)]; +pub(crate) const KRAKEN_RESPONSES: &[(&str, &[u8])] = &[ + ("USDTZUSD", KRAKEN_USDT_CORRECT), + ("USDCUSD", KRAKEN_USDC_CORRECT), + ("DOTUSD", KRAKEN_DOT_CORRECT), + ("XETHZUSD", KRAKEN_WETH_CORRECT) +]; const KRAKEN_USDT_CORRECT: &[u8] = br#"{"error":[],"result":{"USDTZUSD":[[1701877920,"1.00009","1.00011","1.00008","1.00009","1.00010","58759.32214931",36],[1701877980,"1.00009","1.00011","1.00009","1.00010","1.00010","17156.51835679",18],[1701878040,"1.00011","1.00011","1.00010","1.00010","1.00010","231514.66903930",13],[1701878100,"1.00010","1.00015","1.00010","1.00014","1.00012","10577.17236868",27],[1701878160,"1.00015","1.00020","1.00015","1.00019","1.00017","1026827.06857105",67],[1701878220,"1.00019","1.00019","1.00018","1.00019","1.00018","44228.73461655",28],[1701878280,"1.00018","1.00018","1.00015","1.00015","1.00016","41144.63245059",23],[1701878340,"1.00014","1.00015","1.00013","1.00013","1.00013","252283.11050904",67],[1701878400,"1.00014","1.00014","1.00012","1.00014","1.00012","34519.85524461",23],[1701878460,"1.00013","1.00013","1.00008","1.00009","1.00010","49702.48469208",40],[1701878520,"1.00009","1.00016","1.00009","1.00016","1.00012","83532.48937609",43],[1701878580,"1.00016","1.00018","1.00015","1.00018","1.00017","340329.29664927",27],[1701878640,"1.00018","1.00018","1.00015","1.00015","1.00016","125875.61559451",33],[1701878700,"1.00015","1.00015","1.00010","1.00011","1.00012","63925.70403795",32],[1701878760,"1.00010","1.00010","1.00008","1.00008","1.00009","53316.20999461",26]],"last":1699977300}}"#; const KRAKEN_USDC_CORRECT: &[u8] = br#"{"error":[],"result":{"USDCUSD":[[1701878040,"1.0001","1.0001","1.0000","1.0000","1.0000","2210.00000000",2],[1701878100,"1.0002","1.0002","1.0002","1.0002","1.0002","999.00000000",1],[1701878160,"1.0001","1.0002","1.0001","1.0002","1.0001","7201.85053234",9],[1701878220,"1.0001","1.0001","1.0001","1.0001","1.0001","15.71930681",1],[1701878280,"1.0000","1.0001","1.0000","1.0001","1.0000","102108.24129487",5],[1701878340,"1.0001","1.0001","1.0001","1.0001","0.0000","0.00000000",0],[1701878400,"1.0001","1.0001","1.0001","1.0001","1.0001","1451.37880000",1],[1701878460,"1.0001","1.0001","1.0000","1.0000","1.0000","11005.00000000",2],[1701878520,"1.0001","1.0001","1.0000","1.0000","1.0000","6760.93865300",3],[1701878580,"1.0000","1.0000","1.0000","1.0000","0.0000","0.00000000",0],[1701878640,"1.0000","1.0001","1.0000","1.0001","1.0000","1290.84392400",4],[1701878700,"1.0000","1.0001","1.0000","1.0001","1.0000","53.03306930",2],[1701878760,"1.0000","1.0000","1.0000","1.0000","1.0000","16711.33870874",7],[1701878820,"1.0000","1.0000","1.0000","1.0000","1.0000","10007.53328427",2],[1701878880,"0.9999","0.9999","0.9999","0.9999","0.9999","1000.00000000",1]],"last":1699977300}}"#; const KRAKEN_DOT_CORRECT: &[u8] = br#"{"error":[],"result":{"DOTUSD":[[1701878100,"6.1473","6.1474","6.1473","6.1474","6.1473","102.00000000",2],[1701878160,"6.1446","6.1446","6.1378","6.1409","6.1399","56.11963595",4],[1701878220,"6.1251","6.1473","6.1233","6.1473","6.1268","992.18112927",12],[1701878280,"6.1468","6.1500","6.1383","6.1383","6.1463","365.21179340",29],[1701878340,"6.1401","6.1401","6.1378","6.1378","6.1393","57.06050109",5],[1701878400,"6.1298","6.1380","6.1279","6.1380","6.1361","968.44275786",8],[1701878460,"6.1403","6.1407","6.1390","6.1390","6.1400","507.81565634",8],[1701878520,"6.1391","6.1500","6.1385","6.1500","6.1422","344.07407967",5],[1701878580,"6.1499","6.1573","6.1473","6.1573","6.1491","3563.21894841",32],[1701878640,"6.1594","6.1602","6.1552","6.1552","6.1591","1461.51440086",22],[1701878700,"6.1612","6.1622","6.1544","6.1544","6.1598","447.90016651",9],[1701878760,"6.1452","6.1452","6.1407","6.1407","6.1421","225.30037904",6],[1701878820,"6.1192","6.1192","6.1044","6.1044","6.1145","154.45052403",8],[1701878880,"6.1111","6.1126","6.1082","6.1124","6.1116","186.62943447",4],[1701878940,"6.1126","6.1199","6.1124","6.1197","6.1160","145.34596966",7]],"last":1699977300}}"#; diff --git a/runtimes/polimec/src/custom_migrations/asset_id_migration.rs b/runtimes/polimec/src/custom_migrations/asset_id_migration.rs index 9dab0c9c6..650c5f7d8 100644 --- a/runtimes/polimec/src/custom_migrations/asset_id_migration.rs +++ b/runtimes/polimec/src/custom_migrations/asset_id_migration.rs @@ -1,15 +1,13 @@ -use crate::{AccountId, Funding, Oracle, Runtime}; -use alloc::{collections::BTreeMap, vec::Vec}; +use crate::{AccountId, Funding, Runtime}; +use alloc::collections::BTreeMap; use frame_support::{ - migrations::VersionedPostUpgradeData, - pallet_prelude::{NMapKey, StorageDoubleMap, StorageMap, StorageNMap, StorageValue, ValueQuery}, + pallet_prelude::{NMapKey, ValueQuery}, storage_alias, traits::{GetStorageVersion, OnRuntimeUpgrade}, Blake2_128Concat, }; use itertools::Itertools; use pallet_assets::{Approval, AssetAccount, AssetDetails, AssetMetadata}; -use parity_scale_codec::Encode; use polimec_common::assets::AcceptedFundingAsset; use sp_api::runtime_decl_for_core::CoreV5; use sp_runtime::BoundedVec; @@ -87,20 +85,18 @@ pub mod orml_oracle_storage_items { use super::*; pub mod old_types { + use super::*; use frame_support::Twox64Concat; use orml_oracle::TimestampedValue; use shared_configuration::Price; - use super::*; type TimeStampedValueOf = TimestampedValue; #[storage_alias] - pub type RawValues = - StorageDoubleMap; + pub type RawValues = StorageDoubleMap; #[storage_alias] - pub type Values = - StorageMap; + pub type Values = StorageMap; } } @@ -131,7 +127,7 @@ impl OnRuntimeUpgrade for FromOldAssetIdMigration { (1984, AcceptedFundingAsset::USDT.id()), (1337, AcceptedFundingAsset::USDC.id()), (10, AcceptedFundingAsset::DOT.id()), - (3344, Location::here()) + (3344, Location::here()), ]); let old_account_iterator = pallet_assets_storage_items::old_types::Account::iter().collect_vec(); @@ -177,7 +173,11 @@ impl OnRuntimeUpgrade for FromOldAssetIdMigration { for (account, old_asset_id, raw_values) in old_oracle_raw_values_iterator { items += 1; log::info!("old_oracle_raw_values item {:?}", items); - orml_oracle::RawValues::::insert(account.clone(), id_map.get(&old_asset_id).unwrap(), raw_values); + orml_oracle::RawValues::::insert( + account.clone(), + id_map.get(&old_asset_id).unwrap(), + raw_values, + ); orml_oracle_storage_items::old_types::RawValues::remove(account, old_asset_id); } diff --git a/runtimes/polimec/src/lib.rs b/runtimes/polimec/src/lib.rs index 2291f28d1..f0cbc0edb 100644 --- a/runtimes/polimec/src/lib.rs +++ b/runtimes/polimec/src/lib.rs @@ -73,7 +73,7 @@ use sp_std::{cmp::Ordering, prelude::*}; use sp_version::RuntimeVersion; // XCM Imports -use xcm::{v3::MultiLocation, VersionedAssets, VersionedLocation, VersionedXcm}; +use xcm::{VersionedAssets, VersionedLocation, VersionedXcm}; use xcm_config::{PriceForSiblingParachainDelivery, XcmOriginToTransactDispatchOrigin}; use xcm_fee_payment_runtime_api::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, @@ -98,7 +98,12 @@ use alloc::string::String; use sp_core::crypto::Ss58Codec; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; -use xcm::{v4::Location, VersionedAssetId}; +use xcm::{ + v4::{Location}, + VersionedAssetId, +}; +#[cfg(feature = "runtime-benchmarks")] +use xcm::{{v4::{ParentThen, Parent, Junction::Parachain}}}; #[cfg(feature = "runtime-benchmarks")] mod benchmark_helpers; @@ -443,7 +448,7 @@ pub struct PalletAssetsBenchmarkHelper; #[cfg(feature = "runtime-benchmarks")] impl pallet_assets::BenchmarkHelper for PalletAssetsBenchmarkHelper { fn create_asset_id_parameter(id: u32) -> Location { - (Parent, Parachain(id)).into() + Location::from(ParentThen([Parachain(id)].into())) } } impl pallet_assets::Config for Runtime {