@@ -4,15 +4,29 @@ use frame_support::pallet_macros::pallet_section;
44/// This can later be imported into the pallet using [`import_section`].
55#[ pallet_section]
66mod genesis {
7- use sp_keyring:: Sr25519Keyring ;
7+ use sp_core:: crypto:: Pair ;
8+ use sp_core:: sr25519:: Pair as Sr25519Pair ;
9+
810 #[ pallet:: genesis_build]
911 impl < T : Config > BuildGenesisConfig for GenesisConfig < T > {
1012 fn build ( & self ) {
1113 // Alice's public key
12- let alice_bytes = Sr25519Keyring :: Alice . public ( ) ;
13- let alice_key =
14+ let alice_bytes = sp_keyring:: Sr25519Keyring :: Alice . public ( ) ;
15+
16+ // Create Alice's hotkey from seed string
17+ let pair = Sr25519Pair :: from_string ( "//Alice_hk" , None )
18+ . expect ( "Alice hotkey pair should be valid" ) ;
19+ let alice_hk_bytes = pair. public ( ) . 0 ;
20+
21+ let alice_account =
1422 T :: AccountId :: decode ( & mut & alice_bytes[ ..] ) . expect ( "Alice account should decode" ) ;
15- let subnet_root_owner = prod_or_fast ! ( DefaultSubnetOwner :: <T >:: get( ) , alice_key) ;
23+ let alice_hk_account = T :: AccountId :: decode ( & mut & alice_hk_bytes[ ..] )
24+ . expect ( "Alice hotkey account should decode" ) ;
25+
26+ let subnet_root_owner = prod_or_fast ! ( DefaultSubnetOwner :: <T >:: get( ) , alice_account) ;
27+ let subnet_root_owner_hotkey =
28+ prod_or_fast ! ( DefaultSubnetOwner :: <T >:: get( ) , alice_hk_account) ;
29+
1630 // Set initial total issuance from balances
1731 TotalIssuance :: < T > :: put ( self . balances_issuance ) ;
1832
@@ -25,6 +39,9 @@ mod genesis {
2539 // Set the root network owner.
2640 SubnetOwner :: < T > :: insert ( NetUid :: ROOT , subnet_root_owner) ;
2741
42+ // Set the root network owner hotkey.
43+ SubnetOwnerHotkey :: < T > :: insert ( NetUid :: ROOT , subnet_root_owner_hotkey) ;
44+
2845 // Set the number of validators to 1.
2946 SubnetworkN :: < T > :: insert ( NetUid :: ROOT , 0 ) ;
3047
0 commit comments