From 4752d1c53645a3ea9e8c91412b6695f952dfdaba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Bald=C3=A9?= Date: Mon, 4 Nov 2024 15:58:06 +0000 Subject: [PATCH] Apply `cargo fmt` --- .../people/people-kusama/src/genesis.rs | 4 +- .../people/people-polkadot/src/genesis.rs | 2 +- .../people-kusama/src/tests/governance.rs | 83 +++++++++-------- .../people-polkadot/src/tests/governance.rs | 89 ++++++++++--------- 4 files changed, 89 insertions(+), 89 deletions(-) diff --git a/integration-tests/emulated/chains/parachains/people/people-kusama/src/genesis.rs b/integration-tests/emulated/chains/parachains/people/people-kusama/src/genesis.rs index 73cb416993..3afd77c956 100644 --- a/integration-tests/emulated/chains/parachains/people/people-kusama/src/genesis.rs +++ b/integration-tests/emulated/chains/parachains/people/people-kusama/src/genesis.rs @@ -19,10 +19,10 @@ use sp_core::storage::Storage; // Cumulus use cumulus_primitives_core::ParaId; use emulated_integration_tests_common::{ - accounts, build_genesis_storage, collators, SAFE_XCM_VERSION + accounts, build_genesis_storage, collators, SAFE_XCM_VERSION, }; -use parachains_common::Balance; use kusama_runtime_constants::currency::UNITS as KSM; +use parachains_common::Balance; const ENDOWMENT: u128 = 1_000 * KSM; pub const PARA_ID: u32 = 1004; diff --git a/integration-tests/emulated/chains/parachains/people/people-polkadot/src/genesis.rs b/integration-tests/emulated/chains/parachains/people/people-polkadot/src/genesis.rs index 8d648ce854..9d63344e2b 100644 --- a/integration-tests/emulated/chains/parachains/people/people-polkadot/src/genesis.rs +++ b/integration-tests/emulated/chains/parachains/people/people-polkadot/src/genesis.rs @@ -19,7 +19,7 @@ use sp_core::storage::Storage; // Cumulus use cumulus_primitives_core::ParaId; use emulated_integration_tests_common::{ - accounts, build_genesis_storage, collators, SAFE_XCM_VERSION + accounts, build_genesis_storage, collators, SAFE_XCM_VERSION, }; use parachains_common::Balance; use polkadot_runtime_constants::currency::UNITS as DOT; diff --git a/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs b/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs index 65b3f9ae0c..00c244d48d 100644 --- a/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs +++ b/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs @@ -85,16 +85,17 @@ fn relay_commands_kill_identity() { type PeopleRuntime = ::Runtime; type PeopleRuntimeEvent = ::RuntimeEvent; - let people_kusama_alice = ::RuntimeOrigin::signed(PeopleKusama::account_id_of(ALICE)); + let people_kusama_alice = + ::RuntimeOrigin::signed(PeopleKusama::account_id_of(ALICE)); let mut identity_info = ::default(); identity_info.email = Data::Raw(b"test@test.io".to_vec().try_into().unwrap()); - let identity: Box<::IdentityInformation> = Box::new(identity_info); + let identity: Box<::IdentityInformation> = + Box::new(identity_info); - assert_ok!( - ::Identity::set_identity( - people_kusama_alice, - identity + assert_ok!(::Identity::set_identity( + people_kusama_alice, + identity )); assert_expected_events!( @@ -105,8 +106,7 @@ fn relay_commands_kill_identity() { ); }); - let (origin_kind, origin) = - (OriginKind::Superuser, ::RuntimeOrigin::root()); + let (origin_kind, origin) = (OriginKind::Superuser, ::RuntimeOrigin::root()); Kusama::execute_with(|| { type Runtime = ::Runtime; @@ -163,7 +163,6 @@ fn relay_commands_add_remove_username_authority() { let people_kusama_alice = PeopleKusama::account_id_of(ALICE); let people_kusama_bob = PeopleKusama::account_id_of(BOB); - let origins = vec![ (OriginKind::Xcm, GeneralAdminOrigin.into(), "generaladmin"), (OriginKind::Superuser, ::RuntimeOrigin::root(), "rootusername"), @@ -177,12 +176,13 @@ fn relay_commands_add_remove_username_authority() { type PeopleCall = ::RuntimeCall; type PeopleRuntime = ::Runtime; - let add_username_authority = - PeopleCall::Identity(pallet_identity::Call::::add_username_authority { - authority: people_kusama_runtime::MultiAddress::Id(people_kusama_alice.clone()), - suffix: b"suffix1".into(), - allocation: 10 - }); + let add_username_authority = PeopleCall::Identity(pallet_identity::Call::< + PeopleRuntime, + >::add_username_authority { + authority: people_kusama_runtime::MultiAddress::Id(people_kusama_alice.clone()), + suffix: b"suffix1".into(), + allocation: 10, + }); let add_authority_xcm_msg = RuntimeCall::XcmPallet(pallet_xcm::Call::::send { dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))), @@ -223,12 +223,11 @@ fn relay_commands_add_remove_username_authority() { PeopleKusama::execute_with(|| { type PeopleRuntimeEvent = ::RuntimeEvent; - assert_ok!( - ::Identity::set_username_for( - ::RuntimeOrigin::signed(people_kusama_alice.clone()), - people_kusama_runtime::MultiAddress::Id(people_kusama_bob.clone()), - usr.to_owned().into_bytes().try_into().unwrap(), - None, + assert_ok!(::Identity::set_username_for( + ::RuntimeOrigin::signed(people_kusama_alice.clone()), + people_kusama_runtime::MultiAddress::Id(people_kusama_bob.clone()), + usr.to_owned().into_bytes().try_into().unwrap(), + None, )); assert_expected_events!( @@ -244,10 +243,9 @@ fn relay_commands_add_remove_username_authority() { type PeopleRuntimeEvent = ::RuntimeEvent; let full_username = [usr.to_owned(), ".suffix1".to_owned()].concat().into_bytes(); - assert_ok!( - ::Identity::accept_username( - ::RuntimeOrigin::signed(people_kusama_bob.clone()), - full_username.try_into().unwrap(), + assert_ok!(::Identity::accept_username( + ::RuntimeOrigin::signed(people_kusama_bob.clone()), + full_username.try_into().unwrap(), )); assert_expected_events!( @@ -266,23 +264,25 @@ fn relay_commands_add_remove_username_authority() { type PeopleCall = ::RuntimeCall; type PeopleRuntime = ::Runtime; - let remove_username_authority = - PeopleCall::Identity(pallet_identity::Call::::remove_username_authority { - authority: people_kusama_runtime::MultiAddress::Id(people_kusama_alice.clone()), - }); - - let remove_authority_xcm_msg = RuntimeCall::XcmPallet(pallet_xcm::Call::::send { - dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))), - message: bx!(VersionedXcm::from(Xcm(vec![ - UnpaidExecution { weight_limit: Unlimited, check_origin: None }, - Transact { - origin_kind, - require_weight_at_most: Weight::from_parts(500_000_000, 500_000), - call: remove_username_authority.encode().into(), - } - ]))), + let remove_username_authority = PeopleCall::Identity(pallet_identity::Call::< + PeopleRuntime, + >::remove_username_authority { + authority: people_kusama_runtime::MultiAddress::Id(people_kusama_alice.clone()), }); + let remove_authority_xcm_msg = + RuntimeCall::XcmPallet(pallet_xcm::Call::::send { + dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))), + message: bx!(VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit: Unlimited, check_origin: None }, + Transact { + origin_kind, + require_weight_at_most: Weight::from_parts(500_000_000, 500_000), + call: remove_username_authority.encode().into(), + } + ]))), + }); + assert_ok!(remove_authority_xcm_msg.dispatch(origin)); assert_expected_events!( @@ -305,6 +305,5 @@ fn relay_commands_add_remove_username_authority() { ] ); }); - } -} \ No newline at end of file +} diff --git a/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs b/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs index 777ce94365..a6edf4a015 100644 --- a/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs +++ b/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs @@ -17,8 +17,8 @@ use crate::*; use emulated_integration_tests_common::accounts::{ALICE, BOB}; use frame_support::sp_runtime::traits::Dispatchable; -use polkadot_runtime::governance::pallet_custom_origins::Origin::GeneralAdmin as GeneralAdminOrigin; use people_polkadot_runtime::people::IdentityInfo; +use polkadot_runtime::governance::pallet_custom_origins::Origin::GeneralAdmin as GeneralAdminOrigin; use pallet_identity::Data; @@ -85,16 +85,17 @@ fn relay_commands_kill_identity() { type PeopleRuntime = ::Runtime; type PeopleRuntimeEvent = ::RuntimeEvent; - let people_polkadot_alice = ::RuntimeOrigin::signed(PeoplePolkadot::account_id_of(ALICE)); + let people_polkadot_alice = + ::RuntimeOrigin::signed(PeoplePolkadot::account_id_of(ALICE)); let mut identity_info = ::default(); identity_info.email = Data::Raw(b"test@test.io".to_vec().try_into().unwrap()); - let identity: Box<::IdentityInformation> = Box::new(identity_info); + let identity: Box<::IdentityInformation> = + Box::new(identity_info); - assert_ok!( - ::Identity::set_identity( - people_polkadot_alice, - identity + assert_ok!(::Identity::set_identity( + people_polkadot_alice, + identity )); assert_expected_events!( @@ -105,8 +106,7 @@ fn relay_commands_kill_identity() { ); }); - let (origin_kind, origin) = - (OriginKind::Superuser, ::RuntimeOrigin::root()); + let (origin_kind, origin) = (OriginKind::Superuser, ::RuntimeOrigin::root()); Polkadot::execute_with(|| { type Runtime = ::Runtime; @@ -117,7 +117,9 @@ fn relay_commands_kill_identity() { let kill_identity_call = PeopleCall::Identity(pallet_identity::Call::::kill_identity { - target: people_polkadot_runtime::MultiAddress::Id(PeoplePolkadot::account_id_of(ALICE)), + target: people_polkadot_runtime::MultiAddress::Id(PeoplePolkadot::account_id_of( + ALICE, + )), }); let xcm_message = RuntimeCall::XcmPallet(pallet_xcm::Call::::send { @@ -163,7 +165,6 @@ fn relay_commands_add_remove_username_authority() { let people_polkadot_alice = PeoplePolkadot::account_id_of(ALICE); let people_polkadot_bob = PeoplePolkadot::account_id_of(BOB); - let origins = vec![ (OriginKind::Xcm, GeneralAdminOrigin.into(), "generaladmin"), (OriginKind::Superuser, ::RuntimeOrigin::root(), "rootusername"), @@ -177,12 +178,13 @@ fn relay_commands_add_remove_username_authority() { type PeopleCall = ::RuntimeCall; type PeopleRuntime = ::Runtime; - let add_username_authority = - PeopleCall::Identity(pallet_identity::Call::::add_username_authority { - authority: people_polkadot_runtime::MultiAddress::Id(people_polkadot_alice.clone()), - suffix: b"suffix1".into(), - allocation: 10 - }); + let add_username_authority = PeopleCall::Identity(pallet_identity::Call::< + PeopleRuntime, + >::add_username_authority { + authority: people_polkadot_runtime::MultiAddress::Id(people_polkadot_alice.clone()), + suffix: b"suffix1".into(), + allocation: 10, + }); let add_authority_xcm_msg = RuntimeCall::XcmPallet(pallet_xcm::Call::::send { dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))), @@ -223,12 +225,11 @@ fn relay_commands_add_remove_username_authority() { PeoplePolkadot::execute_with(|| { type PeopleRuntimeEvent = ::RuntimeEvent; - assert_ok!( - ::Identity::set_username_for( - ::RuntimeOrigin::signed(people_polkadot_alice.clone()), - people_polkadot_runtime::MultiAddress::Id(people_polkadot_bob.clone()), - usr.to_owned().into_bytes().try_into().unwrap(), - None, + assert_ok!(::Identity::set_username_for( + ::RuntimeOrigin::signed(people_polkadot_alice.clone()), + people_polkadot_runtime::MultiAddress::Id(people_polkadot_bob.clone()), + usr.to_owned().into_bytes().try_into().unwrap(), + None, )); assert_expected_events!( @@ -244,10 +245,9 @@ fn relay_commands_add_remove_username_authority() { type PeopleRuntimeEvent = ::RuntimeEvent; let full_username = [usr.to_owned(), ".suffix1".to_owned()].concat().into_bytes(); - assert_ok!( - ::Identity::accept_username( - ::RuntimeOrigin::signed(people_polkadot_bob.clone()), - full_username.try_into().unwrap(), + assert_ok!(::Identity::accept_username( + ::RuntimeOrigin::signed(people_polkadot_bob.clone()), + full_username.try_into().unwrap(), )); assert_expected_events!( @@ -266,23 +266,25 @@ fn relay_commands_add_remove_username_authority() { type PeopleCall = ::RuntimeCall; type PeopleRuntime = ::Runtime; - let remove_username_authority = - PeopleCall::Identity(pallet_identity::Call::::remove_username_authority { - authority: people_polkadot_runtime::MultiAddress::Id(people_polkadot_alice.clone()), - }); - - let remove_authority_xcm_msg = RuntimeCall::XcmPallet(pallet_xcm::Call::::send { - dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))), - message: bx!(VersionedXcm::from(Xcm(vec![ - UnpaidExecution { weight_limit: Unlimited, check_origin: None }, - Transact { - origin_kind, - require_weight_at_most: Weight::from_parts(500_000_000, 500_000), - call: remove_username_authority.encode().into(), - } - ]))), + let remove_username_authority = PeopleCall::Identity(pallet_identity::Call::< + PeopleRuntime, + >::remove_username_authority { + authority: people_polkadot_runtime::MultiAddress::Id(people_polkadot_alice.clone()), }); + let remove_authority_xcm_msg = + RuntimeCall::XcmPallet(pallet_xcm::Call::::send { + dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))), + message: bx!(VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit: Unlimited, check_origin: None }, + Transact { + origin_kind, + require_weight_at_most: Weight::from_parts(500_000_000, 500_000), + call: remove_username_authority.encode().into(), + } + ]))), + }); + assert_ok!(remove_authority_xcm_msg.dispatch(origin)); assert_expected_events!( @@ -305,6 +307,5 @@ fn relay_commands_add_remove_username_authority() { ] ); }); - } -} \ No newline at end of file +}