@@ -113,7 +113,7 @@ fn westend_session_keys(
113
113
westend:: SessionKeys { babe, grandpa, im_online, parachain_validator, authority_discovery }
114
114
}
115
115
116
- fn polkadot_staging_testnet_config_genesis ( ) -> polkadot:: GenesisConfig {
116
+ fn polkadot_staging_testnet_config_genesis ( wasm_binary : & [ u8 ] ) -> polkadot:: GenesisConfig {
117
117
// subkey inspect "$SECRET"
118
118
let endowed_accounts = vec ! [ ] ;
119
119
@@ -132,7 +132,7 @@ fn polkadot_staging_testnet_config_genesis() -> polkadot::GenesisConfig {
132
132
133
133
polkadot:: GenesisConfig {
134
134
system : Some ( polkadot:: SystemConfig {
135
- code : polkadot :: WASM_BINARY . to_vec ( ) ,
135
+ code : wasm_binary . to_vec ( ) ,
136
136
changes_trie_config : Default :: default ( ) ,
137
137
} ) ,
138
138
balances : Some ( polkadot:: BalancesConfig {
@@ -197,7 +197,7 @@ fn polkadot_staging_testnet_config_genesis() -> polkadot::GenesisConfig {
197
197
}
198
198
}
199
199
200
- fn westend_staging_testnet_config_genesis ( ) -> westend:: GenesisConfig {
200
+ fn westend_staging_testnet_config_genesis ( wasm_binary : & [ u8 ] ) -> westend:: GenesisConfig {
201
201
// subkey inspect "$SECRET"
202
202
let endowed_accounts = vec ! [
203
203
// 5ENpP27BrVdJTdUfY6djmcw3d3xEJ6NzSUU52CCPmGpMrdEY
@@ -284,7 +284,7 @@ fn westend_staging_testnet_config_genesis() -> westend::GenesisConfig {
284
284
285
285
westend:: GenesisConfig {
286
286
system : Some ( westend:: SystemConfig {
287
- code : westend :: WASM_BINARY . to_vec ( ) ,
287
+ code : wasm_binary . to_vec ( ) ,
288
288
changes_trie_config : Default :: default ( ) ,
289
289
} ) ,
290
290
balances : Some ( westend:: BalancesConfig {
@@ -337,7 +337,7 @@ fn westend_staging_testnet_config_genesis() -> westend::GenesisConfig {
337
337
}
338
338
}
339
339
340
- fn kusama_staging_testnet_config_genesis ( ) -> kusama:: GenesisConfig {
340
+ fn kusama_staging_testnet_config_genesis ( wasm_binary : & [ u8 ] ) -> kusama:: GenesisConfig {
341
341
// subkey inspect "$SECRET"
342
342
let endowed_accounts = vec ! [
343
343
// 5CVFESwfkk7NmhQ6FwHCM9roBvr9BGa4vJHFYU8DnGQxrXvz
@@ -424,7 +424,7 @@ fn kusama_staging_testnet_config_genesis() -> kusama::GenesisConfig {
424
424
425
425
kusama:: GenesisConfig {
426
426
system : Some ( kusama:: SystemConfig {
427
- code : kusama :: WASM_BINARY . to_vec ( ) ,
427
+ code : wasm_binary . to_vec ( ) ,
428
428
changes_trie_config : Default :: default ( ) ,
429
429
} ) ,
430
430
balances : Some ( kusama:: BalancesConfig {
@@ -490,54 +490,60 @@ fn kusama_staging_testnet_config_genesis() -> kusama::GenesisConfig {
490
490
}
491
491
492
492
/// Polkadot staging testnet config.
493
- pub fn polkadot_staging_testnet_config ( ) -> PolkadotChainSpec {
493
+ pub fn polkadot_staging_testnet_config ( ) -> Result < PolkadotChainSpec , String > {
494
+ let wasm_binary = polkadot:: WASM_BINARY . ok_or ( "Polkadot development wasm not available" ) ?;
494
495
let boot_nodes = vec ! [ ] ;
495
- PolkadotChainSpec :: from_genesis (
496
+
497
+ Ok ( PolkadotChainSpec :: from_genesis (
496
498
"Polkadot Staging Testnet" ,
497
499
"polkadot_staging_testnet" ,
498
500
ChainType :: Live ,
499
- polkadot_staging_testnet_config_genesis,
501
+ move || polkadot_staging_testnet_config_genesis ( wasm_binary ) ,
500
502
boot_nodes,
501
503
Some ( TelemetryEndpoints :: new ( vec ! [ ( POLKADOT_STAGING_TELEMETRY_URL . to_string( ) , 0 ) ] )
502
504
. expect ( "Polkadot Staging telemetry url is valid; qed" ) ) ,
503
505
Some ( DEFAULT_PROTOCOL_ID ) ,
504
506
None ,
505
507
Default :: default ( ) ,
506
- )
508
+ ) )
507
509
}
508
510
509
511
/// Staging testnet config.
510
- pub fn kusama_staging_testnet_config ( ) -> KusamaChainSpec {
512
+ pub fn kusama_staging_testnet_config ( ) -> Result < KusamaChainSpec , String > {
513
+ let wasm_binary = kusama:: WASM_BINARY . ok_or ( "Kusama development wasm not available" ) ?;
511
514
let boot_nodes = vec ! [ ] ;
512
- KusamaChainSpec :: from_genesis (
515
+
516
+ Ok ( KusamaChainSpec :: from_genesis (
513
517
"Kusama Staging Testnet" ,
514
518
"kusama_staging_testnet" ,
515
519
ChainType :: Live ,
516
- kusama_staging_testnet_config_genesis,
520
+ move || kusama_staging_testnet_config_genesis ( wasm_binary ) ,
517
521
boot_nodes,
518
522
Some ( TelemetryEndpoints :: new ( vec ! [ ( KUSAMA_STAGING_TELEMETRY_URL . to_string( ) , 0 ) ] )
519
523
. expect ( "Kusama Staging telemetry url is valid; qed" ) ) ,
520
524
Some ( DEFAULT_PROTOCOL_ID ) ,
521
525
None ,
522
526
Default :: default ( ) ,
523
- )
527
+ ) )
524
528
}
525
529
526
530
/// Westend staging testnet config.
527
- pub fn westend_staging_testnet_config ( ) -> WestendChainSpec {
531
+ pub fn westend_staging_testnet_config ( ) -> Result < WestendChainSpec , String > {
532
+ let wasm_binary = westend:: WASM_BINARY . ok_or ( "Westend development wasm not available" ) ?;
528
533
let boot_nodes = vec ! [ ] ;
529
- WestendChainSpec :: from_genesis (
534
+
535
+ Ok ( WestendChainSpec :: from_genesis (
530
536
"Westend Staging Testnet" ,
531
537
"westend_staging_testnet" ,
532
538
ChainType :: Live ,
533
- westend_staging_testnet_config_genesis,
539
+ move || westend_staging_testnet_config_genesis ( wasm_binary ) ,
534
540
boot_nodes,
535
541
Some ( TelemetryEndpoints :: new ( vec ! [ ( WESTEND_STAGING_TELEMETRY_URL . to_string( ) , 0 ) ] )
536
542
. expect ( "Westend Staging telemetry url is valid; qed" ) ) ,
537
543
Some ( DEFAULT_PROTOCOL_ID ) ,
538
544
None ,
539
545
Default :: default ( ) ,
540
- )
546
+ ) )
541
547
}
542
548
543
549
/// Helper function to generate a crypto pair from seed
@@ -595,6 +601,7 @@ fn testnet_accounts() -> Vec<AccountId> {
595
601
596
602
/// Helper function to create polkadot GenesisConfig for testing
597
603
pub fn polkadot_testnet_genesis (
604
+ wasm_binary : & [ u8 ] ,
598
605
initial_authorities : Vec < ( AccountId , AccountId , BabeId , GrandpaId , ImOnlineId , ValidatorId , AuthorityDiscoveryId ) > ,
599
606
_root_key : AccountId ,
600
607
endowed_accounts : Option < Vec < AccountId > > ,
@@ -606,7 +613,7 @@ pub fn polkadot_testnet_genesis(
606
613
607
614
polkadot:: GenesisConfig {
608
615
system : Some ( polkadot:: SystemConfig {
609
- code : polkadot :: WASM_BINARY . to_vec ( ) ,
616
+ code : wasm_binary . to_vec ( ) ,
610
617
changes_trie_config : Default :: default ( ) ,
611
618
} ) ,
612
619
indices : Some ( polkadot:: IndicesConfig {
@@ -669,6 +676,7 @@ pub fn polkadot_testnet_genesis(
669
676
670
677
/// Helper function to create kusama GenesisConfig for testing
671
678
pub fn kusama_testnet_genesis (
679
+ wasm_binary : & [ u8 ] ,
672
680
initial_authorities : Vec < ( AccountId , AccountId , BabeId , GrandpaId , ImOnlineId , ValidatorId , AuthorityDiscoveryId ) > ,
673
681
_root_key : AccountId ,
674
682
endowed_accounts : Option < Vec < AccountId > > ,
@@ -680,7 +688,7 @@ pub fn kusama_testnet_genesis(
680
688
681
689
kusama:: GenesisConfig {
682
690
system : Some ( kusama:: SystemConfig {
683
- code : kusama :: WASM_BINARY . to_vec ( ) ,
691
+ code : wasm_binary . to_vec ( ) ,
684
692
changes_trie_config : Default :: default ( ) ,
685
693
} ) ,
686
694
indices : Some ( kusama:: IndicesConfig {
@@ -743,6 +751,7 @@ pub fn kusama_testnet_genesis(
743
751
744
752
/// Helper function to create polkadot GenesisConfig for testing
745
753
pub fn westend_testnet_genesis (
754
+ wasm_binary : & [ u8 ] ,
746
755
initial_authorities : Vec < ( AccountId , AccountId , BabeId , GrandpaId , ImOnlineId , ValidatorId , AuthorityDiscoveryId ) > ,
747
756
root_key : AccountId ,
748
757
endowed_accounts : Option < Vec < AccountId > > ,
@@ -754,7 +763,7 @@ pub fn westend_testnet_genesis(
754
763
755
764
westend:: GenesisConfig {
756
765
system : Some ( westend:: SystemConfig {
757
- code : westend :: WASM_BINARY . to_vec ( ) ,
766
+ code : wasm_binary . to_vec ( ) ,
758
767
changes_trie_config : Default :: default ( ) ,
759
768
} ) ,
760
769
indices : Some ( westend:: IndicesConfig {
@@ -803,8 +812,9 @@ pub fn westend_testnet_genesis(
803
812
}
804
813
}
805
814
806
- fn polkadot_development_config_genesis ( ) -> polkadot:: GenesisConfig {
815
+ fn polkadot_development_config_genesis ( wasm_binary : & [ u8 ] ) -> polkadot:: GenesisConfig {
807
816
polkadot_testnet_genesis (
817
+ wasm_binary,
808
818
vec ! [
809
819
get_authority_keys_from_seed( "Alice" ) ,
810
820
] ,
@@ -813,8 +823,9 @@ fn polkadot_development_config_genesis() -> polkadot::GenesisConfig {
813
823
)
814
824
}
815
825
816
- fn kusama_development_config_genesis ( ) -> kusama:: GenesisConfig {
826
+ fn kusama_development_config_genesis ( wasm_binary : & [ u8 ] ) -> kusama:: GenesisConfig {
817
827
kusama_testnet_genesis (
828
+ wasm_binary,
818
829
vec ! [
819
830
get_authority_keys_from_seed( "Alice" ) ,
820
831
] ,
@@ -823,8 +834,9 @@ fn kusama_development_config_genesis() -> kusama::GenesisConfig {
823
834
)
824
835
}
825
836
826
- fn westend_development_config_genesis ( ) -> westend:: GenesisConfig {
837
+ fn westend_development_config_genesis ( wasm_binary : & [ u8 ] ) -> westend:: GenesisConfig {
827
838
westend_testnet_genesis (
839
+ wasm_binary,
828
840
vec ! [
829
841
get_authority_keys_from_seed( "Alice" ) ,
830
842
] ,
@@ -834,52 +846,59 @@ fn westend_development_config_genesis() -> westend::GenesisConfig {
834
846
}
835
847
836
848
/// Polkadot development config (single validator Alice)
837
- pub fn polkadot_development_config ( ) -> PolkadotChainSpec {
838
- PolkadotChainSpec :: from_genesis (
849
+ pub fn polkadot_development_config ( ) -> Result < PolkadotChainSpec , String > {
850
+ let wasm_binary = polkadot:: WASM_BINARY . ok_or ( "Polkadot development wasm not available" ) ?;
851
+
852
+ Ok ( PolkadotChainSpec :: from_genesis (
839
853
"Development" ,
840
854
"dev" ,
841
855
ChainType :: Development ,
842
- polkadot_development_config_genesis,
856
+ move || polkadot_development_config_genesis ( wasm_binary ) ,
843
857
vec ! [ ] ,
844
858
None ,
845
859
Some ( DEFAULT_PROTOCOL_ID ) ,
846
860
None ,
847
861
Default :: default ( ) ,
848
- )
862
+ ) )
849
863
}
850
864
851
865
/// Kusama development config (single validator Alice)
852
- pub fn kusama_development_config ( ) -> KusamaChainSpec {
853
- KusamaChainSpec :: from_genesis (
866
+ pub fn kusama_development_config ( ) -> Result < KusamaChainSpec , String > {
867
+ let wasm_binary = kusama:: WASM_BINARY . ok_or ( "Kusama development wasm not available" ) ?;
868
+
869
+ Ok ( KusamaChainSpec :: from_genesis (
854
870
"Development" ,
855
871
"kusama_dev" ,
856
872
ChainType :: Development ,
857
- kusama_development_config_genesis,
873
+ move || kusama_development_config_genesis ( wasm_binary ) ,
858
874
vec ! [ ] ,
859
875
None ,
860
876
Some ( DEFAULT_PROTOCOL_ID ) ,
861
877
None ,
862
878
Default :: default ( ) ,
863
- )
879
+ ) )
864
880
}
865
881
866
882
/// Westend development config (single validator Alice)
867
- pub fn westend_development_config ( ) -> WestendChainSpec {
868
- WestendChainSpec :: from_genesis (
883
+ pub fn westend_development_config ( ) -> Result < WestendChainSpec , String > {
884
+ let wasm_binary = westend:: WASM_BINARY . ok_or ( "Westend development wasm not available" ) ?;
885
+
886
+ Ok ( WestendChainSpec :: from_genesis (
869
887
"Development" ,
870
888
"westend_dev" ,
871
889
ChainType :: Development ,
872
- westend_development_config_genesis,
890
+ move || westend_development_config_genesis ( wasm_binary ) ,
873
891
vec ! [ ] ,
874
892
None ,
875
893
Some ( DEFAULT_PROTOCOL_ID ) ,
876
894
None ,
877
895
Default :: default ( ) ,
878
- )
896
+ ) )
879
897
}
880
898
881
- fn polkadot_local_testnet_genesis ( ) -> polkadot:: GenesisConfig {
899
+ fn polkadot_local_testnet_genesis ( wasm_binary : & [ u8 ] ) -> polkadot:: GenesisConfig {
882
900
polkadot_testnet_genesis (
901
+ wasm_binary,
883
902
vec ! [
884
903
get_authority_keys_from_seed( "Alice" ) ,
885
904
get_authority_keys_from_seed( "Bob" ) ,
@@ -890,22 +909,25 @@ fn polkadot_local_testnet_genesis() -> polkadot::GenesisConfig {
890
909
}
891
910
892
911
/// Polkadot local testnet config (multivalidator Alice + Bob)
893
- pub fn polkadot_local_testnet_config ( ) -> PolkadotChainSpec {
894
- PolkadotChainSpec :: from_genesis (
912
+ pub fn polkadot_local_testnet_config ( ) -> Result < PolkadotChainSpec , String > {
913
+ let wasm_binary = polkadot:: WASM_BINARY . ok_or ( "Polkadot development wasm not available" ) ?;
914
+
915
+ Ok ( PolkadotChainSpec :: from_genesis (
895
916
"Local Testnet" ,
896
917
"local_testnet" ,
897
918
ChainType :: Local ,
898
- polkadot_local_testnet_genesis,
919
+ move || polkadot_local_testnet_genesis ( wasm_binary ) ,
899
920
vec ! [ ] ,
900
921
None ,
901
922
Some ( DEFAULT_PROTOCOL_ID ) ,
902
923
None ,
903
924
Default :: default ( ) ,
904
- )
925
+ ) )
905
926
}
906
927
907
- fn kusama_local_testnet_genesis ( ) -> kusama:: GenesisConfig {
928
+ fn kusama_local_testnet_genesis ( wasm_binary : & [ u8 ] ) -> kusama:: GenesisConfig {
908
929
kusama_testnet_genesis (
930
+ wasm_binary,
909
931
vec ! [
910
932
get_authority_keys_from_seed( "Alice" ) ,
911
933
get_authority_keys_from_seed( "Bob" ) ,
@@ -916,22 +938,25 @@ fn kusama_local_testnet_genesis() -> kusama::GenesisConfig {
916
938
}
917
939
918
940
/// Kusama local testnet config (multivalidator Alice + Bob)
919
- pub fn kusama_local_testnet_config ( ) -> KusamaChainSpec {
920
- KusamaChainSpec :: from_genesis (
941
+ pub fn kusama_local_testnet_config ( ) -> Result < KusamaChainSpec , String > {
942
+ let wasm_binary = kusama:: WASM_BINARY . ok_or ( "Kusama development wasm not available" ) ?;
943
+
944
+ Ok ( KusamaChainSpec :: from_genesis (
921
945
"Kusama Local Testnet" ,
922
946
"kusama_local_testnet" ,
923
947
ChainType :: Local ,
924
- kusama_local_testnet_genesis,
948
+ move || kusama_local_testnet_genesis ( wasm_binary ) ,
925
949
vec ! [ ] ,
926
950
None ,
927
951
Some ( DEFAULT_PROTOCOL_ID ) ,
928
952
None ,
929
953
Default :: default ( ) ,
930
- )
954
+ ) )
931
955
}
932
956
933
- fn westend_local_testnet_genesis ( ) -> westend:: GenesisConfig {
957
+ fn westend_local_testnet_genesis ( wasm_binary : & [ u8 ] ) -> westend:: GenesisConfig {
934
958
westend_testnet_genesis (
959
+ wasm_binary,
935
960
vec ! [
936
961
get_authority_keys_from_seed( "Alice" ) ,
937
962
get_authority_keys_from_seed( "Bob" ) ,
@@ -942,16 +967,18 @@ fn westend_local_testnet_genesis() -> westend::GenesisConfig {
942
967
}
943
968
944
969
/// Westend local testnet config (multivalidator Alice + Bob)
945
- pub fn westend_local_testnet_config ( ) -> WestendChainSpec {
946
- WestendChainSpec :: from_genesis (
970
+ pub fn westend_local_testnet_config ( ) -> Result < WestendChainSpec , String > {
971
+ let wasm_binary = westend:: WASM_BINARY . ok_or ( "Westend development wasm not available" ) ?;
972
+
973
+ Ok ( WestendChainSpec :: from_genesis (
947
974
"Westend Local Testnet" ,
948
975
"westend_local_testnet" ,
949
976
ChainType :: Local ,
950
- westend_local_testnet_genesis,
977
+ move || westend_local_testnet_genesis ( wasm_binary ) ,
951
978
vec ! [ ] ,
952
979
None ,
953
980
Some ( DEFAULT_PROTOCOL_ID ) ,
954
981
None ,
955
982
Default :: default ( ) ,
956
- )
983
+ ) )
957
984
}
0 commit comments