Companion for paritytech/polkadot#4712 (#901)

* Rename ParentIsDefault to ParentIsAllZeroes

* Fixes

* Create ParentAccounts for respective networks

* Fixes

* Use b"Parent" as the basis for generating parent AccountId

* Fixes

* Use preset parent account ID

* update lockfile for {"polkadot"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Keith Yeung
2022-01-21 03:40:27 -08:00
committed by GitHub
parent dedb4f7bf7
commit 8c28d4c669
8 changed files with 257 additions and 257 deletions
+235 -235
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -23,7 +23,7 @@ use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup}, traits::{BlakeTwo256, IdentityLookup},
}; };
use xcm_builder::{ use xcm_builder::{
CurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsDefault, CurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsPreset,
}; };
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
@@ -128,7 +128,7 @@ pub type LocalAssetTransactor = CurrencyAdapter<
(), (),
>; >;
pub type LocationToAccountId = (ParentIsDefault<AccountId>,); pub type LocationToAccountId = (ParentIsPreset<AccountId>,);
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
@@ -50,7 +50,7 @@ use polkadot_runtime_common::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpd
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_builder::{ use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsDefault, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, UsingComponents,
@@ -395,8 +395,8 @@ parameter_types! {
/// when determining ownership of accounts for asset transacting and when attempting to use XCM /// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin. /// `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = ( pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the default `AccountId`. // The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsDefault<AccountId>, ParentIsPreset<AccountId>,
// Sibling parachain origins convert to AccountId via the `ParaId::into`. // Sibling parachain origins convert to AccountId via the `ParaId::into`.
SiblingParachainConvertsVia<Sibling, AccountId>, SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`. // Straight up local `AccountId32` origins just alias directly to `AccountId`.
@@ -73,7 +73,7 @@ use xcm::latest::prelude::*;
use xcm_builder::{ use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,
ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
}; };
@@ -283,8 +283,8 @@ parameter_types! {
/// when determining ownership of accounts for asset transacting and when attempting to use XCM /// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin. /// `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = ( pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the default `AccountId`. // The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsDefault<AccountId>, ParentIsPreset<AccountId>,
// Sibling parachain origins convert to AccountId via the `ParaId::into`. // Sibling parachain origins convert to AccountId via the `ParaId::into`.
SiblingParachainConvertsVia<Sibling, AccountId>, SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`. // Straight up local `AccountId32` origins just alias directly to `AccountId`.
+2 -2
View File
@@ -57,7 +57,7 @@ pub use sp_runtime::{Perbill, Permill};
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_builder::{ use xcm_builder::{
AllowUnpaidExecutionFrom, FixedWeightBounds, LocationInverter, ParentAsSuperuser, AllowUnpaidExecutionFrom, FixedWeightBounds, LocationInverter, ParentAsSuperuser,
ParentIsDefault, SovereignSignedViaLocation, ParentIsPreset, SovereignSignedViaLocation,
}; };
use xcm_executor::{Config, XcmExecutor}; use xcm_executor::{Config, XcmExecutor};
@@ -186,7 +186,7 @@ pub type XcmOriginToTransactDispatchOrigin = (
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location // Sovereign account converter; this attempts to derive an `AccountId` from the origin location
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
// foreign chains who want to have a local sovereign account on this chain which they control. // foreign chains who want to have a local sovereign account on this chain which they control.
SovereignSignedViaLocation<ParentIsDefault<AccountId>, Origin>, SovereignSignedViaLocation<ParentIsPreset<AccountId>, Origin>,
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
// transaction from the Root origin. // transaction from the Root origin.
ParentAsSuperuser<Origin>, ParentAsSuperuser<Origin>,
@@ -73,8 +73,8 @@ use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds,
FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset,
ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, UsingComponents,
}; };
@@ -443,8 +443,8 @@ parameter_types! {
/// when determining ownership of accounts for asset transacting and when attempting to use XCM /// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin. /// `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = ( pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the default `AccountId`. // The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsDefault<AccountId>, ParentIsPreset<AccountId>,
// Sibling parachain origins convert to AccountId via the `ParaId::into`. // Sibling parachain origins convert to AccountId via the `ParaId::into`.
SiblingParachainConvertsVia<Sibling, AccountId>, SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`. // Straight up local `AccountId32` origins just alias directly to `AccountId`.
@@ -74,8 +74,8 @@ use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds,
FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset,
ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, UsingComponents,
}; };
@@ -456,8 +456,8 @@ parameter_types! {
/// when determining ownership of accounts for asset transacting and when attempting to use XCM /// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin. /// `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = ( pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the default `AccountId`. // The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsDefault<AccountId>, ParentIsPreset<AccountId>,
// Sibling parachain origins convert to AccountId via the `ParaId::into`. // Sibling parachain origins convert to AccountId via the `ParaId::into`.
SiblingParachainConvertsVia<Sibling, AccountId>, SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`. // Straight up local `AccountId32` origins just alias directly to `AccountId`.
@@ -73,8 +73,8 @@ use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds,
FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset,
ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, UsingComponents,
}; };
@@ -440,8 +440,8 @@ parameter_types! {
/// when determining ownership of accounts for asset transacting and when attempting to use XCM /// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin. /// `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = ( pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the default `AccountId`. // The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsDefault<AccountId>, ParentIsPreset<AccountId>,
// Sibling parachain origins convert to AccountId via the `ParaId::into`. // Sibling parachain origins convert to AccountId via the `ParaId::into`.
SiblingParachainConvertsVia<Sibling, AccountId>, SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`. // Straight up local `AccountId32` origins just alias directly to `AccountId`.