Skip to content

Commit d5053ac

Browse files
Change XcmDryRunApi::dry_run_extrinsic to take a call instead (#4621)
Follow-up to the new `XcmDryRunApi` runtime API introduced in #3872. Taking an extrinsic means the frontend has to sign first to dry-run and once again to submit. This is bad UX which is solved by taking an `origin` and a `call`. This also has the benefit of being able to dry-run as any account, since it needs no signature. This is a breaking change since I changed `dry_run_extrinsic` to `dry_run_call`, however, this API is still only on testnets. The crates are bumped accordingly. As a part of this PR, I changed the name of the API from `XcmDryRunApi` to just `DryRunApi`, since it can be used for general dry-running :) Step towards #690. Example of calling the API with PAPI, not the best code, just testing :) ```ts // We just build a call, the arguments make it look very big though. const call = localApi.tx.XcmPallet.transfer_assets({ dest: XcmVersionedLocation.V4({ parents: 0, interior: XcmV4Junctions.X1(XcmV4Junction.Parachain(1000)) }), beneficiary: XcmVersionedLocation.V4({ parents: 0, interior: XcmV4Junctions.X1(XcmV4Junction.AccountId32({ network: undefined, id: Binary.fromBytes(encodeAccount(account.address)) })) }), weight_limit: XcmV3WeightLimit.Unlimited(), assets: XcmVersionedAssets.V4([{ id: { parents: 0, interior: XcmV4Junctions.Here() }, fun: XcmV3MultiassetFungibility.Fungible(1_000_000_000_000n) } ]), fee_asset_item: 0, }); // We call the API passing in a signed origin const result = await localApi.apis.XcmDryRunApi.dry_run_call( WestendRuntimeOriginCaller.system(DispatchRawOrigin.Signed(account.address)), call.decodedCall ); if (result.success && result.value.execution_result.success) { // We find the forwarded XCM we want. The first one going to AssetHub in this case. const xcmsToAssetHub = result.value.forwarded_xcms.find(([location, _]) => ( location.type === "V4" && location.value.parents === 0 && location.value.interior.type === "X1" && location.value.interior.value.type === "Parachain" && location.value.interior.value.value === 1000 ))!; // We can even find the delivery fees for that forwarded XCM. const deliveryFeesQuery = await localApi.apis.XcmPaymentApi.query_delivery_fees(xcmsToAssetHub[0], xcmsToAssetHub[1][0]); if (deliveryFeesQuery.success) { const amount = deliveryFeesQuery.value.type === "V4" && deliveryFeesQuery.value.value[0].fun.type === "Fungible" && deliveryFeesQuery.value.value[0].fun.value.valueOf() || 0n; // We store them in state somewhere. setDeliveryFees(formatAmount(BigInt(amount))); } } ``` --------- Co-authored-by: Bastian Köcher <[email protected]>
1 parent aa32faa commit d5053ac

File tree

13 files changed

+237
-437
lines changed

13 files changed

+237
-437
lines changed

cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/xcm_fee_estimation.rs

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@
1717
1818
use crate::imports::*;
1919

20-
use sp_keyring::AccountKeyring::Alice;
21-
use sp_runtime::{generic, MultiSignature};
20+
use frame_system::RawOrigin;
2221
use xcm_fee_payment_runtime_api::{
23-
dry_run::runtime_decl_for_xcm_dry_run_api::XcmDryRunApiV1,
22+
dry_run::runtime_decl_for_dry_run_api::DryRunApiV1,
2423
fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1,
2524
};
2625

2726
/// We are able to dry-run and estimate the fees for a teleport between relay and system para.
2827
/// Scenario: Alice on Westend relay chain wants to teleport WND to Asset Hub.
29-
/// We want to know the fees using the `XcmDryRunApi` and `XcmPaymentApi`.
28+
/// We want to know the fees using the `DryRunApi` and `XcmPaymentApi`.
3029
#[test]
3130
fn teleport_relay_system_para_works() {
3231
let destination: Location = Parachain(1000).into(); // Asset Hub.
@@ -42,6 +41,7 @@ fn teleport_relay_system_para_works() {
4241
<Westend as TestExt>::new_ext().execute_with(|| {
4342
type Runtime = <Westend as Chain>::Runtime;
4443
type RuntimeCall = <Westend as Chain>::RuntimeCall;
44+
type OriginCaller = <Westend as Chain>::OriginCaller;
4545

4646
let call = RuntimeCall::XcmPallet(pallet_xcm::Call::transfer_assets {
4747
dest: Box::new(VersionedLocation::V4(destination.clone())),
@@ -50,9 +50,8 @@ fn teleport_relay_system_para_works() {
5050
fee_asset_item: 0,
5151
weight_limit: Unlimited,
5252
});
53-
let sender = Alice; // Is the same as `WestendSender`.
54-
let extrinsic = construct_extrinsic_westend(sender, call);
55-
let result = Runtime::dry_run_extrinsic(extrinsic).unwrap();
53+
let origin = OriginCaller::system(RawOrigin::Signed(WestendSender::get()));
54+
let result = Runtime::dry_run_call(origin, call).unwrap();
5655
assert_eq!(result.forwarded_xcms.len(), 1);
5756
let (destination_to_query, messages_to_query) = &result.forwarded_xcms[0];
5857
assert_eq!(messages_to_query.len(), 1);
@@ -105,7 +104,7 @@ fn teleport_relay_system_para_works() {
105104

106105
/// We are able to dry-run and estimate the fees for a multi-hop XCM journey.
107106
/// Scenario: Alice on PenpalA has some WND and wants to send them to PenpalB.
108-
/// We want to know the fees using the `XcmDryRunApi` and `XcmPaymentApi`.
107+
/// We want to know the fees using the `DryRunApi` and `XcmPaymentApi`.
109108
#[test]
110109
fn multi_hop_works() {
111110
let destination = PenpalA::sibling_location_of(PenpalB::para_id());
@@ -142,6 +141,7 @@ fn multi_hop_works() {
142141
<PenpalA as TestExt>::execute_with(|| {
143142
type Runtime = <PenpalA as Chain>::Runtime;
144143
type RuntimeCall = <PenpalA as Chain>::RuntimeCall;
144+
type OriginCaller = <PenpalA as Chain>::OriginCaller;
145145

146146
let call = RuntimeCall::PolkadotXcm(pallet_xcm::Call::transfer_assets {
147147
dest: Box::new(VersionedLocation::V4(destination.clone())),
@@ -150,9 +150,8 @@ fn multi_hop_works() {
150150
fee_asset_item: 0,
151151
weight_limit: Unlimited,
152152
});
153-
let sender = Alice; // Same as `PenpalASender`.
154-
let extrinsic = construct_extrinsic_penpal(sender, call);
155-
let result = Runtime::dry_run_extrinsic(extrinsic).unwrap();
153+
let origin = OriginCaller::system(RawOrigin::Signed(PenpalASender::get()));
154+
let result = Runtime::dry_run_call(origin, call).unwrap();
156155
assert_eq!(result.forwarded_xcms.len(), 1);
157156
let (destination_to_query, messages_to_query) = &result.forwarded_xcms[0];
158157
assert_eq!(messages_to_query.len(), 1);
@@ -304,68 +303,3 @@ fn transfer_assets_para_to_para(test: ParaToParaThroughRelayTest) -> DispatchRes
304303
test.args.weight_limit,
305304
)
306305
}
307-
308-
// Constructs the SignedExtra component of an extrinsic for the Westend runtime.
309-
fn construct_extrinsic_westend(
310-
sender: sp_keyring::AccountKeyring,
311-
call: westend_runtime::RuntimeCall,
312-
) -> westend_runtime::UncheckedExtrinsic {
313-
type Runtime = <Westend as Chain>::Runtime;
314-
let account_id = <Runtime as frame_system::Config>::AccountId::from(sender.public());
315-
let tip = 0;
316-
let extra: westend_runtime::SignedExtra = (
317-
frame_system::CheckNonZeroSender::<Runtime>::new(),
318-
frame_system::CheckSpecVersion::<Runtime>::new(),
319-
frame_system::CheckTxVersion::<Runtime>::new(),
320-
frame_system::CheckGenesis::<Runtime>::new(),
321-
frame_system::CheckMortality::<Runtime>::from(sp_runtime::generic::Era::immortal()),
322-
frame_system::CheckNonce::<Runtime>::from(
323-
frame_system::Pallet::<Runtime>::account(&account_id).nonce,
324-
),
325-
frame_system::CheckWeight::<Runtime>::new(),
326-
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
327-
frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(false),
328-
);
329-
let raw_payload = westend_runtime::SignedPayload::new(call, extra).unwrap();
330-
let signature = raw_payload.using_encoded(|payload| sender.sign(payload));
331-
let (call, extra, _) = raw_payload.deconstruct();
332-
westend_runtime::UncheckedExtrinsic::new_signed(
333-
call,
334-
account_id.into(),
335-
MultiSignature::Sr25519(signature),
336-
extra,
337-
)
338-
}
339-
340-
// Constructs the SignedExtra component of an extrinsic for the Westend runtime.
341-
fn construct_extrinsic_penpal(
342-
sender: sp_keyring::AccountKeyring,
343-
call: penpal_runtime::RuntimeCall,
344-
) -> penpal_runtime::UncheckedExtrinsic {
345-
type Runtime = <PenpalA as Chain>::Runtime;
346-
let account_id = <Runtime as frame_system::Config>::AccountId::from(sender.public());
347-
let tip = 0;
348-
let extra: penpal_runtime::SignedExtra = (
349-
frame_system::CheckNonZeroSender::<Runtime>::new(),
350-
frame_system::CheckSpecVersion::<Runtime>::new(),
351-
frame_system::CheckTxVersion::<Runtime>::new(),
352-
frame_system::CheckGenesis::<Runtime>::new(),
353-
frame_system::CheckEra::<Runtime>::from(generic::Era::immortal()),
354-
frame_system::CheckNonce::<Runtime>::from(
355-
frame_system::Pallet::<Runtime>::account(&account_id).nonce,
356-
),
357-
frame_system::CheckWeight::<Runtime>::new(),
358-
pallet_asset_tx_payment::ChargeAssetTxPayment::<Runtime>::from(tip, None),
359-
);
360-
type SignedPayload =
361-
generic::SignedPayload<penpal_runtime::RuntimeCall, penpal_runtime::SignedExtra>;
362-
let raw_payload = SignedPayload::new(call, extra).unwrap();
363-
let signature = raw_payload.using_encoded(|payload| sender.sign(payload));
364-
let (call, extra, _) = raw_payload.deconstruct();
365-
penpal_runtime::UncheckedExtrinsic::new_signed(
366-
call,
367-
account_id.into(),
368-
MultiSignature::Sr25519(signature),
369-
extra,
370-
)
371-
}

cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ use xcm::{
101101
IntoVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
102102
};
103103
use xcm_fee_payment_runtime_api::{
104-
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
104+
dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
105105
fees::Error as XcmPaymentApiError,
106106
};
107107

@@ -1332,67 +1332,13 @@ impl_runtime_apis! {
13321332
}
13331333
}
13341334

1335-
impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, RuntimeCall, RuntimeEvent> for Runtime {
1336-
fn dry_run_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
1337-
use xcm_builder::InspectMessageQueues;
1338-
use xcm_executor::RecordXcm;
1339-
use xcm::prelude::*;
1340-
1341-
pallet_xcm::Pallet::<Runtime>::set_record_xcm(true);
1342-
let result = Executive::apply_extrinsic(extrinsic).map_err(|error| {
1343-
log::error!(
1344-
target: "xcm::XcmDryRunApi::dry_run_extrinsic",
1345-
"Applying extrinsic failed with error {:?}",
1346-
error,
1347-
);
1348-
XcmDryRunApiError::InvalidExtrinsic
1349-
})?;
1350-
let local_xcm = pallet_xcm::Pallet::<Runtime>::recorded_xcm();
1351-
let forwarded_xcms = xcm_config::XcmRouter::get_messages();
1352-
let events: Vec<RuntimeEvent> = System::read_events_no_consensus().map(|record| record.event.clone()).collect();
1353-
Ok(ExtrinsicDryRunEffects {
1354-
local_xcm: local_xcm.map(VersionedXcm::<()>::from),
1355-
forwarded_xcms,
1356-
emitted_events: events,
1357-
execution_result: result,
1358-
})
1335+
impl xcm_fee_payment_runtime_api::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
1336+
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
1337+
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call)
13591338
}
13601339

1361-
fn dry_run_xcm(origin_location: VersionedLocation, program: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
1362-
use xcm_builder::InspectMessageQueues;
1363-
use xcm::prelude::*;
1364-
1365-
let origin_location: Location = origin_location.try_into().map_err(|error| {
1366-
log::error!(
1367-
target: "xcm::XcmDryRunApi::dry_run_xcm",
1368-
"Location version conversion failed with error: {:?}",
1369-
error,
1370-
);
1371-
XcmDryRunApiError::VersionedConversionFailed
1372-
})?;
1373-
let program: Xcm<RuntimeCall> = program.try_into().map_err(|error| {
1374-
log::error!(
1375-
target: "xcm::XcmDryRunApi::dry_run_xcm",
1376-
"Xcm version conversion failed with error {:?}",
1377-
error,
1378-
);
1379-
XcmDryRunApiError::VersionedConversionFailed
1380-
})?;
1381-
let mut hash = program.using_encoded(sp_core::hashing::blake2_256);
1382-
let result = xcm_executor::XcmExecutor::<xcm_config::XcmConfig>::prepare_and_execute(
1383-
origin_location,
1384-
program,
1385-
&mut hash,
1386-
Weight::MAX, // Max limit available for execution.
1387-
Weight::zero(),
1388-
);
1389-
let forwarded_xcms = xcm_config::XcmRouter::get_messages();
1390-
let events: Vec<RuntimeEvent> = System::read_events_no_consensus().map(|record| record.event.clone()).collect();
1391-
Ok(XcmDryRunEffects {
1392-
forwarded_xcms,
1393-
emitted_events: events,
1394-
execution_result: result,
1395-
})
1340+
fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
1341+
PolkadotXcm::dry_run_xcm::<Runtime, xcm_config::XcmRouter, RuntimeCall, xcm_config::XcmConfig>(origin_location, xcm)
13961342
}
13971343
}
13981344

cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ use xcm::latest::prelude::{
100100
};
101101

102102
use xcm_fee_payment_runtime_api::{
103-
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
103+
dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
104104
fees::Error as XcmPaymentApiError,
105105
};
106106

@@ -1368,67 +1368,13 @@ impl_runtime_apis! {
13681368
}
13691369
}
13701370

1371-
impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, RuntimeCall, RuntimeEvent> for Runtime {
1372-
fn dry_run_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
1373-
use xcm_builder::InspectMessageQueues;
1374-
use xcm_executor::RecordXcm;
1375-
use xcm::prelude::*;
1376-
1377-
pallet_xcm::Pallet::<Runtime>::set_record_xcm(true);
1378-
let result = Executive::apply_extrinsic(extrinsic).map_err(|error| {
1379-
log::error!(
1380-
target: "xcm::XcmDryRunApi::dry_run_extrinsic",
1381-
"Applying extrinsic failed with error {:?}",
1382-
error,
1383-
);
1384-
XcmDryRunApiError::InvalidExtrinsic
1385-
})?;
1386-
let local_xcm = pallet_xcm::Pallet::<Runtime>::recorded_xcm();
1387-
let forwarded_xcms = xcm_config::XcmRouter::get_messages();
1388-
let events: Vec<RuntimeEvent> = System::read_events_no_consensus().map(|record| record.event.clone()).collect();
1389-
Ok(ExtrinsicDryRunEffects {
1390-
local_xcm: local_xcm.map(VersionedXcm::<()>::from),
1391-
forwarded_xcms,
1392-
emitted_events: events,
1393-
execution_result: result,
1394-
})
1371+
impl xcm_fee_payment_runtime_api::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
1372+
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
1373+
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call)
13951374
}
13961375

1397-
fn dry_run_xcm(origin_location: VersionedLocation, program: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
1398-
use xcm_builder::InspectMessageQueues;
1399-
use xcm::prelude::*;
1400-
1401-
let origin_location: Location = origin_location.try_into().map_err(|error| {
1402-
log::error!(
1403-
target: "xcm::XcmDryRunApi::dry_run_xcm",
1404-
"Location version conversion failed with error: {:?}",
1405-
error,
1406-
);
1407-
XcmDryRunApiError::VersionedConversionFailed
1408-
})?;
1409-
let program: Xcm<RuntimeCall> = program.try_into().map_err(|error| {
1410-
log::error!(
1411-
target: "xcm::XcmDryRunApi::dry_run_xcm",
1412-
"Xcm version conversion failed with error {:?}",
1413-
error,
1414-
);
1415-
XcmDryRunApiError::VersionedConversionFailed
1416-
})?;
1417-
let mut hash = program.using_encoded(sp_core::hashing::blake2_256);
1418-
let result = xcm_executor::XcmExecutor::<xcm_config::XcmConfig>::prepare_and_execute(
1419-
origin_location,
1420-
program,
1421-
&mut hash,
1422-
Weight::MAX, // Max limit available for execution.
1423-
Weight::zero(),
1424-
);
1425-
let forwarded_xcms = xcm_config::XcmRouter::get_messages();
1426-
let events: Vec<RuntimeEvent> = System::read_events_no_consensus().map(|record| record.event.clone()).collect();
1427-
Ok(XcmDryRunEffects {
1428-
forwarded_xcms,
1429-
emitted_events: events,
1430-
execution_result: result,
1431-
})
1376+
fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
1377+
PolkadotXcm::dry_run_xcm::<Runtime, xcm_config::XcmRouter, RuntimeCall, xcm_config::XcmConfig>(origin_location, xcm)
14321378
}
14331379
}
14341380

cumulus/parachains/runtimes/testing/penpal/src/lib.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
6464
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
6565
use sp_runtime::{
6666
create_runtime_str, generic, impl_opaque_keys,
67-
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT},
67+
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Dispatchable},
6868
transaction_validity::{TransactionSource, TransactionValidity},
6969
ApplyExtrinsicResult,
7070
};
@@ -86,7 +86,7 @@ use xcm::{
8686
IntoVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
8787
};
8888
use xcm_fee_payment_runtime_api::{
89-
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
89+
dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
9090
fees::Error as XcmPaymentApiError,
9191
};
9292

@@ -886,25 +886,19 @@ impl_runtime_apis! {
886886
}
887887
}
888888

889-
impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, RuntimeCall, RuntimeEvent> for Runtime {
890-
fn dry_run_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
889+
impl xcm_fee_payment_runtime_api::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
890+
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
891891
use xcm_builder::InspectMessageQueues;
892892
use xcm_executor::RecordXcm;
893893
use xcm::prelude::*;
894-
895894
pallet_xcm::Pallet::<Runtime>::set_record_xcm(true);
896-
let result = Executive::apply_extrinsic(extrinsic).map_err(|error| {
897-
log::error!(
898-
target: "xcm::XcmDryRunApi::dry_run_extrinsic",
899-
"Applying extrinsic failed with error {:?}",
900-
error,
901-
);
902-
XcmDryRunApiError::InvalidExtrinsic
903-
})?;
895+
frame_system::Pallet::<Runtime>::reset_events(); // To make sure we only record events from current call.
896+
let result = call.dispatch(origin.into());
897+
pallet_xcm::Pallet::<Runtime>::set_record_xcm(false);
904898
let local_xcm = pallet_xcm::Pallet::<Runtime>::recorded_xcm();
905899
let forwarded_xcms = xcm_config::XcmRouter::get_messages();
906900
let events: Vec<RuntimeEvent> = System::read_events_no_consensus().map(|record| record.event.clone()).collect();
907-
Ok(ExtrinsicDryRunEffects {
901+
Ok(CallDryRunEffects {
908902
local_xcm: local_xcm.map(VersionedXcm::<()>::from),
909903
forwarded_xcms,
910904
emitted_events: events,
@@ -918,21 +912,22 @@ impl_runtime_apis! {
918912

919913
let origin_location: Location = origin_location.try_into().map_err(|error| {
920914
log::error!(
921-
target: "xcm::XcmDryRunApi::dry_run_xcm",
915+
target: "xcm::DryRunApi::dry_run_xcm",
922916
"Location version conversion failed with error: {:?}",
923917
error,
924918
);
925919
XcmDryRunApiError::VersionedConversionFailed
926920
})?;
927921
let program: Xcm<RuntimeCall> = program.try_into().map_err(|error| {
928922
log::error!(
929-
target: "xcm::XcmDryRunApi::dry_run_xcm",
923+
target: "xcm::DryRunApi::dry_run_xcm",
930924
"Xcm version conversion failed with error {:?}",
931925
error,
932926
);
933927
XcmDryRunApiError::VersionedConversionFailed
934928
})?;
935929
let mut hash = program.using_encoded(sp_core::hashing::blake2_256);
930+
frame_system::Pallet::<Runtime>::reset_events(); // To make sure we only record events from current call.
936931
let result = xcm_executor::XcmExecutor::<xcm_config::XcmConfig>::prepare_and_execute(
937932
origin_location,
938933
program,

0 commit comments

Comments
 (0)