File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ approx.workspace = true
4242subtensor-swap-interface.workspace = true
4343runtime-common.workspace = true
4444subtensor-runtime-common = { workspace = true , features = [" approx" ] }
45+ sp-keyring.workspace = true
4546
4647pallet-drand.workspace = true
4748pallet-commitments.workspace = true
@@ -105,6 +106,7 @@ std = [
105106 " sp-std/std" ,
106107 " sp-tracing/std" ,
107108 " sp-version/std" ,
109+ " sp-keyring/std" ,
108110 " subtensor-runtime-common/std" ,
109111 " pallet-commitments/std" ,
110112 " pallet-crowdloan/std" ,
Original file line number Diff line number Diff line change @@ -4,10 +4,15 @@ 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-
7+ use sp_keyring :: Sr25519Keyring ;
88 #[ pallet:: genesis_build]
99 impl < T : Config > BuildGenesisConfig for GenesisConfig < T > {
1010 fn build ( & self ) {
11+ // Alice's public key
12+ let alice_bytes = Sr25519Keyring :: Alice . public ( ) ;
13+ let alice_key =
14+ T :: AccountId :: decode ( & mut & alice_bytes[ ..] ) . expect ( "Alice account should decode" ) ;
15+ let subnet_root_owner = prod_or_fast ! ( DefaultSubnetOwner :: <T >:: get( ) , alice_key) ;
1116 // Set initial total issuance from balances
1217 TotalIssuance :: < T > :: put ( self . balances_issuance ) ;
1318
@@ -17,6 +22,9 @@ mod genesis {
1722 // Increment the number of total networks.
1823 TotalNetworks :: < T > :: mutate ( |n| * n = n. saturating_add ( 1 ) ) ;
1924
25+ // Set the root network owner.
26+ SubnetOwner :: < T > :: insert ( NetUid :: ROOT , subnet_root_owner) ;
27+
2028 // Set the number of validators to 1.
2129 SubnetworkN :: < T > :: insert ( NetUid :: ROOT , 0 ) ;
2230
You can’t perform that action at this time.
0 commit comments