mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
pallet-xcm: ensure xcm outcome is always complete, revert effects otherwise (#2405)
On extrinsics/call, ensure local XCM execution is complete/successful. Otherwise, fail the extrinsic so that state changes don't get committed to the db. Added regression tests that fail without the fix. fixes #2237 --------- Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
@@ -152,7 +152,7 @@ pub fn teleports_for_native_asset_works<
|
||||
hash,
|
||||
RuntimeHelper::<Runtime>::xcm_max_weight(XcmReceivedFrom::Parent),
|
||||
);
|
||||
assert_eq!(outcome.ensure_complete(), Ok(()));
|
||||
assert_ok!(outcome.ensure_complete());
|
||||
|
||||
// check Balances after
|
||||
assert_ne!(<pallet_balances::Pallet<Runtime>>::free_balance(&target_account), 0.into());
|
||||
@@ -499,7 +499,7 @@ pub fn teleports_for_foreign_assets_works<
|
||||
hash,
|
||||
RuntimeHelper::<Runtime>::xcm_max_weight(XcmReceivedFrom::Sibling),
|
||||
);
|
||||
assert_eq!(outcome.ensure_complete(), Ok(()));
|
||||
assert_ok!(outcome.ensure_complete());
|
||||
|
||||
// checks target_account after
|
||||
assert_eq!(
|
||||
@@ -1211,7 +1211,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor
|
||||
hash,
|
||||
RuntimeHelper::<Runtime>::xcm_max_weight(XcmReceivedFrom::Sibling),
|
||||
);
|
||||
assert_eq!(outcome.ensure_complete(), Ok(()));
|
||||
assert_ok!(outcome.ensure_complete());
|
||||
|
||||
// check events
|
||||
let mut events = <frame_system::Pallet<Runtime>>::events()
|
||||
@@ -1319,7 +1319,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor
|
||||
hash,
|
||||
RuntimeHelper::<Runtime>::xcm_max_weight(XcmReceivedFrom::Sibling),
|
||||
);
|
||||
assert_eq!(outcome.ensure_complete(), Ok(()));
|
||||
assert_ok!(outcome.ensure_complete());
|
||||
|
||||
additional_checks_after();
|
||||
})
|
||||
|
||||
@@ -483,7 +483,7 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
|
||||
XcmReceivedFrom::Sibling,
|
||||
),
|
||||
);
|
||||
assert_eq!(outcome.ensure_complete(), Ok(()));
|
||||
assert_ok!(outcome.ensure_complete());
|
||||
|
||||
// author actual balance after (received fees from Trader for ForeignAssets)
|
||||
let author_received_fees =
|
||||
@@ -588,7 +588,7 @@ pub fn report_bridge_status_from_xcm_bridge_router_works<
|
||||
hash,
|
||||
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::xcm_max_weight(XcmReceivedFrom::Sibling),
|
||||
);
|
||||
assert_eq!(outcome.ensure_complete(), Ok(()));
|
||||
assert_ok!(outcome.ensure_complete());
|
||||
assert_eq!(is_congested, pallet_xcm_bridge_hub_router::Pallet::<Runtime, XcmBridgeHubRouterInstance>::bridge().is_congested);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user