@@ -43,14 +43,7 @@ use sp_version::NativeVersion;
4343use sp_version:: RuntimeVersion ;
4444use pallet_xcm:: XcmPassthrough ;
4545use polkadot_parachain:: primitives:: Sibling ;
46- use xcm:: v0:: {
47- BodyId ,
48- Junction ,
49- Junction :: * ,
50- MultiLocation ,
51- MultiLocation :: * ,
52- NetworkId ,
53- } ;
46+ use xcm:: v0:: { BodyId , Junction :: * , MultiAsset , MultiLocation , MultiLocation :: * , NetworkId , Xcm } ;
5447use xcm_builder:: {
5548 IsConcrete ,
5649 AccountId32Aliases ,
@@ -69,6 +62,8 @@ use xcm_builder::{
6962 AllowUnpaidExecutionFrom ,
7063 FixedWeightBounds ,
7164 UsingComponents ,
65+ SignedToAccountId32 ,
66+ EnsureXcmOrigin ,
7267} ;
7368use xcm_executor:: {
7469 Config ,
@@ -105,6 +100,7 @@ pub use frame_support::{
105100pub use pallet_balances:: Call as BalancesCall ;
106101// pub use pallet_staking::StakerStatus;
107102pub use pallet_timestamp:: Call as TimestampCall ;
103+ pub use sp_consensus_aura:: sr25519:: AuthorityId as AuraId ;
108104#[ cfg( any( feature = "std" , test) ) ]
109105pub use sp_runtime:: BuildStorage ;
110106pub use sp_runtime:: {
@@ -314,6 +310,7 @@ impl pallet_timestamp::Config for Runtime {
314310parameter_types ! {
315311 pub const ExistentialDeposit : u128 = 500 ;
316312 pub const MaxLocks : u32 = 50 ;
313+ pub const MaxReserves : u32 = 50 ;
317314}
318315
319316impl pallet_balances:: Config for Runtime {
@@ -325,7 +322,9 @@ impl pallet_balances::Config for Runtime {
325322 type Event = Event ;
326323 type ExistentialDeposit = ExistentialDeposit ;
327324 type MaxLocks = MaxLocks ;
325+ type MaxReserves = MaxReserves ;
328326 type WeightInfo = ( ) ;
327+ type ReserveIdentifier = [ u8 ; 8 ] ;
329328}
330329
331330parameter_types ! {
@@ -408,6 +407,8 @@ parameter_types! {
408407 pub const BountyUpdatePeriod : u32 = 20 ;
409408 pub const DataDepositPerByte : u64 = 1 ;
410409 pub const TreasuryPalletId : PalletId = PalletId ( * b"py/trsry" ) ;
410+ pub const MaxApprovals : u32 = 100 ;
411+
411412}
412413
413414impl pallet_treasury:: Config for Runtime {
@@ -436,6 +437,7 @@ impl pallet_treasury::Config for Runtime {
436437 // type Tippers = GeneralCouncilProvider;
437438 // Just gets burned.
438439 type WeightInfo = ( ) ;
440+ type MaxApprovals = MaxApprovals ;
439441}
440442
441443parameter_types ! {
@@ -726,12 +728,10 @@ impl membership_supernodes::Config for Runtime {
726728}
727729
728730parameter_types ! {
729- pub const RococoLocation : MultiLocation = MultiLocation :: X1 ( Junction :: Parent ) ;
731+ pub const RococoLocation : MultiLocation = MultiLocation :: X1 ( Parent ) ;
730732 pub const RococoNetwork : NetworkId = NetworkId :: Polkadot ;
731733 pub RelayChainOrigin : Origin = cumulus_pallet_xcm:: Origin :: Relay . into( ) ;
732- pub Ancestry : MultiLocation = Junction :: Parachain {
733- id: ParachainInfo :: parachain_id( ) . into( )
734- } . into( ) ;
734+ pub Ancestry : MultiLocation = X1 ( Parachain ( ParachainInfo :: parachain_id( ) . into( ) ) ) ;
735735}
736736
737737/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
@@ -820,7 +820,34 @@ impl Config for XcmConfig {
820820 type ResponseHandler = ( ) ; // Don't handle responses for now.
821821}
822822
823- impl cumulus_pallet_xcm:: Config for Runtime { }
823+ /// No local origins on this chain are allowed to dispatch XCM sends/executions.
824+ pub type LocalOriginToLocation = SignedToAccountId32 < Origin , AccountId , RococoNetwork > ;
825+
826+ /// The means for routing XCM messages which are not for local execution into the right message
827+ /// queues.
828+ pub type XcmRouter = (
829+ // Two routers - use UMP to communicate with the relay chain:
830+ cumulus_primitives_utility:: ParentAsUmp < ParachainSystem > ,
831+ // ..and XCMP to communicate with the sibling chains.
832+ XcmpQueue ,
833+ ) ;
834+
835+ impl pallet_xcm:: Config for Runtime {
836+ type Event = Event ;
837+ type SendXcmOrigin = EnsureXcmOrigin < Origin , LocalOriginToLocation > ;
838+ type XcmRouter = XcmRouter ;
839+ type ExecuteXcmOrigin = EnsureXcmOrigin < Origin , LocalOriginToLocation > ;
840+ type XcmExecuteFilter = All < ( MultiLocation , Xcm < Call > ) > ;
841+ type XcmExecutor = XcmExecutor < XcmConfig > ;
842+ type XcmTeleportFilter = All < ( MultiLocation , Vec < MultiAsset > ) > ;
843+ type XcmReserveTransferFilter = ( ) ;
844+ type Weigher = FixedWeightBounds < UnitWeightCost , Call > ;
845+ }
846+
847+ impl cumulus_pallet_xcm:: Config for Runtime {
848+ type Event = Event ;
849+ type XcmExecutor = XcmExecutor < XcmConfig > ;
850+ }
824851
825852impl cumulus_pallet_xcmp_queue:: Config for Runtime {
826853 type Event = Event ;
@@ -832,36 +859,39 @@ parameter_types! {
832859 pub const MaxDownwardMessageWeight : Weight = MAXIMUM_BLOCK_WEIGHT / 10 ;
833860}
834861
835- /// No local origins on this chain are allowed to dispatch XCM sends/executions.
836- pub type LocalOriginToLocation = ( ) ;
837-
838- /// The means for routing XCM messages which are not for local execution into the right message
839- /// queues.
840- pub type XcmRouter = (
841- // Two routers - use UMP to communicate with the relay chain:
842- cumulus_primitives_utility:: ParentAsUmp < ParachainSystem > ,
843- // ..and XCMP to communicate with the sibling chains.
844- XcmpQueue ,
845- ) ;
846-
847862parameter_types ! {
848863 pub const ReservedXcmpWeight : Weight = MAXIMUM_BLOCK_WEIGHT / 4 ;
864+ pub const ReservedDmpWeight : Weight = MAXIMUM_BLOCK_WEIGHT / 4 ;
849865}
850866
851867impl cumulus_pallet_parachain_system:: Config for Runtime {
852- type Event = Event ;
853- type OnValidationData = ( ) ;
854- type SelfParaId = parachain_info:: Module < Runtime > ;
855- type OutboundXcmpMessageSource = XcmpQueue ;
856- type XcmpMessageHandler = XcmpQueue ;
857- type ReservedXcmpWeight = ReservedXcmpWeight ;
858-
868+ type Event = Event ;
869+ type OnValidationData = ( ) ;
870+ type SelfParaId = parachain_info:: Pallet < Runtime > ;
871+ type OutboundXcmpMessageSource = XcmpQueue ;
872+ type DmpMessageHandler = DmpQueue ;
873+ type ReservedDmpWeight = ReservedDmpWeight ;
874+ type XcmpMessageHandler = XcmpQueue ;
875+ type ReservedXcmpWeight = ReservedXcmpWeight ;
859876}
860877
878+
861879impl parachain_info:: Config for Runtime { }
862880
863881impl cumulus_pallet_aura_ext:: Config for Runtime { }
864882
883+ impl pallet_randomness_collective_flip:: Config for Runtime { }
884+
885+ impl cumulus_pallet_dmp_queue:: Config for Runtime {
886+ type Event = Event ;
887+ type XcmExecutor = XcmExecutor < XcmConfig > ;
888+ type ExecuteOverweightOrigin = frame_system:: EnsureRoot < AccountId > ;
889+ }
890+
891+ impl pallet_aura:: Config for Runtime {
892+ type AuthorityId = AuraId ;
893+ }
894+
865895// Create the runtime by composing the FRAME pallets that were previously configured.
866896construct_runtime ! (
867897 pub enum Runtime where
@@ -874,6 +904,7 @@ construct_runtime!(
874904 Timestamp : pallet_timestamp:: { Pallet , Call , Storage , Inherent } ,
875905 //Indices: pallet_indices::{Pallet, Call, Storage, Event<T>, Config<T>},
876906 Balances : pallet_balances:: { Pallet , Call , Storage , Config <T >, Event <T >} ,
907+ Aura : pallet_aura:: { Pallet , Config <T >} ,
877908 AuraExt : cumulus_pallet_aura_ext:: { Pallet , Config } ,
878909 TransactionPayment : pallet_transaction_payment:: { Pallet , Storage } ,
879910 Sudo : pallet_sudo:: { Pallet , Call , Config <T >, Storage , Event <T >} ,
@@ -913,8 +944,10 @@ construct_runtime!(
913944 // PARACHAIN
914945 ParachainSystem : cumulus_pallet_parachain_system:: { Pallet , Call , Storage , Inherent , Event <T >} ,
915946 ParachainInfo : parachain_info:: { Pallet , Storage , Config } ,
916- XcmHandler : cumulus_pallet_xcm:: { Pallet , Origin } ,
947+ PolkadotXcm : pallet_xcm:: { Pallet , Call , Event <T >, Origin } ,
948+ XcmHandler : cumulus_pallet_xcm:: { Pallet , Call , Event <T >, Origin } ,
917949 XcmpQueue : cumulus_pallet_xcmp_queue:: { Pallet , Call , Storage , Event <T >} ,
950+ DmpQueue : cumulus_pallet_dmp_queue:: { Pallet , Call , Storage , Event <T >} ,
918951 }
919952) ;
920953
@@ -993,8 +1026,9 @@ impl_runtime_apis! {
9931026 fn validate_transaction(
9941027 source: TransactionSource ,
9951028 tx: <Block as BlockT >:: Extrinsic ,
1029+ block_hash: <Block as BlockT >:: Hash ,
9961030 ) -> TransactionValidity {
997- Executive :: validate_transaction( source, tx)
1031+ Executive :: validate_transaction( source, tx, block_hash )
9981032 }
9991033 }
10001034
@@ -1016,6 +1050,16 @@ impl_runtime_apis! {
10161050 }
10171051 }
10181052
1053+ impl sp_consensus_aura:: AuraApi <Block , AuraId > for Runtime {
1054+ fn slot_duration( ) -> sp_consensus_aura:: SlotDuration {
1055+ sp_consensus_aura:: SlotDuration :: from_millis( Aura :: slot_duration( ) )
1056+ }
1057+
1058+ fn authorities( ) -> Vec <AuraId > {
1059+ Aura :: authorities( )
1060+ }
1061+ }
1062+
10191063 impl frame_system_rpc_runtime_api:: AccountNonceApi <Block , AccountId , Index > for Runtime {
10201064 fn account_nonce( account: AccountId ) -> Index {
10211065 System :: account_nonce( account)
0 commit comments