@@ -241,25 +241,49 @@ def deploy_neofs_contract(self):
241241                "There should be at least a single IR instance configured(not started) to deploy neofs contract" 
242242            )
243243        neo_go  =  self .neo_go ()
244+         neo_go .nep17 .balance (
245+             self .main_chain .wallet .address ,
246+             "GAS" ,
247+             f"http://{ self .main_chain .rpc_address }  ,
248+             wallet_config = self .main_chain .neo_go_config ,
249+         )
244250        neo_go .nep17 .transfer (
245251            "GAS" ,
246252            self .default_wallet .address ,
247253            f"http://{ self .main_chain .rpc_address }  ,
248-             from_address = self .inner_ring_nodes [ - 1 ]. alphabet_wallet .address ,
254+             from_address = self .main_chain . wallet .address ,
249255            amount = 9000 ,
250256            force = True ,
251257            wallet_config = self .main_chain .neo_go_config ,
252258            await_ = True ,
253259        )
254-         ir_alphabet_pubkey_from_neogo  =  wallet_utils .get_last_public_key_from_wallet_with_neogo (
255-             self .neo_go (), self .inner_ring_nodes [- 1 ].alphabet_wallet .path 
260+ 
261+         for  ir_node  in  self .inner_ring_nodes :
262+             accounts  =  wallet_utils .get_accounts_from_wallet (ir_node .alphabet_wallet .path , self .default_password )
263+             for  acc  in  accounts :
264+                 neo_go .nep17 .transfer (
265+                     "GAS" ,
266+                     acc .address ,
267+                     f"http://{ self .main_chain .rpc_address }  ,
268+                     from_address = self .main_chain .wallet .address ,
269+                     amount = 9000 ,
270+                     force = True ,
271+                     wallet_config = self .main_chain .neo_go_config ,
272+                     await_ = True ,
273+                 )
274+ 
275+         pub_keys_of_existing_ir_nodes  =  " " .join (
276+             wallet_utils .get_last_public_key_from_wallet_with_neogo (
277+                 self .neo_go (),
278+                 ir_node .alphabet_wallet .path ,
279+             ).splitlines ()
256280        )
257281        result  =  neo_go .contract .deploy (
258282            input_file = f"{ self .neofs_contract_dir }  ,
259283            manifest = f"{ self .neofs_contract_dir }  ,
260284            force = True ,
261285            rpc_endpoint = f"http://{ self .main_chain .rpc_address }  ,
262-             post_data = f"[ true ffffffffffffffffffffffffffffffffffffffff [ { ir_alphabet_pubkey_from_neogo }  ,
286+             post_data = f"[ true ffffffffffffffffffffffffffffffffffffffff [ { pub_keys_of_existing_ir_nodes }  ,
263287            wallet_config = self .default_wallet_neogo_config ,
264288        )
265289        contract_hash  =  result .stdout .split ("Contract: " )[- 1 ].strip ()
@@ -306,34 +330,34 @@ def generate_storage_wallet(
306330
307331    @allure .step ("Generate alphabet wallets" ) 
308332    def  generate_alphabet_wallets (
309-         self ,
310-         network_config : Optional [str ] =  None ,
311-         size : Optional [int ] =  1 ,
333+         self , network_config : Optional [str ] =  None , size : Optional [int ] =  1 , alphabet_wallets_dir : Optional [str ] =  None 
312334    ) ->  list [NodeWallet ]:
313335        neofs_adm  =  self .neofs_adm (network_config )
314336
315-         neofs_adm .fschain .generate_alphabet (alphabet_wallets = self .alphabet_wallets_dir , size = size )
337+         if  not  alphabet_wallets_dir :
338+             alphabet_wallets_dir  =  self .alphabet_wallets_dir 
339+         neofs_adm .fschain .generate_alphabet (alphabet_wallets = alphabet_wallets_dir , size = size )
316340
317341        generated_wallets  =  []
318342
319-         for  generated_wallet  in  os .listdir (self . alphabet_wallets_dir ):
343+         for  generated_wallet  in  os .listdir (alphabet_wallets_dir ):
320344            # neo3 package requires some attributes to be set 
321-             with  open (os .path .join (self . alphabet_wallets_dir , generated_wallet ), "r" ) as  wallet_file :
345+             with  open (os .path .join (alphabet_wallets_dir , generated_wallet ), "r" ) as  wallet_file :
322346                wallet_json  =  json .load (wallet_file )
323347
324348            wallet_json ["name" ] =  None 
325349            for  acc  in  wallet_json ["accounts" ]:
326350                acc ["extra" ] =  None 
327351
328-             with  open (os .path .join (self . alphabet_wallets_dir , generated_wallet ), "w" ) as  wallet_file :
352+             with  open (os .path .join (alphabet_wallets_dir , generated_wallet ), "w" ) as  wallet_file :
329353                json .dump (wallet_json , wallet_file )
330354
331355            generated_wallets .append (
332356                NodeWallet (
333-                     path = os .path .join (self . alphabet_wallets_dir , generated_wallet ),
357+                     path = os .path .join (alphabet_wallets_dir , generated_wallet ),
334358                    password = self .default_password ,
335359                    address = wallet_utils .get_last_address_from_wallet (
336-                         os .path .join (self . alphabet_wallets_dir , generated_wallet ), self .default_password 
360+                         os .path .join (alphabet_wallets_dir , generated_wallet ), self .default_password 
337361                    ),
338362                )
339363            )
@@ -686,6 +710,8 @@ def __init__(self, neofs_env: NeoFSEnv):
686710        self .p2p_address  =  f"{ self .neofs_env .domain } { NeoFSEnv .get_available_port ()}  
687711        self .pprof_address  =  f"{ self .neofs_env .domain } { NeoFSEnv .get_available_port ()}  
688712        self .prometheus_address  =  f"{ self .neofs_env .domain } { NeoFSEnv .get_available_port ()}  
713+         self .wallet_dir  =  self .neofs_env ._generate_temp_dir (prefix = "mainchain_wallet" )
714+         self .wallet  =  None 
689715        self .stdout  =  "Not initialized" 
690716        self .stderr  =  "Not initialized" 
691717        self .process  =  None 
@@ -715,21 +741,31 @@ def start(self, wait_until_ready=True):
715741        if  self .process  is  not None :
716742            raise  RuntimeError ("This main chain instance has already been started" )
717743
718-         alphabet_wallet  =  self .neofs_env .inner_ring_nodes [- 1 ].alphabet_wallet 
744+         self .wallet  =  self .neofs_env .generate_alphabet_wallets (alphabet_wallets_dir = self .wallet_dir )[0 ]
745+ 
746+         standby_committee  =  wallet_utils .get_last_public_key_from_wallet_with_neogo (
747+             self .neofs_env .neo_go (), self .wallet .path 
748+         )
719749
720750        ir_alphabet_pubkey_from_neogo  =  wallet_utils .get_last_public_key_from_wallet_with_neogo (
721-             self .neofs_env .neo_go (), alphabet_wallet .path 
751+             self .neofs_env .neo_go (), self . neofs_env . inner_ring_nodes [ - 1 ]. alphabet_wallet .path 
722752        )
723753
754+         if  len (self .neofs_env .inner_ring_nodes ) >  1 :
755+             ir_public_keys  =  ir_alphabet_pubkey_from_neogo .splitlines ()
756+         else :
757+             ir_public_keys  =  [ir_alphabet_pubkey_from_neogo ]
758+ 
724759        logger .info (f"Generating main chain config at: { self .main_chain_config_path }  )
725760        main_chain_config_template  =  "main_chain.yaml" 
726761
727762        NeoFSEnv .generate_config_file (
728763            config_template = main_chain_config_template ,
729764            config_path = self .main_chain_config_path ,
730765            custom = Path (main_chain_config_template ).is_file (),
731-             wallet = alphabet_wallet ,
732-             public_key = ir_alphabet_pubkey_from_neogo ,
766+             wallet = self .wallet ,
767+             standby_committee = standby_committee ,
768+             ir_public_keys = ir_public_keys ,
733769            main_chain_boltdb = self .main_chain_boltdb ,
734770            p2p_address = self .p2p_address ,
735771            rpc_address = self .rpc_address ,
@@ -738,12 +774,10 @@ def start(self, wait_until_ready=True):
738774            prometheus_address = self .prometheus_address ,
739775        )
740776        logger .info (f"Generating CLI config at: { self .cli_config }  )
741-         NeoFSEnv .generate_config_file (
742-             config_template = "cli_cfg.yaml" , config_path = self .cli_config , wallet = alphabet_wallet 
743-         )
777+         NeoFSEnv .generate_config_file (config_template = "cli_cfg.yaml" , config_path = self .cli_config , wallet = self .wallet )
744778        logger .info (f"Generating NEO GO config at: { self .neo_go_config }  )
745779        NeoFSEnv .generate_config_file (
746-             config_template = "neo_go_cfg.yaml" , config_path = self .neo_go_config , wallet = alphabet_wallet 
780+             config_template = "neo_go_cfg.yaml" , config_path = self .neo_go_config , wallet = self . wallet 
747781        )
748782        logger .info (f"Launching Main Chain:{ self }  )
749783        self ._launch_process ()
@@ -839,18 +873,31 @@ def generate_cli_config(self):
839873        )
840874
841875    @allure .step ("Start Inner Ring node" ) 
842-     def  start (self , wait_until_ready = True , with_main_chain = False ):
876+     def  start (
877+         self ,
878+         wait_until_ready = True ,
879+         with_main_chain = False ,
880+         pub_keys_of_existing_ir_nodes = None ,
881+         seed_node_addresses_of_existing_ir_nodes = None ,
882+         fschain_autodeploy = True ,
883+     ):
843884        if  self .process  is  not None :
844885            raise  RuntimeError ("This inner ring node instance has already been started" )
845886        logger .info (f"Generating IR config at: { self .ir_node_config_path }  )
846887        ir_config_template  =  "ir.yaml" 
847888
848-         pub_keys_of_existing_ir_nodes  =  [
849-             wallet_utils .get_last_public_key_from_wallet (ir_node .alphabet_wallet .path , ir_node .alphabet_wallet .password )
850-             for  ir_node  in  self .neofs_env .inner_ring_nodes 
851-         ]
889+         if  not  pub_keys_of_existing_ir_nodes :
890+             pub_keys_of_existing_ir_nodes  =  [
891+                 wallet_utils .get_last_public_key_from_wallet (
892+                     ir_node .alphabet_wallet .path , ir_node .alphabet_wallet .password 
893+                 )
894+                 for  ir_node  in  self .neofs_env .inner_ring_nodes 
895+             ]
852896
853-         seed_node_addresses_of_existing_ir_nodes  =  [ir_node .p2p_address  for  ir_node  in  self .neofs_env .inner_ring_nodes ]
897+         if  not  seed_node_addresses_of_existing_ir_nodes :
898+             seed_node_addresses_of_existing_ir_nodes  =  [
899+                 ir_node .p2p_address  for  ir_node  in  self .neofs_env .inner_ring_nodes 
900+             ]
854901
855902        NeoFSEnv .generate_config_file (
856903            config_template = ir_config_template ,
@@ -868,6 +915,7 @@ def start(self, wait_until_ready=True, with_main_chain=False):
868915                len (self .neofs_env .inner_ring_nodes ) -  (len (self .neofs_env .inner_ring_nodes ) -  1 ) /  3  -  1 
869916            ),
870917            set_roles_in_genesis = str (False  if  len (self .neofs_env .inner_ring_nodes ) ==  1  else  True ).lower (),
918+             fschain_autodeploy = fschain_autodeploy ,
871919            control_public_key = wallet_utils .get_last_public_key_from_wallet (
872920                self .alphabet_wallet .path , self .alphabet_wallet .password 
873921            ),
0 commit comments