@@ -84,7 +84,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
8484 spec_name : alloc:: borrow:: Cow :: Borrowed ( "robonomics" ) ,
8585 impl_name : alloc:: borrow:: Cow :: Borrowed ( "robonomics-airalab" ) ,
8686 authoring_version : 1 ,
87- spec_version : 40 ,
87+ spec_version : 41 ,
8888 impl_version : 1 ,
8989 apis : RUNTIME_API_VERSIONS ,
9090 transaction_version : 2 ,
@@ -204,7 +204,7 @@ impl cumulus_pallet_aura_ext::Config for Runtime {}
204204
205205impl pallet_timestamp:: Config for Runtime {
206206 type Moment = u64 ;
207- type OnTimestampSet = ( ) ;
207+ type OnTimestampSet = Aura ;
208208 type MinimumPeriod = ConstU64 < 0 > ;
209209 type WeightInfo = ( ) ;
210210}
@@ -537,7 +537,7 @@ construct_runtime! {
537537 Timestamp : pallet_timestamp = 12 ,
538538 Multisig : pallet_multisig = 15 ,
539539 MultiBlockMigrations : pallet_migrations = 16 ,
540- StateTrieMigration : pallet_state_trie_migration = 17 ,
540+ // Ex: StateTrieMigration: pallet_state_trie_migration = 17,
541541
542542 // Parachain systems.
543543 ParachainSystem : cumulus_pallet_parachain_system = 21 ,
@@ -628,98 +628,7 @@ pub type Executive = frame_executive::Executive<
628628> ;
629629
630630/// Migrations to apply on runtime upgrade.
631- pub type Migrations = (
632- pallet_multisig:: migrations:: v1:: MigrateToV1 < Runtime > ,
633- //cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
634- //cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
635- InitMigrationStorage ,
636- // permanent
637- //pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
638- ) ;
639-
640- pub struct InitMigrationStorage ;
641- impl frame_support:: traits:: OnRuntimeUpgrade for InitMigrationStorage {
642- fn on_runtime_upgrade ( ) -> Weight {
643- use sp_core:: crypto:: Ss58Codec ;
644- use sp_keyring:: Sr25519Keyring ;
645-
646- // setup sudo
647- if let Ok ( sudo_key) =
648- AccountId :: from_ss58check ( "5Cakru1BpXPiezeD2LRZh3pJamHcbX9yZ13KLBxuqdTpgnYF" )
649- {
650- let _ = Sudo :: set_key ( RuntimeOrigin :: root ( ) , sudo_key. into ( ) ) ;
651- }
652-
653- // setup collators
654- use pallet_collator_selection:: { CandidacyBond , DesiredCandidates , Invulnerables } ;
655- let desired_candidates = 25 ;
656- let candidacy_bond = 32 * XRT ;
657- let invulnerables: Vec < AccountId > = vec ! [
658- Sr25519Keyring :: Alice . to_account_id( ) ,
659- Sr25519Keyring :: Bob . to_account_id( ) ,
660- ] ;
661-
662- let bounded_invulnerables: BoundedVec <
663- _ ,
664- <Runtime as pallet_collator_selection:: Config >:: MaxInvulnerables ,
665- > = invulnerables
666- . clone ( )
667- . try_into ( )
668- . expect ( "genesis invulnerables are more than T::MaxInvulnerables" ) ;
669-
670- DesiredCandidates :: < Runtime > :: put ( desired_candidates) ;
671- CandidacyBond :: < Runtime > :: put ( candidacy_bond) ;
672- Invulnerables :: < Runtime > :: put ( bounded_invulnerables) ;
673-
674- // Genesis init pallet_session
675- use pallet_session:: { NextKeys , QueuedKeys , SessionHandler , SessionManager , Validators } ;
676-
677- // insert genesis keys
678- NextKeys :: < Runtime > :: insert (
679- Sr25519Keyring :: Alice . to_account_id ( ) ,
680- SessionKeys {
681- aura : Sr25519Keyring :: Alice . public ( ) . into ( ) ,
682- } ,
683- ) ;
684- NextKeys :: < Runtime > :: insert (
685- Sr25519Keyring :: Bob . to_account_id ( ) ,
686- SessionKeys {
687- aura : Sr25519Keyring :: Bob . public ( ) . into ( ) ,
688- } ,
689- ) ;
690-
691- // init validators
692- let initial_validators_0 =
693- <Runtime as pallet_session:: Config >:: SessionManager :: new_session_genesis ( 0 )
694- . unwrap_or_else ( || {
695- frame_support:: print (
696- "No initial validator provided by `SessionManager`, use \
697- session config keys to generate initial validator set.",
698- ) ;
699- invulnerables
700- } ) ;
701-
702- let initial_validators_1 =
703- <Runtime as pallet_session:: Config >:: SessionManager :: new_session_genesis ( 1 )
704- . unwrap_or_else ( || initial_validators_0. clone ( ) ) ;
705-
706- let queued_keys: Vec < _ > = initial_validators_1
707- . into_iter ( )
708- . filter_map ( |v| pallet_session:: Pallet :: < Runtime > :: load_keys ( & v) . map ( |k| ( v, k) ) )
709- . collect ( ) ;
710-
711- <Runtime as pallet_session:: Config >:: SessionHandler :: on_genesis_session :: <
712- <Runtime as pallet_session:: Config >:: Keys ,
713- > ( & queued_keys) ;
714-
715- Validators :: < Runtime > :: put ( initial_validators_0) ;
716- QueuedKeys :: < Runtime > :: put ( queued_keys) ;
717-
718- <Runtime as pallet_session:: Config >:: SessionManager :: start_session ( 0 ) ;
719-
720- Default :: default ( )
721- }
722- }
631+ pub type Migrations = ( ) ;
723632
724633#[ cfg( feature = "runtime-benchmarks" ) ]
725634extern crate frame_benchmarking;
@@ -943,66 +852,7 @@ impl_runtime_apis! {
943852 }
944853}
945854
946- /// Recovery block executor that pass blocks when authorities list is empty.
947- pub struct BlockExecutor < T , I > ( core:: marker:: PhantomData < ( T , I ) > ) ;
948-
949- impl < Block , T , I > frame_support:: traits:: ExecuteBlock < Block > for BlockExecutor < T , I >
950- where
951- Block : BlockT ,
952- T : cumulus_pallet_aura_ext:: Config ,
953- I : frame_support:: traits:: ExecuteBlock < Block > ,
954- {
955- fn execute_block ( block : Block ) {
956- if pallet_aura:: Authorities :: < T > :: get ( ) . len ( ) > 0 {
957- // Execute block with aura pallet
958- cumulus_pallet_aura_ext:: BlockExecutor :: < T , I > :: execute_block ( block) ;
959- } else {
960- // Workaround because we don't have authorities
961- use sp_consensus_aura:: digests:: CompatibleDigestItem ;
962- use sp_runtime:: { traits:: Header , RuntimeAppPublic } ;
963-
964- // Filter aura digests befor pass block to executor
965- let ( mut header, extrinsics) = block. deconstruct ( ) ;
966- header. digest_mut ( ) . logs . retain ( |s|
967- CompatibleDigestItem :: < <T :: AuthorityId as RuntimeAppPublic >:: Signature > :: as_aura_seal ( s)
968- . is_none ( )
969- ) ;
970-
971- I :: execute_block ( Block :: new ( header, extrinsics) ) ;
972- }
973- }
974- }
975-
976855cumulus_pallet_parachain_system:: register_validate_block! {
977856 Runtime = Runtime ,
978- BlockExecutor = BlockExecutor <Runtime , Executive >,
979- }
980-
981- parameter_types ! {
982- // The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high)
983- pub const MigrationSignedDepositPerItem : Balance = COASE ;
984- pub const MigrationSignedDepositBase : Balance = 2_000 * COASE ;
985- pub const MigrationMaxKeyLen : u32 = 512 ;
986- }
987-
988- impl pallet_state_trie_migration:: Config for Runtime {
989- type RuntimeEvent = RuntimeEvent ;
990- type Currency = Balances ;
991- type RuntimeHoldReason = RuntimeHoldReason ;
992- type SignedDepositPerItem = MigrationSignedDepositPerItem ;
993- type SignedDepositBase = MigrationSignedDepositBase ;
994- // An origin that can control the whole pallet: should be Root, or a part of your council.
995- type ControlOrigin = frame_system:: EnsureSignedBy < RootMigController , AccountId > ;
996- // specific account for the migration, can trigger the signed migrations.
997- type SignedFilter = frame_system:: EnsureSignedBy < MigController , AccountId > ;
998-
999- // Replace this with weight based on your runtime.
1000- type WeightInfo = pallet_state_trie_migration:: weights:: SubstrateWeight < Runtime > ;
1001-
1002- type MaxKeyLen = MigrationMaxKeyLen ;
1003- }
1004-
1005- frame_support:: ord_parameter_types! {
1006- pub const MigController : AccountId = AccountId :: from( hex_literal:: hex!( "16eb796bee0c857db3d646ee7070252707aec0c7d82b2eda856632f6a2306a58" ) ) ;
1007- pub const RootMigController : AccountId = AccountId :: from( hex_literal:: hex!( "16eb796bee0c857db3d646ee7070252707aec0c7d82b2eda856632f6a2306a58" ) ) ;
857+ BlockExecutor = cumulus_pallet_aura_ext:: BlockExecutor :: <Runtime , Executive >,
1008858}
0 commit comments