Skip to content

Commit

Permalink
Apply cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
rockbmb committed Nov 4, 2024
1 parent 1325e59 commit 4752d1c
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,17 @@ fn relay_commands_kill_identity() {
type PeopleRuntime = <PeopleKusama as Chain>::Runtime;
type PeopleRuntimeEvent = <PeopleKusama as Chain>::RuntimeEvent;

let people_kusama_alice = <PeopleKusama as Chain>::RuntimeOrigin::signed(PeopleKusama::account_id_of(ALICE));
let people_kusama_alice =
<PeopleKusama as Chain>::RuntimeOrigin::signed(PeopleKusama::account_id_of(ALICE));

let mut identity_info = <IdentityInfo as Default>::default();
identity_info.email = Data::Raw(b"[email protected]".to_vec().try_into().unwrap());
let identity: Box<<PeopleRuntime as pallet_identity::Config>::IdentityInformation> = Box::new(identity_info);
let identity: Box<<PeopleRuntime as pallet_identity::Config>::IdentityInformation> =
Box::new(identity_info);

assert_ok!(
<PeopleKusama as PeopleKusamaPallet>::Identity::set_identity(
people_kusama_alice,
identity
assert_ok!(<PeopleKusama as PeopleKusamaPallet>::Identity::set_identity(
people_kusama_alice,
identity
));

assert_expected_events!(
Expand All @@ -105,8 +106,7 @@ fn relay_commands_kill_identity() {
);
});

let (origin_kind, origin) =
(OriginKind::Superuser, <Kusama as Chain>::RuntimeOrigin::root());
let (origin_kind, origin) = (OriginKind::Superuser, <Kusama as Chain>::RuntimeOrigin::root());

Kusama::execute_with(|| {
type Runtime = <Kusama as Chain>::Runtime;
Expand Down Expand Up @@ -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, <Kusama as Chain>::RuntimeOrigin::root(), "rootusername"),
Expand All @@ -177,12 +176,13 @@ fn relay_commands_add_remove_username_authority() {
type PeopleCall = <PeopleKusama as Chain>::RuntimeCall;
type PeopleRuntime = <PeopleKusama as Chain>::Runtime;

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_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::<Runtime>::send {
dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))),
Expand Down Expand Up @@ -223,12 +223,11 @@ fn relay_commands_add_remove_username_authority() {
PeopleKusama::execute_with(|| {
type PeopleRuntimeEvent = <PeopleKusama as Chain>::RuntimeEvent;

assert_ok!(
<PeopleKusama as PeopleKusamaPallet>::Identity::set_username_for(
<PeopleKusama as Chain>::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!(<PeopleKusama as PeopleKusamaPallet>::Identity::set_username_for(
<PeopleKusama as Chain>::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!(
Expand All @@ -244,10 +243,9 @@ fn relay_commands_add_remove_username_authority() {
type PeopleRuntimeEvent = <PeopleKusama as Chain>::RuntimeEvent;
let full_username = [usr.to_owned(), ".suffix1".to_owned()].concat().into_bytes();

assert_ok!(
<PeopleKusama as PeopleKusamaPallet>::Identity::accept_username(
<PeopleKusama as Chain>::RuntimeOrigin::signed(people_kusama_bob.clone()),
full_username.try_into().unwrap(),
assert_ok!(<PeopleKusama as PeopleKusamaPallet>::Identity::accept_username(
<PeopleKusama as Chain>::RuntimeOrigin::signed(people_kusama_bob.clone()),
full_username.try_into().unwrap(),
));

assert_expected_events!(
Expand All @@ -266,23 +264,25 @@ fn relay_commands_add_remove_username_authority() {
type PeopleCall = <PeopleKusama as Chain>::RuntimeCall;
type PeopleRuntime = <PeopleKusama as Chain>::Runtime;

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::<Runtime>::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::<Runtime>::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!(
Expand All @@ -305,6 +305,5 @@ fn relay_commands_add_remove_username_authority() {
]
);
});

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -85,16 +85,17 @@ fn relay_commands_kill_identity() {
type PeopleRuntime = <PeoplePolkadot as Chain>::Runtime;
type PeopleRuntimeEvent = <PeoplePolkadot as Chain>::RuntimeEvent;

let people_polkadot_alice = <PeoplePolkadot as Chain>::RuntimeOrigin::signed(PeoplePolkadot::account_id_of(ALICE));
let people_polkadot_alice =
<PeoplePolkadot as Chain>::RuntimeOrigin::signed(PeoplePolkadot::account_id_of(ALICE));

let mut identity_info = <IdentityInfo as Default>::default();
identity_info.email = Data::Raw(b"[email protected]".to_vec().try_into().unwrap());
let identity: Box<<PeopleRuntime as pallet_identity::Config>::IdentityInformation> = Box::new(identity_info);
let identity: Box<<PeopleRuntime as pallet_identity::Config>::IdentityInformation> =
Box::new(identity_info);

assert_ok!(
<PeoplePolkadot as PeoplePolkadotPallet>::Identity::set_identity(
people_polkadot_alice,
identity
assert_ok!(<PeoplePolkadot as PeoplePolkadotPallet>::Identity::set_identity(
people_polkadot_alice,
identity
));

assert_expected_events!(
Expand All @@ -105,8 +106,7 @@ fn relay_commands_kill_identity() {
);
});

let (origin_kind, origin) =
(OriginKind::Superuser, <Polkadot as Chain>::RuntimeOrigin::root());
let (origin_kind, origin) = (OriginKind::Superuser, <Polkadot as Chain>::RuntimeOrigin::root());

Polkadot::execute_with(|| {
type Runtime = <Polkadot as Chain>::Runtime;
Expand All @@ -117,7 +117,9 @@ fn relay_commands_kill_identity() {

let kill_identity_call =
PeopleCall::Identity(pallet_identity::Call::<PeopleRuntime>::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::<Runtime>::send {
Expand Down Expand Up @@ -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, <Polkadot as Chain>::RuntimeOrigin::root(), "rootusername"),
Expand All @@ -177,12 +178,13 @@ fn relay_commands_add_remove_username_authority() {
type PeopleCall = <PeoplePolkadot as Chain>::RuntimeCall;
type PeopleRuntime = <PeoplePolkadot as Chain>::Runtime;

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_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::<Runtime>::send {
dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))),
Expand Down Expand Up @@ -223,12 +225,11 @@ fn relay_commands_add_remove_username_authority() {
PeoplePolkadot::execute_with(|| {
type PeopleRuntimeEvent = <PeoplePolkadot as Chain>::RuntimeEvent;

assert_ok!(
<PeoplePolkadot as PeoplePolkadotPallet>::Identity::set_username_for(
<PeoplePolkadot as Chain>::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!(<PeoplePolkadot as PeoplePolkadotPallet>::Identity::set_username_for(
<PeoplePolkadot as Chain>::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!(
Expand All @@ -244,10 +245,9 @@ fn relay_commands_add_remove_username_authority() {
type PeopleRuntimeEvent = <PeoplePolkadot as Chain>::RuntimeEvent;
let full_username = [usr.to_owned(), ".suffix1".to_owned()].concat().into_bytes();

assert_ok!(
<PeoplePolkadot as PeoplePolkadotPallet>::Identity::accept_username(
<PeoplePolkadot as Chain>::RuntimeOrigin::signed(people_polkadot_bob.clone()),
full_username.try_into().unwrap(),
assert_ok!(<PeoplePolkadot as PeoplePolkadotPallet>::Identity::accept_username(
<PeoplePolkadot as Chain>::RuntimeOrigin::signed(people_polkadot_bob.clone()),
full_username.try_into().unwrap(),
));

assert_expected_events!(
Expand All @@ -266,23 +266,25 @@ fn relay_commands_add_remove_username_authority() {
type PeopleCall = <PeoplePolkadot as Chain>::RuntimeCall;
type PeopleRuntime = <PeoplePolkadot as Chain>::Runtime;

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::<Runtime>::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::<Runtime>::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!(
Expand All @@ -305,6 +307,5 @@ fn relay_commands_add_remove_username_authority() {
]
);
});

}
}
}

0 comments on commit 4752d1c

Please sign in to comment.