@@ -192,6 +192,8 @@ mod pallet {
192192 #[ cfg( not( feature = "std" ) ) ]
193193 use alloc:: string:: String ;
194194 #[ cfg( not( feature = "std" ) ) ]
195+ use alloc:: vec;
196+ #[ cfg( not( feature = "std" ) ) ]
195197 use alloc:: vec:: Vec ;
196198 use codec:: FullCodec ;
197199 use domain_runtime_primitives:: EVMChainId ;
@@ -219,7 +221,6 @@ mod pallet {
219221 use sp_std:: boxed:: Box ;
220222 use sp_std:: collections:: btree_set:: BTreeSet ;
221223 use sp_std:: fmt:: Debug ;
222- use sp_std:: vec;
223224 use subspace_core_primitives:: U256 ;
224225 use subspace_runtime_primitives:: StorageFee ;
225226
@@ -1399,16 +1400,16 @@ mod pallet {
13991400
14001401 #[ pallet:: genesis_config]
14011402 pub struct GenesisConfig < T : Config > {
1402- pub genesis_domain : Option < GenesisDomain < T :: AccountId , BalanceOf < T > > > ,
14031403 pub permissioned_action_allowed_by :
14041404 Option < sp_domains:: PermissionedActionAllowedBy < T :: AccountId > > ,
1405+ pub genesis_domains : Vec < GenesisDomain < T :: AccountId , BalanceOf < T > > > ,
14051406 }
14061407
14071408 impl < T : Config > Default for GenesisConfig < T > {
14081409 fn default ( ) -> Self {
14091410 GenesisConfig {
1410- genesis_domain : None ,
14111411 permissioned_action_allowed_by : None ,
1412+ genesis_domains : vec ! [ ] ,
14121413 }
14131414 }
14141415 }
@@ -1421,46 +1422,58 @@ mod pallet {
14211422 {
14221423 PermissionedActionAllowedBy :: < T > :: put ( permissioned_action_allowed_by)
14231424 }
1424- if let Some ( genesis_domain) = self . genesis_domain . as_ref ( ) . cloned ( ) {
1425- // Register the genesis domain runtime
1426- let runtime_id = register_runtime_at_genesis :: < T > (
1427- genesis_domain. runtime_name ,
1428- genesis_domain. runtime_type ,
1429- genesis_domain. runtime_version ,
1430- genesis_domain. raw_genesis_storage ,
1431- Zero :: zero ( ) ,
1432- )
1433- . expect ( "Genesis runtime registration must always succeed" ) ;
1434-
1435- // Instantiate the genesis domain
1436- let domain_config = DomainConfig {
1437- domain_name : genesis_domain. domain_name ,
1438- runtime_id,
1439- max_block_size : genesis_domain. max_block_size ,
1440- max_block_weight : genesis_domain. max_block_weight ,
1441- bundle_slot_probability : genesis_domain. bundle_slot_probability ,
1442- target_bundles_per_block : genesis_domain. target_bundles_per_block ,
1443- operator_allow_list : genesis_domain. operator_allow_list ,
1444- initial_balances : genesis_domain. initial_balances ,
1445- } ;
1446- let domain_owner = genesis_domain. owner_account_id ;
1447- let domain_id =
1448- do_instantiate_domain :: < T > ( domain_config, domain_owner. clone ( ) , Zero :: zero ( ) )
1449- . expect ( "Genesis domain instantiation must always succeed" ) ;
1450-
1451- // Register domain_owner as the genesis operator.
1452- let operator_config = OperatorConfig {
1453- signing_key : genesis_domain. signing_key . clone ( ) ,
1454- minimum_nominator_stake : genesis_domain. minimum_nominator_stake ,
1455- nomination_tax : genesis_domain. nomination_tax ,
1456- } ;
1457- let operator_stake = T :: MinOperatorStake :: get ( ) ;
1458- do_register_operator :: < T > ( domain_owner, domain_id, operator_stake, operator_config)
1425+
1426+ self . genesis_domains
1427+ . clone ( )
1428+ . into_iter ( )
1429+ . for_each ( |genesis_domain| {
1430+ // Register the genesis domain runtime
1431+ let runtime_id = register_runtime_at_genesis :: < T > (
1432+ genesis_domain. runtime_name ,
1433+ genesis_domain. runtime_type ,
1434+ genesis_domain. runtime_version ,
1435+ genesis_domain. raw_genesis_storage ,
1436+ Zero :: zero ( ) ,
1437+ )
1438+ . expect ( "Genesis runtime registration must always succeed" ) ;
1439+
1440+ // Instantiate the genesis domain
1441+ let domain_config = DomainConfig {
1442+ domain_name : genesis_domain. domain_name ,
1443+ runtime_id,
1444+ max_block_size : genesis_domain. max_block_size ,
1445+ max_block_weight : genesis_domain. max_block_weight ,
1446+ bundle_slot_probability : genesis_domain. bundle_slot_probability ,
1447+ target_bundles_per_block : genesis_domain. target_bundles_per_block ,
1448+ operator_allow_list : genesis_domain. operator_allow_list ,
1449+ initial_balances : genesis_domain. initial_balances ,
1450+ } ;
1451+ let domain_owner = genesis_domain. owner_account_id ;
1452+ let domain_id = do_instantiate_domain :: < T > (
1453+ domain_config,
1454+ domain_owner. clone ( ) ,
1455+ Zero :: zero ( ) ,
1456+ )
1457+ . expect ( "Genesis domain instantiation must always succeed" ) ;
1458+
1459+ // Register domain_owner as the genesis operator.
1460+ let operator_config = OperatorConfig {
1461+ signing_key : genesis_domain. signing_key . clone ( ) ,
1462+ minimum_nominator_stake : genesis_domain. minimum_nominator_stake ,
1463+ nomination_tax : genesis_domain. nomination_tax ,
1464+ } ;
1465+ let operator_stake = T :: MinOperatorStake :: get ( ) ;
1466+ do_register_operator :: < T > (
1467+ domain_owner,
1468+ domain_id,
1469+ operator_stake,
1470+ operator_config,
1471+ )
14591472 . expect ( "Genesis operator registration must succeed" ) ;
14601473
1461- do_finalize_domain_current_epoch :: < T > ( domain_id)
1462- . expect ( "Genesis epoch must succeed" ) ;
1463- }
1474+ do_finalize_domain_current_epoch :: < T > ( domain_id)
1475+ . expect ( "Genesis epoch must succeed" ) ;
1476+ } ) ;
14641477 }
14651478 }
14661479
0 commit comments