Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(XcmDryRunApi): rename ExtrinsicDryRunEffects to CallDryRunEffects
  • Loading branch information
franciscoaguirre committed May 29, 2024
commit 39738c2f9aa5e5b000624fa1fb6ed0e89699767c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ use xcm::{
IntoVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_fee_payment_runtime_api::{
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
dry_run::{Error as XcmDryRunApiError, CallDryRunEffects, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};

Expand Down Expand Up @@ -1333,7 +1333,7 @@ impl_runtime_apis! {
}

impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ use xcm::latest::prelude::{
};

use xcm_fee_payment_runtime_api::{
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
dry_run::{Error as XcmDryRunApiError, CallDryRunEffects, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};

Expand Down Expand Up @@ -1369,7 +1369,7 @@ impl_runtime_apis! {
}

impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call)
}

Expand Down
6 changes: 3 additions & 3 deletions cumulus/parachains/runtimes/testing/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ use xcm::{
IntoVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_fee_payment_runtime_api::{
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
dry_run::{Error as XcmDryRunApiError, CallDryRunEffects, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};

Expand Down Expand Up @@ -887,7 +887,7 @@ impl_runtime_apis! {
}

impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
use xcm_builder::InspectMessageQueues;
use xcm_executor::RecordXcm;
use xcm::prelude::*;
Expand All @@ -896,7 +896,7 @@ impl_runtime_apis! {
let local_xcm = pallet_xcm::Pallet::<Runtime>::recorded_xcm();
let forwarded_xcms = xcm_config::XcmRouter::get_messages();
let events: Vec<RuntimeEvent> = System::read_events_no_consensus().map(|record| record.event.clone()).collect();
Ok(ExtrinsicDryRunEffects {
Ok(CallDryRunEffects {
local_xcm: local_xcm.map(VersionedXcm::<()>::from),
forwarded_xcms,
emitted_events: events,
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/service/src/fake_runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ sp_api::impl_runtime_apis! {
}

impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, (), (), ()> for Runtime {
fn dry_run_call(_: (), _: ()) -> Result<xcm_fee_payment_runtime_api::dry_run::ExtrinsicDryRunEffects<()>, xcm_fee_payment_runtime_api::dry_run::Error> {
fn dry_run_call(_: (), _: ()) -> Result<xcm_fee_payment_runtime_api::dry_run::CallDryRunEffects<()>, xcm_fee_payment_runtime_api::dry_run::Error> {
unimplemented!()
}

Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ use governance::{
TreasurySpender,
};
use xcm_fee_payment_runtime_api::{
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
dry_run::{Error as XcmDryRunApiError, CallDryRunEffects, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};

Expand Down Expand Up @@ -1810,7 +1810,7 @@ sp_api::impl_runtime_apis! {
}

impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
XcmPallet::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call)
}

Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ use xcm::{
use xcm_builder::PayOverXcm;

use xcm_fee_payment_runtime_api::{
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
dry_run::{Error as XcmDryRunApiError, CallDryRunEffects, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};

Expand Down Expand Up @@ -2272,7 +2272,7 @@ sp_api::impl_runtime_apis! {
}

impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
XcmPallet::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call)
}

Expand Down
6 changes: 3 additions & 3 deletions polkadot/xcm/pallet-xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ use xcm_executor::{
AssetsInHolding,
};
use xcm_fee_payment_runtime_api::{
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
dry_run::{Error as XcmDryRunApiError, CallDryRunEffects, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};

Expand Down Expand Up @@ -2442,7 +2442,7 @@ impl<T: Config> Pallet<T> {
origin: OriginCaller,
call: RuntimeCall,
) -> Result<
ExtrinsicDryRunEffects<<Runtime as frame_system::Config>::RuntimeEvent>,
CallDryRunEffects<<Runtime as frame_system::Config>::RuntimeEvent>,
XcmDryRunApiError,
>
where
Expand All @@ -2459,7 +2459,7 @@ impl<T: Config> Pallet<T> {
frame_system::Pallet::<Runtime>::read_events_no_consensus()
.map(|record| record.event.clone())
.collect();
Ok(ExtrinsicDryRunEffects {
Ok(CallDryRunEffects {
local_xcm: local_xcm.map(VersionedXcm::<()>::from),
forwarded_xcms,
emitted_events: events,
Expand Down
6 changes: 3 additions & 3 deletions polkadot/xcm/xcm-fee-payment-runtime-api/src/dry_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use xcm::prelude::*;

/// Effects of dry-running an extrinsic.
#[derive(Encode, Decode, Debug, TypeInfo)]
pub struct ExtrinsicDryRunEffects<Event> {
pub struct CallDryRunEffects<Event> {
/// The result of executing the extrinsic.
pub execution_result: DispatchResultWithPostInfo,
/// The list of events fired by the extrinsic.
Expand Down Expand Up @@ -54,12 +54,12 @@ sp_api::decl_runtime_apis! {
/// If there's local execution, the location will be "Here".
/// This vector can be used to calculate both execution and delivery fees.
///
/// Extrinsics or XCMs might fail when executed, this doesn't mean the result of these calls will be an `Err`.
/// Calls or XCMs might fail when executed, this doesn't mean the result of these calls will be an `Err`.
/// In those cases, there might still be a valid result, with the execution error inside it.
/// The only reasons why these calls might return an error are listed in the [`Error`] enum.
pub trait XcmDryRunApi<Call: Encode, Event: Decode, OriginCaller: Encode> {
/// Dry run call.
fn dry_run_call(origin: OriginCaller, call: Call) -> Result<ExtrinsicDryRunEffects<Event>, Error>;
fn dry_run_call(origin: OriginCaller, call: Call) -> Result<CallDryRunEffects<Event>, Error>;

/// Dry run XCM program
fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<Call>) -> Result<XcmDryRunEffects<Event>, Error>;
Expand Down
6 changes: 3 additions & 3 deletions polkadot/xcm/xcm-fee-payment-runtime-api/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use xcm_executor::{
};

use xcm_fee_payment_runtime_api::{
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunApi, XcmDryRunEffects},
dry_run::{Error as XcmDryRunApiError, CallDryRunEffects, XcmDryRunApi, XcmDryRunEffects},
fees::{Error as XcmPaymentApiError, XcmPaymentApi},
};

Expand Down Expand Up @@ -451,7 +451,7 @@ sp_api::mock_impl_runtime_apis! {
}

impl XcmDryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for RuntimeApi {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
use xcm_executor::RecordXcm;
pallet_xcm::Pallet::<TestRuntime>::set_record_xcm(true);
let result = call.dispatch(origin.into());
Expand All @@ -463,7 +463,7 @@ sp_api::mock_impl_runtime_apis! {
vec![VersionedXcm::from(message)],
)).collect();
let events: Vec<RuntimeEvent> = System::read_events_no_consensus().map(|record| record.event.clone()).collect();
Ok(ExtrinsicDryRunEffects {
Ok(CallDryRunEffects {
local_xcm: local_xcm.map(VersionedXcm::<()>::from),
forwarded_xcms,
emitted_events: events,
Expand Down