mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 16:21:02 +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...
|
||||
|
||||
@@ -286,11 +286,11 @@ mod tests {
|
||||
struct ClassInstanceIdConverter;
|
||||
impl MaybeEquivalence<AssetInstance, ClassInstanceId> for ClassInstanceIdConverter {
|
||||
fn convert(value: &AssetInstance) -> Option<ClassInstanceId> {
|
||||
value.clone().try_into().ok()
|
||||
(*value).try_into().ok()
|
||||
}
|
||||
|
||||
fn convert_back(value: &ClassInstanceId) -> Option<AssetInstance> {
|
||||
Some(AssetInstance::from(value.clone()))
|
||||
Some(AssetInstance::from(*value))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -147,10 +147,7 @@ fn reserve_transfer_should_work() {
|
||||
let message = Xcm(vec![TransferReserveAsset {
|
||||
assets: (Here, 100u128).into(),
|
||||
dest: Parachain(2).into(),
|
||||
xcm: Xcm::<()>(vec![DepositAsset {
|
||||
assets: AllCounted(1).into(),
|
||||
beneficiary: three.clone(),
|
||||
}]),
|
||||
xcm: Xcm::<()>(vec![DepositAsset { assets: AllCounted(1).into(), beneficiary: three }]),
|
||||
}]);
|
||||
let hash = fake_message_hash(&message);
|
||||
let r = XcmExecutor::<TestConfig>::execute_xcm(
|
||||
|
||||
@@ -155,7 +155,7 @@ fn price<RemoteExporter: ExportXcm>(
|
||||
d: &InteriorMultiLocation,
|
||||
m: &Xcm<()>,
|
||||
) -> Result<MultiAssets, SendError> {
|
||||
Ok(validate_export::<RemoteExporter>(n, c, s.clone(), d.clone(), m.clone())?.1)
|
||||
Ok(validate_export::<RemoteExporter>(n, c, *s, *d, m.clone())?.1)
|
||||
}
|
||||
|
||||
fn deliver<RemoteExporter: ExportXcm>(
|
||||
@@ -205,7 +205,7 @@ impl<Local: Get<Junctions>, Remote: Get<Junctions>, RemoteExporter: ExportXcm> S
|
||||
// though it is `Remote`.
|
||||
ExecutorUniversalLocation::set(Remote::get());
|
||||
let origin = Local::get().relative_to(&Remote::get());
|
||||
AllowUnpaidFrom::set(vec![origin.clone()]);
|
||||
AllowUnpaidFrom::set(vec![origin]);
|
||||
set_exporter_override(price::<RemoteExporter>, deliver::<RemoteExporter>);
|
||||
// The we execute it:
|
||||
let mut id = fake_id();
|
||||
@@ -255,7 +255,7 @@ impl<Local: Get<Junctions>, Remote: Get<Junctions>, RemoteExporter: ExportXcm> S
|
||||
// though it is `Remote`.
|
||||
ExecutorUniversalLocation::set(Remote::get());
|
||||
let origin = Local::get().relative_to(&Remote::get());
|
||||
AllowPaidFrom::set(vec![origin.clone()]);
|
||||
AllowPaidFrom::set(vec![origin]);
|
||||
set_exporter_override(price::<RemoteExporter>, deliver::<RemoteExporter>);
|
||||
// Then we execute it:
|
||||
let mut id = fake_id();
|
||||
|
||||
@@ -113,7 +113,7 @@ fn sending_to_bridged_chain_without_funds_fails() {
|
||||
let dest: MultiLocation = (Parent, Parent, Remote::get()).into();
|
||||
// Routing won't work if we don't have enough funds.
|
||||
assert_eq!(
|
||||
send_xcm::<LocalRouter>(dest.clone(), Xcm(vec![Trap(1)])),
|
||||
send_xcm::<LocalRouter>(dest, Xcm(vec![Trap(1)])),
|
||||
Err(SendError::Transport("Error executing")),
|
||||
);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ fn sending_to_parachain_of_bridged_chain_without_funds_fails() {
|
||||
let dest: MultiLocation = (Parent, Parent, Remote::get(), Parachain(100)).into();
|
||||
// Routing won't work if we don't have enough funds.
|
||||
assert_eq!(
|
||||
send_xcm::<LocalRouter>(dest.clone(), Xcm(vec![Trap(1)])),
|
||||
send_xcm::<LocalRouter>(dest, Xcm(vec![Trap(1)])),
|
||||
Err(SendError::Transport("Error executing")),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ impl TransactAsset for TestAssetTransactor {
|
||||
who: &MultiLocation,
|
||||
_context: &XcmContext,
|
||||
) -> Result<(), XcmError> {
|
||||
add_asset(who.clone(), what.clone());
|
||||
add_asset(*who, what.clone());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ pub fn disallow_unlock(
|
||||
pub fn unlock_allowed(unlocker: &MultiLocation, asset: &MultiAsset, owner: &MultiLocation) -> bool {
|
||||
ALLOWED_UNLOCKS.with(|l| {
|
||||
l.borrow_mut()
|
||||
.get(&(owner.clone(), unlocker.clone()))
|
||||
.get(&(*owner, *unlocker))
|
||||
.map_or(false, |x| x.contains_asset(asset))
|
||||
})
|
||||
}
|
||||
@@ -550,7 +550,7 @@ pub fn request_unlock_allowed(
|
||||
) -> bool {
|
||||
ALLOWED_REQUEST_UNLOCKS.with(|l| {
|
||||
l.borrow_mut()
|
||||
.get(&(owner.clone(), locker.clone()))
|
||||
.get(&(*owner, *locker))
|
||||
.map_or(false, |x| x.contains_asset(asset))
|
||||
})
|
||||
}
|
||||
@@ -560,11 +560,11 @@ impl Enact for TestTicket {
|
||||
fn enact(self) -> Result<(), LockError> {
|
||||
match &self.0 {
|
||||
LockTraceItem::Lock { unlocker, asset, owner } =>
|
||||
allow_unlock(unlocker.clone(), asset.clone(), owner.clone()),
|
||||
allow_unlock(*unlocker, asset.clone(), *owner),
|
||||
LockTraceItem::Unlock { unlocker, asset, owner } =>
|
||||
disallow_unlock(unlocker.clone(), asset.clone(), owner.clone()),
|
||||
disallow_unlock(*unlocker, asset.clone(), *owner),
|
||||
LockTraceItem::Reduce { locker, asset, owner } =>
|
||||
disallow_request_unlock(locker.clone(), asset.clone(), owner.clone()),
|
||||
disallow_request_unlock(*locker, asset.clone(), *owner),
|
||||
_ => {},
|
||||
}
|
||||
LOCK_TRACE.with(move |l| l.borrow_mut().push(self.0));
|
||||
@@ -583,7 +583,7 @@ impl AssetLock for TestAssetLock {
|
||||
asset: MultiAsset,
|
||||
owner: MultiLocation,
|
||||
) -> Result<Self::LockTicket, LockError> {
|
||||
ensure!(assets(owner.clone()).contains_asset(&asset), LockError::AssetNotOwned);
|
||||
ensure!(assets(owner).contains_asset(&asset), LockError::AssetNotOwned);
|
||||
Ok(TestTicket(LockTraceItem::Lock { unlocker, asset, owner }))
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ impl AssetLock for TestAssetLock {
|
||||
asset: MultiAsset,
|
||||
owner: MultiLocation,
|
||||
) -> Result<(), LockError> {
|
||||
allow_request_unlock(locker.clone(), asset.clone(), owner.clone());
|
||||
allow_request_unlock(locker, asset.clone(), owner);
|
||||
let item = LockTraceItem::Note { locker, asset, owner };
|
||||
LOCK_TRACE.with(move |l| l.borrow_mut().push(item));
|
||||
Ok(())
|
||||
|
||||
@@ -66,11 +66,11 @@ fn transacting_should_refund_weight() {
|
||||
#[test]
|
||||
fn paid_transacting_should_refund_payment_for_unused_weight() {
|
||||
let one: MultiLocation = AccountIndex64 { index: 1, network: None }.into();
|
||||
AllowPaidFrom::set(vec![one.clone()]);
|
||||
AllowPaidFrom::set(vec![one]);
|
||||
add_asset(AccountIndex64 { index: 1, network: None }, (Parent, 200u128));
|
||||
WeightPrice::set((Parent.into(), 1_000_000_000_000, 1024 * 1024));
|
||||
|
||||
let origin = one.clone();
|
||||
let origin = one;
|
||||
let fees = (Parent, 200u128).into();
|
||||
let message = Xcm::<TestCall>(vec![
|
||||
WithdrawAsset((Parent, 200u128).into()), // enough for 200 units of weight.
|
||||
@@ -84,7 +84,7 @@ fn paid_transacting_should_refund_payment_for_unused_weight() {
|
||||
.into(),
|
||||
},
|
||||
RefundSurplus,
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: one.clone() },
|
||||
DepositAsset { assets: AllCounted(1).into(), beneficiary: one },
|
||||
]);
|
||||
let hash = fake_message_hash(&message);
|
||||
let weight_limit = Weight::from_parts(100, 100);
|
||||
|
||||
@@ -59,7 +59,7 @@ fn version_subscription_instruction_should_work() {
|
||||
let hash = fake_message_hash(&message);
|
||||
let weight_limit = Weight::from_parts(20, 20);
|
||||
let r = XcmExecutor::<TestConfig>::execute_xcm_in_credit(
|
||||
origin.clone(),
|
||||
origin,
|
||||
message,
|
||||
hash,
|
||||
weight_limit,
|
||||
@@ -124,7 +124,7 @@ fn version_unsubscription_instruction_should_work() {
|
||||
let hash = fake_message_hash(&message);
|
||||
let weight_limit = Weight::from_parts(20, 20);
|
||||
let r = XcmExecutor::<TestConfig>::execute_xcm_in_credit(
|
||||
origin.clone(),
|
||||
origin,
|
||||
message,
|
||||
hash,
|
||||
weight_limit,
|
||||
|
||||
@@ -238,7 +238,7 @@ pub mod mock_msg_queue {
|
||||
Ok(xcm) => {
|
||||
let location = MultiLocation::new(1, X1(Parachain(sender.into())));
|
||||
match T::XcmExecutor::execute_xcm(location, xcm, message_hash, max_weight) {
|
||||
Outcome::Error(e) => (Err(e.clone()), Event::Fail(Some(hash), e)),
|
||||
Outcome::Error(e) => (Err(e), Event::Fail(Some(hash), e)),
|
||||
Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))),
|
||||
// As far as the caller is concerned, this was dispatched without error, so
|
||||
// we just report the weight used.
|
||||
@@ -262,7 +262,7 @@ pub mod mock_msg_queue {
|
||||
let _ = XcmpMessageFormat::decode(&mut data_ref)
|
||||
.expect("Simulator encodes with versioned xcm format; qed");
|
||||
|
||||
let mut remaining_fragments = &data_ref[..];
|
||||
let mut remaining_fragments = data_ref;
|
||||
while !remaining_fragments.is_empty() {
|
||||
if let Ok(xcm) =
|
||||
VersionedXcm::<T::RuntimeCall>::decode(&mut remaining_fragments)
|
||||
|
||||
Reference in New Issue
Block a user