Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XcmDryRunApi - Dry-running extrinsics to get their XCM effects #3872

Merged
merged 74 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
43faca7
feat(xcm-fee-payment-runtime-api): add XcmTransfersApi and tests
franciscoaguirre Mar 27, 2024
dd0376d
feat(xcm-fee-payment-runtime-api): changed XcmTransfersApi to XcmDryR…
franciscoaguirre Mar 28, 2024
cd1838a
feat(xcm-dry-run-api): get forwarded messages from the queues
franciscoaguirre Mar 29, 2024
7e04d50
feat(xcm-dry-run-api): updated test works
franciscoaguirre Mar 31, 2024
ec04b80
feat(xcm-dry-run-api): add test for a reserve asset transfer
franciscoaguirre Mar 31, 2024
c5c48ca
feat(xcm-dry-run-api): add dry_run_xcm call
franciscoaguirre Mar 31, 2024
df90feb
feat(xcm-dry-run-api): grab XCM that's about to be executed
franciscoaguirre Apr 9, 2024
ccda0df
chore(xcm-dry-run-api): remove dbgs
franciscoaguirre Apr 9, 2024
a9e0ec4
chore(xcm-dry-run-api): fmt
franciscoaguirre Apr 9, 2024
e09a9a7
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 9, 2024
4bec8ee
fix: compilation issues
franciscoaguirre Apr 9, 2024
3502666
chore(pallet-xcm): revert refactor
franciscoaguirre Apr 10, 2024
7ccd0e4
docs(xcm-executor): update comments about RecordXcm
franciscoaguirre Apr 10, 2024
7b825f2
feat(xcm-dry-run-api): add emitted events to XcmDryRunEffects
franciscoaguirre Apr 10, 2024
3767e4d
chore(pallet-xcm): remove refactor leftovers
franciscoaguirre Apr 10, 2024
f7c55ac
feat(xcm-fee-payment-runtime-api): improve test
franciscoaguirre Apr 10, 2024
26c2b7d
feat(xcm-dry-run-api): add execution result to XcmDryRunEffects and E…
franciscoaguirre Apr 10, 2024
609137b
feat(xcm-dry-run-api): add error enum and return error when extrinsic…
franciscoaguirre Apr 12, 2024
465e5ee
Update polkadot/xcm/xcm-fee-payment-runtime-api/tests/mock.rs
franciscoaguirre Apr 12, 2024
8c47443
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 12, 2024
b6864fe
fix(xcm-fee-payment-runtime-api): reexport inner modules instead of s…
franciscoaguirre Apr 12, 2024
aba11e8
fix(xcm-recorder): add XcmRecorder config item to all XCM configs
franciscoaguirre Apr 12, 2024
3a4210b
fix: fmt
franciscoaguirre Apr 12, 2024
eca20db
fix(xcm-fee-payment-runtime-api): add missing BenchmarkHelper in mock
franciscoaguirre Apr 12, 2024
34cdb17
doc: add prdoc
franciscoaguirre Apr 12, 2024
317fb6e
feat(xcm-dry-run-api): add XcmDryRunApi to fake_runtime_api
franciscoaguirre Apr 12, 2024
08d5ebc
doc: update prdoc
franciscoaguirre Apr 12, 2024
a202ddf
fix(xcm-fee-payment-runtime-api): add runtime-benchmarks feature and …
franciscoaguirre Apr 12, 2024
2462d7a
fix(prdoc): fix crate names and add xcm-builder
franciscoaguirre Apr 12, 2024
84b1e0b
fix(xcm-fee-payment-runtime-api): propagate features and format Cargo…
franciscoaguirre Apr 12, 2024
114860f
fix(xcm-fee-payment-runtime-api): fix weight update issue in tests
franciscoaguirre Apr 12, 2024
6f6cb91
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 12, 2024
c696674
fix: fmt
franciscoaguirre Apr 12, 2024
3e7dc0c
fix(xcm-fee-payment-runtime-api): propagate std feature to log
franciscoaguirre Apr 12, 2024
ea13755
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 12, 2024
f304400
fix(xcm-fee-payment-runtime-api): fix feature propagation
franciscoaguirre Apr 12, 2024
f80aaf5
fix(xcm-fee-payment-runtime-api): format Cargo.toml
franciscoaguirre Apr 12, 2024
43496f3
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 15, 2024
2a7af71
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 16, 2024
16d3a54
fix(xcm-builder): remove XcmRecorder from polkadot-test-runtime
franciscoaguirre Apr 16, 2024
030255c
feat(xcm-dry-run-api): add test setup with emulator
franciscoaguirre Apr 17, 2024
0d2e19c
feat(xcm-fee-estimation): add xcm emulator test for fee estimation
franciscoaguirre Apr 19, 2024
97ee470
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 25, 2024
9fcf4b2
fix(pallet-xcm): RecordXcm test was using old function
franciscoaguirre Apr 25, 2024
5aeae3a
fix: fmt
franciscoaguirre Apr 25, 2024
a90c091
feat: finish implementing XcmDryRunApi for westend and asset hub westend
franciscoaguirre Apr 25, 2024
6a35294
fix(xcm-dry-run-api): fix multiple forwarded messages instead of one
franciscoaguirre Apr 26, 2024
cc2b177
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 26, 2024
51b279c
feat: add multi-hop example to xcm estimation
franciscoaguirre Apr 29, 2024
cad8cd5
fix: remove unnecessary clone
franciscoaguirre Apr 29, 2024
3c12610
fix(xcm-fee-estimation-tests): use immortal transactions
franciscoaguirre Apr 30, 2024
a498649
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 30, 2024
6246d7f
fix: fmt
franciscoaguirre Apr 30, 2024
69a26ec
fix: Cargo.toml format
franciscoaguirre Apr 30, 2024
29a0b8a
Update cumulus/parachains/runtimes/testing/penpal/src/lib.rs
franciscoaguirre Apr 30, 2024
6d785f3
feat: implement InspectMessageQueues on the bridge router
franciscoaguirre Apr 30, 2024
3298ff2
feat(xcm-dry-run-api): remove unnecessary weight parameter
franciscoaguirre Apr 30, 2024
f153875
feat(record-xcm): add getters and setters to trait
franciscoaguirre Apr 30, 2024
9be1146
chore(xcm-dry-run-api): change program and message to xcm
franciscoaguirre Apr 30, 2024
b71536e
fix(xcm-fee-payment-runtime-api): remove no longer used parameter
franciscoaguirre Apr 30, 2024
36927bd
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre Apr 30, 2024
6080edb
fix: fmt
franciscoaguirre Apr 30, 2024
8c9a090
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
franciscoaguirre May 1, 2024
720f0c0
chore: address feedback
franciscoaguirre May 6, 2024
bb712bb
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre May 7, 2024
ccf6a70
fix: merge conflicts
franciscoaguirre May 7, 2024
a30de00
fix(xcm-fee-payment-runtime-api): deal with local xcm being an option…
franciscoaguirre May 7, 2024
5a2cbf5
feat(rococo-runtime): add XcmDryRunApi
franciscoaguirre May 7, 2024
a5c4c67
feat(asset-hub-rococo-runtime): add XcmDryRunApi
franciscoaguirre May 7, 2024
e7beae4
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre May 7, 2024
0a42dea
fix(asset-hub-rococo-runtime): feature propagation
franciscoaguirre May 7, 2024
93c5b83
fix(asset-hub-rococo): taplo
franciscoaguirre May 7, 2024
7edc8b8
fix: clippy
franciscoaguirre May 8, 2024
186ea04
Merge branch 'master' into xcm-transfers-fee-estimation
franciscoaguirre May 8, 2024
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
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cumulus/pallets/xcmp-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}

pub type XcmRouter = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Converts a local signed origin into an XCM location.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Local origins on this chain are allowed to dispatch XCM sends/executions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

pub type PriceForParentDelivery =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

pub type PriceForParentDelivery =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Converts a local signed origin into an XCM location.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Converts a local signed origin into an XCM location.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Converts a local signed origin into an XCM location. Forms the basis for local origins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Converts a local signed origin into an XCM location. Forms the basis for local origins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}

impl cumulus_pallet_xcm::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Converts a local signed origin into an XCM location. Forms the basis for local origins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Converts a local signed origin into an XCM location. Forms the basis for local origins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}

impl cumulus_pallet_xcm::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Multiplier used for dedicated `TakeFirstAssetTrader` with `ForeignAssets` instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PolkadotXcm;
}

/// Local origins on this chain are allowed to dispatch XCM sends/executions.
Expand Down
1 change: 1 addition & 0 deletions polkadot/node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ runtime-benchmarks = [
"service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"westend-runtime?/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
20 changes: 15 additions & 5 deletions polkadot/node/service/src/fake_runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,20 +398,30 @@ sp_api::impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::XcmPaymentApi<Block> for Runtime {
fn query_acceptable_payment_assets(_: xcm::Version) -> Result<Vec<VersionedAssetId>, xcm_fee_payment_runtime_api::Error> {
impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi<Block> for Runtime {
fn query_acceptable_payment_assets(_: xcm::Version) -> Result<Vec<VersionedAssetId>, xcm_fee_payment_runtime_api::fees::Error> {
unimplemented!()
}

fn query_weight_to_asset_fee(_: Weight, _: VersionedAssetId) -> Result<u128, xcm_fee_payment_runtime_api::Error> {
fn query_weight_to_asset_fee(_: Weight, _: VersionedAssetId) -> Result<u128, xcm_fee_payment_runtime_api::fees::Error> {
unimplemented!()
}

fn query_xcm_weight(_: VersionedXcm<()>) -> Result<Weight, xcm_fee_payment_runtime_api::Error> {
fn query_xcm_weight(_: VersionedXcm<()>) -> Result<Weight, xcm_fee_payment_runtime_api::fees::Error> {
unimplemented!()
}

fn query_delivery_fees(_: VersionedLocation, _: VersionedXcm<()>) -> Result<VersionedAssets, xcm_fee_payment_runtime_api::Error> {
fn query_delivery_fees(_: VersionedLocation, _: VersionedXcm<()>) -> Result<VersionedAssets, xcm_fee_payment_runtime_api::fees::Error> {
unimplemented!()
}
}

impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, (), ()> for Runtime {
fn dry_run_extrinsic(_: <Block as BlockT>::Extrinsic) -> Result<xcm_fee_payment_runtime_api::dry_run::ExtrinsicDryRunEffects<()>, xcm_fee_payment_runtime_api::dry_run::Error> {
unimplemented!()
}

fn dry_run_xcm(_: VersionedLocation, _: VersionedXcm<()>, _: Weight) -> Result<xcm_fee_payment_runtime_api::dry_run::XcmDryRunEffects<()>, xcm_fee_payment_runtime_api::dry_run::Error> {
unimplemented!()
}
}
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ runtime-benchmarks = [
"sp-staking/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
]
try-runtime = [
"frame-executive/try-runtime",
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 @@ -129,7 +129,7 @@ use governance::{
pallet_custom_origins, AuctionAdmin, Fellows, GeneralAdmin, LeaseAdmin, Treasurer,
TreasurySpender,
};
use xcm_fee_payment_runtime_api::Error as XcmPaymentApiError;
use xcm_fee_payment_runtime_api::fees::Error as XcmPaymentApiError;

#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -1745,7 +1745,7 @@ sp_api::impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::XcmPaymentApi<Block> for Runtime {
impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi<Block> for Runtime {
fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
if !matches!(xcm_version, 3 | 4) {
return Err(XcmPaymentApiError::UnhandledXcmVersion);
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/rococo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = XcmPallet;
}

parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/test-runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = super::Xcm;
}

impl pallet_xcm::Config for crate::Runtime {
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ runtime-benchmarks = [
"sp-staking/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
]
try-runtime = [
"frame-election-provider-support/try-runtime",
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 @@ -106,7 +106,7 @@ use xcm::{
};
use xcm_builder::PayOverXcm;

use xcm_fee_payment_runtime_api::Error as XcmPaymentApiError;
use xcm_fee_payment_runtime_api::fees::Error as XcmPaymentApiError;

pub use frame_system::Call as SystemCall;
pub use pallet_balances::Call as BalancesCall;
Expand Down Expand Up @@ -2211,7 +2211,7 @@ sp_api::impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::XcmPaymentApi<Block> for Runtime {
impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi<Block> for Runtime {
fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
if !matches!(xcm_version, 3 | 4) {
return Err(XcmPaymentApiError::UnhandledXcmVersion);
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/westend/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = XcmPallet;
}

parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions polkadot/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}

impl crate::Config for Test {
Expand Down
1 change: 1 addition & 0 deletions polkadot/xcm/pallet-xcm-benchmarks/src/generic/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}

parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions polkadot/xcm/pallet-xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
Loading
Loading