Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
374e427
Initial implementation of `LocationToAccountApi` runtime API
bkontur Jun 21, 2024
87e231b
Add it to the AssetHubWestend
bkontur Jun 21, 2024
db24e91
Nits
bkontur Jun 24, 2024
5cdf57a
Use `xcm::VersionedLocation` instead of `xcm::latest::Location`
bkontur Jun 25, 2024
36eedd5
Added to the all testnets
bkontur Jun 25, 2024
c9684b3
Merge remote-tracking branch 'origin/master' into bko-xcm-runtime-api
bkontur Jun 25, 2024
eb547b3
Change to workspace deps
bkontur Jun 25, 2024
098d1fb
One more
bkontur Jun 25, 2024
5eff80c
taplo zepter
bkontur Jun 25, 2024
bd99b8d
clippy imports
bkontur Jun 25, 2024
0a7b5de
prdoc
bkontur Jun 25, 2024
208d24c
Again import
bkontur Jun 25, 2024
6d7b3fc
Fix umbrella
bkontur Jun 25, 2024
e4f5f0b
Umbrella?
bkontur Jun 25, 2024
de7147a
Merge branch 'master' into bko-xcm-runtime-api
bkontur Jun 25, 2024
e9da1da
Update polkadot/xcm/xcm-runtime-api/tests/conversions.rs
bkontur Jun 25, 2024
fe41925
Update polkadot/xcm/xcm-runtime-api/src/conversions.rs
bkontur Jun 25, 2024
b5d8faa
Merge branch 'master' into bko-xcm-runtime-api
bkontur Jun 25, 2024
7b83b94
Simplify XCM runtime API
bkontur Jun 25, 2024
6f3a41c
More cleaning
bkontur Jun 25, 2024
f695e7a
Import
bkontur Jun 25, 2024
ab63f0d
Merge `xcm-fee-payment-runtime-api` to `xcm-runtime-api`
bkontur Jun 26, 2024
d28ae13
Merge remote-tracking branch 'origin/master' into bko-xcm-runtime-api
bkontur Jun 26, 2024
e782950
prdoc
bkontur Jun 26, 2024
829060a
prdoc
bkontur Jun 26, 2024
f950a5a
Merge remote-tracking branch 'origin/master' into bko-xcm-runtime-api
bkontur Jun 26, 2024
4511ecd
Update cumulus/parachains/runtimes/collectives/collectives-westend/sr…
bkontur Jun 26, 2024
18a9918
Update prdoc/pr_4857.prdoc
bkontur Jun 26, 2024
1089020
Update polkadot/xcm/xcm-runtime-api/src/conversions.rs
bkontur Jun 26, 2024
e39e6e7
Reflect review comments
bkontur Jun 26, 2024
540433c
More review comments
bkontur Jun 26, 2024
6457a41
Merge remote-tracking branch 'origin/master' into bko-xcm-runtime-api
bkontur Jun 26, 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
31 changes: 31 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ members = [
"polkadot/xcm/xcm-executor",
"polkadot/xcm/xcm-executor/integration-tests",
"polkadot/xcm/xcm-fee-payment-runtime-api",
"polkadot/xcm/xcm-runtime-api",
"polkadot/xcm/xcm-simulator",
"polkadot/xcm/xcm-simulator/example",
"polkadot/xcm/xcm-simulator/fuzzer",
Expand Down Expand Up @@ -1338,6 +1339,7 @@ xcm-emulator = { path = "cumulus/xcm/xcm-emulator", default-features = false }
xcm-executor = { path = "polkadot/xcm/xcm-executor", default-features = false, package = "staging-xcm-executor" }
xcm-fee-payment-runtime-api = { path = "polkadot/xcm/xcm-fee-payment-runtime-api", default-features = false }
xcm-procedural = { path = "polkadot/xcm/procedural", default-features = false }
xcm-runtime-api = { path = "polkadot/xcm/xcm-runtime-api", default-features = false }
xcm-simulator = { path = "polkadot/xcm/xcm-simulator", default-features = false }
zeroize = { version = "1.7.0", default-features = false }
zstd = { version = "0.12.4", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
xcm-runtime-api = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
Expand Down Expand Up @@ -251,6 +252,7 @@ std = [
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-api/std",
"xcm/std",
]

Expand Down
13 changes: 13 additions & 0 deletions cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,19 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_api::conversions::LocationToAccountApi<Block> for Runtime {
fn convert_location(location: VersionedLocation, ss58_prefix: Option<u16>) -> Result<
xcm_runtime_api::conversions::Account,
xcm_runtime_api::conversions::Error
> {
xcm_runtime_api::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
SS58Prefix,
>::convert_location(location, ss58_prefix)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
xcm-runtime-api = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
Expand Down Expand Up @@ -250,6 +251,7 @@ std = [
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-api/std",
"xcm/std",
]

Expand Down
21 changes: 17 additions & 4 deletions cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ pub use sp_runtime::BuildStorage;

use assets_common::{foreign_creators::ForeignCreators, matching::FromSiblingParachain};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use xcm::prelude::{VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm};

// We exclude `Assets` since it's the name of a pallet
use xcm::latest::prelude::AssetId;
use xcm::{
latest::prelude::AssetId,
prelude::{VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm},
};

#[cfg(feature = "runtime-benchmarks")]
use xcm::latest::prelude::{
Expand Down Expand Up @@ -1392,6 +1392,19 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_api::conversions::LocationToAccountApi<Block> for Runtime {
fn convert_location(location: VersionedLocation, ss58_prefix: Option<u16>) -> Result<
xcm_runtime_api::conversions::Account,
xcm_runtime_api::conversions::Error
> {
xcm_runtime_api::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
SS58Prefix,
>::convert_location(location, ss58_prefix)
}
}

impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
for Runtime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
xcm-runtime-api = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
Expand Down Expand Up @@ -220,6 +221,7 @@ std = [
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-api/std",
"xcm/std",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,19 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_api::conversions::LocationToAccountApi<Block> for Runtime {
fn convert_location(location: VersionedLocation, ss58_prefix: Option<u16>) -> Result<
xcm_runtime_api::conversions::Account,
xcm_runtime_api::conversions::Error
> {
xcm_runtime_api::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
SS58Prefix,
>::convert_location(location, ss58_prefix)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
xcm-runtime-api = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
Expand Down Expand Up @@ -185,6 +186,7 @@ std = [
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-api/std",
"xcm/std",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,19 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_api::conversions::LocationToAccountApi<Block> for Runtime {
fn convert_location(location: VersionedLocation, ss58_prefix: Option<u16>) -> Result<
xcm_runtime_api::conversions::Account,
xcm_runtime_api::conversions::Error
> {
xcm_runtime_api::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
SS58Prefix,
>::convert_location(location, ss58_prefix)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
westend-runtime-constants = { workspace = true }
xcm-runtime-api = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
Expand Down Expand Up @@ -239,6 +240,7 @@ std = [
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-api/std",
"xcm/std",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ use frame_support::{
genesis_builder_helper::{build_state, get_preset},
parameter_types,
traits::{
fungible::HoldConsideration, ConstBool, ConstU16, ConstU32, ConstU64, ConstU8,
EitherOfDiverse, InstanceFilter, LinearStoragePrice, TransformOrigin,
fungible::HoldConsideration, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse,
InstanceFilter, LinearStoragePrice, TransformOrigin,
},
weights::{ConstantMultiplier, Weight, WeightToFee as _},
PalletId,
Expand Down Expand Up @@ -163,6 +163,7 @@ parameter_types! {
})
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
.build_or_panic();
pub const SS58Prefix: u8 = 0;
}

// Configure FRAME pallets to include in runtime.
Expand All @@ -180,7 +181,7 @@ impl frame_system::Config for Runtime {
type Version = Version;
type AccountData = pallet_balances::AccountData<Balance>;
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
type SS58Prefix = ConstU16<0>;
type SS58Prefix = SS58Prefix;
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
Expand Down Expand Up @@ -982,6 +983,19 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_api::conversions::LocationToAccountApi<Block> for Runtime {
fn convert_location(location: VersionedLocation, ss58_prefix: Option<u16>) -> Result<
xcm_runtime_api::conversions::Account,
xcm_runtime_api::conversions::Error
> {
xcm_runtime_api::conversions::LocationToAccountHelper::<
AccountId,
LocationToAccountId,
SS58Prefix,
>::convert_location(location, ss58_prefix)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
xcm-runtime-api = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
Expand Down Expand Up @@ -142,6 +143,7 @@ std = [
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-api/std",
"xcm/std",
]

Expand Down
Loading