@@ -27,10 +27,10 @@ use sp_arithmetic::{FixedU128, Percent};
2727use sp_authority_discovery:: AuthorityId as AuthorityDiscoveryId ;
2828use sp_consensus_babe:: AuthorityId as BabeId ;
2929use sp_consensus_beefy:: ecdsa_crypto:: AuthorityId as BeefyId ;
30- use sp_core:: { sr25519, storage:: Storage , Pair , Public } ;
30+ use sp_core:: { crypto :: get_public_from_string_or_panic , sr25519, storage:: Storage } ;
3131use sp_runtime:: { bounded_vec, BuildStorage , Perbill } ;
3232pub use xcm;
33- use xcm_emulator:: { helpers :: get_account_id_from_seed , Chain , Parachain } ;
33+ use xcm_emulator:: { Chain , Parachain } ;
3434
3535pub const XCM_V2 : u32 = 3 ;
3636pub const XCM_V3 : u32 = 2 ;
@@ -60,11 +60,6 @@ fn polimec_inflation_config() -> polimec_runtime::pallet_parachain_staking::Infl
6060 }
6161}
6262
63- /// Helper function to generate a crypto pair from seed
64- fn get_from_seed < TPublic : Public > ( seed : & str ) -> <TPublic :: Pair as Pair >:: Public {
65- TPublic :: Pair :: from_string ( & format ! ( "//{}" , seed) , None ) . expect ( "static values are valid; qed" ) . public ( )
66- }
67-
6863pub struct Prices {
6964 pub dot : FixedU128 ,
7065 pub usdc : FixedU128 ,
@@ -153,20 +148,7 @@ pub mod accounts {
153148 pub const FERDIE_STASH : & str = "Ferdie//stash" ;
154149
155150 pub fn init_balances ( ) -> Vec < AccountId > {
156- vec ! [
157- get_account_id_from_seed:: <sr25519:: Public >( ALICE ) ,
158- get_account_id_from_seed:: <sr25519:: Public >( BOB ) ,
159- get_account_id_from_seed:: <sr25519:: Public >( CHARLIE ) ,
160- get_account_id_from_seed:: <sr25519:: Public >( DAVE ) ,
161- get_account_id_from_seed:: <sr25519:: Public >( EVE ) ,
162- get_account_id_from_seed:: <sr25519:: Public >( FERDIE ) ,
163- get_account_id_from_seed:: <sr25519:: Public >( ALICE_STASH ) ,
164- get_account_id_from_seed:: <sr25519:: Public >( BOB_STASH ) ,
165- get_account_id_from_seed:: <sr25519:: Public >( CHARLIE_STASH ) ,
166- get_account_id_from_seed:: <sr25519:: Public >( DAVE_STASH ) ,
167- get_account_id_from_seed:: <sr25519:: Public >( EVE_STASH ) ,
168- get_account_id_from_seed:: <sr25519:: Public >( FERDIE_STASH ) ,
169- ]
151+ sp_keyring:: AccountKeyring :: iter ( ) . map ( |a| a. to_account_id ( ) ) . collect ( )
170152 }
171153}
172154
@@ -175,22 +157,34 @@ pub mod collators {
175157
176158 pub fn invulnerables_asset_hub ( ) -> Vec < ( AccountId , AssetHubPolkadotAuraId ) > {
177159 vec ! [
178- ( get_account_id_from_seed:: <sr25519:: Public >( "Alice" ) , get_from_seed:: <AssetHubPolkadotAuraId >( "Alice" ) ) ,
179- ( get_account_id_from_seed:: <sr25519:: Public >( "Bob" ) , get_from_seed:: <AssetHubPolkadotAuraId >( "Bob" ) ) ,
160+ (
161+ sp_keyring:: AccountKeyring :: Alice . to_account_id( ) ,
162+ get_public_from_string_or_panic:: <AssetHubPolkadotAuraId >( "Alice" ) ,
163+ ) ,
164+ (
165+ sp_keyring:: AccountKeyring :: Bob . to_account_id( ) ,
166+ get_public_from_string_or_panic:: <AssetHubPolkadotAuraId >( "Bob" ) ,
167+ ) ,
180168 ]
181169 }
182170
183171 pub fn invulnerables ( ) -> Vec < ( AccountId , AuraId ) > {
184172 vec ! [
185- ( get_account_id_from_seed :: <sr25519 :: Public > ( " Alice" ) , get_from_seed :: <AuraId >( "Alice" ) ) ,
186- ( get_account_id_from_seed :: <sr25519 :: Public > ( " Bob" ) , get_from_seed :: <AuraId >( "Bob" ) ) ,
173+ ( sp_keyring :: AccountKeyring :: Alice . to_account_id ( ) , get_public_from_string_or_panic :: <AuraId >( "Alice" ) ) ,
174+ ( sp_keyring :: AccountKeyring :: Bob . to_account_id ( ) , get_public_from_string_or_panic :: <AuraId >( "Bob" ) ) ,
187175 ]
188176 }
189177
190178 pub fn initial_authorities ( ) -> Vec < ( AccountId , AuraId ) > {
191179 vec ! [
192- ( get_account_id_from_seed:: <sr25519:: Public >( "COLL_1" ) , get_from_seed:: <AuraId >( "COLL_1" ) ) ,
193- ( get_account_id_from_seed:: <sr25519:: Public >( "COLL_2" ) , get_from_seed:: <AuraId >( "COLL_2" ) ) ,
180+ (
181+ get_public_from_string_or_panic:: <sr25519:: Public >( "COLL_1" ) . into( ) ,
182+ get_public_from_string_or_panic:: <AuraId >( "COLL_1" ) ,
183+ ) ,
184+ (
185+ get_public_from_string_or_panic:: <sr25519:: Public >( "COLL_2" ) . into( ) ,
186+ get_public_from_string_or_panic:: <AuraId >( "COLL_2" ) ,
187+ ) ,
194188 ]
195189 }
196190}
@@ -212,15 +206,15 @@ pub mod validators {
212206 ) > {
213207 let seed = "Alice" ;
214208 vec ! [ (
215- get_account_id_from_seed :: <sr25519 :: Public > ( & format! ( "{}//stash" , seed ) ) ,
216- get_account_id_from_seed :: <sr25519 :: Public > ( seed ) ,
217- get_from_seed :: <BabeId >( seed) ,
218- get_from_seed :: <GrandpaId >( seed) ,
219- get_from_seed :: <ImOnlineId >( seed) ,
220- get_from_seed :: <ValidatorId >( seed) ,
221- get_from_seed :: <AssignmentId >( seed) ,
222- get_from_seed :: <AuthorityDiscoveryId >( seed) ,
223- get_from_seed :: <BeefyId >( seed) ,
209+ sp_keyring :: AccountKeyring :: AliceStash . to_account_id ( ) ,
210+ sp_keyring :: AccountKeyring :: Alice . to_account_id ( ) ,
211+ get_public_from_string_or_panic :: <BabeId >( seed) ,
212+ get_public_from_string_or_panic :: <GrandpaId >( seed) ,
213+ get_public_from_string_or_panic :: <ImOnlineId >( seed) ,
214+ get_public_from_string_or_panic :: <ValidatorId >( seed) ,
215+ get_public_from_string_or_panic :: <AssignmentId >( seed) ,
216+ get_public_from_string_or_panic :: <AuthorityDiscoveryId >( seed) ,
217+ get_public_from_string_or_panic :: <BeefyId >( seed) ,
224218 ) ]
225219 }
226220}
@@ -282,6 +276,7 @@ pub mod polkadot {
282276 )
283277 } )
284278 . collect :: < Vec < _ > > ( ) ,
279+ ..Default :: default ( )
285280 } ,
286281 babe : rococo_runtime:: BabeConfig {
287282 authorities : Default :: default ( ) ,
@@ -358,8 +353,9 @@ pub mod polimec {
358353 let usdc_asset_id = AcceptedFundingAsset :: USDC . id ( ) ;
359354 let eth_asset_id = AcceptedFundingAsset :: ETH . id ( ) ;
360355
356+ let ah_location: Location = ( Parent , xcm:: v4:: Junction :: Parachain ( 1000 ) ) . into ( ) ;
361357 let mut funded_accounts = vec ! [ (
362- PolimecNet :: sovereign_account_id_of( ( Parent , xcm :: prelude :: Parachain ( 1000 ) ) . into ( ) ) ,
358+ PolimecNet :: sovereign_account_id_of( ah_location . try_into ( ) . expect ( "convertible; qed" ) ) ,
363359 INITIAL_DEPOSIT ,
364360 ) ] ;
365361 let alice_account = PolimecNet :: account_id_of ( accounts:: ALICE ) ;
@@ -393,6 +389,7 @@ pub mod polimec {
393389 ( eth_asset_id, "Local ETH" . as_bytes( ) . to_vec( ) , "ETH" . as_bytes( ) . to_vec( ) , 18 ) ,
394390 ] ,
395391 accounts : vec ! [ ] ,
392+ next_asset_id : None ,
396393 } ,
397394 parachain_info : polimec_runtime:: ParachainInfoConfig { parachain_id : PARA_ID . into ( ) , ..Default :: default ( ) } ,
398395 session : polimec_runtime:: SessionConfig {
@@ -406,6 +403,7 @@ pub mod polimec {
406403 )
407404 } )
408405 . collect ( ) ,
406+ ..Default :: default ( )
409407 } ,
410408 aura : Default :: default ( ) ,
411409 aura_ext : Default :: default ( ) ,
0 commit comments