From 7db0e1ad462dc3861ab1f1e119be8121d4682e0a Mon Sep 17 00:00:00 2001 From: lemunozm Date: Mon, 25 Mar 2024 17:30:35 +0100 Subject: [PATCH 1/6] main changes --- Cargo.toml | 1 + runtime/integration-tests/Cargo.toml | 1 + runtime/integration-tests/src/generic/mod.rs | 5 ++--- runtime/integration-tests/src/lib.rs | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 128f5708df..31d132bb48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -120,6 +120,7 @@ polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" } polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" } polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" } +polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" } polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" } polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" } diff --git a/runtime/integration-tests/Cargo.toml b/runtime/integration-tests/Cargo.toml index 98ba5a6985..8168aaf253 100644 --- a/runtime/integration-tests/Cargo.toml +++ b/runtime/integration-tests/Cargo.toml @@ -52,6 +52,7 @@ cumulus-test-relay-sproof-builder = { workspace = true, features = ["std"] } staging-kusama-runtime = { workspace = true, features = ["std"] } polkadot-core-primitives = { workspace = true, features = ["std"] } +polkadot-node-primitives = { workspace = true } polkadot-parachain-primitives = { workspace = true, features = ["std"] } polkadot-primitives = { workspace = true, features = ["std"] } polkadot-runtime = { workspace = true, features = ["std"] } diff --git a/runtime/integration-tests/src/generic/mod.rs b/runtime/integration-tests/src/generic/mod.rs index c8582732dc..fb0fe1c517 100644 --- a/runtime/integration-tests/src/generic/mod.rs +++ b/runtime/integration-tests/src/generic/mod.rs @@ -13,7 +13,7 @@ mod impls; pub mod utils; // Test cases -/*mod cases { +mod cases { mod account_derivation; mod example; mod investments; @@ -22,8 +22,7 @@ pub mod utils; mod oracles; mod proxy; mod restricted_transfers; - mod rewards; -}*/ +} /// Generate tests for the specified runtimes or all runtimes. /// Usage diff --git a/runtime/integration-tests/src/lib.rs b/runtime/integration-tests/src/lib.rs index e9527af906..a4d349415f 100644 --- a/runtime/integration-tests/src/lib.rs +++ b/runtime/integration-tests/src/lib.rs @@ -14,9 +14,9 @@ #![cfg(test)] #![allow(unused)] -//mod evm; +mod evm; mod generic; -//mod rewards; +mod rewards; mod utils; /// Re-exports the correct runtimes that we run the integration tests with From 4d4969f1aec145bce9592a2b6a982ddbce42c56e Mon Sep 17 00:00:00 2001 From: cdamian <17934949+cdamian@users.noreply.github.com> Date: Wed, 27 Mar 2024 12:10:15 +0200 Subject: [PATCH 2/6] integration-tests: Fix test envs --- .../integration-tests/src/evm/precompile.rs | 12 +++- .../src/generic/cases/account_derivation.rs | 13 +++- .../src/generic/cases/investments.rs | 10 +-- .../src/generic/cases/liquidity_pools.rs | 67 ++++++++++++------- .../src/generic/cases/proxy.rs | 2 +- .../src/generic/envs/fudge_env/handle.rs | 30 ++++----- .../integration-tests/src/generic/impls.rs | 4 +- .../src/generic/utils/democracy.rs | 4 +- .../integration-tests/src/utils/accounts.rs | 2 - runtime/integration-tests/src/utils/env.rs | 14 ++-- .../integration-tests/src/utils/genesis.rs | 8 ++- runtime/integration-tests/src/utils/mod.rs | 7 -- rust-toolchain.toml | 2 +- 13 files changed, 101 insertions(+), 74 deletions(-) diff --git a/runtime/integration-tests/src/evm/precompile.rs b/runtime/integration-tests/src/evm/precompile.rs index 26335f8c58..6390d474fd 100644 --- a/runtime/integration-tests/src/evm/precompile.rs +++ b/runtime/integration-tests/src/evm/precompile.rs @@ -22,7 +22,7 @@ use cfg_types::{ }; use ethabi::{Contract, Function, Param, ParamType, Token}; use ethereum::{LegacyTransaction, TransactionAction, TransactionSignature, TransactionV2}; -use frame_support::{assert_err, assert_ok, dispatch::RawOrigin}; +use frame_support::{assert_err, assert_ok, dispatch::RawOrigin, BoundedVec}; use fudge::primitives::Chain; use hex::ToHex; use orml_traits::{asset_registry::AssetMetadata, MultiCurrency}; @@ -91,8 +91,14 @@ async fn axelar_precompile_execute() { let currency_metadata = AssetMetadata { decimals: 18, - name: "Test".into(), - symbol: "TST".into(), + name: BoundedVec::::StringLimit>::try_from( + "Test".as_bytes().to_vec(), + ) + .expect("Can create BoundedVec for token name"), + symbol: BoundedVec::::StringLimit>::try_from( + "TST".as_bytes().to_vec(), + ) + .expect("Can create BoundedVec for token symbol"), existential_deposit: ED, location: Some(VersionedMultiLocation::V3(MultiLocation::here())), additional: CustomMetadata { diff --git a/runtime/integration-tests/src/generic/cases/account_derivation.rs b/runtime/integration-tests/src/generic/cases/account_derivation.rs index 378c13f209..80dec7f78a 100644 --- a/runtime/integration-tests/src/generic/cases/account_derivation.rs +++ b/runtime/integration-tests/src/generic/cases/account_derivation.rs @@ -14,8 +14,9 @@ use cfg_primitives::AccountId; use runtime_common::apis::runtime_decl_for_account_conversion_api::AccountConversionApi; +use sp_api::{BlockT, HeaderT}; use sp_runtime::traits::{Get, Zero}; -use xcm::v3::{ +use staging_xcm::v3::{ Junction::{AccountId32, AccountKey20, Parachain}, Junctions::{X1, X2}, MultiLocation, NetworkId, @@ -187,7 +188,10 @@ fn remote_account_on_relay() { AccountId32 { id: KEY_32, network: Some(NetworkId::ByGenesis( - frame_system::BlockHash::::get(T::BlockNumber::zero()).0, + frame_system::BlockHash::::get( + <::Header as HeaderT>::Number::zero(), + ) + .0, )), }, ), @@ -215,7 +219,10 @@ fn remote_account_on_sibling() { AccountId32 { id: KEY_32, network: Some(NetworkId::ByGenesis( - frame_system::BlockHash::::get(T::BlockNumber::zero()).0, + frame_system::BlockHash::::get( + <::Header as HeaderT>::Number::zero(), + ) + .0, )), }, ), diff --git a/runtime/integration-tests/src/generic/cases/investments.rs b/runtime/integration-tests/src/generic/cases/investments.rs index 83abfb1855..cacd0b53cc 100644 --- a/runtime/integration-tests/src/generic/cases/investments.rs +++ b/runtime/integration-tests/src/generic/cases/investments.rs @@ -39,10 +39,12 @@ mod common { pub fn initialize_state_for_investments, T: Runtime>() -> E { let mut env = E::from_parachain_storage( - Genesis::::default() - .add(genesis::balances(T::ExistentialDeposit::get() + FOR_FEES)) - .add(genesis::assets(vec![Box::new(Usd6)])) - .add(genesis::tokens(vec![(Usd6.id(), Usd6.ed())])) + Genesis::default() + .add(genesis::balances::( + T::ExistentialDeposit::get() + FOR_FEES, + )) + .add(genesis::assets::(vec![Box::new(Usd6)])) + .add(genesis::tokens::(vec![(Usd6.id(), Usd6.ed())])) .storage(), ); diff --git a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs index 35a64d396b..b92e039286 100644 --- a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs +++ b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs @@ -21,7 +21,7 @@ use cfg_types::{ use cfg_utils::vec_to_fixed_array; use frame_support::{ assert_noop, assert_ok, - dispatch::{RawOrigin, Weight}, + dispatch::RawOrigin, traits::{ fungible::Mutate as FungibleMutate, fungibles::{Inspect, Mutate as FungiblesMutate}, @@ -39,7 +39,7 @@ use pallet_liquidity_pools_gateway::{Call as LiquidityPoolsGatewayCall, GatewayO use pallet_pool_system::tranches::{TrancheInput, TrancheLoc, TrancheType}; use parity_scale_codec::Encode; use polkadot_core_primitives::BlakeTwo256; -use polkadot_parachain::primitives::{Id, ValidationCode}; +use polkadot_parachain_primitives::primitives::{Id, ValidationCode}; use polkadot_runtime_parachains::{ paras, paras::{ParaGenesisArgs, ParaKind}, @@ -52,7 +52,10 @@ use runtime_common::{ }; use sp_core::{Get, H160, U256}; use sp_runtime::{ - traits::{AccountIdConversion, BadOrigin, ConstU32, Convert as C2, EnsureAdd, Hash, One, Zero}, + traits::{ + AccountIdConversion, BadOrigin, ConstU32, Convert as C1, Convert as C2, EnsureAdd, Hash, + One, Zero, + }, BoundedVec, BuildStorage, DispatchError, FixedPointNumber, Perquintill, SaturatedConversion, WeakBoundedVec, }; @@ -65,7 +68,6 @@ use staging_xcm::{ }, VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation, }; -use staging_xcm_executor::traits::Convert as C1; use crate::{ generic::{ @@ -81,7 +83,7 @@ pub mod utils { use super::*; pub fn parachain_account(id: u32) -> AccountId { - polkadot_parachain::primitives::Sibling::from(id).into_account_truncating() + polkadot_parachain_primitives::primitives::Sibling::from(id).into_account_truncating() } pub fn xcm_metadata(transferability: CrossChainTransferability) -> Option { @@ -184,10 +186,22 @@ pub mod utils { } pub fn register_ausd() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata< + Balance, + CustomMetadata, + ::StringLimit, + > = AssetMetadata { decimals: 12, - name: "Acala Dollar".into(), - symbol: "AUSD".into(), + name: BoundedVec::< + u8, + ::StringLimit, + >::try_from("Acala Dollar".as_bytes().to_vec()) + .expect("Can create BoundedVec for token name"), + symbol: BoundedVec::< + u8, + ::StringLimit, + >::try_from("AUSD".as_bytes().to_vec()) + .expect("Can create BoundedVec for token symbol"), existential_deposit: 1_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -285,6 +299,7 @@ mod development { mod utils { use cfg_types::oracles::OracleKey; + use frame_support::weights::Weight; use runtime_common::oracle::Feeder; use super::*; @@ -321,14 +336,14 @@ mod development { // liquidity pools AddTranche message. token_name: BoundedVec::< u8, - ::MaxTokenNameLength, + ::StringLimit, >::try_from("A highly advanced tranche".as_bytes().to_vec()) - .expect(""), + .expect("Can create BoundedVec for token name"), token_symbol: BoundedVec::< u8, - ::MaxTokenSymbolLength, + ::StringLimit, >::try_from("TrNcH".as_bytes().to_vec()) - .expect(""), + .expect("Can create BoundedVec for token symbol"), } }, TrancheInput { @@ -5730,7 +5745,11 @@ mod altair { env: &mut FudgeEnv, transfer_amount: Balance, currency_id: CurrencyId, - meta: AssetMetadata, + meta: AssetMetadata< + Balance, + CustomMetadata, + ::StringLimit, + >, ) { env.parachain_state_mut(|| { assert_ok!(orml_asset_registry::Pallet::::register_asset( @@ -6333,7 +6352,7 @@ mod centrifuge { use super::*; mod utils { - use xcm::v3::NetworkId; + use staging_xcm::v3::NetworkId; use super::*; @@ -6461,18 +6480,20 @@ mod centrifuge { name: "Centrifuge".into(), symbol: "CFG".into(), existential_deposit: 1_000_000_000_000, - location: Some(VersionedMultiLocation::V2(xcm::v2::MultiLocation::new( - 1, - xcm::v2::Junctions::X2( - xcm::v2::Junction::Parachain(T::FudgeHandle::PARA_ID), - xcm::v2::Junction::GeneralKey( - WeakBoundedVec::>::force_from( - parachains::polkadot::centrifuge::CFG_KEY.into(), - None, + location: Some(VersionedMultiLocation::V2( + staging_xcm::v2::MultiLocation::new( + 1, + staging_xcm::v2::Junctions::X2( + staging_xcm::v2::Junction::Parachain(T::FudgeHandle::PARA_ID), + staging_xcm::v2::Junction::GeneralKey( + WeakBoundedVec::>::force_from( + parachains::polkadot::centrifuge::CFG_KEY.into(), + None, + ), ), ), ), - ))), + )), additional: CustomMetadata { transferability: CrossChainTransferability::Xcm(Default::default()), ..CustomMetadata::default() diff --git a/runtime/integration-tests/src/generic/cases/proxy.rs b/runtime/integration-tests/src/generic/cases/proxy.rs index fd0e301c08..89380d25d6 100644 --- a/runtime/integration-tests/src/generic/cases/proxy.rs +++ b/runtime/integration-tests/src/generic/cases/proxy.rs @@ -3,7 +3,7 @@ use cfg_types::{tokens::CrossChainTransferability, xcm::XcmMetadata}; use frame_support::{assert_err, assert_ok, traits::Get}; use frame_system::RawOrigin; use sp_runtime::{traits::StaticLookup, DispatchResult}; -use xcm::{ +use staging_xcm::{ prelude::Parachain, v3::{Junction, Junctions::*, MultiLocation, WeightLimit}, VersionedMultiLocation, diff --git a/runtime/integration-tests/src/generic/envs/fudge_env/handle.rs b/runtime/integration-tests/src/generic/envs/fudge_env/handle.rs index a869e31277..4fc86e1b28 100644 --- a/runtime/integration-tests/src/generic/envs/fudge_env/handle.rs +++ b/runtime/integration-tests/src/generic/envs/fudge_env/handle.rs @@ -2,7 +2,6 @@ use std::sync::Arc; use cfg_primitives::{AuraId, Balance, Header}; use cumulus_primitives_core::CollectCollationInfo; -use frame_support::traits::GenesisBuild; use fudge::{ digest::{DigestCreator as DigestCreatorT, DigestProvider, FudgeAuraDigest, FudgeBabeDigest}, inherent::{ @@ -18,14 +17,13 @@ use polkadot_parachain_primitives::primitives::Id as ParaId; use polkadot_primitives::runtime_api::ParachainHost; use polkadot_runtime_parachains::configuration::HostConfiguration; use sc_block_builder::BlockBuilderApi; -use sc_client_api::Backend; use sc_service::{TFullBackend, TFullClient}; use sp_api::{ApiExt, ConstructRuntimeApi}; use sp_consensus_aura::{sr25519::AuthorityId, AuraApi}; use sp_consensus_babe::BabeApi; use sp_consensus_slots::SlotDuration; use sp_core::{crypto::AccountId32, ByteArray, H256}; -use sp_runtime::{traits::AccountIdLookup, Storage}; +use sp_runtime::{traits::AccountIdLookup, BuildStorage, Storage}; use sp_transaction_pool::runtime_api::TaggedTransactionQueue; use tokio::runtime::Handle; @@ -96,7 +94,7 @@ pub trait FudgeHandle { type RelayApi: BlockBuilderApi + BabeApi + ParachainHost - + ApiExt as Backend>::State> + + ApiExt + TaggedTransactionQueue; type ParachainConstructApi: ConstructRuntimeApi< @@ -108,7 +106,7 @@ pub trait FudgeHandle { + 'static; type ParachainApi: BlockBuilderApi - + ApiExt as Backend>::State> + + ApiExt + AuraApi + TaggedTransactionQueue + CollectCollationInfo; @@ -157,7 +155,7 @@ pub trait FudgeHandle { Self::RelayRuntime, >::default(); - let mut host_config = HostConfiguration::::default(); + let mut host_config = HostConfiguration::default(); host_config.max_downward_message_size = 1024; host_config.hrmp_channel_max_capacity = 100; host_config.hrmp_channel_max_message_size = 1024; @@ -182,10 +180,11 @@ pub trait FudgeHandle { state .insert_storage( - frame_system::GenesisConfig { + frame_system::GenesisConfig:: { code: code.to_vec(), + _config: Default::default(), } - .build_storage::() + .build_storage() .expect("ESSENTIAL: GenesisBuild must not fail at this stage."), ) .expect("ESSENTIAL: Storage can be inserted"); @@ -265,10 +264,11 @@ pub trait FudgeHandle { state .insert_storage( - frame_system::GenesisConfig { + frame_system::GenesisConfig:: { code: code.to_vec(), + _config: Default::default(), } - .build_storage::() + .build_storage() .expect("ESSENTIAL: GenesisBuild must not fail at this stage."), ) .expect("ESSENTIAL: Storage can be inserted"); @@ -283,11 +283,11 @@ pub trait FudgeHandle { .expect("ESSENTIAL: Storage can be inserted"); state .insert_storage( - >::build_storage( - ¶chain_info::GenesisConfig { - parachain_id: para_id, - }, - ) + parachain_info::GenesisConfig:: { + _config: Default::default(), + parachain_id: para_id, + } + .build_storage() .expect("ESSENTIAL: Parachain Info GenesisBuild must not fail at this stage."), ) .expect("ESSENTIAL: Storage can be inserted"); diff --git a/runtime/integration-tests/src/generic/impls.rs b/runtime/integration-tests/src/generic/impls.rs index 5073b3fc45..274dc95082 100644 --- a/runtime/integration-tests/src/generic/impls.rs +++ b/runtime/integration-tests/src/generic/impls.rs @@ -25,7 +25,6 @@ impl_runtime!(development_runtime, Development); impl_runtime!(altair_runtime, Altair); impl_runtime!(centrifuge_runtime, Centrifuge); -/* /// Implements fudge support for a runtime macro_rules! impl_fudge_support { ( @@ -215,6 +214,8 @@ pub fn default_kusama_session_keys() -> staging_kusama_runtime::SessionKeys { para_validator: ValidatorId::from_slice([0u8; 32].as_slice()).unwrap(), para_assignment: AssignmentId::from_slice([0u8; 32].as_slice()).unwrap(), authority_discovery: AuthorityDiscoveryId::from_slice([0u8; 32].as_slice()).unwrap(), + beefy: sp_consensus_beefy::ecdsa_crypto::AuthorityId::from_slice([0u8; 33].as_slice()) + .unwrap(), } } @@ -229,4 +230,3 @@ pub fn default_polkadot_session_keys() -> polkadot_runtime::SessionKeys { authority_discovery: AuthorityDiscoveryId::from_slice([0u8; 32].as_slice()).unwrap(), } } -*/ diff --git a/runtime/integration-tests/src/generic/utils/democracy.rs b/runtime/integration-tests/src/generic/utils/democracy.rs index e83042f627..a5c234ada7 100644 --- a/runtime/integration-tests/src/generic/utils/democracy.rs +++ b/runtime/integration-tests/src/generic/utils/democracy.rs @@ -16,7 +16,7 @@ use crate::{ generic::{ config::Runtime, env::{Blocks, Env}, - //envs::fudge_env::FudgeSupport, + envs::fudge_env::FudgeSupport, }, utils::accounts::Keyring, }; @@ -55,7 +55,6 @@ pub fn fast_track( .into() } -/* pub fn execute_via_democracy( env: &mut impl Env, council_members: Vec, @@ -113,7 +112,6 @@ pub fn execute_via_democracy( (starting_prop_index + 2, starting_ref_index + 1) } -*/ pub fn democracy_vote( ref_index: ReferendumIndex, diff --git a/runtime/integration-tests/src/utils/accounts.rs b/runtime/integration-tests/src/utils/accounts.rs index fd79986dfe..3a0f563486 100644 --- a/runtime/integration-tests/src/utils/accounts.rs +++ b/runtime/integration-tests/src/utils/accounts.rs @@ -24,7 +24,6 @@ use sp_core::{ }; use sp_runtime::AccountId32; -/* use crate::{ chain::{centrifuge, centrifuge::PARA_ID, relay}, utils::env::TestEnv, @@ -126,7 +125,6 @@ fn nonce_relay(env: &TestEnv, who: Keyring) -> RelayNonce { }) .expect("ESSENTIAL: Nonce must be retrievable.") } -*/ fn nonce(who: AccountId) -> Nonce where diff --git a/runtime/integration-tests/src/utils/env.rs b/runtime/integration-tests/src/utils/env.rs index 48f2a24f50..753933079e 100644 --- a/runtime/integration-tests/src/utils/env.rs +++ b/runtime/integration-tests/src/utils/env.rs @@ -14,7 +14,6 @@ use std::collections::HashMap; use cfg_primitives::{AuraId, BlockNumber, Nonce}; -use frame_support::traits::GenesisBuild; use frame_system::EventRecord; use fudge::{ digest::{DigestCreator, DigestProvider, FudgeAuraDigest, FudgeBabeDigest}, @@ -41,7 +40,7 @@ use sp_core::H256; use sp_runtime::{ generic::BlockId, traits::{BlakeTwo256, Extrinsic}, - DigestItem, Storage, + BuildStorage, DigestItem, Storage, }; use tokio::runtime::Handle; @@ -805,6 +804,7 @@ fn test_env( state.insert_storage( frame_system::GenesisConfig { code: RelayCode.expect("ESSENTIAL: Relay WASM is some.").to_vec(), + _config: Default::default(), } .build_storage::() .expect("ESSENTIAL: Frame System GenesisBuild must not fail at this stage."), @@ -924,11 +924,11 @@ fn get_parachain_builder( .expect("ESSENTIAL: Pallet Aura GenesisBuild must not fail at this stage."), ); state.insert_storage( - >::build_storage( - ¶chain_info::GenesisConfig { - parachain_id: ParaId::from(para_id), - }, - ) + parachain_info::GenesisConfig { + _config: Default::default(), + parachain_id: ParaId::from(para_id), + } + .build_storage() .expect("ESSENTIAL: Parachain Info GenesisBuild must not fail at this stage."), ); diff --git a/runtime/integration-tests/src/utils/genesis.rs b/runtime/integration-tests/src/utils/genesis.rs index a2dc3d70fb..9d5993920f 100644 --- a/runtime/integration-tests/src/utils/genesis.rs +++ b/runtime/integration-tests/src/utils/genesis.rs @@ -17,7 +17,7 @@ use cfg_types::{ }; use frame_support::traits::GenesisBuild; use serde::{Deserialize, Serialize}; -use sp_runtime::{AccountId32, FixedPointNumber, Storage}; +use sp_runtime::{AccountId32, BoundedVec, BuildStorage, FixedPointNumber, Storage}; use crate::utils::{ accounts::{default_accounts, Keyring}, @@ -145,8 +145,10 @@ where orml_asset_registry::Pallet::::do_register_asset( orml_asset_registry::AssetMetadata { decimals: 18, - name: b"mock_name".to_vec(), - symbol: b"mock_symbol".to_vec(), + name: BoundedVec::::try_from("mock_name".as_bytes()) + .expect("Can create bounded vec for token name"), + symbol: BoundedVec::::try_from("mock_symbol") + .expect("Can create bounded vec for token symbol"), existential_deposit: 0u128.into(), location: None, additional: CustomMetadata { diff --git a/runtime/integration-tests/src/utils/mod.rs b/runtime/integration-tests/src/utils/mod.rs index 81aa022576..a390d3dbbc 100644 --- a/runtime/integration-tests/src/utils/mod.rs +++ b/runtime/integration-tests/src/utils/mod.rs @@ -10,24 +10,18 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -/* use cfg_primitives::Balance; use cfg_types::tokens::CurrencyId; -*/ pub mod accounts; -/* pub mod env; pub mod evm; pub mod extrinsics; pub mod genesis; -*/ pub mod logs; pub mod time; -/* pub mod tokens; - /// The relay native token's asset id pub const RELAY_ASSET_ID: CurrencyId = CurrencyId::ForeignAsset(5); /// The Glimmer asset id @@ -42,4 +36,3 @@ pub const MOONBEAM_EVM_CHAIN_ID: u64 = 1284; pub const GLMR_ED: Balance = 1_000_000; pub const AUSD_ED: Balance = 1_000_000_000; pub const USDT_ED: Balance = 10_000; -*/ diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a187069911..79c9b0c2a8 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2023-10-26" # rustc 1.75.0 +channel = "nightly-2024-02-06" components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ] profile = "minimal" \ No newline at end of file From 2dcc6d03afe5fa9b7c6195efb9177b02182bee46 Mon Sep 17 00:00:00 2001 From: cdamian <17934949+cdamian@users.noreply.github.com> Date: Wed, 27 Mar 2024 16:28:09 +0200 Subject: [PATCH 3/6] runtime: Implement parachains pallets for runtimes --- Cargo.lock | 4 + runtime/altair/Cargo.toml | 1 + runtime/altair/src/lib.rs | 25 ++ runtime/altair/src/weights/mod.rs | 2 + .../src/weights/pallet_parachains_config.rs | 36 ++ .../src/weights/pallet_parachains_paras.rs | 58 +++ runtime/centrifuge/Cargo.toml | 1 + runtime/centrifuge/src/lib.rs | 25 ++ runtime/centrifuge/src/weights/mod.rs | 2 + .../src/weights/pallet_parachains_config.rs | 36 ++ .../src/weights/pallet_parachains_paras.rs | 58 +++ runtime/development/Cargo.toml | 1 + runtime/development/src/lib.rs | 25 ++ runtime/development/src/weights/mod.rs | 2 + .../src/weights/pallet_parachains_config.rs | 36 ++ .../src/weights/pallet_parachains_paras.rs | 58 +++ .../src/generic/cases/liquidity_pools.rs | 356 ++++++++---------- .../src/generic/cases/loans.rs | 10 +- .../src/generic/cases/proxy.rs | 10 +- .../integration-tests/src/generic/config.rs | 2 +- runtime/integration-tests/src/utils/env.rs | 13 +- runtime/integration-tests/src/utils/evm.rs | 8 +- .../integration-tests/src/utils/genesis.rs | 8 +- 23 files changed, 546 insertions(+), 231 deletions(-) create mode 100644 runtime/altair/src/weights/pallet_parachains_config.rs create mode 100644 runtime/altair/src/weights/pallet_parachains_paras.rs create mode 100644 runtime/centrifuge/src/weights/pallet_parachains_config.rs create mode 100644 runtime/centrifuge/src/weights/pallet_parachains_paras.rs create mode 100644 runtime/development/src/weights/pallet_parachains_config.rs create mode 100644 runtime/development/src/weights/pallet_parachains_paras.rs diff --git a/Cargo.lock b/Cargo.lock index c352fb0fcf..a71a3c777e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -213,6 +213,7 @@ dependencies = [ "parity-scale-codec 3.6.9", "polkadot-parachain-primitives", "polkadot-runtime-common", + "polkadot-runtime-parachains", "runtime-common", "scale-info", "serde", @@ -1225,6 +1226,7 @@ dependencies = [ "parity-scale-codec 3.6.9", "polkadot-parachain-primitives", "polkadot-runtime-common", + "polkadot-runtime-parachains", "runtime-common", "scale-info", "serde", @@ -2434,6 +2436,7 @@ dependencies = [ "parity-scale-codec 3.6.9", "polkadot-parachain-primitives", "polkadot-runtime-common", + "polkadot-runtime-parachains", "runtime-common", "scale-info", "serde", @@ -10745,6 +10748,7 @@ dependencies = [ "parachain-info", "parity-scale-codec 3.6.9", "polkadot-core-primitives", + "polkadot-node-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime", diff --git a/runtime/altair/Cargo.toml b/runtime/altair/Cargo.toml index 628d3fbaae..80d3b36463 100644 --- a/runtime/altair/Cargo.toml +++ b/runtime/altair/Cargo.toml @@ -49,6 +49,7 @@ cumulus-primitives-utility = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } polkadot-parachain-primitives = { workspace = true } polkadot-runtime-common = { workspace = true } +polkadot-runtime-parachains = { workspace = true } staging-xcm = { workspace = true } staging-xcm-builder = { workspace = true } diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index c6786c2626..d5f1764347 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -63,6 +63,7 @@ use frame_support::{ }; use frame_system::{ limits::{BlockLength, BlockWeights}, + offchain::SendTransactionTypes, EnsureRoot, EnsureSigned, }; use orml_traits::currency::MutationHooks; @@ -1905,6 +1906,29 @@ impl axelar_gateway_precompile::Config for Runtime { type WeightInfo = (); } +impl polkadot_runtime_parachains::configuration::Config for Runtime { + type WeightInfo = weights::pallet_parachains_config::WeightInfo; +} + +impl polkadot_runtime_parachains::shared::Config for Runtime {} + +impl SendTransactionTypes for Runtime +where + RuntimeCall: From, +{ + type Extrinsic = UncheckedExtrinsic; + type OverarchingCall = RuntimeCall; +} + +impl polkadot_runtime_parachains::paras::Config for Runtime { + type NextSessionRotation = pallet_session::PeriodicSessions; + type OnNewHead = (); + type QueueFootprinter = (); + type RuntimeEvent = RuntimeEvent; + type UnsignedPriority = (); + type WeightInfo = weights::pallet_parachains_paras::WeightInfo; +} + /// Block type as expected by this runtime. pub type Block = generic::Block; /// A Block signed with a Justification @@ -1977,6 +2001,7 @@ construct_runtime!( Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 69, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 70, Uniques: pallet_uniques::{Pallet, Call, Storage, Event} = 72, + Paras: polkadot_runtime_parachains::paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 73, // our pallets (part 1) Fees: pallet_fees::{Pallet, Call, Storage, Config, Event} = 90, diff --git a/runtime/altair/src/weights/mod.rs b/runtime/altair/src/weights/mod.rs index 5f02a62635..37a4f68070 100644 --- a/runtime/altair/src/weights/mod.rs +++ b/runtime/altair/src/weights/mod.rs @@ -32,6 +32,8 @@ pub mod pallet_multisig; pub mod pallet_oracle_collection; pub mod pallet_oracle_feed; pub mod pallet_order_book; +pub mod pallet_parachains_config; +pub mod pallet_parachains_paras; pub mod pallet_permissions; pub mod pallet_pool_fees; pub mod pallet_pool_registry; diff --git a/runtime/altair/src/weights/pallet_parachains_config.rs b/runtime/altair/src/weights/pallet_parachains_config.rs new file mode 100644 index 0000000000..dbea9bc012 --- /dev/null +++ b/runtime/altair/src/weights/pallet_parachains_config.rs @@ -0,0 +1,36 @@ +use core::marker::PhantomData; + +use frame_support::weights::Weight; + +pub struct WeightInfo(PhantomData); +impl polkadot_runtime_parachains::configuration::WeightInfo + for WeightInfo +{ + fn set_config_with_block_number() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_u32() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_option_u32() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_balance() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_hrmp_open_request_ttl() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_executor_params() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_perbill() -> Weight { + Weight::from_parts(100_000_000, 0) + } +} diff --git a/runtime/altair/src/weights/pallet_parachains_paras.rs b/runtime/altair/src/weights/pallet_parachains_paras.rs new file mode 100644 index 0000000000..331e68aa86 --- /dev/null +++ b/runtime/altair/src/weights/pallet_parachains_paras.rs @@ -0,0 +1,58 @@ +use core::marker::PhantomData; + +use frame_support::weights::Weight; + +pub struct WeightInfo(PhantomData); +impl polkadot_runtime_parachains::paras::WeightInfo for WeightInfo { + fn force_set_current_code(c: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_set_current_head(s: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_set_most_recent_context() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_schedule_code_upgrade(c: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_note_new_head(s: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_queue_action() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn add_trusted_validation_code(c: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn poke_unused_validation_code() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement() -> Weight { + Weight::from_parts(100_000_000, 0) + } +} diff --git a/runtime/centrifuge/Cargo.toml b/runtime/centrifuge/Cargo.toml index f8490daba5..67327ed8f5 100644 --- a/runtime/centrifuge/Cargo.toml +++ b/runtime/centrifuge/Cargo.toml @@ -49,6 +49,7 @@ cumulus-primitives-utility = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } polkadot-parachain-primitives = { workspace = true } polkadot-runtime-common = { workspace = true } +polkadot-runtime-parachains = { workspace = true } staging-xcm = { workspace = true } staging-xcm-builder = { workspace = true } diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index e9f29bbccf..e8f8263130 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -64,6 +64,7 @@ use frame_support::{ }; use frame_system::{ limits::{BlockLength, BlockWeights}, + offchain::SendTransactionTypes, EnsureRoot, EnsureSigned, }; use orml_traits::currency::MutationHooks; @@ -2019,6 +2020,29 @@ impl axelar_gateway_precompile::Config for Runtime { type WeightInfo = (); } +impl polkadot_runtime_parachains::configuration::Config for Runtime { + type WeightInfo = weights::pallet_parachains_config::WeightInfo; +} + +impl polkadot_runtime_parachains::shared::Config for Runtime {} + +impl SendTransactionTypes for Runtime +where + RuntimeCall: From, +{ + type Extrinsic = UncheckedExtrinsic; + type OverarchingCall = RuntimeCall; +} + +impl polkadot_runtime_parachains::paras::Config for Runtime { + type NextSessionRotation = pallet_session::PeriodicSessions; + type OnNewHead = (); + type QueueFootprinter = (); + type RuntimeEvent = RuntimeEvent; + type UnsignedPriority = (); + type WeightInfo = weights::pallet_parachains_paras::WeightInfo; +} + /// Block type as expected by this runtime. pub type Block = generic::Block; /// A Block signed with a Justification @@ -2089,6 +2113,7 @@ construct_runtime!( Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config} = 68, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 69, Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 70, + Paras: polkadot_runtime_parachains::paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 72, // our pallets Fees: pallet_fees::{Pallet, Call, Storage, Config, Event} = 90, diff --git a/runtime/centrifuge/src/weights/mod.rs b/runtime/centrifuge/src/weights/mod.rs index 5f02a62635..37a4f68070 100644 --- a/runtime/centrifuge/src/weights/mod.rs +++ b/runtime/centrifuge/src/weights/mod.rs @@ -32,6 +32,8 @@ pub mod pallet_multisig; pub mod pallet_oracle_collection; pub mod pallet_oracle_feed; pub mod pallet_order_book; +pub mod pallet_parachains_config; +pub mod pallet_parachains_paras; pub mod pallet_permissions; pub mod pallet_pool_fees; pub mod pallet_pool_registry; diff --git a/runtime/centrifuge/src/weights/pallet_parachains_config.rs b/runtime/centrifuge/src/weights/pallet_parachains_config.rs new file mode 100644 index 0000000000..dbea9bc012 --- /dev/null +++ b/runtime/centrifuge/src/weights/pallet_parachains_config.rs @@ -0,0 +1,36 @@ +use core::marker::PhantomData; + +use frame_support::weights::Weight; + +pub struct WeightInfo(PhantomData); +impl polkadot_runtime_parachains::configuration::WeightInfo + for WeightInfo +{ + fn set_config_with_block_number() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_u32() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_option_u32() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_balance() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_hrmp_open_request_ttl() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_executor_params() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_perbill() -> Weight { + Weight::from_parts(100_000_000, 0) + } +} diff --git a/runtime/centrifuge/src/weights/pallet_parachains_paras.rs b/runtime/centrifuge/src/weights/pallet_parachains_paras.rs new file mode 100644 index 0000000000..331e68aa86 --- /dev/null +++ b/runtime/centrifuge/src/weights/pallet_parachains_paras.rs @@ -0,0 +1,58 @@ +use core::marker::PhantomData; + +use frame_support::weights::Weight; + +pub struct WeightInfo(PhantomData); +impl polkadot_runtime_parachains::paras::WeightInfo for WeightInfo { + fn force_set_current_code(c: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_set_current_head(s: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_set_most_recent_context() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_schedule_code_upgrade(c: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_note_new_head(s: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_queue_action() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn add_trusted_validation_code(c: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn poke_unused_validation_code() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement() -> Weight { + Weight::from_parts(100_000_000, 0) + } +} diff --git a/runtime/development/Cargo.toml b/runtime/development/Cargo.toml index 62f82a6595..02c54f205c 100644 --- a/runtime/development/Cargo.toml +++ b/runtime/development/Cargo.toml @@ -48,6 +48,7 @@ cumulus-primitives-utility = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } polkadot-parachain-primitives = { workspace = true } polkadot-runtime-common = { workspace = true } +polkadot-runtime-parachains = { workspace = true } staging-xcm = { workspace = true } staging-xcm-builder = { workspace = true } diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index f0ae47e34a..7f11b22f77 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -69,6 +69,7 @@ use frame_support::{ }; use frame_system::{ limits::{BlockLength, BlockWeights}, + offchain::SendTransactionTypes, EnsureRoot, EnsureSigned, }; use orml_traits::currency::MutationHooks; @@ -1997,6 +1998,29 @@ impl axelar_gateway_precompile::Config for Runtime { type WeightInfo = (); } +impl polkadot_runtime_parachains::configuration::Config for Runtime { + type WeightInfo = weights::pallet_parachains_config::WeightInfo; +} + +impl polkadot_runtime_parachains::shared::Config for Runtime {} + +impl SendTransactionTypes for Runtime +where + RuntimeCall: From, +{ + type Extrinsic = UncheckedExtrinsic; + type OverarchingCall = RuntimeCall; +} + +impl polkadot_runtime_parachains::paras::Config for Runtime { + type NextSessionRotation = pallet_session::PeriodicSessions; + type OnNewHead = (); + type QueueFootprinter = (); + type RuntimeEvent = RuntimeEvent; + type UnsignedPriority = (); + type WeightInfo = weights::pallet_parachains_paras::WeightInfo; +} + /// Block type as expected by this runtime. pub type Block = generic::Block; /// A Block signed with a Justification @@ -2068,6 +2092,7 @@ construct_runtime!( Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 69, Uniques: pallet_uniques::{Pallet, Call, Storage, Event} = 70, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 72, + Paras: polkadot_runtime_parachains::paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 73, // our pallets part 1 Fees: pallet_fees::{Pallet, Call, Storage, Config, Event} = 90, diff --git a/runtime/development/src/weights/mod.rs b/runtime/development/src/weights/mod.rs index d2e6fc44bb..ef0ec5bf68 100644 --- a/runtime/development/src/weights/mod.rs +++ b/runtime/development/src/weights/mod.rs @@ -31,6 +31,8 @@ pub mod pallet_multisig; pub mod pallet_oracle_collection; pub mod pallet_oracle_feed; pub mod pallet_order_book; +pub mod pallet_parachains_config; +pub mod pallet_parachains_paras; pub mod pallet_permissions; pub mod pallet_pool_fees; pub mod pallet_pool_registry; diff --git a/runtime/development/src/weights/pallet_parachains_config.rs b/runtime/development/src/weights/pallet_parachains_config.rs new file mode 100644 index 0000000000..bccb374cc3 --- /dev/null +++ b/runtime/development/src/weights/pallet_parachains_config.rs @@ -0,0 +1,36 @@ +use core::marker::PhantomData; + +use pallet_order_book::weights::Weight; + +pub struct WeightInfo(PhantomData); +impl polkadot_runtime_parachains::configuration::WeightInfo + for WeightInfo +{ + fn set_config_with_block_number() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_u32() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_option_u32() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_balance() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_hrmp_open_request_ttl() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_executor_params() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn set_config_with_perbill() -> Weight { + Weight::from_parts(100_000_000, 0) + } +} diff --git a/runtime/development/src/weights/pallet_parachains_paras.rs b/runtime/development/src/weights/pallet_parachains_paras.rs new file mode 100644 index 0000000000..331e68aa86 --- /dev/null +++ b/runtime/development/src/weights/pallet_parachains_paras.rs @@ -0,0 +1,58 @@ +use core::marker::PhantomData; + +use frame_support::weights::Weight; + +pub struct WeightInfo(PhantomData); +impl polkadot_runtime_parachains::paras::WeightInfo for WeightInfo { + fn force_set_current_code(c: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_set_current_head(s: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_set_most_recent_context() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_schedule_code_upgrade(c: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_note_new_head(s: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn force_queue_action() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn add_trusted_validation_code(c: u32) -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn poke_unused_validation_code() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { + Weight::from_parts(100_000_000, 0) + } + + fn include_pvf_check_statement() -> Weight { + Weight::from_parts(100_000_000, 0) + } +} diff --git a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs index b92e039286..6dc2ee7f42 100644 --- a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs +++ b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs @@ -15,7 +15,7 @@ use cfg_types::{ orders::FulfillmentWithPrice, permissions::{PermissionScope, PoolRole, Role}, pools::TrancheMetadata, - tokens::{CrossChainTransferability, CurrencyId, CustomMetadata}, + tokens::{AssetMetadata, CrossChainTransferability, CurrencyId, CustomMetadata}, xcm::XcmMetadata, }; use cfg_utils::vec_to_fixed_array; @@ -32,7 +32,7 @@ use liquidity_pools_gateway_routers::{ AxelarEVMRouter, AxelarXCMRouter, DomainRouter, EVMDomain, EVMRouter, EthereumXCMRouter, FeeValues, XCMRouter, XcmDomain, DEFAULT_PROOF_SIZE, MAX_AXELAR_EVM_CHAIN_SIZE, }; -use orml_traits::{asset_registry::AssetMetadata, MultiCurrency}; +use orml_traits::MultiCurrency; use pallet_investments::CollectOutcome; use pallet_liquidity_pools::Message; use pallet_liquidity_pools_gateway::{Call as LiquidityPoolsGatewayCall, GatewayOrigin}; @@ -45,7 +45,7 @@ use polkadot_runtime_parachains::{ paras::{ParaGenesisArgs, ParaKind}, }; use runtime_common::{ - account_conversion::AccountConverter, + account_conversion::{convert_evm_address, AccountConverter}, foreign_investments::IdentityPoolCurrencyConverter, xcm::general_key, xcm_fees::{default_per_second, ksm_per_second}, @@ -186,22 +186,10 @@ pub mod utils { } pub fn register_ausd() { - let meta: AssetMetadata< - Balance, - CustomMetadata, - ::StringLimit, - > = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 12, - name: BoundedVec::< - u8, - ::StringLimit, - >::try_from("Acala Dollar".as_bytes().to_vec()) - .expect("Can create BoundedVec for token name"), - symbol: BoundedVec::< - u8, - ::StringLimit, - >::try_from("AUSD".as_bytes().to_vec()) - .expect("Can create BoundedVec for token symbol"), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -366,10 +354,10 @@ mod development { } pub fn register_glmr() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Glimmer".into(), - symbol: "GLMR".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: GLMR_ED, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -754,9 +742,7 @@ mod development { assert_eq!( orml_tokens::Pallet::::balance( default_investment_id::().into(), - &AccountConverter::::convert( - DEFAULT_OTHER_DOMAIN_ADDRESS - ) + &AccountConverter::convert(DEFAULT_OTHER_DOMAIN_ADDRESS) ), 0 ); @@ -790,10 +776,10 @@ mod development { /// /// NOTE: Assumes to be executed within an externalities environment. fn register_usdt() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 6, - name: "Tether USDT".into(), - symbol: "USDT".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: USDT_ED, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -1042,7 +1028,7 @@ mod development { // Whitelist destination as TrancheInvestor of this Pool crate::generic::utils::give_pool_role::( - AccountConverter::::convert(new_member.clone()), + AccountConverter::convert(new_member.clone()), pool_id, PoolRole::TrancheInvestor(default_tranche_id::(pool_id), DEFAULT_VALIDITY), ); @@ -1050,7 +1036,7 @@ mod development { // Verify the Investor role was set as expected in Permissions assert!(pallet_permissions::Pallet::::has( PermissionScope::Pool(pool_id), - AccountConverter::::convert(new_member.clone()), + AccountConverter::convert(new_member.clone()), Role::PoolRole(PoolRole::TrancheInvestor(tranche_id, DEFAULT_VALIDITY)), )); @@ -1233,8 +1219,8 @@ mod development { assert_ok!(orml_asset_registry::Pallet::::register_asset( ::RuntimeOrigin::root(), AssetMetadata { - name: "Test".into(), - symbol: "TEST".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), decimals: 12, location: None, existential_deposit: 1_000_000, @@ -1408,8 +1394,8 @@ mod development { assert_ok!(orml_asset_registry::Pallet::::register_asset( ::RuntimeOrigin::root(), AssetMetadata { - name: "Test".into(), - symbol: "TEST".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), decimals: 12, location: None, existential_deposit: 1_000_000, @@ -1601,8 +1587,8 @@ mod development { assert_ok!(orml_asset_registry::Pallet::::register_asset( ::RuntimeOrigin::root(), AssetMetadata { - name: "Test".into(), - symbol: "TEST".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), decimals: 12, location: None, existential_deposit: 1_000_000, @@ -1861,9 +1847,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let amount = 10 * decimals(12); - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; @@ -1916,9 +1901,8 @@ mod development { let invest_amount: u128 = 10 * decimals(12); let decrease_amount = invest_amount / 3; let final_amount = invest_amount - decrease_amount; - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id: CurrencyId = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; @@ -2007,9 +1991,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let invest_amount = 10 * decimals(12); - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; @@ -2107,9 +2090,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let amount = 10 * decimals(12); - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; let sending_domain_locator = @@ -2259,9 +2241,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let invest_amount = 10 * decimals(12); - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; let sending_domain_locator = @@ -2492,9 +2473,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let amount = 10 * decimals(12); - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; @@ -2552,9 +2532,8 @@ mod development { let redeem_amount = 10 * decimals(12); let decrease_amount = redeem_amount / 3; let final_amount = redeem_amount - decrease_amount; - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; let sending_domain_locator = @@ -2670,9 +2649,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let redeem_amount = 10 * decimals(12); - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; let sending_domain_locator = @@ -2768,9 +2746,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let amount = 10 * decimals(12); - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; let pool_account = pallet_pool_system::pool_types::PoolLocator { pool_id } @@ -2923,9 +2900,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let redeem_amount = 10 * decimals(12); - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; let pool_account = pallet_pool_system::pool_types::PoolLocator { pool_id } @@ -3152,10 +3128,7 @@ mod development { let invest_amount: u128 = 10 * decimals(12); let decrease_amount = invest_amount + 1; let investor: AccountId = - AccountConverter::::convert(( - DOMAIN_MOONBEAM, - Keyring::Bob.into(), - )); + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id: CurrencyId = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; create_currency_pool::( @@ -3204,10 +3177,7 @@ mod development { let redeem_amount: u128 = 10 * decimals(12); let decrease_amount = redeem_amount + 1; let investor: AccountId = - AccountConverter::::convert(( - DOMAIN_MOONBEAM, - Keyring::Bob.into(), - )); + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id: CurrencyId = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; create_currency_pool::( @@ -3261,10 +3231,7 @@ mod development { let pool_id = POOL_ID; let amount: u128 = 10 * decimals(12); let investor: AccountId = - AccountConverter::::convert(( - DOMAIN_MOONBEAM, - Keyring::Bob.into(), - )); + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id: CurrencyId = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; create_currency_pool::( @@ -3347,10 +3314,7 @@ mod development { let pool_id = POOL_ID; let amount: u128 = 10 * decimals(12); let investor: AccountId = - AccountConverter::::convert(( - DOMAIN_MOONBEAM, - Keyring::Bob.into(), - )); + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let currency_id: CurrencyId = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; create_currency_pool::( @@ -3446,10 +3410,7 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let investor: AccountId = - AccountConverter::::convert(( - DOMAIN_MOONBEAM, - Keyring::Bob.into(), - )); + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let pool_currency = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; let foreign_currency: CurrencyId = USDT_CURRENCY_ID; @@ -3528,10 +3489,7 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let investor: AccountId = - AccountConverter::::convert(( - DOMAIN_MOONBEAM, - Keyring::Bob.into(), - )); + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let pool_currency = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; let foreign_currency: CurrencyId = USDT_CURRENCY_ID; @@ -3614,10 +3572,7 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; let investor: AccountId = - AccountConverter::::convert(( - DOMAIN_MOONBEAM, - Keyring::Bob.into(), - )); + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let pool_currency = AUSD_CURRENCY_ID; let currency_decimals = currency_decimals::AUSD; let foreign_currency: CurrencyId = USDT_CURRENCY_ID; @@ -3696,9 +3651,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let pool_currency: CurrencyId = AUSD_CURRENCY_ID; let foreign_currency: CurrencyId = USDT_CURRENCY_ID; let pool_currency_decimals = currency_decimals::AUSD; @@ -3814,9 +3768,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let pool_currency: CurrencyId = AUSD_CURRENCY_ID; let foreign_currency: CurrencyId = USDT_CURRENCY_ID; let pool_currency_decimals = currency_decimals::AUSD; @@ -3957,9 +3910,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let trader: AccountId = Keyring::Alice.into(); let pool_currency: CurrencyId = AUSD_CURRENCY_ID; let foreign_currency: CurrencyId = USDT_CURRENCY_ID; @@ -4076,9 +4028,8 @@ mod development { env.parachain_state_mut(|| { let pool_id = POOL_ID; - let investor: AccountId = AccountConverter::::convert( - (DOMAIN_MOONBEAM, Keyring::Bob.into()), - ); + let investor: AccountId = + AccountConverter::convert((DOMAIN_MOONBEAM, Keyring::Bob.into())); let pool_currency: CurrencyId = AUSD_CURRENCY_ID; let foreign_currency: CurrencyId = USDT_CURRENCY_ID; let pool_currency_decimals = currency_decimals::AUSD; @@ -4394,7 +4345,7 @@ mod development { let valid_until = u64::MAX; crate::generic::utils::give_pool_role::( - AccountConverter::::convert(dest_address.clone()), + AccountConverter::convert(dest_address.clone()), pool_id, PoolRole::TrancheInvestor(default_tranche_id::(pool_id), valid_until), ); @@ -4571,12 +4522,12 @@ mod development { // Give Keyring::Bob investor role for (valid_pool_id, invalid_tranche_id) and // (invalid_pool_id, valid_tranche_id) crate::generic::utils::give_pool_role::( - AccountConverter::::convert(dest_address.clone()), + AccountConverter::convert(dest_address.clone()), invalid_pool_id, PoolRole::TrancheInvestor(valid_tranche_id, valid_until), ); crate::generic::utils::give_pool_role::( - AccountConverter::::convert(dest_address.clone()), + AccountConverter::convert(dest_address.clone()), valid_pool_id, PoolRole::TrancheInvestor(invalid_tranche_id, valid_until), ); @@ -4609,10 +4560,10 @@ mod development { let cfg_in_sibling = CurrencyId::ForeignAsset(12); // CFG Metadata - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Development".into(), - symbol: "CFG".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -4824,10 +4775,7 @@ mod development { ) { let chain_id = env.parachain_state(|| pallet_evm_chain_id::Pallet::::get()); - let derived_account = AccountConverter::::convert_evm_address( - chain_id, - address.to_fixed_bytes(), - ); + let derived_account = convert_evm_address(chain_id, address.to_fixed_bytes()); env.parachain_state_mut(|| { pallet_balances::Pallet::::mint_into(&derived_account.into(), balance) @@ -4840,9 +4788,9 @@ mod development { fn test_via_outbound_queue() { let mut env = FudgeEnv::::from_parachain_storage( - Genesis::::default() + Genesis::default() .add(genesis::balances::(cfg(1_000))) - .add::(genesis::council_members::( + .add(genesis::council_members::( get_council_members(), )) .storage(), @@ -5172,9 +5120,9 @@ mod development { fn set_domain_router() { let mut env = FudgeEnv::::from_parachain_storage( - Genesis::::default() + Genesis::default() .add(genesis::balances::(cfg(1_000))) - .add::(genesis::council_members::( + .add(genesis::council_members::( get_council_members(), )) .storage(), @@ -5243,9 +5191,9 @@ mod development { fn add_remove_instances() { let mut env = FudgeEnv::::from_parachain_storage( - Genesis::::default() + Genesis::default() .add(genesis::balances::(cfg(1_000))) - .add::(genesis::council_members::( + .add(genesis::council_members::( get_council_members(), )) .storage(), @@ -5301,9 +5249,9 @@ mod development { fn process_msg() { let mut env = FudgeEnv::::from_parachain_storage( - Genesis::::default() + Genesis::default() .add(genesis::balances::(cfg(1_000))) - .add::(genesis::council_members::( + .add(genesis::council_members::( get_council_members(), )) .storage(), @@ -5373,10 +5321,10 @@ mod altair { use super::*; pub fn register_air() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Altair".into(), - symbol: "AIR".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -5399,10 +5347,10 @@ mod altair { } pub fn register_ksm() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 12, - name: "Kusama".into(), - symbol: "KSM".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new(1, Here))), additional: CustomMetadata { @@ -5463,10 +5411,10 @@ mod altair { ); // Register AIR as foreign asset in the sibling parachain - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Altair".into(), - symbol: "AIR".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -5494,10 +5442,10 @@ mod altair { ); // Register AIR as foreign asset in the sibling parachain - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Altair".into(), - symbol: "AIR".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -5745,11 +5693,7 @@ mod altair { env: &mut FudgeEnv, transfer_amount: Balance, currency_id: CurrencyId, - meta: AssetMetadata< - Balance, - CustomMetadata, - ::StringLimit, - >, + meta: AssetMetadata, ) { env.parachain_state_mut(|| { assert_ok!(orml_asset_registry::Pallet::::register_asset( @@ -5816,10 +5760,10 @@ mod altair { let transfer_amount: Balance = ksm(2); let currency_id = CurrencyId::ForeignAsset(3001); - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 12, - name: "Kusama".into(), - symbol: "KSM".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new(1, Here))), additional: CustomMetadata { @@ -5889,10 +5833,10 @@ mod altair { 1, X2(Parachain(T::FudgeHandle::SIBLING_ID), general_key(&[0, 1])), ); - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Sibling Native Token".into(), - symbol: "SBLNG".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(asset_location)), additional: CustomMetadata { @@ -6001,10 +5945,10 @@ mod altair { general_key("0x02f3a00dd12f644daec907013b16eb6d14bf1c4cb4".as_bytes()), ), ); - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 6, - name: "Wormhole USDC".into(), - symbol: "WUSDC".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1, location: Some(VersionedMultiLocation::V3(asset_location)), additional: CustomMetadata { @@ -6098,10 +6042,10 @@ mod altair { let mut env = FudgeEnv::::default(); env.parachain_state_mut(|| { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Altair".into(), - symbol: "AIR".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 0, @@ -6125,10 +6069,10 @@ mod altair { let mut env = FudgeEnv::::default(); env.parachain_state_mut(|| { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 12, - name: "Acala Dollar".into(), - symbol: "AUSD".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -6156,10 +6100,10 @@ mod altair { let mut env = FudgeEnv::::default(); env.parachain_state_mut(|| { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 12, - name: "Tranche Token 1".into(), - symbol: "TRNCH".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -6369,10 +6313,10 @@ mod centrifuge { /// Register DOT in the asset registry. /// It should be executed within an externalities environment. pub fn register_dot() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 10, - name: "Polkadot".into(), - symbol: "DOT".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 100_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::parent())), additional: CustomMetadata { @@ -6388,10 +6332,10 @@ mod centrifuge { } pub fn register_lp_eth_usdc() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 6, - name: "LP Ethereum Wrapped USDC".into(), - symbol: "LpEthUSDC".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 0, @@ -6418,10 +6362,10 @@ mod centrifuge { } pub fn register_usdc() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 6, - name: "USD Circle".into(), - symbol: "USDC".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -6446,10 +6390,10 @@ mod centrifuge { /// Register CFG in the asset registry. /// It should be executed within an externalities environment. pub fn register_cfg(para_id: u32) { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Centrifuge".into(), - symbol: "CFG".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -6475,10 +6419,10 @@ mod centrifuge { /// production. It should be executed within an externalities /// environment. pub fn register_cfg_v2() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Centrifuge".into(), - symbol: "CFG".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V2( staging_xcm::v2::MultiLocation::new( @@ -6510,10 +6454,10 @@ mod centrifuge { /// Register a token whose `CrossChainTransferability` does NOT include /// XCM. pub fn register_no_xcm_token() { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "NO XCM".into(), - symbol: "NXCM".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: None, additional: CustomMetadata { @@ -6634,10 +6578,10 @@ mod centrifuge { let mut env = FudgeEnv::::default(); env.parachain_state_mut(|| { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Centrifuge".into(), - symbol: "CFG".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 0, @@ -6661,10 +6605,10 @@ mod centrifuge { let mut env = FudgeEnv::::default(); env.parachain_state_mut(|| { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 12, - name: "Acala Dollar".into(), - symbol: "AUSD".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -6692,10 +6636,10 @@ mod centrifuge { let mut env = FudgeEnv::::default(); env.parachain_state_mut(|| { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 12, - name: "Tranche Token 1".into(), - symbol: "TRNCH".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -7369,18 +7313,18 @@ mod centrifuge { fn restrict_usdc_xcm_transfer() { let mut env = FudgeEnv::::from_storage( - >>::build_storage( - ¶s::GenesisConfig { - paras: vec![( - 1000.into(), - ParaGenesisArgs { - genesis_head: Default::default(), - validation_code: ValidationCode::from(vec![0, 1, 2, 3]), - para_kind: ParaKind::Parachain, - }, - )], - }, - ) + paras::GenesisConfig:: { + _config: Default::default(), + paras: vec![( + 1000.into(), + ParaGenesisArgs { + genesis_head: Default::default(), + validation_code: ValidationCode::from(vec![0, 1, 2, 3]), + para_kind: ParaKind::Parachain, + }, + )], + } + .build_storage() .unwrap(), Genesis::default() .add(genesis::balances::(cfg(10))) @@ -7674,10 +7618,10 @@ mod centrifuge { let cfg_in_sibling = CurrencyId::ForeignAsset(12); // CFG Metadata - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Centrifuge".into(), - symbol: "CFG".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(MultiLocation::new( 1, @@ -8012,10 +7956,10 @@ mod centrifuge { 1, X2(Parachain(T::FudgeHandle::SIBLING_ID), general_key(&[0, 1])), ); - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Sibling Native Token".into(), - symbol: "SBLNG".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1_000_000_000_000, location: Some(VersionedMultiLocation::V3(asset_location)), additional: CustomMetadata { @@ -8125,10 +8069,10 @@ mod centrifuge { general_key("0x02f3a00dd12f644daec907013b16eb6d14bf1c4cb4".as_bytes()), ), ); - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 6, - name: "Wormhole USDC".into(), - symbol: "WUSDC".into(), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 1, location: Some(VersionedMultiLocation::V3(asset_location)), additional: CustomMetadata { diff --git a/runtime/integration-tests/src/generic/cases/loans.rs b/runtime/integration-tests/src/generic/cases/loans.rs index e28a4224cd..1bc33b5d1b 100644 --- a/runtime/integration-tests/src/generic/cases/loans.rs +++ b/runtime/integration-tests/src/generic/cases/loans.rs @@ -71,10 +71,12 @@ mod common { pub fn initialize_state_for_loans, T: Runtime>() -> E { let mut env = E::from_parachain_storage( - Genesis::::default() - .add(genesis::balances(T::ExistentialDeposit::get() + FOR_FEES)) - .add(genesis::assets(vec![Box::new(Usd6)])) - .add(genesis::tokens(vec![(Usd6.id(), Usd6.ed())])) + Genesis::default() + .add(genesis::balances::( + T::ExistentialDeposit::get() + FOR_FEES, + )) + .add(genesis::assets::(vec![Box::new(Usd6)])) + .add(genesis::tokens::(vec![(Usd6.id(), Usd6.ed())])) .storage(), ); diff --git a/runtime/integration-tests/src/generic/cases/proxy.rs b/runtime/integration-tests/src/generic/cases/proxy.rs index 89380d25d6..a606944618 100644 --- a/runtime/integration-tests/src/generic/cases/proxy.rs +++ b/runtime/integration-tests/src/generic/cases/proxy.rs @@ -36,9 +36,11 @@ const TRANSFER_AMOUNT: Balance = usd6(100); fn configure_proxy_and_transfer(proxy_type: T::ProxyType) -> DispatchResult { let env = RuntimeEnv::::from_parachain_storage( - Genesis::::default() - .add(genesis::balances(T::ExistentialDeposit::get() + FOR_FEES)) - .add(genesis::tokens(vec![(Usd6.id(), Usd6.ed())])) + Genesis::default() + .add(genesis::balances::( + T::ExistentialDeposit::get() + FOR_FEES, + )) + .add(genesis::tokens::(vec![(Usd6.id(), Usd6.ed())])) .storage(), ); @@ -60,7 +62,7 @@ fn configure_proxy_and_x_transfer( .add(genesis::balances::( T::ExistentialDeposit::get() + FOR_FEES, )) - .add(genesis::tokens(vec![(Usd6.id(), Usd6.ed())])) + .add(genesis::tokens::(vec![(Usd6.id(), Usd6.ed())])) .storage(), ); diff --git a/runtime/integration-tests/src/generic/config.rs b/runtime/integration-tests/src/generic/config.rs index 98a1c87cae..bb7f04a343 100644 --- a/runtime/integration-tests/src/generic/config.rs +++ b/runtime/integration-tests/src/generic/config.rs @@ -162,7 +162,7 @@ pub trait Runtime: FixedI128, SingleCurrencyMovement, >, - > + > + polkadot_runtime_parachains::paras::Config { /// Just the RuntimeCall type, but redefined with extra bounds. /// You can add `From` bounds in order to convert pallet calls to diff --git a/runtime/integration-tests/src/utils/env.rs b/runtime/integration-tests/src/utils/env.rs index 753933079e..59f89635dd 100644 --- a/runtime/integration-tests/src/utils/env.rs +++ b/runtime/integration-tests/src/utils/env.rs @@ -802,11 +802,11 @@ fn test_env( ); state.insert_storage( - frame_system::GenesisConfig { + frame_system::GenesisConfig:: { code: RelayCode.expect("ESSENTIAL: Relay WASM is some.").to_vec(), _config: Default::default(), } - .build_storage::() + .build_storage() .expect("ESSENTIAL: Frame System GenesisBuild must not fail at this stage."), ); @@ -893,8 +893,8 @@ fn test_env( fn get_parachain_builder( handle: Handle, inherent_builder: InherentBuilder< - TFullClient, TFullBackend, + TFullClient, >, para_id: u32, centrifuge_storage: Option, @@ -908,12 +908,13 @@ fn get_parachain_builder( .expect("ESSENTIAL: State provider can be created."); state.insert_storage( - frame_system::GenesisConfig { + frame_system::GenesisConfig:: { code: CentrifugeCode .expect("ESSENTIAL: Centrifuge WASM is some.") .to_vec(), + _config: Default::default(), } - .build_storage::() + .build_storage() .expect("ESSENTIAL: Frame System GenesisBuild must not fail at this stage."), ); state.insert_storage( @@ -924,7 +925,7 @@ fn get_parachain_builder( .expect("ESSENTIAL: Pallet Aura GenesisBuild must not fail at this stage."), ); state.insert_storage( - parachain_info::GenesisConfig { + parachain_info::GenesisConfig:: { _config: Default::default(), parachain_id: ParaId::from(para_id), } diff --git a/runtime/integration-tests/src/utils/evm.rs b/runtime/integration-tests/src/utils/evm.rs index 57bccefb0d..5300a234bd 100644 --- a/runtime/integration-tests/src/utils/evm.rs +++ b/runtime/integration-tests/src/utils/evm.rs @@ -13,7 +13,7 @@ use frame_support::{dispatch::RawOrigin, traits::fungible::Mutate}; use fudge::primitives::Chain; use pallet_evm::FeeCalculator; -use runtime_common::account_conversion::AccountConverter; +use runtime_common::account_conversion::{convert_evm_address, AccountConverter}; use sp_core::{Get, H160, U256}; use crate::{ @@ -28,8 +28,7 @@ pub fn mint_balance_into_derived_account(env: &mut TestEnv, address: H160, balan }) .unwrap(); - let derived_account = - AccountConverter::::convert_evm_address(chain_id, address.to_fixed_bytes()); + let derived_account = convert_evm_address(chain_id, address.to_fixed_bytes()); env.with_mut_state(Chain::Para(PARA_ID), || { Balances::mint_into(&derived_account.into(), balance).unwrap() @@ -44,8 +43,7 @@ pub fn deploy_contract(env: &mut TestEnv, address: H160, code: Vec) { }) .unwrap(); - let derived_address = - AccountConverter::::convert_evm_address(chain_id, address.to_fixed_bytes()); + let derived_address = convert_evm_address(chain_id, address.to_fixed_bytes()); let transaction_create_cost = env .with_state(Chain::Para(PARA_ID), || { diff --git a/runtime/integration-tests/src/utils/genesis.rs b/runtime/integration-tests/src/utils/genesis.rs index 9d5993920f..03d205c251 100644 --- a/runtime/integration-tests/src/utils/genesis.rs +++ b/runtime/integration-tests/src/utils/genesis.rs @@ -10,7 +10,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -//! Utilitites around populating a genesis storage +//! Utilities around populating a genesis storage use cfg_types::{ fixed_point::Rate, tokens::{CurrencyId, CustomMetadata}, @@ -145,10 +145,8 @@ where orml_asset_registry::Pallet::::do_register_asset( orml_asset_registry::AssetMetadata { decimals: 18, - name: BoundedVec::::try_from("mock_name".as_bytes()) - .expect("Can create bounded vec for token name"), - symbol: BoundedVec::::try_from("mock_symbol") - .expect("Can create bounded vec for token symbol"), + name: BoundedVec::default(), + symbol: BoundedVec::default(), existential_deposit: 0u128.into(), location: None, additional: CustomMetadata { From dce24dc90c9350000b06587b7de809ce7781c16f Mon Sep 17 00:00:00 2001 From: cdamian <17934949+cdamian@users.noreply.github.com> Date: Wed, 27 Mar 2024 16:40:04 +0200 Subject: [PATCH 4/6] runtime: Enable multilocation convert for CurrencyIdConvert --- runtime/common/src/xcm.rs | 6 ++---- .../src/generic/cases/liquidity_pools.rs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/runtime/common/src/xcm.rs b/runtime/common/src/xcm.rs index 31cefcc725..dd838647b6 100644 --- a/runtime/common/src/xcm.rs +++ b/runtime/common/src/xcm.rs @@ -198,10 +198,9 @@ where } } -/* /// Convert an incoming `MultiLocation` into a `CurrencyId` through a /// reverse-lookup using the AssetRegistry. In the registry, we register CFG -/// using its absolute, non-anchored MultliLocation so we need to unanchor the +/// using its absolute, non-anchored MultiLocation so we need to unanchor the /// input location for Centrifuge-native assets for that to work. impl Convert> for CurrencyIdConvert where @@ -209,10 +208,9 @@ where + parachain_info::Config, { fn convert(location: MultiLocation) -> Option { - >::convert(location) + >::convert(&location) } } -*/ impl Convert> for CurrencyIdConvert where diff --git a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs index 6dc2ee7f42..299b2e785c 100644 --- a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs +++ b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs @@ -6152,7 +6152,7 @@ mod altair { assert_eq!( >::convert(air_location_inner), - Ok(CurrencyId::Native), + Some(CurrencyId::Native), ); // The canonical way AIR is represented out in the wild @@ -6194,7 +6194,7 @@ mod altair { env.parachain_state_mut(|| { assert_eq!( >::convert(tranche_multilocation), - Err(tranche_multilocation), + None, ); }); @@ -6224,7 +6224,7 @@ mod altair { assert_eq!( >::convert(ausd_location.clone()), - Ok(AUSD_CURRENCY_ID), + Some(AUSD_CURRENCY_ID), ); assert_eq!( @@ -6244,7 +6244,7 @@ mod altair { assert_eq!( >::convert(ksm_location), - Ok(KSM_ASSET_ID), + Some(KSM_ASSET_ID), ); assert_eq!( @@ -6263,7 +6263,7 @@ mod altair { ); env.parachain_state_mut(|| { - assert!(>::convert(unknown_location).is_err()); + assert!(>::convert(unknown_location).is_none()); }); } @@ -6689,7 +6689,7 @@ mod centrifuge { assert_eq!( >::convert(cfg_location_inner), - Ok(CurrencyId::Native), + Some(CurrencyId::Native), ); // The canonical way CFG is represented out in the wild @@ -6728,7 +6728,7 @@ mod centrifuge { assert_eq!( >::convert(cfg_location_inner), - Ok(CurrencyId::Native), + Some(CurrencyId::Native), ); // The canonical way CFG is represented out in the wild @@ -6772,7 +6772,7 @@ mod centrifuge { assert_eq!( >::convert(dot_location), - Ok(DOT_ASSET_ID), + Some(DOT_ASSET_ID), ); assert_eq!( @@ -6794,7 +6794,7 @@ mod centrifuge { ); env.parachain_state_mut(|| { - assert!(>::convert(unknown_location).is_err()); + assert!(>::convert(unknown_location).is_none()); }); } From e38468991ab22a89f4979d6059285e3b1b5fe534 Mon Sep 17 00:00:00 2001 From: cdamian <17934949+cdamian@users.noreply.github.com> Date: Thu, 28 Mar 2024 13:53:35 +0200 Subject: [PATCH 5/6] runtime: Remove extra paras pallets --- Cargo.lock | 3 - runtime/altair/Cargo.toml | 1 - runtime/altair/src/lib.rs | 24 -------- runtime/altair/src/weights/mod.rs | 2 - .../src/weights/pallet_parachains_config.rs | 36 ------------ .../src/weights/pallet_parachains_paras.rs | 58 ------------------- runtime/centrifuge/Cargo.toml | 1 - runtime/centrifuge/src/lib.rs | 24 -------- runtime/centrifuge/src/weights/mod.rs | 2 - .../src/weights/pallet_parachains_config.rs | 36 ------------ .../src/weights/pallet_parachains_paras.rs | 58 ------------------- runtime/development/Cargo.toml | 1 - runtime/development/src/lib.rs | 24 -------- runtime/development/src/weights/mod.rs | 2 - .../src/weights/pallet_parachains_config.rs | 36 ------------ .../src/weights/pallet_parachains_paras.rs | 58 ------------------- .../src/generic/cases/account_derivation.rs | 5 +- .../src/generic/cases/liquidity_pools.rs | 2 +- .../integration-tests/src/generic/config.rs | 2 +- runtime/integration-tests/src/generic/mod.rs | 1 + 20 files changed, 4 insertions(+), 372 deletions(-) delete mode 100644 runtime/altair/src/weights/pallet_parachains_config.rs delete mode 100644 runtime/altair/src/weights/pallet_parachains_paras.rs delete mode 100644 runtime/centrifuge/src/weights/pallet_parachains_config.rs delete mode 100644 runtime/centrifuge/src/weights/pallet_parachains_paras.rs delete mode 100644 runtime/development/src/weights/pallet_parachains_config.rs delete mode 100644 runtime/development/src/weights/pallet_parachains_paras.rs diff --git a/Cargo.lock b/Cargo.lock index a71a3c777e..8f485cc94c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -213,7 +213,6 @@ dependencies = [ "parity-scale-codec 3.6.9", "polkadot-parachain-primitives", "polkadot-runtime-common", - "polkadot-runtime-parachains", "runtime-common", "scale-info", "serde", @@ -1226,7 +1225,6 @@ dependencies = [ "parity-scale-codec 3.6.9", "polkadot-parachain-primitives", "polkadot-runtime-common", - "polkadot-runtime-parachains", "runtime-common", "scale-info", "serde", @@ -2436,7 +2434,6 @@ dependencies = [ "parity-scale-codec 3.6.9", "polkadot-parachain-primitives", "polkadot-runtime-common", - "polkadot-runtime-parachains", "runtime-common", "scale-info", "serde", diff --git a/runtime/altair/Cargo.toml b/runtime/altair/Cargo.toml index 80d3b36463..628d3fbaae 100644 --- a/runtime/altair/Cargo.toml +++ b/runtime/altair/Cargo.toml @@ -49,7 +49,6 @@ cumulus-primitives-utility = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } polkadot-parachain-primitives = { workspace = true } polkadot-runtime-common = { workspace = true } -polkadot-runtime-parachains = { workspace = true } staging-xcm = { workspace = true } staging-xcm-builder = { workspace = true } diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index d5f1764347..e2e30ff5d3 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -1906,29 +1906,6 @@ impl axelar_gateway_precompile::Config for Runtime { type WeightInfo = (); } -impl polkadot_runtime_parachains::configuration::Config for Runtime { - type WeightInfo = weights::pallet_parachains_config::WeightInfo; -} - -impl polkadot_runtime_parachains::shared::Config for Runtime {} - -impl SendTransactionTypes for Runtime -where - RuntimeCall: From, -{ - type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = RuntimeCall; -} - -impl polkadot_runtime_parachains::paras::Config for Runtime { - type NextSessionRotation = pallet_session::PeriodicSessions; - type OnNewHead = (); - type QueueFootprinter = (); - type RuntimeEvent = RuntimeEvent; - type UnsignedPriority = (); - type WeightInfo = weights::pallet_parachains_paras::WeightInfo; -} - /// Block type as expected by this runtime. pub type Block = generic::Block; /// A Block signed with a Justification @@ -2001,7 +1978,6 @@ construct_runtime!( Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 69, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 70, Uniques: pallet_uniques::{Pallet, Call, Storage, Event} = 72, - Paras: polkadot_runtime_parachains::paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 73, // our pallets (part 1) Fees: pallet_fees::{Pallet, Call, Storage, Config, Event} = 90, diff --git a/runtime/altair/src/weights/mod.rs b/runtime/altair/src/weights/mod.rs index 37a4f68070..5f02a62635 100644 --- a/runtime/altair/src/weights/mod.rs +++ b/runtime/altair/src/weights/mod.rs @@ -32,8 +32,6 @@ pub mod pallet_multisig; pub mod pallet_oracle_collection; pub mod pallet_oracle_feed; pub mod pallet_order_book; -pub mod pallet_parachains_config; -pub mod pallet_parachains_paras; pub mod pallet_permissions; pub mod pallet_pool_fees; pub mod pallet_pool_registry; diff --git a/runtime/altair/src/weights/pallet_parachains_config.rs b/runtime/altair/src/weights/pallet_parachains_config.rs deleted file mode 100644 index dbea9bc012..0000000000 --- a/runtime/altair/src/weights/pallet_parachains_config.rs +++ /dev/null @@ -1,36 +0,0 @@ -use core::marker::PhantomData; - -use frame_support::weights::Weight; - -pub struct WeightInfo(PhantomData); -impl polkadot_runtime_parachains::configuration::WeightInfo - for WeightInfo -{ - fn set_config_with_block_number() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_u32() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_option_u32() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_balance() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_hrmp_open_request_ttl() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_executor_params() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_perbill() -> Weight { - Weight::from_parts(100_000_000, 0) - } -} diff --git a/runtime/altair/src/weights/pallet_parachains_paras.rs b/runtime/altair/src/weights/pallet_parachains_paras.rs deleted file mode 100644 index 331e68aa86..0000000000 --- a/runtime/altair/src/weights/pallet_parachains_paras.rs +++ /dev/null @@ -1,58 +0,0 @@ -use core::marker::PhantomData; - -use frame_support::weights::Weight; - -pub struct WeightInfo(PhantomData); -impl polkadot_runtime_parachains::paras::WeightInfo for WeightInfo { - fn force_set_current_code(c: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_set_current_head(s: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_set_most_recent_context() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_schedule_code_upgrade(c: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_note_new_head(s: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_queue_action() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn add_trusted_validation_code(c: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn poke_unused_validation_code() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement() -> Weight { - Weight::from_parts(100_000_000, 0) - } -} diff --git a/runtime/centrifuge/Cargo.toml b/runtime/centrifuge/Cargo.toml index 67327ed8f5..f8490daba5 100644 --- a/runtime/centrifuge/Cargo.toml +++ b/runtime/centrifuge/Cargo.toml @@ -49,7 +49,6 @@ cumulus-primitives-utility = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } polkadot-parachain-primitives = { workspace = true } polkadot-runtime-common = { workspace = true } -polkadot-runtime-parachains = { workspace = true } staging-xcm = { workspace = true } staging-xcm-builder = { workspace = true } diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index e8f8263130..425ed959dd 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -2020,29 +2020,6 @@ impl axelar_gateway_precompile::Config for Runtime { type WeightInfo = (); } -impl polkadot_runtime_parachains::configuration::Config for Runtime { - type WeightInfo = weights::pallet_parachains_config::WeightInfo; -} - -impl polkadot_runtime_parachains::shared::Config for Runtime {} - -impl SendTransactionTypes for Runtime -where - RuntimeCall: From, -{ - type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = RuntimeCall; -} - -impl polkadot_runtime_parachains::paras::Config for Runtime { - type NextSessionRotation = pallet_session::PeriodicSessions; - type OnNewHead = (); - type QueueFootprinter = (); - type RuntimeEvent = RuntimeEvent; - type UnsignedPriority = (); - type WeightInfo = weights::pallet_parachains_paras::WeightInfo; -} - /// Block type as expected by this runtime. pub type Block = generic::Block; /// A Block signed with a Justification @@ -2113,7 +2090,6 @@ construct_runtime!( Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config} = 68, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 69, Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 70, - Paras: polkadot_runtime_parachains::paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 72, // our pallets Fees: pallet_fees::{Pallet, Call, Storage, Config, Event} = 90, diff --git a/runtime/centrifuge/src/weights/mod.rs b/runtime/centrifuge/src/weights/mod.rs index 37a4f68070..5f02a62635 100644 --- a/runtime/centrifuge/src/weights/mod.rs +++ b/runtime/centrifuge/src/weights/mod.rs @@ -32,8 +32,6 @@ pub mod pallet_multisig; pub mod pallet_oracle_collection; pub mod pallet_oracle_feed; pub mod pallet_order_book; -pub mod pallet_parachains_config; -pub mod pallet_parachains_paras; pub mod pallet_permissions; pub mod pallet_pool_fees; pub mod pallet_pool_registry; diff --git a/runtime/centrifuge/src/weights/pallet_parachains_config.rs b/runtime/centrifuge/src/weights/pallet_parachains_config.rs deleted file mode 100644 index dbea9bc012..0000000000 --- a/runtime/centrifuge/src/weights/pallet_parachains_config.rs +++ /dev/null @@ -1,36 +0,0 @@ -use core::marker::PhantomData; - -use frame_support::weights::Weight; - -pub struct WeightInfo(PhantomData); -impl polkadot_runtime_parachains::configuration::WeightInfo - for WeightInfo -{ - fn set_config_with_block_number() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_u32() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_option_u32() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_balance() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_hrmp_open_request_ttl() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_executor_params() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_perbill() -> Weight { - Weight::from_parts(100_000_000, 0) - } -} diff --git a/runtime/centrifuge/src/weights/pallet_parachains_paras.rs b/runtime/centrifuge/src/weights/pallet_parachains_paras.rs deleted file mode 100644 index 331e68aa86..0000000000 --- a/runtime/centrifuge/src/weights/pallet_parachains_paras.rs +++ /dev/null @@ -1,58 +0,0 @@ -use core::marker::PhantomData; - -use frame_support::weights::Weight; - -pub struct WeightInfo(PhantomData); -impl polkadot_runtime_parachains::paras::WeightInfo for WeightInfo { - fn force_set_current_code(c: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_set_current_head(s: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_set_most_recent_context() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_schedule_code_upgrade(c: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_note_new_head(s: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_queue_action() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn add_trusted_validation_code(c: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn poke_unused_validation_code() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement() -> Weight { - Weight::from_parts(100_000_000, 0) - } -} diff --git a/runtime/development/Cargo.toml b/runtime/development/Cargo.toml index 02c54f205c..62f82a6595 100644 --- a/runtime/development/Cargo.toml +++ b/runtime/development/Cargo.toml @@ -48,7 +48,6 @@ cumulus-primitives-utility = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } polkadot-parachain-primitives = { workspace = true } polkadot-runtime-common = { workspace = true } -polkadot-runtime-parachains = { workspace = true } staging-xcm = { workspace = true } staging-xcm-builder = { workspace = true } diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index 7f11b22f77..c1d24e1eb7 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -1998,29 +1998,6 @@ impl axelar_gateway_precompile::Config for Runtime { type WeightInfo = (); } -impl polkadot_runtime_parachains::configuration::Config for Runtime { - type WeightInfo = weights::pallet_parachains_config::WeightInfo; -} - -impl polkadot_runtime_parachains::shared::Config for Runtime {} - -impl SendTransactionTypes for Runtime -where - RuntimeCall: From, -{ - type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = RuntimeCall; -} - -impl polkadot_runtime_parachains::paras::Config for Runtime { - type NextSessionRotation = pallet_session::PeriodicSessions; - type OnNewHead = (); - type QueueFootprinter = (); - type RuntimeEvent = RuntimeEvent; - type UnsignedPriority = (); - type WeightInfo = weights::pallet_parachains_paras::WeightInfo; -} - /// Block type as expected by this runtime. pub type Block = generic::Block; /// A Block signed with a Justification @@ -2092,7 +2069,6 @@ construct_runtime!( Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 69, Uniques: pallet_uniques::{Pallet, Call, Storage, Event} = 70, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 72, - Paras: polkadot_runtime_parachains::paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 73, // our pallets part 1 Fees: pallet_fees::{Pallet, Call, Storage, Config, Event} = 90, diff --git a/runtime/development/src/weights/mod.rs b/runtime/development/src/weights/mod.rs index ef0ec5bf68..d2e6fc44bb 100644 --- a/runtime/development/src/weights/mod.rs +++ b/runtime/development/src/weights/mod.rs @@ -31,8 +31,6 @@ pub mod pallet_multisig; pub mod pallet_oracle_collection; pub mod pallet_oracle_feed; pub mod pallet_order_book; -pub mod pallet_parachains_config; -pub mod pallet_parachains_paras; pub mod pallet_permissions; pub mod pallet_pool_fees; pub mod pallet_pool_registry; diff --git a/runtime/development/src/weights/pallet_parachains_config.rs b/runtime/development/src/weights/pallet_parachains_config.rs deleted file mode 100644 index bccb374cc3..0000000000 --- a/runtime/development/src/weights/pallet_parachains_config.rs +++ /dev/null @@ -1,36 +0,0 @@ -use core::marker::PhantomData; - -use pallet_order_book::weights::Weight; - -pub struct WeightInfo(PhantomData); -impl polkadot_runtime_parachains::configuration::WeightInfo - for WeightInfo -{ - fn set_config_with_block_number() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_u32() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_option_u32() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_balance() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_hrmp_open_request_ttl() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_executor_params() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn set_config_with_perbill() -> Weight { - Weight::from_parts(100_000_000, 0) - } -} diff --git a/runtime/development/src/weights/pallet_parachains_paras.rs b/runtime/development/src/weights/pallet_parachains_paras.rs deleted file mode 100644 index 331e68aa86..0000000000 --- a/runtime/development/src/weights/pallet_parachains_paras.rs +++ /dev/null @@ -1,58 +0,0 @@ -use core::marker::PhantomData; - -use frame_support::weights::Weight; - -pub struct WeightInfo(PhantomData); -impl polkadot_runtime_parachains::paras::WeightInfo for WeightInfo { - fn force_set_current_code(c: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_set_current_head(s: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_set_most_recent_context() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_schedule_code_upgrade(c: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_note_new_head(s: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn force_queue_action() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn add_trusted_validation_code(c: u32) -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn poke_unused_validation_code() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_upgrade_accept() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_upgrade_reject() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_onboarding_accept() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement_finalize_onboarding_reject() -> Weight { - Weight::from_parts(100_000_000, 0) - } - - fn include_pvf_check_statement() -> Weight { - Weight::from_parts(100_000_000, 0) - } -} diff --git a/runtime/integration-tests/src/generic/cases/account_derivation.rs b/runtime/integration-tests/src/generic/cases/account_derivation.rs index 80dec7f78a..3ad950f10f 100644 --- a/runtime/integration-tests/src/generic/cases/account_derivation.rs +++ b/runtime/integration-tests/src/generic/cases/account_derivation.rs @@ -188,10 +188,7 @@ fn remote_account_on_relay() { AccountId32 { id: KEY_32, network: Some(NetworkId::ByGenesis( - frame_system::BlockHash::::get( - <::Header as HeaderT>::Number::zero(), - ) - .0, + frame_system::BlockHash::::get::(Zero::zero()).0, )), }, ), diff --git a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs index 299b2e785c..a11efab847 100644 --- a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs +++ b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs @@ -7313,7 +7313,7 @@ mod centrifuge { fn restrict_usdc_xcm_transfer() { let mut env = FudgeEnv::::from_storage( - paras::GenesisConfig:: { + paras::GenesisConfig::> { _config: Default::default(), paras: vec![( 1000.into(), diff --git a/runtime/integration-tests/src/generic/config.rs b/runtime/integration-tests/src/generic/config.rs index bb7f04a343..98a1c87cae 100644 --- a/runtime/integration-tests/src/generic/config.rs +++ b/runtime/integration-tests/src/generic/config.rs @@ -162,7 +162,7 @@ pub trait Runtime: FixedI128, SingleCurrencyMovement, >, - > + polkadot_runtime_parachains::paras::Config + > { /// Just the RuntimeCall type, but redefined with extra bounds. /// You can add `From` bounds in order to convert pallet calls to diff --git a/runtime/integration-tests/src/generic/mod.rs b/runtime/integration-tests/src/generic/mod.rs index fb0fe1c517..5e0b2a3cdd 100644 --- a/runtime/integration-tests/src/generic/mod.rs +++ b/runtime/integration-tests/src/generic/mod.rs @@ -22,6 +22,7 @@ mod cases { mod oracles; mod proxy; mod restricted_transfers; + mod rewards; } /// Generate tests for the specified runtimes or all runtimes. From f954aa1811d5049b9e97ef38b4e368a824aa0e48 Mon Sep 17 00:00:00 2001 From: cdamian <17934949+cdamian@users.noreply.github.com> Date: Fri, 29 Mar 2024 01:29:12 +0200 Subject: [PATCH 6/6] integration-tests: Update expected balances --- runtime/altair/src/lib.rs | 1 - runtime/centrifuge/src/lib.rs | 1 - runtime/development/src/lib.rs | 1 - .../src/generic/cases/liquidity_pools.rs | 16 +++++++--------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index e2e30ff5d3..c6786c2626 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -63,7 +63,6 @@ use frame_support::{ }; use frame_system::{ limits::{BlockLength, BlockWeights}, - offchain::SendTransactionTypes, EnsureRoot, EnsureSigned, }; use orml_traits::currency::MutationHooks; diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 425ed959dd..e9f29bbccf 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -64,7 +64,6 @@ use frame_support::{ }; use frame_system::{ limits::{BlockLength, BlockWeights}, - offchain::SendTransactionTypes, EnsureRoot, EnsureSigned, }; use orml_traits::currency::MutationHooks; diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index c1d24e1eb7..f0ae47e34a 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -69,7 +69,6 @@ use frame_support::{ }; use frame_system::{ limits::{BlockLength, BlockWeights}, - offchain::SendTransactionTypes, EnsureRoot, EnsureSigned, }; use orml_traits::currency::MutationHooks; diff --git a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs index a11efab847..d9b03ca415 100644 --- a/runtime/integration-tests/src/generic/cases/liquidity_pools.rs +++ b/runtime/integration-tests/src/generic/cases/liquidity_pools.rs @@ -265,8 +265,6 @@ type FudgeRelayRuntime = <::FudgeHandle as FudgeHandle> use utils::*; mod development { - use development_runtime::xcm::LocationToAccountId; - use super::*; pub const GLMR_CURRENCY_ID: CurrencyId = CurrencyId::ForeignAsset(4); @@ -4656,7 +4654,7 @@ mod development { assert_eq!(current_balance, transfer_amount - fee(18)); // Sanity check for the actual amount Keyring::Bob ends up with - assert_eq!(current_balance, 4992960800000000000); + assert_eq!(current_balance, 4993570400000000000); }); } @@ -5514,7 +5512,7 @@ mod altair { assert_eq!(current_balance, transfer_amount - fee(18)); // Sanity check for the actual amount Keyring::Bob ends up with - assert_eq!(current_balance, 4992960800000000000); + assert_eq!(current_balance, 4993570400000000000); }); } @@ -5750,7 +5748,7 @@ mod altair { env.parachain_state(|| { assert_eq!( orml_tokens::Pallet::::free_balance(currency_id, &Keyring::Bob.into()), - transfer_amount - fee(meta.decimals) + 1991963000000 ); }); } @@ -6024,7 +6022,7 @@ mod altair { orml_tokens::Pallet::::free_balance(usdc_asset_id, &Keyring::Bob.into()); // Sanity check to ensure the calculated is what is expected - assert_eq!(bob_balance, 11992961); + assert_eq!(bob_balance, 11993571); }); } @@ -6563,7 +6561,7 @@ mod centrifuge { env.parachain_state(|| { assert_eq!( orml_tokens::Pallet::::free_balance(DOT_ASSET_ID, &Keyring::Alice.into()), - transfer_amount - dot_fee() + 29919630000 ); }); } @@ -7714,7 +7712,7 @@ mod centrifuge { assert_eq!(current_balance, transfer_amount - fee(18)); // Sanity check for the actual amount Keyring::Bob ends up with - assert_eq!(current_balance, 4992960800000000000); + assert_eq!(current_balance, 4993570400000000000); }); } @@ -8146,7 +8144,7 @@ mod centrifuge { orml_tokens::Pallet::::free_balance(usdc_asset_id, &Keyring::Bob.into()); // Sanity check to ensure the calculated is what is expected - assert_eq!(bob_balance, 11992961); + assert_eq!(bob_balance, 11993571); }); }