@@ -58,6 +58,66 @@ pub fn icefrog_testnet_config() -> Result<ChainSpec, String> {
58
58
ChainSpec :: from_json_bytes ( & include_bytes ! ( "../res/icefrog.json" ) [ ..] )
59
59
}
60
60
61
+ /// IceFrog testnet config generator
62
+ pub fn gen_icefrog_testnet_config ( ) -> ChainSpec {
63
+ fn icefrog_config_genesis ( ) -> GenesisConfig {
64
+ darwinia_genesis (
65
+ vec ! [
66
+ (
67
+ hex![ "be3fd892bf0e2b33dbfcf298c99a9f71e631a57af6c017dc5ac078c5d5b3494b" ] . into( ) , //stash
68
+ hex![ "70bf51d123581d6e51af70b342cac75ae0a0fc71d1a8d388719139af9c042b18" ] . into( ) ,
69
+ get_from_seed:: <GrandpaId >( "Alice" ) ,
70
+ get_from_seed:: <BabeId >( "Alice" ) ,
71
+ get_from_seed:: <ImOnlineId >( "Alice" ) ,
72
+ ) ,
73
+ (
74
+ hex![ "e2f560c01a2d8e98d313d6799185c28a39e10896332b56304ff46392f585024c" ] . into( ) , //stash
75
+ hex![ "94c51178449c09eec77918ea951fa3244f7b841eea1dd1489d2b5f2a53f8840f" ] . into( ) ,
76
+ get_from_seed:: <GrandpaId >( "Bob" ) ,
77
+ get_from_seed:: <BabeId >( "Bob" ) ,
78
+ get_from_seed:: <ImOnlineId >( "Bob" ) ,
79
+ ) ,
80
+ ] ,
81
+ hex ! [ "a60837b2782f7ffd23e95cd26d1aa8d493b8badc6636234ccd44db03c41fcc6c" ] . into ( ) ,
82
+ vec ! [
83
+ hex![ "a60837b2782f7ffd23e95cd26d1aa8d493b8badc6636234ccd44db03c41fcc6c" ] . into( ) ,
84
+ hex![ "f29311a581558ded67b8bfd097e614ce8135f777e29777d07ec501adb0ddab08" ] . into( ) ,
85
+ hex![ "1098e3bf7b351d6210c61b05edefb3a2b88c9611db26fbed2c7136b6d8f9c90f" ] . into( ) ,
86
+ hex![ "f252bc67e45acc9b3852a0ef84ddfce6c9cef25193617ef1421c460ecc2c746f" ] . into( ) ,
87
+ hex![ "90ce56f84328b180fc55146709aa7038c18efd58f1f247410be0b1ddc612df27" ] . into( ) ,
88
+ hex![ "4ca516c4b95488d0e6e9810a429a010b5716168d777c6b1399d3ed61cce1715c" ] . into( ) ,
89
+ hex![ "e28573bb4d9233c799defe8f85fa80a66b43d47f4c1aef64bb8fffde1ecf8606" ] . into( ) ,
90
+ hex![ "20e2455350cbe36631e82ce9b12152f98a3738cb763e46e65d1a253806a26d1a" ] . into( ) ,
91
+ hex![ "9eccaca8a35f0659aed4df45455a855bcb3e7bff7bfc9d672b676bbb78988f0d" ] . into( ) ,
92
+ hex![ "98dba2d3252825f4cd1141ca4f41ea201a22b4e129a6c7253cea546dbb20e442" ] . into( ) ,
93
+ ] ,
94
+ true ,
95
+ false ,
96
+ )
97
+ }
98
+
99
+ ChainSpec :: from_genesis (
100
+ "Darwinia IceFrog Testnet" ,
101
+ "icefrog_testnet" ,
102
+ icefrog_config_genesis,
103
+ vec ! [ ] ,
104
+ Some ( TelemetryEndpoints :: new ( vec ! [ ( STAGING_TELEMETRY_URL . to_string( ) , 0 ) ] ) ) ,
105
+ Some ( "DAR" ) ,
106
+ {
107
+ let mut properties = Properties :: new ( ) ;
108
+
109
+ properties. insert ( "ss58Format" . into ( ) , 42 . into ( ) ) ;
110
+ properties. insert ( "tokenDecimals" . into ( ) , 9 . into ( ) ) ;
111
+ properties. insert ( "tokenSymbol" . into ( ) , "IRING" . into ( ) ) ;
112
+ properties. insert ( "ktonTokenDecimals" . into ( ) , 9 . into ( ) ) ;
113
+ properties. insert ( "ktonTokenSymbol" . into ( ) , "IKTON" . into ( ) ) ;
114
+
115
+ Some ( properties)
116
+ } ,
117
+ Default :: default ( ) ,
118
+ )
119
+ }
120
+
61
121
fn session_keys ( grandpa : GrandpaId , babe : BabeId , im_online : ImOnlineId ) -> SessionKeys {
62
122
SessionKeys {
63
123
grandpa,
@@ -133,7 +193,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
133
193
134
194
let endowed_accounts: Vec < AccountId > = vec ! [ root_key. clone( ) ] ;
135
195
136
- darwinia_genesis ( initial_authorities, root_key, Some ( endowed_accounts) , false )
196
+ darwinia_genesis ( initial_authorities, root_key, endowed_accounts, false , true )
137
197
}
138
198
139
199
/// Staging testnet config.
@@ -177,33 +237,23 @@ pub fn get_authority_keys_from_seed(seed: &str) -> (AccountId, AccountId, Grandp
177
237
}
178
238
179
239
/// Helper function to create GenesisConfig for darwinia
240
+ /// is_testnet: under test net we will use Alice & Bob as seed to generate keys,
241
+ /// but in production enviroment, these accounts will use preset keys
180
242
pub fn darwinia_genesis (
181
243
initial_authorities : Vec < ( AccountId , AccountId , GrandpaId , BabeId , ImOnlineId ) > ,
182
244
root_key : AccountId ,
183
- endowed_accounts : Option < Vec < AccountId > > ,
245
+ endowed_accounts : Vec < AccountId > ,
184
246
enable_println : bool ,
247
+ is_testnet : bool ,
185
248
) -> GenesisConfig {
186
- let endowed_accounts : Vec < AccountId > = endowed_accounts . unwrap_or_else ( || {
249
+ let eth_relay_authorities : Vec < AccountId > = if is_testnet {
187
250
vec ! [
188
251
get_account_id_from_seed:: <sr25519:: Public >( "Alice" ) ,
189
252
get_account_id_from_seed:: <sr25519:: Public >( "Bob" ) ,
190
- get_account_id_from_seed:: <sr25519:: Public >( "Charlie" ) ,
191
- get_account_id_from_seed:: <sr25519:: Public >( "Dave" ) ,
192
- get_account_id_from_seed:: <sr25519:: Public >( "Eve" ) ,
193
- get_account_id_from_seed:: <sr25519:: Public >( "Ferdie" ) ,
194
- get_account_id_from_seed:: <sr25519:: Public >( "Alice//stash" ) ,
195
- get_account_id_from_seed:: <sr25519:: Public >( "Bob//stash" ) ,
196
- get_account_id_from_seed:: <sr25519:: Public >( "Charlie//stash" ) ,
197
- get_account_id_from_seed:: <sr25519:: Public >( "Dave//stash" ) ,
198
- get_account_id_from_seed:: <sr25519:: Public >( "Eve//stash" ) ,
199
- get_account_id_from_seed:: <sr25519:: Public >( "Ferdie//stash" ) ,
200
253
]
201
- } ) ;
202
-
203
- let eth_relay_authorities: Vec < AccountId > = vec ! [
204
- get_account_id_from_seed:: <sr25519:: Public >( "Alice" ) ,
205
- get_account_id_from_seed:: <sr25519:: Public >( "Bob" ) ,
206
- ] ;
254
+ } else {
255
+ vec ! [ initial_authorities[ 0 ] . clone( ) . 1 , initial_authorities[ 1 ] . clone( ) . 1 ]
256
+ } ;
207
257
208
258
const RING_ENDOWMENT : Balance = 20_000_000 * COIN ;
209
259
const KTON_ENDOWMENT : Balance = 10 * COIN ;
@@ -291,7 +341,21 @@ pub fn development_config() -> ChainSpec {
291
341
darwinia_genesis (
292
342
vec ! [ get_authority_keys_from_seed( "Alice" ) ] ,
293
343
get_account_id_from_seed :: < sr25519:: Public > ( "Alice" ) ,
294
- None ,
344
+ vec ! [
345
+ get_account_id_from_seed:: <sr25519:: Public >( "Alice" ) ,
346
+ get_account_id_from_seed:: <sr25519:: Public >( "Bob" ) ,
347
+ get_account_id_from_seed:: <sr25519:: Public >( "Charlie" ) ,
348
+ get_account_id_from_seed:: <sr25519:: Public >( "Dave" ) ,
349
+ get_account_id_from_seed:: <sr25519:: Public >( "Eve" ) ,
350
+ get_account_id_from_seed:: <sr25519:: Public >( "Ferdie" ) ,
351
+ get_account_id_from_seed:: <sr25519:: Public >( "Alice//stash" ) ,
352
+ get_account_id_from_seed:: <sr25519:: Public >( "Bob//stash" ) ,
353
+ get_account_id_from_seed:: <sr25519:: Public >( "Charlie//stash" ) ,
354
+ get_account_id_from_seed:: <sr25519:: Public >( "Dave//stash" ) ,
355
+ get_account_id_from_seed:: <sr25519:: Public >( "Eve//stash" ) ,
356
+ get_account_id_from_seed:: <sr25519:: Public >( "Ferdie//stash" ) ,
357
+ ] ,
358
+ true ,
295
359
true ,
296
360
)
297
361
}
@@ -317,7 +381,7 @@ pub fn local_testnet_config() -> ChainSpec {
317
381
get_authority_keys_from_seed( "Bob" ) ,
318
382
] ,
319
383
hex ! [ "a60837b2782f7ffd23e95cd26d1aa8d493b8badc6636234ccd44db03c41fcc6c" ] . into ( ) , // 5FpQFHfKd1xQ9HLZLQoG1JAQSCJoUEVBELnKsKNcuRLZejJR
320
- Some ( vec ! [
384
+ vec ! [
321
385
hex![ "a60837b2782f7ffd23e95cd26d1aa8d493b8badc6636234ccd44db03c41fcc6c" ] . into( ) ,
322
386
hex![ "f29311a581558ded67b8bfd097e614ce8135f777e29777d07ec501adb0ddab08" ] . into( ) ,
323
387
hex![ "1098e3bf7b351d6210c61b05edefb3a2b88c9611db26fbed2c7136b6d8f9c90f" ] . into( ) ,
@@ -328,7 +392,8 @@ pub fn local_testnet_config() -> ChainSpec {
328
392
hex![ "20e2455350cbe36631e82ce9b12152f98a3738cb763e46e65d1a253806a26d1a" ] . into( ) ,
329
393
hex![ "9eccaca8a35f0659aed4df45455a855bcb3e7bff7bfc9d672b676bbb78988f0d" ] . into( ) ,
330
394
hex![ "98dba2d3252825f4cd1141ca4f41ea201a22b4e129a6c7253cea546dbb20e442" ] . into( ) ,
331
- ] ) ,
395
+ ] ,
396
+ true ,
332
397
true ,
333
398
)
334
399
}
0 commit comments