diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs index 01de6b0317e3..94b2a2e423a3 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs @@ -1356,115 +1356,6 @@ fn change_xcm_bridge_hub_ethereum_base_fee_by_governance_works() { ) } -#[test] -fn location_conversion_works() { - // the purpose of hardcoded values is to catch an unintended location conversion logic change. - struct TestCase { - description: &'static str, - location: Location, - expected_account_id_str: &'static str, - } - - let test_cases = vec![ - // DescribeTerminus - TestCase { - description: "DescribeTerminus Parent", - location: Location::new(1, Here), - expected_account_id_str: "5Dt6dpkWPwLaH4BBCKJwjiWrFVAGyYk3tLUabvyn4v7KtESG", - }, - TestCase { - description: "DescribeTerminus Sibling", - location: Location::new(1, [Parachain(1111)]), - expected_account_id_str: "5Eg2fnssmmJnF3z1iZ1NouAuzciDaaDQH7qURAy3w15jULDk", - }, - // DescribePalletTerminal - TestCase { - description: "DescribePalletTerminal Parent", - location: Location::new(1, [PalletInstance(50)]), - expected_account_id_str: "5CnwemvaAXkWFVwibiCvf2EjqwiqBi29S5cLLydZLEaEw6jZ", - }, - TestCase { - description: "DescribePalletTerminal Sibling", - location: Location::new(1, [Parachain(1111), PalletInstance(50)]), - expected_account_id_str: "5GFBgPjpEQPdaxEnFirUoa51u5erVx84twYxJVuBRAT2UP2g", - }, - // DescribeAccountId32Terminal - TestCase { - description: "DescribeAccountId32Terminal Parent", - location: Location::new( - 1, - [AccountId32 { network: None, id: AccountId::from(ALICE).into() }], - ), - expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", - }, - TestCase { - description: "DescribeAccountId32Terminal Sibling", - location: Location::new( - 1, - [ - Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, - ], - ), - expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", - }, - // DescribeAccountKey20Terminal - TestCase { - description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", - }, - TestCase { - description: "DescribeAccountKey20Terminal Sibling", - location: Location::new( - 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], - ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", - }, - // DescribeTreasuryVoiceTerminal - TestCase { - description: "DescribeTreasuryVoiceTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Treasury, part: BodyPart::Voice }]), - expected_account_id_str: "5CUjnE2vgcUCuhxPwFoQ5r7p1DkhujgvMNDHaF2bLqRp4D5F", - }, - TestCase { - description: "DescribeTreasuryVoiceTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Treasury, part: BodyPart::Voice }], - ), - expected_account_id_str: "5G6TDwaVgbWmhqRUKjBhRRnH4ry9L9cjRymUEmiRsLbSE4gB", - }, - // DescribeBodyTerminal - TestCase { - description: "DescribeBodyTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Unit, part: BodyPart::Voice }]), - expected_account_id_str: "5EBRMTBkDisEXsaN283SRbzx9Xf2PXwUxxFCJohSGo4jYe6B", - }, - TestCase { - description: "DescribeBodyTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Unit, part: BodyPart::Voice }], - ), - expected_account_id_str: "5DBoExvojy8tYnHgLL97phNH975CyT45PWTZEeGoBZfAyRMH", - }, - ]; - - for tc in test_cases { - let expected = - AccountId::from_string(tc.expected_account_id_str).expect("Invalid AccountId string"); - - let got = LocationToAccountHelper::::convert_location( - tc.location.into(), - ) - .unwrap(); - - assert_eq!(got, expected, "{}", tc.description); - } -} - #[test] fn xcm_payment_api_works() { parachains_runtimes_test_utils::test_cases::xcm_payment_api_with_native_token_works::< diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs index 9ba342e8837a..16bb3cecb690 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs @@ -1330,115 +1330,6 @@ fn reserve_transfer_native_asset_to_non_teleport_para_works() { ); } -#[test] -fn location_conversion_works() { - // the purpose of hardcoded values is to catch an unintended location conversion logic change. - struct TestCase { - description: &'static str, - location: Location, - expected_account_id_str: &'static str, - } - - let test_cases = vec![ - // DescribeTerminus - TestCase { - description: "DescribeTerminus Parent", - location: Location::new(1, Here), - expected_account_id_str: "5Dt6dpkWPwLaH4BBCKJwjiWrFVAGyYk3tLUabvyn4v7KtESG", - }, - TestCase { - description: "DescribeTerminus Sibling", - location: Location::new(1, [Parachain(1111)]), - expected_account_id_str: "5Eg2fnssmmJnF3z1iZ1NouAuzciDaaDQH7qURAy3w15jULDk", - }, - // DescribePalletTerminal - TestCase { - description: "DescribePalletTerminal Parent", - location: Location::new(1, [PalletInstance(50)]), - expected_account_id_str: "5CnwemvaAXkWFVwibiCvf2EjqwiqBi29S5cLLydZLEaEw6jZ", - }, - TestCase { - description: "DescribePalletTerminal Sibling", - location: Location::new(1, [Parachain(1111), PalletInstance(50)]), - expected_account_id_str: "5GFBgPjpEQPdaxEnFirUoa51u5erVx84twYxJVuBRAT2UP2g", - }, - // DescribeAccountId32Terminal - TestCase { - description: "DescribeAccountId32Terminal Parent", - location: Location::new( - 1, - [AccountId32 { network: None, id: AccountId::from(ALICE).into() }], - ), - expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", - }, - TestCase { - description: "DescribeAccountId32Terminal Sibling", - location: Location::new( - 1, - [ - Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, - ], - ), - expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", - }, - // DescribeAccountKey20Terminal - TestCase { - description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", - }, - TestCase { - description: "DescribeAccountKey20Terminal Sibling", - location: Location::new( - 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], - ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", - }, - // DescribeTreasuryVoiceTerminal - TestCase { - description: "DescribeTreasuryVoiceTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Treasury, part: BodyPart::Voice }]), - expected_account_id_str: "5CUjnE2vgcUCuhxPwFoQ5r7p1DkhujgvMNDHaF2bLqRp4D5F", - }, - TestCase { - description: "DescribeTreasuryVoiceTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Treasury, part: BodyPart::Voice }], - ), - expected_account_id_str: "5G6TDwaVgbWmhqRUKjBhRRnH4ry9L9cjRymUEmiRsLbSE4gB", - }, - // DescribeBodyTerminal - TestCase { - description: "DescribeBodyTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Unit, part: BodyPart::Voice }]), - expected_account_id_str: "5EBRMTBkDisEXsaN283SRbzx9Xf2PXwUxxFCJohSGo4jYe6B", - }, - TestCase { - description: "DescribeBodyTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Unit, part: BodyPart::Voice }], - ), - expected_account_id_str: "5DBoExvojy8tYnHgLL97phNH975CyT45PWTZEeGoBZfAyRMH", - }, - ]; - - for tc in test_cases { - let expected = - AccountId::from_string(tc.expected_account_id_str).expect("Invalid AccountId string"); - - let got = LocationToAccountHelper::::convert_location( - tc.location.into(), - ) - .unwrap(); - - assert_eq!(got, expected, "{}", tc.description); - } -} - #[test] fn xcm_payment_api_works() { parachains_runtimes_test_utils::test_cases::xcm_payment_api_with_native_token_works::< diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs index 29db12ab8b95..386ec65ac3d0 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs @@ -720,137 +720,6 @@ mod bridge_hub_bulletin_tests { } } -#[test] -fn change_required_stake_by_governance_works() { - bridge_hub_test_utils::test_cases::change_storage_constant_by_governance_works::< - Runtime, - bridge_common_config::RequiredStakeForStakeAndSlash, - Balance, - >( - collator_session_keys(), - bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, - Box::new(|call| RuntimeCall::System(call).encode()), - || { - ( - bridge_common_config::RequiredStakeForStakeAndSlash::key().to_vec(), - bridge_common_config::RequiredStakeForStakeAndSlash::get(), - ) - }, - |old_value| old_value.checked_mul(2).unwrap(), - ) -} - -#[test] -fn location_conversion_works() { - // the purpose of hardcoded values is to catch an unintended location conversion logic - // change. - struct TestCase { - description: &'static str, - location: Location, - expected_account_id_str: &'static str, - } - - let test_cases = vec![ - // DescribeTerminus - TestCase { - description: "DescribeTerminus Parent", - location: Location::new(1, Here), - expected_account_id_str: "5Dt6dpkWPwLaH4BBCKJwjiWrFVAGyYk3tLUabvyn4v7KtESG", - }, - TestCase { - description: "DescribeTerminus Sibling", - location: Location::new(1, [Parachain(1111)]), - expected_account_id_str: "5Eg2fnssmmJnF3z1iZ1NouAuzciDaaDQH7qURAy3w15jULDk", - }, - // DescribePalletTerminal - TestCase { - description: "DescribePalletTerminal Parent", - location: Location::new(1, [PalletInstance(50)]), - expected_account_id_str: "5CnwemvaAXkWFVwibiCvf2EjqwiqBi29S5cLLydZLEaEw6jZ", - }, - TestCase { - description: "DescribePalletTerminal Sibling", - location: Location::new(1, [Parachain(1111), PalletInstance(50)]), - expected_account_id_str: "5GFBgPjpEQPdaxEnFirUoa51u5erVx84twYxJVuBRAT2UP2g", - }, - // DescribeAccountId32Terminal - TestCase { - description: "DescribeAccountId32Terminal Parent", - location: Location::new( - 1, - [Junction::AccountId32 { network: None, id: AccountId::from(Alice).into() }], - ), - expected_account_id_str: "5EueAXd4h8u75nSbFdDJbC29cmi4Uo1YJssqEL9idvindxFL", - }, - TestCase { - description: "DescribeAccountId32Terminal Sibling", - location: Location::new( - 1, - [ - Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(Alice).into() }, - ], - ), - expected_account_id_str: "5Dmbuiq48fU4iW58FKYqoGbbfxFHjbAeGLMtjFg6NNCw3ssr", - }, - // DescribeAccountKey20Terminal - TestCase { - description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", - }, - TestCase { - description: "DescribeAccountKey20Terminal Sibling", - location: Location::new( - 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], - ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", - }, - // DescribeTreasuryVoiceTerminal - TestCase { - description: "DescribeTreasuryVoiceTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Treasury, part: BodyPart::Voice }]), - expected_account_id_str: "5CUjnE2vgcUCuhxPwFoQ5r7p1DkhujgvMNDHaF2bLqRp4D5F", - }, - TestCase { - description: "DescribeTreasuryVoiceTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Treasury, part: BodyPart::Voice }], - ), - expected_account_id_str: "5G6TDwaVgbWmhqRUKjBhRRnH4ry9L9cjRymUEmiRsLbSE4gB", - }, - // DescribeBodyTerminal - TestCase { - description: "DescribeBodyTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Unit, part: BodyPart::Voice }]), - expected_account_id_str: "5EBRMTBkDisEXsaN283SRbzx9Xf2PXwUxxFCJohSGo4jYe6B", - }, - TestCase { - description: "DescribeBodyTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Unit, part: BodyPart::Voice }], - ), - expected_account_id_str: "5DBoExvojy8tYnHgLL97phNH975CyT45PWTZEeGoBZfAyRMH", - }, - ]; - - for tc in test_cases { - let expected = - AccountId::from_string(tc.expected_account_id_str).expect("Invalid AccountId string"); - - let got = LocationToAccountHelper::< - AccountId, - bridge_hub_rococo_runtime::xcm_config::LocationToAccountId, - >::convert_location(tc.location.into()) - .unwrap(); - - assert_eq!(got, expected, "{}", tc.description); - } -} - #[test] fn xcm_payment_api_works() { parachains_runtimes_test_utils::test_cases::xcm_payment_api_with_native_token_works::< diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs index d559e20ace7f..412cde0c1387 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/tests/tests.rs @@ -414,115 +414,6 @@ pub fn can_calculate_fee_for_standalone_message_confirmation_transaction() { ) } -#[test] -fn location_conversion_works() { - // the purpose of hardcoded values is to catch an unintended location conversion logic change. - struct TestCase { - description: &'static str, - location: Location, - expected_account_id_str: &'static str, - } - - let test_cases = vec![ - // DescribeTerminus - TestCase { - description: "DescribeTerminus Parent", - location: Location::new(1, Here), - expected_account_id_str: "5Dt6dpkWPwLaH4BBCKJwjiWrFVAGyYk3tLUabvyn4v7KtESG", - }, - TestCase { - description: "DescribeTerminus Sibling", - location: Location::new(1, [Parachain(1111)]), - expected_account_id_str: "5Eg2fnssmmJnF3z1iZ1NouAuzciDaaDQH7qURAy3w15jULDk", - }, - // DescribePalletTerminal - TestCase { - description: "DescribePalletTerminal Parent", - location: Location::new(1, [PalletInstance(50)]), - expected_account_id_str: "5CnwemvaAXkWFVwibiCvf2EjqwiqBi29S5cLLydZLEaEw6jZ", - }, - TestCase { - description: "DescribePalletTerminal Sibling", - location: Location::new(1, [Parachain(1111), PalletInstance(50)]), - expected_account_id_str: "5GFBgPjpEQPdaxEnFirUoa51u5erVx84twYxJVuBRAT2UP2g", - }, - // DescribeAccountId32Terminal - TestCase { - description: "DescribeAccountId32Terminal Parent", - location: Location::new( - 1, - [Junction::AccountId32 { network: None, id: AccountId::from(Alice).into() }], - ), - expected_account_id_str: "5EueAXd4h8u75nSbFdDJbC29cmi4Uo1YJssqEL9idvindxFL", - }, - TestCase { - description: "DescribeAccountId32Terminal Sibling", - location: Location::new( - 1, - [ - Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(Alice).into() }, - ], - ), - expected_account_id_str: "5Dmbuiq48fU4iW58FKYqoGbbfxFHjbAeGLMtjFg6NNCw3ssr", - }, - // DescribeAccountKey20Terminal - TestCase { - description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", - }, - TestCase { - description: "DescribeAccountKey20Terminal Sibling", - location: Location::new( - 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], - ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", - }, - // DescribeTreasuryVoiceTerminal - TestCase { - description: "DescribeTreasuryVoiceTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Treasury, part: BodyPart::Voice }]), - expected_account_id_str: "5CUjnE2vgcUCuhxPwFoQ5r7p1DkhujgvMNDHaF2bLqRp4D5F", - }, - TestCase { - description: "DescribeTreasuryVoiceTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Treasury, part: BodyPart::Voice }], - ), - expected_account_id_str: "5G6TDwaVgbWmhqRUKjBhRRnH4ry9L9cjRymUEmiRsLbSE4gB", - }, - // DescribeBodyTerminal - TestCase { - description: "DescribeBodyTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Unit, part: BodyPart::Voice }]), - expected_account_id_str: "5EBRMTBkDisEXsaN283SRbzx9Xf2PXwUxxFCJohSGo4jYe6B", - }, - TestCase { - description: "DescribeBodyTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Unit, part: BodyPart::Voice }], - ), - expected_account_id_str: "5DBoExvojy8tYnHgLL97phNH975CyT45PWTZEeGoBZfAyRMH", - }, - ]; - - for tc in test_cases { - let expected = - AccountId::from_string(tc.expected_account_id_str).expect("Invalid AccountId string"); - - let got = LocationToAccountHelper::::convert_location( - tc.location.into(), - ) - .unwrap(); - - assert_eq!(got, expected, "{}", tc.description); - } -} - #[test] fn xcm_payment_api_works() { parachains_runtimes_test_utils::test_cases::xcm_payment_api_with_native_token_works::< diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/tests/tests.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/tests/tests.rs index c9191eba49f6..08eb71d9b8ce 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/tests/tests.rs @@ -26,115 +26,6 @@ use xcm_runtime_apis::conversions::LocationToAccountHelper; const ALICE: [u8; 32] = [1u8; 32]; -#[test] -fn location_conversion_works() { - // the purpose of hardcoded values is to catch an unintended location conversion logic change. - struct TestCase { - description: &'static str, - location: Location, - expected_account_id_str: &'static str, - } - - let test_cases = vec![ - // DescribeTerminus - TestCase { - description: "DescribeTerminus Parent", - location: Location::new(1, Here), - expected_account_id_str: "5Dt6dpkWPwLaH4BBCKJwjiWrFVAGyYk3tLUabvyn4v7KtESG", - }, - TestCase { - description: "DescribeTerminus Sibling", - location: Location::new(1, [Parachain(1111)]), - expected_account_id_str: "5Eg2fnssmmJnF3z1iZ1NouAuzciDaaDQH7qURAy3w15jULDk", - }, - // DescribePalletTerminal - TestCase { - description: "DescribePalletTerminal Parent", - location: Location::new(1, [PalletInstance(50)]), - expected_account_id_str: "5CnwemvaAXkWFVwibiCvf2EjqwiqBi29S5cLLydZLEaEw6jZ", - }, - TestCase { - description: "DescribePalletTerminal Sibling", - location: Location::new(1, [Parachain(1111), PalletInstance(50)]), - expected_account_id_str: "5GFBgPjpEQPdaxEnFirUoa51u5erVx84twYxJVuBRAT2UP2g", - }, - // DescribeAccountId32Terminal - TestCase { - description: "DescribeAccountId32Terminal Parent", - location: Location::new( - 1, - [Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }], - ), - expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", - }, - TestCase { - description: "DescribeAccountId32Terminal Sibling", - location: Location::new( - 1, - [ - Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, - ], - ), - expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", - }, - // DescribeAccountKey20Terminal - TestCase { - description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", - }, - TestCase { - description: "DescribeAccountKey20Terminal Sibling", - location: Location::new( - 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], - ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", - }, - // DescribeTreasuryVoiceTerminal - TestCase { - description: "DescribeTreasuryVoiceTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Treasury, part: BodyPart::Voice }]), - expected_account_id_str: "5CUjnE2vgcUCuhxPwFoQ5r7p1DkhujgvMNDHaF2bLqRp4D5F", - }, - TestCase { - description: "DescribeTreasuryVoiceTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Treasury, part: BodyPart::Voice }], - ), - expected_account_id_str: "5G6TDwaVgbWmhqRUKjBhRRnH4ry9L9cjRymUEmiRsLbSE4gB", - }, - // DescribeBodyTerminal - TestCase { - description: "DescribeBodyTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Unit, part: BodyPart::Voice }]), - expected_account_id_str: "5EBRMTBkDisEXsaN283SRbzx9Xf2PXwUxxFCJohSGo4jYe6B", - }, - TestCase { - description: "DescribeBodyTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Unit, part: BodyPart::Voice }], - ), - expected_account_id_str: "5DBoExvojy8tYnHgLL97phNH975CyT45PWTZEeGoBZfAyRMH", - }, - ]; - - for tc in test_cases { - let expected = - AccountId::from_string(tc.expected_account_id_str).expect("Invalid AccountId string"); - - let got = LocationToAccountHelper::::convert_location( - tc.location.into(), - ) - .unwrap(); - - assert_eq!(got, expected, "{}", tc.description); - } -} - #[test] fn xcm_payment_api_works() { parachains_runtimes_test_utils::test_cases::xcm_payment_api_with_native_token_works::< diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/tests/tests.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/tests/tests.rs index 89a593ab0f57..648f8284d1f4 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/tests/tests.rs @@ -26,115 +26,6 @@ use xcm_runtime_apis::conversions::LocationToAccountHelper; const ALICE: [u8; 32] = [1u8; 32]; -#[test] -fn location_conversion_works() { - // the purpose of hardcoded values is to catch an unintended location conversion logic change. - struct TestCase { - description: &'static str, - location: Location, - expected_account_id_str: &'static str, - } - - let test_cases = vec![ - // DescribeTerminus - TestCase { - description: "DescribeTerminus Parent", - location: Location::new(1, Here), - expected_account_id_str: "5Dt6dpkWPwLaH4BBCKJwjiWrFVAGyYk3tLUabvyn4v7KtESG", - }, - TestCase { - description: "DescribeTerminus Sibling", - location: Location::new(1, [Parachain(1111)]), - expected_account_id_str: "5Eg2fnssmmJnF3z1iZ1NouAuzciDaaDQH7qURAy3w15jULDk", - }, - // DescribePalletTerminal - TestCase { - description: "DescribePalletTerminal Parent", - location: Location::new(1, [PalletInstance(50)]), - expected_account_id_str: "5CnwemvaAXkWFVwibiCvf2EjqwiqBi29S5cLLydZLEaEw6jZ", - }, - TestCase { - description: "DescribePalletTerminal Sibling", - location: Location::new(1, [Parachain(1111), PalletInstance(50)]), - expected_account_id_str: "5GFBgPjpEQPdaxEnFirUoa51u5erVx84twYxJVuBRAT2UP2g", - }, - // DescribeAccountId32Terminal - TestCase { - description: "DescribeAccountId32Terminal Parent", - location: Location::new( - 1, - [Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }], - ), - expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", - }, - TestCase { - description: "DescribeAccountId32Terminal Sibling", - location: Location::new( - 1, - [ - Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, - ], - ), - expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", - }, - // DescribeAccountKey20Terminal - TestCase { - description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", - }, - TestCase { - description: "DescribeAccountKey20Terminal Sibling", - location: Location::new( - 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], - ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", - }, - // DescribeTreasuryVoiceTerminal - TestCase { - description: "DescribeTreasuryVoiceTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Treasury, part: BodyPart::Voice }]), - expected_account_id_str: "5CUjnE2vgcUCuhxPwFoQ5r7p1DkhujgvMNDHaF2bLqRp4D5F", - }, - TestCase { - description: "DescribeTreasuryVoiceTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Treasury, part: BodyPart::Voice }], - ), - expected_account_id_str: "5G6TDwaVgbWmhqRUKjBhRRnH4ry9L9cjRymUEmiRsLbSE4gB", - }, - // DescribeBodyTerminal - TestCase { - description: "DescribeBodyTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Unit, part: BodyPart::Voice }]), - expected_account_id_str: "5EBRMTBkDisEXsaN283SRbzx9Xf2PXwUxxFCJohSGo4jYe6B", - }, - TestCase { - description: "DescribeBodyTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Unit, part: BodyPart::Voice }], - ), - expected_account_id_str: "5DBoExvojy8tYnHgLL97phNH975CyT45PWTZEeGoBZfAyRMH", - }, - ]; - - for tc in test_cases { - let expected = - AccountId::from_string(tc.expected_account_id_str).expect("Invalid AccountId string"); - - let got = LocationToAccountHelper::::convert_location( - tc.location.into(), - ) - .unwrap(); - - assert_eq!(got, expected, "{}", tc.description); - } -} - #[test] fn xcm_payment_api_works() { parachains_runtimes_test_utils::test_cases::xcm_payment_api_with_native_token_works::< diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/tests/tests.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/tests/tests.rs index 976ce23d6e87..87ef46850491 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/tests/tests.rs @@ -26,115 +26,6 @@ use xcm_runtime_apis::conversions::LocationToAccountHelper; const ALICE: [u8; 32] = [1u8; 32]; -#[test] -fn location_conversion_works() { - // the purpose of hardcoded values is to catch an unintended location conversion logic change. - struct TestCase { - description: &'static str, - location: Location, - expected_account_id_str: &'static str, - } - - let test_cases = vec![ - // DescribeTerminus - TestCase { - description: "DescribeTerminus Parent", - location: Location::new(1, Here), - expected_account_id_str: "5Dt6dpkWPwLaH4BBCKJwjiWrFVAGyYk3tLUabvyn4v7KtESG", - }, - TestCase { - description: "DescribeTerminus Sibling", - location: Location::new(1, [Parachain(1111)]), - expected_account_id_str: "5Eg2fnssmmJnF3z1iZ1NouAuzciDaaDQH7qURAy3w15jULDk", - }, - // DescribePalletTerminal - TestCase { - description: "DescribePalletTerminal Parent", - location: Location::new(1, [PalletInstance(50)]), - expected_account_id_str: "5CnwemvaAXkWFVwibiCvf2EjqwiqBi29S5cLLydZLEaEw6jZ", - }, - TestCase { - description: "DescribePalletTerminal Sibling", - location: Location::new(1, [Parachain(1111), PalletInstance(50)]), - expected_account_id_str: "5GFBgPjpEQPdaxEnFirUoa51u5erVx84twYxJVuBRAT2UP2g", - }, - // DescribeAccountId32Terminal - TestCase { - description: "DescribeAccountId32Terminal Parent", - location: Location::new( - 1, - [Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }], - ), - expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", - }, - TestCase { - description: "DescribeAccountId32Terminal Sibling", - location: Location::new( - 1, - [ - Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, - ], - ), - expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", - }, - // DescribeAccountKey20Terminal - TestCase { - description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", - }, - TestCase { - description: "DescribeAccountKey20Terminal Sibling", - location: Location::new( - 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], - ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", - }, - // DescribeTreasuryVoiceTerminal - TestCase { - description: "DescribeTreasuryVoiceTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Treasury, part: BodyPart::Voice }]), - expected_account_id_str: "5CUjnE2vgcUCuhxPwFoQ5r7p1DkhujgvMNDHaF2bLqRp4D5F", - }, - TestCase { - description: "DescribeTreasuryVoiceTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Treasury, part: BodyPart::Voice }], - ), - expected_account_id_str: "5G6TDwaVgbWmhqRUKjBhRRnH4ry9L9cjRymUEmiRsLbSE4gB", - }, - // DescribeBodyTerminal - TestCase { - description: "DescribeBodyTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Unit, part: BodyPart::Voice }]), - expected_account_id_str: "5EBRMTBkDisEXsaN283SRbzx9Xf2PXwUxxFCJohSGo4jYe6B", - }, - TestCase { - description: "DescribeBodyTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Unit, part: BodyPart::Voice }], - ), - expected_account_id_str: "5DBoExvojy8tYnHgLL97phNH975CyT45PWTZEeGoBZfAyRMH", - }, - ]; - - for tc in test_cases { - let expected = - AccountId::from_string(tc.expected_account_id_str).expect("Invalid AccountId string"); - - let got = LocationToAccountHelper::::convert_location( - tc.location.into(), - ) - .unwrap(); - - assert_eq!(got, expected, "{}", tc.description); - } -} - #[test] fn xcm_payment_api_works() { parachains_runtimes_test_utils::test_cases::xcm_payment_api_with_native_token_works::< diff --git a/cumulus/parachains/runtimes/people/people-rococo/tests/tests.rs b/cumulus/parachains/runtimes/people/people-rococo/tests/tests.rs index 00fe7781822a..4cfeaf7d3cce 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/tests/tests.rs @@ -26,115 +26,6 @@ use xcm_runtime_apis::conversions::LocationToAccountHelper; const ALICE: [u8; 32] = [1u8; 32]; -#[test] -fn location_conversion_works() { - // the purpose of hardcoded values is to catch an unintended location conversion logic change. - struct TestCase { - description: &'static str, - location: Location, - expected_account_id_str: &'static str, - } - - let test_cases = vec![ - // DescribeTerminus - TestCase { - description: "DescribeTerminus Parent", - location: Location::new(1, Here), - expected_account_id_str: "5Dt6dpkWPwLaH4BBCKJwjiWrFVAGyYk3tLUabvyn4v7KtESG", - }, - TestCase { - description: "DescribeTerminus Sibling", - location: Location::new(1, [Parachain(1111)]), - expected_account_id_str: "5Eg2fnssmmJnF3z1iZ1NouAuzciDaaDQH7qURAy3w15jULDk", - }, - // DescribePalletTerminal - TestCase { - description: "DescribePalletTerminal Parent", - location: Location::new(1, [PalletInstance(50)]), - expected_account_id_str: "5CnwemvaAXkWFVwibiCvf2EjqwiqBi29S5cLLydZLEaEw6jZ", - }, - TestCase { - description: "DescribePalletTerminal Sibling", - location: Location::new(1, [Parachain(1111), PalletInstance(50)]), - expected_account_id_str: "5GFBgPjpEQPdaxEnFirUoa51u5erVx84twYxJVuBRAT2UP2g", - }, - // DescribeAccountId32Terminal - TestCase { - description: "DescribeAccountId32Terminal Parent", - location: Location::new( - 1, - [Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }], - ), - expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", - }, - TestCase { - description: "DescribeAccountId32Terminal Sibling", - location: Location::new( - 1, - [ - Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, - ], - ), - expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", - }, - // DescribeAccountKey20Terminal - TestCase { - description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", - }, - TestCase { - description: "DescribeAccountKey20Terminal Sibling", - location: Location::new( - 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], - ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", - }, - // DescribeTreasuryVoiceTerminal - TestCase { - description: "DescribeTreasuryVoiceTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Treasury, part: BodyPart::Voice }]), - expected_account_id_str: "5CUjnE2vgcUCuhxPwFoQ5r7p1DkhujgvMNDHaF2bLqRp4D5F", - }, - TestCase { - description: "DescribeTreasuryVoiceTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Treasury, part: BodyPart::Voice }], - ), - expected_account_id_str: "5G6TDwaVgbWmhqRUKjBhRRnH4ry9L9cjRymUEmiRsLbSE4gB", - }, - // DescribeBodyTerminal - TestCase { - description: "DescribeBodyTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Unit, part: BodyPart::Voice }]), - expected_account_id_str: "5EBRMTBkDisEXsaN283SRbzx9Xf2PXwUxxFCJohSGo4jYe6B", - }, - TestCase { - description: "DescribeBodyTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Unit, part: BodyPart::Voice }], - ), - expected_account_id_str: "5DBoExvojy8tYnHgLL97phNH975CyT45PWTZEeGoBZfAyRMH", - }, - ]; - - for tc in test_cases { - let expected = - AccountId::from_string(tc.expected_account_id_str).expect("Invalid AccountId string"); - - let got = LocationToAccountHelper::::convert_location( - tc.location.into(), - ) - .unwrap(); - - assert_eq!(got, expected, "{}", tc.description); - } -} - #[test] fn xcm_payment_api_works() { parachains_runtimes_test_utils::test_cases::xcm_payment_api_with_native_token_works::< diff --git a/cumulus/parachains/runtimes/people/people-westend/tests/tests.rs b/cumulus/parachains/runtimes/people/people-westend/tests/tests.rs index 5cefec44b1cd..6a222347cef5 100644 --- a/cumulus/parachains/runtimes/people/people-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/people/people-westend/tests/tests.rs @@ -26,115 +26,6 @@ use xcm_runtime_apis::conversions::LocationToAccountHelper; const ALICE: [u8; 32] = [1u8; 32]; -#[test] -fn location_conversion_works() { - // the purpose of hardcoded values is to catch an unintended location conversion logic change. - struct TestCase { - description: &'static str, - location: Location, - expected_account_id_str: &'static str, - } - - let test_cases = vec![ - // DescribeTerminus - TestCase { - description: "DescribeTerminus Parent", - location: Location::new(1, Here), - expected_account_id_str: "5Dt6dpkWPwLaH4BBCKJwjiWrFVAGyYk3tLUabvyn4v7KtESG", - }, - TestCase { - description: "DescribeTerminus Sibling", - location: Location::new(1, [Parachain(1111)]), - expected_account_id_str: "5Eg2fnssmmJnF3z1iZ1NouAuzciDaaDQH7qURAy3w15jULDk", - }, - // DescribePalletTerminal - TestCase { - description: "DescribePalletTerminal Parent", - location: Location::new(1, [PalletInstance(50)]), - expected_account_id_str: "5CnwemvaAXkWFVwibiCvf2EjqwiqBi29S5cLLydZLEaEw6jZ", - }, - TestCase { - description: "DescribePalletTerminal Sibling", - location: Location::new(1, [Parachain(1111), PalletInstance(50)]), - expected_account_id_str: "5GFBgPjpEQPdaxEnFirUoa51u5erVx84twYxJVuBRAT2UP2g", - }, - // DescribeAccountId32Terminal - TestCase { - description: "DescribeAccountId32Terminal Parent", - location: Location::new( - 1, - [Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }], - ), - expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", - }, - TestCase { - description: "DescribeAccountId32Terminal Sibling", - location: Location::new( - 1, - [ - Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, - ], - ), - expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", - }, - // DescribeAccountKey20Terminal - TestCase { - description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", - }, - TestCase { - description: "DescribeAccountKey20Terminal Sibling", - location: Location::new( - 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], - ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", - }, - // DescribeTreasuryVoiceTerminal - TestCase { - description: "DescribeTreasuryVoiceTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Treasury, part: BodyPart::Voice }]), - expected_account_id_str: "5CUjnE2vgcUCuhxPwFoQ5r7p1DkhujgvMNDHaF2bLqRp4D5F", - }, - TestCase { - description: "DescribeTreasuryVoiceTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Treasury, part: BodyPart::Voice }], - ), - expected_account_id_str: "5G6TDwaVgbWmhqRUKjBhRRnH4ry9L9cjRymUEmiRsLbSE4gB", - }, - // DescribeBodyTerminal - TestCase { - description: "DescribeBodyTerminal Parent", - location: Location::new(1, [Plurality { id: BodyId::Unit, part: BodyPart::Voice }]), - expected_account_id_str: "5EBRMTBkDisEXsaN283SRbzx9Xf2PXwUxxFCJohSGo4jYe6B", - }, - TestCase { - description: "DescribeBodyTerminal Sibling", - location: Location::new( - 1, - [Parachain(1111), Plurality { id: BodyId::Unit, part: BodyPart::Voice }], - ), - expected_account_id_str: "5DBoExvojy8tYnHgLL97phNH975CyT45PWTZEeGoBZfAyRMH", - }, - ]; - - for tc in test_cases { - let expected = - AccountId::from_string(tc.expected_account_id_str).expect("Invalid AccountId string"); - - let got = LocationToAccountHelper::::convert_location( - tc.location.into(), - ) - .unwrap(); - - assert_eq!(got, expected, "{}", tc.description); - } -} - #[test] fn xcm_payment_api_works() { parachains_runtimes_test_utils::test_cases::xcm_payment_api_with_native_token_works::<