@@ -24,7 +24,8 @@ use cirrus_runtime::GenesisConfig as ExecutionGenesisConfig;
2424use sc_service:: ChainType ;
2525use sc_subspace_chain_specs:: { ChainSpecExtensions , ConsensusChainSpec } ;
2626use sc_telemetry:: TelemetryEndpoints ;
27- use sp_core:: crypto:: Ss58Codec ;
27+ use sp_consensus_subspace:: FarmerPublicKey ;
28+ use sp_core:: crypto:: { Ss58Codec , UncheckedFrom } ;
2829use sp_executor:: ExecutorId ;
2930use subspace_runtime:: {
3031 AllowAuthoringBy , BalancesConfig , ExecutorConfig , GenesisConfig , RuntimeConfigsConfig ,
@@ -72,6 +73,109 @@ struct GenesisParams {
7273 max_plot_size : u64 ,
7374}
7475
76+ pub fn gemini_2a ( ) -> Result < ConsensusChainSpec < GenesisConfig , ExecutionGenesisConfig > , String > {
77+ unimplemented ! ( )
78+ }
79+
80+ pub fn gemini_2a_compiled (
81+ ) -> Result < ConsensusChainSpec < GenesisConfig , ExecutionGenesisConfig > , String > {
82+ Ok ( ConsensusChainSpec :: from_genesis (
83+ // Name
84+ "Subspace Gemini 2a" ,
85+ // ID
86+ "subspace_gemini_2a" ,
87+ ChainType :: Custom ( "Subspace Gemini 2a" . to_string ( ) ) ,
88+ || {
89+ let sudo_account =
90+ AccountId :: from_ss58check ( "5CXTmJEusve5ixyJufqHThmy4qUrrm6FyLCR7QfE4bbyMTNC" )
91+ . expect ( "Wrong root account address" ) ;
92+
93+ let mut balances = vec ! [ ( sudo_account. clone( ) , 1_000 * SSC ) ] ;
94+ let vesting_schedules = TOKEN_GRANTS
95+ . iter ( )
96+ . flat_map ( |& ( account_address, amount) | {
97+ let account_id = AccountId :: from_ss58check ( account_address)
98+ . expect ( "Wrong vesting account address" ) ;
99+ let amount: Balance = amount * SSC ;
100+
101+ // TODO: Adjust start block to real value before mainnet launch
102+ let start_block = 100_000_000 ;
103+ let one_month_in_blocks =
104+ u32:: try_from ( 3600 * 24 * 30 * MILLISECS_PER_BLOCK / 1000 )
105+ . expect ( "One month of blocks always fits in u32; qed" ) ;
106+
107+ // Add balance so it can be locked
108+ balances. push ( ( account_id. clone ( ) , amount) ) ;
109+
110+ [
111+ // 1/4 of tokens are released after 1 year.
112+ (
113+ account_id. clone ( ) ,
114+ start_block,
115+ one_month_in_blocks * 12 ,
116+ 1 ,
117+ amount / 4 ,
118+ ) ,
119+ // 1/48 of tokens are released every month after that for 3 more years.
120+ (
121+ account_id,
122+ start_block + one_month_in_blocks * 12 ,
123+ one_month_in_blocks,
124+ 36 ,
125+ amount / 48 ,
126+ ) ,
127+ ]
128+ } )
129+ . collect :: < Vec < _ > > ( ) ;
130+ subspace_genesis_config (
131+ WASM_BINARY . expect ( "Wasm binary must be built for Gemini" ) ,
132+ sudo_account,
133+ balances,
134+ vesting_schedules,
135+ (
136+ AccountId :: from_ss58check ( "5Df6w8CgYY8kTRwCu8bjBsFu46fy4nFa61xk6dUbL6G4fFjQ" )
137+ . expect ( "Wrong Executor account address" ) ,
138+ ExecutorId :: from_ss58check ( "5FuuXk1TL8DKQMvg7mcqmP8t9FhxUdzTcYC9aFmebiTLmASx" )
139+ . expect ( "Wrong Executor authority address" ) ,
140+ ) ,
141+ GenesisParams {
142+ enable_rewards : false ,
143+ enable_storage_access : false ,
144+ allow_authoring_by : AllowAuthoringBy :: RootFarmer (
145+ FarmerPublicKey :: unchecked_from ( [
146+ 0x50 , 0x69 , 0x60 , 0xf3 , 0x50 , 0x33 , 0xee , 0xc1 , 0x12 , 0xb5 , 0xbc , 0xb4 ,
147+ 0xe5 , 0x91 , 0xfb , 0xbb , 0xf5 , 0x88 , 0xac , 0x45 , 0x26 , 0x90 , 0xd4 , 0x70 ,
148+ 0x32 , 0x6c , 0x3f , 0x7b , 0x4e , 0xd9 , 0x41 , 0x17 ,
149+ ] ) ,
150+ ) ,
151+ enable_executor : false ,
152+ // 10GiB
153+ max_plot_size : 10 * 1024 * 1024 * 1024 ,
154+ } ,
155+ )
156+ } ,
157+ // Bootnodes
158+ vec ! [ ] ,
159+ // Telemetry
160+ Some (
161+ TelemetryEndpoints :: new ( vec ! [
162+ ( POLKADOT_TELEMETRY_URL . into( ) , 1 ) ,
163+ ( SUBSPACE_TELEMETRY_URL . into( ) , 1 ) ,
164+ ] )
165+ . map_err ( |error| error. to_string ( ) ) ?,
166+ ) ,
167+ // Protocol ID
168+ Some ( "subspace-gemini-2a" ) ,
169+ None ,
170+ // Properties
171+ Some ( chain_spec_properties ( ) ) ,
172+ // Extensions
173+ ChainSpecExtensions {
174+ execution_chain_spec : secondary_chain:: chain_spec:: development_config ( ) ,
175+ } ,
176+ ) )
177+ }
178+
75179pub fn x_net_config ( ) -> Result < ConsensusChainSpec < GenesisConfig , ExecutionGenesisConfig > , String > {
76180 ConsensusChainSpec :: from_json_bytes ( X_NET_1_CHAIN_SPEC )
77181}
0 commit comments