Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit f5926c2

Browse files
authored
Use safer template defaults for polkadot-v0.9.12, move to recognize, comment on Override for AdvertisedXcmVersion default (#690)
* use safer defaults in template for sovereign paraobjects * fmt * Nothing trait, fix XcmTeleportFilter * rm unused traits, update rococo and template runtimes * https://writingexplained.org/recognise-or-recognize-difference * Override for AdvertisedXcmVersion default -> to match all runtimes * cargo +nightly fmt
1 parent 9298272 commit f5926c2

File tree

6 files changed

+31
-28
lines changed

6 files changed

+31
-28
lines changed

parachain-template/runtime/src/lib.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use sp_version::RuntimeVersion;
2323

2424
use frame_support::{
2525
construct_runtime, match_type, parameter_types,
26-
traits::Everything,
26+
traits::{Everything, Nothing},
2727
weights::{
2828
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, WEIGHT_PER_SECOND},
2929
DispatchClass, IdentityFee, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
@@ -50,10 +50,9 @@ use polkadot_runtime_common::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpd
5050
use xcm::latest::prelude::*;
5151
use xcm_builder::{
5252
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
53-
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,
54-
ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,
55-
SiblingParachainConvertsVia, SignedAccountId32AsNative,
56-
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
53+
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsDefault,
54+
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
55+
SignedAccountId32AsNative, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
5756
};
5857
use xcm_executor::{Config, XcmExecutor};
5958

@@ -438,14 +437,11 @@ pub type XcmOriginToTransactDispatchOrigin = (
438437
// foreign chains who want to have a local sovereign account on this chain which they control.
439438
SovereignSignedViaLocation<LocationToAccountId, Origin>,
440439
// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when
441-
// recognised.
440+
// recognized.
442441
RelayChainAsNative<RelayChainOrigin, Origin>,
443442
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
444-
// recognised.
443+
// recognized.
445444
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
446-
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
447-
// transaction from the Root origin.
448-
ParentAsSuperuser<Origin>,
449445
// Native signed account converter; this just converts an `AccountId32` origin into a normal
450446
// `Origin::Signed` origin of the same 32-byte value.
451447
SignedAccountId32AsNative<RelayNetwork, Origin>,
@@ -481,7 +477,7 @@ impl Config for XcmConfig {
481477
type AssetTransactor = LocalAssetTransactor;
482478
type OriginConverter = XcmOriginToTransactDispatchOrigin;
483479
type IsReserve = NativeAsset;
484-
type IsTeleporter = NativeAsset; // Should be enough to allow teleportation of ROC
480+
type IsTeleporter = (); // Teleporting is disabled.
485481
type LocationInverter = LocationInverter<Ancestry>;
486482
type Barrier = Barrier;
487483
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
@@ -516,13 +512,14 @@ impl pallet_xcm::Config for Runtime {
516512
type XcmExecuteFilter = Everything;
517513
type XcmExecutor = XcmExecutor<XcmConfig>;
518514
type XcmTeleportFilter = Everything;
519-
type XcmReserveTransferFilter = Everything;
515+
type XcmReserveTransferFilter = Nothing;
520516
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
521517
type LocationInverter = LocationInverter<Ancestry>;
522518
type Origin = Origin;
523519
type Call = Call;
524520

525521
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
522+
// Override for AdvertisedXcmVersion default
526523
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
527524
}
528525

polkadot-parachains/rococo/src/lib.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use sp_version::RuntimeVersion;
3838
// A few exports that help ease life for downstream crates.
3939
pub use frame_support::{
4040
construct_runtime, match_type, parameter_types,
41-
traits::{Everything, IsInVec, Randomness},
41+
traits::{Everything, Nothing},
4242
weights::{
4343
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
4444
DispatchClass, IdentityFee, Weight,
@@ -186,7 +186,7 @@ impl frame_system::Config for Runtime {
186186
type OnNewAccount = ();
187187
type OnKilledAccount = ();
188188
type DbWeight = ();
189-
type BaseCallFilter = frame_support::traits::Everything;
189+
type BaseCallFilter = Everything;
190190
type SystemWeightInfo = ();
191191
type BlockWeights = RuntimeBlockWeights;
192192
type BlockLength = RuntimeBlockLength;
@@ -335,10 +335,10 @@ pub type XcmOriginToTransactDispatchOrigin = (
335335
// foreign chains who want to have a local sovereign account on this chain which they control.
336336
SovereignSignedViaLocation<LocationToAccountId, Origin>,
337337
// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when
338-
// recognised.
338+
// recognized.
339339
RelayChainAsNative<RelayChainOrigin, Origin>,
340340
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
341-
// recognised.
341+
// recognized.
342342
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
343343
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
344344
// transaction from the Root origin.
@@ -423,12 +423,14 @@ impl pallet_xcm::Config for Runtime {
423423
type XcmExecuteFilter = Everything;
424424
type XcmExecutor = XcmExecutor<XcmConfig>;
425425
type XcmTeleportFilter = Everything;
426-
type XcmReserveTransferFilter = frame_support::traits::Nothing;
426+
type XcmReserveTransferFilter = Nothing;
427427
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
428428
type LocationInverter = LocationInverter<Ancestry>;
429429
type Origin = Origin;
430430
type Call = Call;
431+
431432
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
433+
// Override for AdvertisedXcmVersion default
432434
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
433435
}
434436

polkadot-parachains/statemine/src/lib.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ use xcm_builder::{
7474
AsPrefixedGeneralIndex, ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin,
7575
FixedWeightBounds, FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset,
7676
ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,
77-
SiblingParachainConvertsVia, SignedAccountId32AsNative,
78-
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
77+
SiblingParachainConvertsVia, SignedAccountId32AsNative, SovereignSignedViaLocation,
78+
TakeWeightCredit, UsingComponents,
7979
};
8080
use xcm_executor::{traits::JustTry, Config, XcmExecutor};
8181

@@ -530,10 +530,10 @@ pub type XcmOriginToTransactDispatchOrigin = (
530530
// foreign chains who want to have a local sovereign account on this chain which they control.
531531
SovereignSignedViaLocation<LocationToAccountId, Origin>,
532532
// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when
533-
// recognised.
533+
// recognized.
534534
RelayChainAsNative<RelayChainOrigin, Origin>,
535535
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
536-
// recognised.
536+
// recognized.
537537
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
538538
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
539539
// transaction from the Root origin.
@@ -615,6 +615,7 @@ impl pallet_xcm::Config for Runtime {
615615
type Call = Call;
616616

617617
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
618+
// Override for AdvertisedXcmVersion default
618619
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
619620
}
620621

polkadot-parachains/statemint/src/lib.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ use xcm_builder::{
7474
AsPrefixedGeneralIndex, ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin,
7575
FixedWeightBounds, FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset,
7676
ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,
77-
SiblingParachainConvertsVia, SignedAccountId32AsNative,
78-
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
77+
SiblingParachainConvertsVia, SignedAccountId32AsNative, SovereignSignedViaLocation,
78+
TakeWeightCredit, UsingComponents,
7979
};
8080
use xcm_executor::{traits::JustTry, Config, XcmExecutor};
8181

@@ -495,10 +495,10 @@ pub type XcmOriginToTransactDispatchOrigin = (
495495
// foreign chains who want to have a local sovereign account on this chain which they control.
496496
SovereignSignedViaLocation<LocationToAccountId, Origin>,
497497
// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when
498-
// recognised.
498+
// recognized.
499499
RelayChainAsNative<RelayChainOrigin, Origin>,
500500
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
501-
// recognised.
501+
// recognized.
502502
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
503503
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
504504
// transaction from the Root origin.
@@ -577,7 +577,9 @@ impl pallet_xcm::Config for Runtime {
577577
type LocationInverter = LocationInverter<Ancestry>;
578578
type Origin = Origin;
579579
type Call = Call;
580+
580581
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
582+
// Override for AdvertisedXcmVersion default
581583
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
582584
}
583585

polkadot-parachains/westmint/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,10 @@ pub type XcmOriginToTransactDispatchOrigin = (
494494
// foreign chains who want to have a local sovereign account on this chain which they control.
495495
SovereignSignedViaLocation<LocationToAccountId, Origin>,
496496
// Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when
497-
// recognised.
497+
// recognized.
498498
RelayChainAsNative<RelayChainOrigin, Origin>,
499499
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
500-
// recognised.
500+
// recognized.
501501
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
502502
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
503503
// transaction from the Root origin.
@@ -577,6 +577,7 @@ impl pallet_xcm::Config for Runtime {
577577
type Call = Call;
578578

579579
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
580+
// Override for AdvertisedXcmVersion default
580581
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
581582
}
582583

primitives/utility/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use cumulus_primitives_core::UpwardMessageSender;
2424
use sp_std::marker::PhantomData;
2525
use xcm::{latest::prelude::*, WrapVersion};
2626

27-
/// Xcm router which recognises the `Parent` destination and handles it by sending the message into
27+
/// Xcm router which recognizes the `Parent` destination and handles it by sending the message into
2828
/// the given UMP `UpwardMessageSender` implementation. Thus this essentially adapts an
2929
/// `UpwardMessageSender` trait impl into a `SendXcm` trait impl.
3030
///

0 commit comments

Comments
 (0)