mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 02:51:01 +00:00
Fix clippy warnings (#7625)
* Fix clippy check Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Autofix clippy Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix trivial Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * suppress warnings Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Quiet clippy 😌 Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
committed by
GitHub
parent
a0f83eb992
commit
d501d92176
@@ -46,10 +46,8 @@ fn report_outcome_notify_works() {
|
||||
(ParaId::from(PARA_ID).into_account_truncating(), INITIAL_BALANCE),
|
||||
];
|
||||
let sender: MultiLocation = AccountId32 { network: None, id: ALICE.into() }.into();
|
||||
let mut message = Xcm(vec![TransferAsset {
|
||||
assets: (Here, SEND_AMOUNT).into(),
|
||||
beneficiary: sender.clone(),
|
||||
}]);
|
||||
let mut message =
|
||||
Xcm(vec![TransferAsset { assets: (Here, SEND_AMOUNT).into(), beneficiary: sender }]);
|
||||
let call = pallet_test_notifier::Call::notification_received {
|
||||
query_id: 0,
|
||||
response: Default::default(),
|
||||
@@ -71,7 +69,7 @@ fn report_outcome_notify_works() {
|
||||
query_id: 0,
|
||||
max_weight: Weight::from_parts(1_000_000, 1_000_000),
|
||||
})])),
|
||||
TransferAsset { assets: (Here, SEND_AMOUNT).into(), beneficiary: sender.clone() },
|
||||
TransferAsset { assets: (Here, SEND_AMOUNT).into(), beneficiary: sender },
|
||||
])
|
||||
);
|
||||
let querier: MultiLocation = Here.into();
|
||||
@@ -79,7 +77,7 @@ fn report_outcome_notify_works() {
|
||||
responder: MultiLocation::from(Parachain(PARA_ID)).into(),
|
||||
maybe_notify: Some((4, 2)),
|
||||
timeout: 100,
|
||||
maybe_match_querier: Some(querier.clone().into()),
|
||||
maybe_match_querier: Some(querier.into()),
|
||||
};
|
||||
assert_eq!(crate::Queries::<Test>::iter().collect::<Vec<_>>(), vec![(0, status)]);
|
||||
|
||||
@@ -123,10 +121,8 @@ fn report_outcome_works() {
|
||||
(ParaId::from(PARA_ID).into_account_truncating(), INITIAL_BALANCE),
|
||||
];
|
||||
let sender: MultiLocation = AccountId32 { network: None, id: ALICE.into() }.into();
|
||||
let mut message = Xcm(vec![TransferAsset {
|
||||
assets: (Here, SEND_AMOUNT).into(),
|
||||
beneficiary: sender.clone(),
|
||||
}]);
|
||||
let mut message =
|
||||
Xcm(vec![TransferAsset { assets: (Here, SEND_AMOUNT).into(), beneficiary: sender }]);
|
||||
new_test_ext_with_balances(balances).execute_with(|| {
|
||||
XcmPallet::report_outcome(&mut message, Parachain(PARA_ID).into_location(), 100).unwrap();
|
||||
assert_eq!(
|
||||
@@ -137,7 +133,7 @@ fn report_outcome_works() {
|
||||
query_id: 0,
|
||||
max_weight: Weight::zero(),
|
||||
})])),
|
||||
TransferAsset { assets: (Here, SEND_AMOUNT).into(), beneficiary: sender.clone() },
|
||||
TransferAsset { assets: (Here, SEND_AMOUNT).into(), beneficiary: sender },
|
||||
])
|
||||
);
|
||||
let querier: MultiLocation = Here.into();
|
||||
@@ -145,7 +141,7 @@ fn report_outcome_works() {
|
||||
responder: MultiLocation::from(Parachain(PARA_ID)).into(),
|
||||
maybe_notify: None,
|
||||
timeout: 100,
|
||||
maybe_match_querier: Some(querier.clone().into()),
|
||||
maybe_match_querier: Some(querier.into()),
|
||||
};
|
||||
assert_eq!(crate::Queries::<Test>::iter().collect::<Vec<_>>(), vec![(0, status)]);
|
||||
|
||||
@@ -187,13 +183,13 @@ fn custom_querier_works() {
|
||||
let querier: MultiLocation =
|
||||
(Parent, AccountId32 { network: None, id: ALICE.into() }).into();
|
||||
|
||||
let r = TestNotifier::prepare_new_query(RuntimeOrigin::signed(ALICE), querier.clone());
|
||||
let r = TestNotifier::prepare_new_query(RuntimeOrigin::signed(ALICE), querier);
|
||||
assert_eq!(r, Ok(()));
|
||||
let status = QueryStatus::Pending {
|
||||
responder: MultiLocation::from(AccountId32 { network: None, id: ALICE.into() }).into(),
|
||||
maybe_notify: None,
|
||||
timeout: 100,
|
||||
maybe_match_querier: Some(querier.clone().into()),
|
||||
maybe_match_querier: Some(querier.into()),
|
||||
};
|
||||
assert_eq!(crate::Queries::<Test>::iter().collect::<Vec<_>>(), vec![(0, status)]);
|
||||
|
||||
@@ -218,7 +214,7 @@ fn custom_querier_works() {
|
||||
RuntimeEvent::XcmPallet(crate::Event::InvalidQuerier {
|
||||
origin: AccountId32 { network: None, id: ALICE.into() }.into(),
|
||||
query_id: 0,
|
||||
expected_querier: querier.clone(),
|
||||
expected_querier: querier,
|
||||
maybe_actual_querier: None,
|
||||
}),
|
||||
);
|
||||
@@ -244,7 +240,7 @@ fn custom_querier_works() {
|
||||
RuntimeEvent::XcmPallet(crate::Event::InvalidQuerier {
|
||||
origin: AccountId32 { network: None, id: ALICE.into() }.into(),
|
||||
query_id: 0,
|
||||
expected_querier: querier.clone(),
|
||||
expected_querier: querier,
|
||||
maybe_actual_querier: Some(MultiLocation::here()),
|
||||
}),
|
||||
);
|
||||
@@ -293,7 +289,7 @@ fn send_works() {
|
||||
ReserveAssetDeposited((Parent, SEND_AMOUNT).into()),
|
||||
ClearOrigin,
|
||||
buy_execution((Parent, SEND_AMOUNT)),
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: sender.clone() },
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: sender },
|
||||
]);
|
||||
|
||||
let versioned_dest = Box::new(RelayLocation::get().into());
|
||||
@@ -303,7 +299,7 @@ fn send_works() {
|
||||
versioned_dest,
|
||||
versioned_message
|
||||
));
|
||||
let sent_message = Xcm(Some(DescendOrigin(sender.clone().try_into().unwrap()))
|
||||
let sent_message = Xcm(Some(DescendOrigin(sender.try_into().unwrap()))
|
||||
.into_iter()
|
||||
.chain(message.0.clone().into_iter())
|
||||
.collect());
|
||||
@@ -337,7 +333,7 @@ fn send_fails_when_xcm_router_blocks() {
|
||||
let message = Xcm(vec![
|
||||
ReserveAssetDeposited((Parent, SEND_AMOUNT).into()),
|
||||
buy_execution((Parent, SEND_AMOUNT)),
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: sender.clone() },
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: sender },
|
||||
]);
|
||||
assert_noop!(
|
||||
XcmPallet::send(
|
||||
@@ -367,7 +363,7 @@ fn teleport_assets_works() {
|
||||
assert_ok!(XcmPallet::teleport_assets(
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(RelayLocation::get().into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new(dest.into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
0,
|
||||
));
|
||||
@@ -410,7 +406,7 @@ fn limited_teleport_assets_works() {
|
||||
assert_ok!(XcmPallet::limited_teleport_assets(
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(RelayLocation::get().into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new(dest.into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
0,
|
||||
WeightLimit::Limited(Weight::from_parts(5000, 5000)),
|
||||
@@ -454,7 +450,7 @@ fn unlimited_teleport_assets_works() {
|
||||
assert_ok!(XcmPallet::limited_teleport_assets(
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(RelayLocation::get().into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new(dest.into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
0,
|
||||
WeightLimit::Unlimited,
|
||||
@@ -496,7 +492,7 @@ fn reserve_transfer_assets_works() {
|
||||
assert_ok!(XcmPallet::reserve_transfer_assets(
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(Parachain(PARA_ID).into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new(dest.into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
0,
|
||||
));
|
||||
@@ -543,7 +539,7 @@ fn limited_reserve_transfer_assets_works() {
|
||||
assert_ok!(XcmPallet::limited_reserve_transfer_assets(
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(Parachain(PARA_ID).into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new(dest.into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
0,
|
||||
WeightLimit::Limited(Weight::from_parts(5000, 5000)),
|
||||
@@ -591,7 +587,7 @@ fn unlimited_reserve_transfer_assets_works() {
|
||||
assert_ok!(XcmPallet::limited_reserve_transfer_assets(
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(Parachain(PARA_ID).into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new(dest.into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
0,
|
||||
WeightLimit::Unlimited,
|
||||
@@ -670,7 +666,7 @@ fn trapped_assets_can_be_claimed() {
|
||||
// This will make an error.
|
||||
Trap(0),
|
||||
// This would succeed, but we never get to it.
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: dest.clone() },
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: dest },
|
||||
]))),
|
||||
weight
|
||||
));
|
||||
@@ -678,12 +674,12 @@ fn trapped_assets_can_be_claimed() {
|
||||
Junction::AccountId32 { network: None, id: ALICE.into() }.into();
|
||||
let trapped = AssetTraps::<Test>::iter().collect::<Vec<_>>();
|
||||
let vma = VersionedMultiAssets::from(MultiAssets::from((Here, SEND_AMOUNT)));
|
||||
let hash = BlakeTwo256::hash_of(&(source.clone(), vma.clone()));
|
||||
let hash = BlakeTwo256::hash_of(&(source, vma.clone()));
|
||||
assert_eq!(
|
||||
last_events(2),
|
||||
vec![
|
||||
RuntimeEvent::XcmPallet(crate::Event::AssetsTrapped {
|
||||
hash: hash.clone(),
|
||||
hash,
|
||||
origin: source,
|
||||
assets: vma
|
||||
}),
|
||||
@@ -704,7 +700,7 @@ fn trapped_assets_can_be_claimed() {
|
||||
Box::new(VersionedXcm::from(Xcm(vec![
|
||||
ClaimAsset { assets: (Here, SEND_AMOUNT).into(), ticket: Here.into() },
|
||||
buy_execution((Here, SEND_AMOUNT)),
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: dest.clone() },
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: dest },
|
||||
]))),
|
||||
weight
|
||||
));
|
||||
@@ -742,25 +738,22 @@ fn basic_subscription_works() {
|
||||
let remote: MultiLocation = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
Box::new(remote.into()),
|
||||
));
|
||||
|
||||
assert_eq!(
|
||||
Queries::<Test>::iter().collect::<Vec<_>>(),
|
||||
vec![(
|
||||
0,
|
||||
QueryStatus::VersionNotifier { origin: remote.clone().into(), is_active: false }
|
||||
)]
|
||||
vec![(0, QueryStatus::VersionNotifier { origin: remote.into(), is_active: false })]
|
||||
);
|
||||
assert_eq!(
|
||||
VersionNotifiers::<Test>::iter().collect::<Vec<_>>(),
|
||||
vec![(XCM_VERSION, remote.clone().into(), 0)]
|
||||
vec![(XCM_VERSION, remote.into(), 0)]
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
take_sent_xcm(),
|
||||
vec![(
|
||||
remote.clone(),
|
||||
remote,
|
||||
Xcm(vec![SubscribeVersion { query_id: 0, max_response_weight: Weight::zero() }]),
|
||||
),]
|
||||
);
|
||||
@@ -790,27 +783,27 @@ fn subscriptions_increment_id() {
|
||||
let remote: MultiLocation = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
Box::new(remote.into()),
|
||||
));
|
||||
|
||||
let remote2: MultiLocation = Parachain(1001).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote2.clone().into()),
|
||||
Box::new(remote2.into()),
|
||||
));
|
||||
|
||||
assert_eq!(
|
||||
take_sent_xcm(),
|
||||
vec![
|
||||
(
|
||||
remote.clone(),
|
||||
remote,
|
||||
Xcm(vec![SubscribeVersion {
|
||||
query_id: 0,
|
||||
max_response_weight: Weight::zero()
|
||||
}]),
|
||||
),
|
||||
(
|
||||
remote2.clone(),
|
||||
remote2,
|
||||
Xcm(vec![SubscribeVersion {
|
||||
query_id: 1,
|
||||
max_response_weight: Weight::zero()
|
||||
@@ -827,12 +820,12 @@ fn double_subscription_fails() {
|
||||
let remote: MultiLocation = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
Box::new(remote.into()),
|
||||
));
|
||||
assert_noop!(
|
||||
XcmPallet::force_subscribe_version_notify(
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into())
|
||||
Box::new(remote.into())
|
||||
),
|
||||
Error::<Test>::AlreadySubscribed,
|
||||
);
|
||||
@@ -845,16 +838,16 @@ fn unsubscribe_works() {
|
||||
let remote: MultiLocation = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
Box::new(remote.into()),
|
||||
));
|
||||
assert_ok!(XcmPallet::force_unsubscribe_version_notify(
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into())
|
||||
Box::new(remote.into())
|
||||
));
|
||||
assert_noop!(
|
||||
XcmPallet::force_unsubscribe_version_notify(
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into())
|
||||
Box::new(remote.into())
|
||||
),
|
||||
Error::<Test>::NoSubscription,
|
||||
);
|
||||
@@ -863,13 +856,13 @@ fn unsubscribe_works() {
|
||||
take_sent_xcm(),
|
||||
vec![
|
||||
(
|
||||
remote.clone(),
|
||||
remote,
|
||||
Xcm(vec![SubscribeVersion {
|
||||
query_id: 0,
|
||||
max_response_weight: Weight::zero()
|
||||
}]),
|
||||
),
|
||||
(remote.clone(), Xcm(vec![UnsubscribeVersion]),),
|
||||
(remote, Xcm(vec![UnsubscribeVersion]),),
|
||||
]
|
||||
);
|
||||
});
|
||||
@@ -886,7 +879,7 @@ fn subscription_side_works() {
|
||||
let message =
|
||||
Xcm(vec![SubscribeVersion { query_id: 0, max_response_weight: Weight::zero() }]);
|
||||
let hash = fake_message_hash(&message);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote.clone(), message, hash, weight);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote, message, hash, weight);
|
||||
assert_eq!(r, Outcome::Complete(weight));
|
||||
|
||||
let instr = QueryResponse {
|
||||
@@ -895,7 +888,7 @@ fn subscription_side_works() {
|
||||
response: Response::Version(1),
|
||||
querier: None,
|
||||
};
|
||||
assert_eq!(take_sent_xcm(), vec![(remote.clone(), Xcm(vec![instr]))]);
|
||||
assert_eq!(take_sent_xcm(), vec![(remote, Xcm(vec![instr]))]);
|
||||
|
||||
// A runtime upgrade which doesn't alter the version sends no notifications.
|
||||
CurrentMigration::<Test>::put(VersionMigrationStage::default());
|
||||
@@ -914,7 +907,7 @@ fn subscription_side_works() {
|
||||
response: Response::Version(2),
|
||||
querier: None,
|
||||
};
|
||||
assert_eq!(take_sent_xcm(), vec![(remote.clone(), Xcm(vec![instr]))]);
|
||||
assert_eq!(take_sent_xcm(), vec![(remote, Xcm(vec![instr]))]);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1004,7 +997,7 @@ fn subscriber_side_subscription_works() {
|
||||
let remote: MultiLocation = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
Box::new(remote.into()),
|
||||
));
|
||||
take_sent_xcm();
|
||||
|
||||
@@ -1021,7 +1014,7 @@ fn subscriber_side_subscription_works() {
|
||||
},
|
||||
]);
|
||||
let hash = fake_message_hash(&message);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote.clone(), message, hash, weight);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote, message, hash, weight);
|
||||
assert_eq!(r, Outcome::Complete(weight));
|
||||
assert_eq!(take_sent_xcm(), vec![]);
|
||||
|
||||
@@ -1039,7 +1032,7 @@ fn subscriber_side_subscription_works() {
|
||||
},
|
||||
]);
|
||||
let hash = fake_message_hash(&message);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote.clone(), message, hash, weight);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote, message, hash, weight);
|
||||
assert_eq!(r, Outcome::Complete(weight));
|
||||
|
||||
// This message can now be sent to remote as it's v2.
|
||||
@@ -1068,7 +1061,7 @@ fn auto_subscription_works() {
|
||||
);
|
||||
assert_eq!(XcmPallet::wrap_version(&remote_v2, msg_v3.clone()), Err(()));
|
||||
|
||||
let expected = vec![(remote_v2.clone().into(), 2)];
|
||||
let expected = vec![(remote_v2.into(), 2)];
|
||||
assert_eq!(VersionDiscoveryQueue::<Test>::get().into_inner(), expected);
|
||||
|
||||
assert_eq!(
|
||||
@@ -1077,14 +1070,14 @@ fn auto_subscription_works() {
|
||||
);
|
||||
assert_eq!(XcmPallet::wrap_version(&remote_v3, msg_v3.clone()), Err(()));
|
||||
|
||||
let expected = vec![(remote_v2.clone().into(), 2), (remote_v3.clone().into(), 2)];
|
||||
let expected = vec![(remote_v2.into(), 2), (remote_v3.into(), 2)];
|
||||
assert_eq!(VersionDiscoveryQueue::<Test>::get().into_inner(), expected);
|
||||
|
||||
XcmPallet::on_initialize(1);
|
||||
assert_eq!(
|
||||
take_sent_xcm(),
|
||||
vec![(
|
||||
remote_v3.clone(),
|
||||
remote_v3,
|
||||
Xcm(vec![SubscribeVersion { query_id: 0, max_response_weight: Weight::zero() }]),
|
||||
)]
|
||||
);
|
||||
@@ -1102,7 +1095,7 @@ fn auto_subscription_works() {
|
||||
},
|
||||
]);
|
||||
let hash = fake_message_hash(&message);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote_v3.clone(), message, hash, weight);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote_v3, message, hash, weight);
|
||||
assert_eq!(r, Outcome::Complete(weight));
|
||||
|
||||
// V2 messages can be sent to remote_v3 under XCM v3.
|
||||
@@ -1120,7 +1113,7 @@ fn auto_subscription_works() {
|
||||
assert_eq!(
|
||||
take_sent_xcm(),
|
||||
vec![(
|
||||
remote_v2.clone(),
|
||||
remote_v2,
|
||||
Xcm(vec![SubscribeVersion { query_id: 1, max_response_weight: Weight::zero() }]),
|
||||
)]
|
||||
);
|
||||
@@ -1138,7 +1131,7 @@ fn auto_subscription_works() {
|
||||
},
|
||||
]);
|
||||
let hash = fake_message_hash(&message);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote_v2.clone(), message, hash, weight);
|
||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote_v2, message, hash, weight);
|
||||
assert_eq!(r, Outcome::Complete(weight));
|
||||
|
||||
// v3 messages cannot be sent to remote_v2...
|
||||
|
||||
Reference in New Issue
Block a user