diff --git a/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs b/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs index 2d6a3bac62..4b6892d9a1 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs @@ -711,6 +711,12 @@ fn treasury_pallet_account_not_none() { #[test] fn location_conversion_works() { + let alice_32 = AccountId32 { + network: None, + id: polkadot_core_primitives::AccountId::from(ALICE).into(), + }; + let bob_20 = AccountKey20 { network: None, key: [123u8; 20] }; + // the purpose of hardcoded values is to catch an unintended location conversion logic change. struct TestCase { description: &'static str, @@ -746,10 +752,7 @@ fn location_conversion_works() { description: "DescribeAccountId32Terminal Parent", location: Location::new( 1, - [AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(ALICE).into(), - }], + [alice_32.clone()], ), expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", }, @@ -759,10 +762,7 @@ fn location_conversion_works() { 1, [ Parachain(1111), - Junction::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(ALICE).into(), - }, + alice_32.clone(), ], ), expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", @@ -770,16 +770,16 @@ fn location_conversion_works() { // DescribeAccountKey20Terminal TestCase { description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", + location: Location::new(1, [bob_20.clone()]), + expected_account_id_str: "5CJeW9bdeos6EmaEofTUiNrvyVobMBfWbdQvhTe6UciGjH2n", }, TestCase { description: "DescribeAccountKey20Terminal Sibling", location: Location::new( 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], + [Parachain(1111), bob_20.clone()], ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", + expected_account_id_str: "5CE6V5AKH8H4rg2aq5KMbvaVUDMumHKVPPQEEDMHPy3GmJQp", }, // DescribeTreasuryVoiceTerminal TestCase { diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs b/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs index 4442966b83..a7e603a02c 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs @@ -735,6 +735,12 @@ fn change_xcm_bridge_hub_ethereum_base_fee_by_governance_works() { #[test] fn location_conversion_works() { + let alice_32 = AccountId32 { + network: None, + id: polkadot_core_primitives::AccountId::from(ALICE).into(), + }; + let bob_20 = AccountKey20 { network: None, key: [123u8; 20] }; + // the purpose of hardcoded values is to catch an unintended location conversion logic change. struct TestCase { description: &'static str, @@ -770,10 +776,7 @@ fn location_conversion_works() { description: "DescribeAccountId32Terminal Parent", location: Location::new( 1, - [AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(ALICE).into(), - }], + [alice_32.clone()], ), expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", }, @@ -783,10 +786,7 @@ fn location_conversion_works() { 1, [ Parachain(1111), - Junction::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(ALICE).into(), - }, + alice_32.clone(), ], ), expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", @@ -794,16 +794,16 @@ fn location_conversion_works() { // DescribeAccountKey20Terminal TestCase { description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", + location: Location::new(1, [bob_20.clone()]), + expected_account_id_str: "5CJeW9bdeos6EmaEofTUiNrvyVobMBfWbdQvhTe6UciGjH2n", }, TestCase { description: "DescribeAccountKey20Terminal Sibling", location: Location::new( 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], + [Parachain(1111), bob_20.clone()], ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", + expected_account_id_str: "5CE6V5AKH8H4rg2aq5KMbvaVUDMumHKVPPQEEDMHPy3GmJQp", }, // DescribeTreasuryVoiceTerminal TestCase { diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs index d74f627f54..05223ad35a 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs @@ -372,6 +372,12 @@ fn treasury_pallet_account_not_none() { #[test] fn location_conversion_works() { + let alice_32 = xcm::prelude::AccountId32 { + network: None, + id: polkadot_core_primitives::AccountId::from(Alice).into(), + }; + let bob_20 = AccountKey20 { network: None, key: [123u8; 20] }; + // the purpose of hardcoded values is to catch an unintended location conversion logic change. struct TestCase { description: &'static str, @@ -407,10 +413,7 @@ fn location_conversion_works() { description: "DescribeAccountId32Terminal Parent", location: Location::new( 1, - [xcm::prelude::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(Alice).into(), - }], + [alice_32.clone()], ), expected_account_id_str: "5EueAXd4h8u75nSbFdDJbC29cmi4Uo1YJssqEL9idvindxFL", }, @@ -420,10 +423,7 @@ fn location_conversion_works() { 1, [ Parachain(1111), - Junction::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(Alice).into(), - }, + alice_32.clone(), ], ), expected_account_id_str: "5Dmbuiq48fU4iW58FKYqoGbbfxFHjbAeGLMtjFg6NNCw3ssr", @@ -431,16 +431,16 @@ fn location_conversion_works() { // DescribeAccountKey20Terminal TestCase { description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", + location: Location::new(1, [bob_20.clone()]), + expected_account_id_str: "5CJeW9bdeos6EmaEofTUiNrvyVobMBfWbdQvhTe6UciGjH2n", }, TestCase { description: "DescribeAccountKey20Terminal Sibling", location: Location::new( 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], + [Parachain(1111), bob_20.clone()], ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", + expected_account_id_str: "5CE6V5AKH8H4rg2aq5KMbvaVUDMumHKVPPQEEDMHPy3GmJQp", }, // DescribeTreasuryVoiceTerminal TestCase { diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs index 1526e9af27..18bd832422 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs @@ -373,6 +373,12 @@ fn treasury_pallet_account_not_none() { #[test] fn location_conversion_works() { + let alice_32 = xcm::prelude::AccountId32 { + network: None, + id: polkadot_core_primitives::AccountId::from(Alice).into(), + }; + let bob_20 = AccountKey20 { network: None, key: [123u8; 20] }; + // the purpose of hardcoded values is to catch an unintended location conversion logic change. struct TestCase { description: &'static str, @@ -408,10 +414,7 @@ fn location_conversion_works() { description: "DescribeAccountId32Terminal Parent", location: Location::new( 1, - [xcm::prelude::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(Alice).into(), - }], + [alice_32.clone()], ), expected_account_id_str: "5EueAXd4h8u75nSbFdDJbC29cmi4Uo1YJssqEL9idvindxFL", }, @@ -421,10 +424,7 @@ fn location_conversion_works() { 1, [ Parachain(1111), - Junction::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(Alice).into(), - }, + alice_32.clone(), ], ), expected_account_id_str: "5Dmbuiq48fU4iW58FKYqoGbbfxFHjbAeGLMtjFg6NNCw3ssr", @@ -432,16 +432,16 @@ fn location_conversion_works() { // DescribeAccountKey20Terminal TestCase { description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", + location: Location::new(1, [bob_20.clone()]), + expected_account_id_str: "5CJeW9bdeos6EmaEofTUiNrvyVobMBfWbdQvhTe6UciGjH2n", }, TestCase { description: "DescribeAccountKey20Terminal Sibling", location: Location::new( 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], + [Parachain(1111), bob_20.clone()], ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", + expected_account_id_str: "5CE6V5AKH8H4rg2aq5KMbvaVUDMumHKVPPQEEDMHPy3GmJQp", }, // DescribeTreasuryVoiceTerminal TestCase { diff --git a/system-parachains/collectives/collectives-polkadot/tests/location_conversion.rs b/system-parachains/collectives/collectives-polkadot/tests/location_conversion.rs index 1f93e04d6f..45feb648af 100644 --- a/system-parachains/collectives/collectives-polkadot/tests/location_conversion.rs +++ b/system-parachains/collectives/collectives-polkadot/tests/location_conversion.rs @@ -24,6 +24,12 @@ const ALICE: [u8; 32] = [1u8; 32]; #[test] fn location_conversion_works() { + let alice_32 = xcm::prelude::AccountId32 { + network: None, + id: polkadot_core_primitives::AccountId::from(ALICE).into(), + }; + let bob_20 = AccountKey20 { network: None, key: [123u8; 20] }; + // the purpose of hardcoded values is to catch an unintended location conversion logic change. struct TestCase { description: &'static str, @@ -59,7 +65,7 @@ fn location_conversion_works() { description: "DescribeAccountId32Terminal Parent", location: Location::new( 1, - [AccountId32 { network: None, id: AccountId::from(ALICE).into() }], + [alice_32.clone()], ), expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", }, @@ -69,7 +75,7 @@ fn location_conversion_works() { 1, [ Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, + alice_32.clone(), ], ), expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", @@ -77,16 +83,16 @@ fn location_conversion_works() { // DescribeAccountKey20Terminal TestCase { description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", + location: Location::new(1, [bob_20.clone()]), + expected_account_id_str: "5CJeW9bdeos6EmaEofTUiNrvyVobMBfWbdQvhTe6UciGjH2n", }, TestCase { description: "DescribeAccountKey20Terminal Sibling", location: Location::new( 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], + [Parachain(1111), bob_20.clone()], ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", + expected_account_id_str: "5CE6V5AKH8H4rg2aq5KMbvaVUDMumHKVPPQEEDMHPy3GmJQp", }, // DescribeTreasuryVoiceTerminal TestCase { diff --git a/system-parachains/coretime/coretime-kusama/src/tests.rs b/system-parachains/coretime/coretime-kusama/src/tests.rs index 743659c48c..e03098006b 100644 --- a/system-parachains/coretime/coretime-kusama/src/tests.rs +++ b/system-parachains/coretime/coretime-kusama/src/tests.rs @@ -116,6 +116,12 @@ fn timeslice_period_is_sane() { #[test] fn location_conversion_works() { + let alice_32 = AccountId32 { + network: None, + id: polkadot_core_primitives::AccountId::from(ALICE).into(), + }; + let bob_20 = AccountKey20 { network: None, key: [123u8; 20] }; + // the purpose of hardcoded values is to catch an unintended location conversion logic change. struct TestCase { description: &'static str, @@ -151,10 +157,7 @@ fn location_conversion_works() { description: "DescribeAccountId32Terminal Parent", location: Location::new( 1, - [xcm::prelude::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(ALICE).into(), - }], + [alice_32.clone()], ), expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", }, @@ -164,10 +167,7 @@ fn location_conversion_works() { 1, [ Parachain(1111), - Junction::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(ALICE).into(), - }, + alice_32.clone(), ], ), expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", @@ -175,16 +175,16 @@ fn location_conversion_works() { // DescribeAccountKey20Terminal TestCase { description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", + location: Location::new(1, [bob_20.clone()]), + expected_account_id_str: "5CJeW9bdeos6EmaEofTUiNrvyVobMBfWbdQvhTe6UciGjH2n", }, TestCase { description: "DescribeAccountKey20Terminal Sibling", location: Location::new( 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], + [Parachain(1111), bob_20.clone()], ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", + expected_account_id_str: "5CE6V5AKH8H4rg2aq5KMbvaVUDMumHKVPPQEEDMHPy3GmJQp", }, // DescribeTreasuryVoiceTerminal TestCase { diff --git a/system-parachains/coretime/coretime-polkadot/src/tests.rs b/system-parachains/coretime/coretime-polkadot/src/tests.rs index 67a1696a95..bfea18ef9b 100644 --- a/system-parachains/coretime/coretime-polkadot/src/tests.rs +++ b/system-parachains/coretime/coretime-polkadot/src/tests.rs @@ -116,6 +116,12 @@ fn timeslice_period_is_sane() { #[test] fn location_conversion_works() { + let alice_32 = AccountId32 { + network: None, + id: polkadot_core_primitives::AccountId::from(ALICE).into(), + }; + let bob_20 = AccountKey20 { network: None, key: [123u8; 20] }; + // the purpose of hardcoded values is to catch an unintended location conversion logic change. struct TestCase { description: &'static str, @@ -151,10 +157,7 @@ fn location_conversion_works() { description: "DescribeAccountId32Terminal Parent", location: Location::new( 1, - [xcm::prelude::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(ALICE).into(), - }], + [alice_32.clone()], ), expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", }, @@ -164,10 +167,7 @@ fn location_conversion_works() { 1, [ Parachain(1111), - Junction::AccountId32 { - network: None, - id: polkadot_core_primitives::AccountId::from(ALICE).into(), - }, + alice_32.clone(), ], ), expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", @@ -175,16 +175,16 @@ fn location_conversion_works() { // DescribeAccountKey20Terminal TestCase { description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", + location: Location::new(1, [bob_20.clone()]), + expected_account_id_str: "5CJeW9bdeos6EmaEofTUiNrvyVobMBfWbdQvhTe6UciGjH2n", }, TestCase { description: "DescribeAccountKey20Terminal Sibling", location: Location::new( 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], + [Parachain(1111), bob_20.clone()], ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", + expected_account_id_str: "5CE6V5AKH8H4rg2aq5KMbvaVUDMumHKVPPQEEDMHPy3GmJQp", }, // DescribeTreasuryVoiceTerminal TestCase { diff --git a/system-parachains/people/people-kusama/src/tests.rs b/system-parachains/people/people-kusama/src/tests.rs index dcd0045625..a4849a28ed 100644 --- a/system-parachains/people/people-kusama/src/tests.rs +++ b/system-parachains/people/people-kusama/src/tests.rs @@ -24,6 +24,12 @@ const ALICE: [u8; 32] = [1u8; 32]; #[test] fn location_conversion_works() { + let alice_32 = AccountId32 { + network: None, + id: AccountId::from(ALICE).into(), + }; + let bob_20 = AccountKey20 { network: None, key: [123u8; 20] }; + // the purpose of hardcoded values is to catch an unintended location conversion logic change. struct TestCase { description: &'static str, @@ -59,7 +65,7 @@ fn location_conversion_works() { description: "DescribeAccountId32Terminal Parent", location: Location::new( 1, - [xcm::prelude::AccountId32 { network: None, id: AccountId::from(ALICE).into() }], + [alice_32.clone()], ), expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", }, @@ -69,7 +75,7 @@ fn location_conversion_works() { 1, [ Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, + alice_32.clone(), ], ), expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", @@ -77,16 +83,16 @@ fn location_conversion_works() { // DescribeAccountKey20Terminal TestCase { description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", + location: Location::new(1, [bob_20.clone()]), + expected_account_id_str: "5CJeW9bdeos6EmaEofTUiNrvyVobMBfWbdQvhTe6UciGjH2n", }, TestCase { description: "DescribeAccountKey20Terminal Sibling", location: Location::new( 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], + [Parachain(1111), bob_20.clone()], ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", + expected_account_id_str: "5CE6V5AKH8H4rg2aq5KMbvaVUDMumHKVPPQEEDMHPy3GmJQp", }, // DescribeTreasuryVoiceTerminal TestCase { diff --git a/system-parachains/people/people-polkadot/src/tests.rs b/system-parachains/people/people-polkadot/src/tests.rs index 12faa07e47..547f338ade 100644 --- a/system-parachains/people/people-polkadot/src/tests.rs +++ b/system-parachains/people/people-polkadot/src/tests.rs @@ -24,6 +24,12 @@ const ALICE: [u8; 32] = [1u8; 32]; #[test] fn location_conversion_works() { + let alice_32 = AccountId32 { + network: None, + id: AccountId::from(ALICE).into(), + }; + let bob_20 = AccountKey20 { network: None, key: [123u8; 20] }; + // the purpose of hardcoded values is to catch an unintended location conversion logic change. struct TestCase { description: &'static str, @@ -59,7 +65,7 @@ fn location_conversion_works() { description: "DescribeAccountId32Terminal Parent", location: Location::new( 1, - [xcm::prelude::AccountId32 { network: None, id: AccountId::from(ALICE).into() }], + [alice_32.clone()], ), expected_account_id_str: "5DN5SGsuUG7PAqFL47J9meViwdnk9AdeSWKFkcHC45hEzVz4", }, @@ -69,7 +75,7 @@ fn location_conversion_works() { 1, [ Parachain(1111), - Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, + alice_32.clone(), ], ), expected_account_id_str: "5DGRXLYwWGce7wvm14vX1Ms4Vf118FSWQbJkyQigY2pfm6bg", @@ -77,16 +83,16 @@ fn location_conversion_works() { // DescribeAccountKey20Terminal TestCase { description: "DescribeAccountKey20Terminal Parent", - location: Location::new(1, [AccountKey20 { network: None, key: [0u8; 20] }]), - expected_account_id_str: "5F5Ec11567pa919wJkX6VHtv2ZXS5W698YCW35EdEbrg14cg", + location: Location::new(1, [bob_20.clone()]), + expected_account_id_str: "5CJeW9bdeos6EmaEofTUiNrvyVobMBfWbdQvhTe6UciGjH2n", }, TestCase { description: "DescribeAccountKey20Terminal Sibling", location: Location::new( 1, - [Parachain(1111), AccountKey20 { network: None, key: [0u8; 20] }], + [Parachain(1111), bob_20.clone()], ), - expected_account_id_str: "5CB2FbUds2qvcJNhDiTbRZwiS3trAy6ydFGMSVutmYijpPAg", + expected_account_id_str: "5CE6V5AKH8H4rg2aq5KMbvaVUDMumHKVPPQEEDMHPy3GmJQp", }, // DescribeTreasuryVoiceTerminal TestCase {