@@ -481,7 +481,7 @@ func convertBlockchain(_ *cobra.Command, args []string) error {
481
481
globalNetworkFlags ,
482
482
true ,
483
483
false ,
484
- networkoptions .DefaultSupportedNetworkOptions ,
484
+ networkoptions .GetNetworkFromSidecar ( sidecar , networkoptions . DefaultSupportedNetworkOptions ) ,
485
485
"" ,
486
486
)
487
487
if err != nil {
@@ -492,21 +492,24 @@ func convertBlockchain(_ *cobra.Command, args []string) error {
492
492
subnetID := sidecar .Networks [network .Name ()].SubnetID
493
493
blockchainID := sidecar .Networks [network .Name ()].BlockchainID
494
494
495
- if validatorManagerAddress == "" {
496
- validatorManagerAddressAddrFmt , err := app .Prompt .CaptureAddress ("What is the address of the Validator Manager?" )
497
- if err != nil {
495
+ if ! convertOnly {
496
+ if validatorManagerAddress == "" {
497
+ validatorManagerAddressAddrFmt , err := app .Prompt .CaptureAddress ("What is the address of the Validator Manager?" )
498
+ if err != nil {
499
+ return err
500
+ }
501
+ validatorManagerAddress = validatorManagerAddressAddrFmt .String ()
502
+ }
503
+
504
+ if err = promptValidatorManagementType (app , & sidecar ); err != nil {
498
505
return err
499
506
}
500
- validatorManagerAddress = validatorManagerAddressAddrFmt .String ()
507
+ if err := setSidecarValidatorManageOwner (& sidecar , createFlags ); err != nil {
508
+ return err
509
+ }
510
+ sidecar .UpdateValidatorManagerAddress (network .Name (), validatorManagerAddress )
501
511
}
502
512
503
- if err = promptValidatorManagementType (app , & sidecar ); err != nil {
504
- return err
505
- }
506
- if err := setSidecarValidatorManageOwner (& sidecar , createFlags ); err != nil {
507
- return err
508
- }
509
- sidecar .UpdateValidatorManagerAddress (network .Name (), validatorManagerAddress )
510
513
sidecar .Sovereign = true
511
514
fee := uint64 (0 )
512
515
@@ -531,63 +534,65 @@ func convertBlockchain(_ *cobra.Command, args []string) error {
531
534
532
535
deployBalance := uint64 (deployBalanceAVAX * float64 (units .Avax ))
533
536
534
- if changeOwnerAddress == "" {
535
- // use provided key as change owner unless already set
536
- if pAddr , err := kc .PChainFormattedStrAddresses (); err == nil && len (pAddr ) > 0 {
537
- changeOwnerAddress = pAddr [0 ]
538
- ux .Logger .PrintToUser ("Using [%s] to be set as a change owner for leftover AVAX" , changeOwnerAddress )
539
- }
540
- }
541
- if ! generateNodeID {
542
- if err = StartLocalMachine (network , sidecar , blockchainName , deployBalance , availableBalance ); err != nil {
543
- return err
544
- }
545
- }
546
- switch {
547
- case len (bootstrapEndpoints ) > 0 :
537
+ if len (bootstrapValidators ) == 0 {
548
538
if changeOwnerAddress == "" {
549
- changeOwnerAddress , err = blockchain .GetKeyForChangeOwner (app , network )
550
- if err != nil {
551
- return err
539
+ // use provided key as change owner unless already set
540
+ if pAddr , err := kc .PChainFormattedStrAddresses (); err == nil && len (pAddr ) > 0 {
541
+ changeOwnerAddress = pAddr [0 ]
542
+ ux .Logger .PrintToUser ("Using [%s] to be set as a change owner for leftover AVAX" , changeOwnerAddress )
552
543
}
553
544
}
554
- for _ , endpoint := range bootstrapEndpoints {
555
- infoClient := info .NewClient (endpoint )
556
- ctx , cancel := utils .GetAPILargeContext ()
557
- defer cancel ()
558
- nodeID , proofOfPossession , err := infoClient .GetNodeID (ctx )
559
- if err != nil {
545
+ if ! generateNodeID {
546
+ if err = StartLocalMachine (network , sidecar , blockchainName , deployBalance , availableBalance ); err != nil {
560
547
return err
561
548
}
562
- publicKey = "0x" + hex .EncodeToString (proofOfPossession .PublicKey [:])
563
- pop = "0x" + hex .EncodeToString (proofOfPossession .ProofOfPossession [:])
564
-
565
- bootstrapValidators = append (bootstrapValidators , models.SubnetValidator {
566
- NodeID : nodeID .String (),
567
- Weight : constants .BootstrapValidatorWeight ,
568
- Balance : deployBalance ,
569
- BLSPublicKey : publicKey ,
570
- BLSProofOfPossession : pop ,
571
- ChangeOwnerAddr : changeOwnerAddress ,
572
- })
573
- }
574
- case clusterNameFlagValue != "" :
575
- // for remote clusters we don't need to ask for bootstrap validators and can read it from filesystem
576
- bootstrapValidators , err = getClusterBootstrapValidators (clusterNameFlagValue , network , deployBalance )
577
- if err != nil {
578
- return fmt .Errorf ("error getting bootstrap validators from cluster %s: %w" , clusterNameFlagValue , err )
579
549
}
550
+ switch {
551
+ case len (bootstrapEndpoints ) > 0 :
552
+ if changeOwnerAddress == "" {
553
+ changeOwnerAddress , err = blockchain .GetKeyForChangeOwner (app , network )
554
+ if err != nil {
555
+ return err
556
+ }
557
+ }
558
+ for _ , endpoint := range bootstrapEndpoints {
559
+ infoClient := info .NewClient (endpoint )
560
+ ctx , cancel := utils .GetAPILargeContext ()
561
+ defer cancel ()
562
+ nodeID , proofOfPossession , err := infoClient .GetNodeID (ctx )
563
+ if err != nil {
564
+ return err
565
+ }
566
+ publicKey = "0x" + hex .EncodeToString (proofOfPossession .PublicKey [:])
567
+ pop = "0x" + hex .EncodeToString (proofOfPossession .ProofOfPossession [:])
568
+
569
+ bootstrapValidators = append (bootstrapValidators , models.SubnetValidator {
570
+ NodeID : nodeID .String (),
571
+ Weight : constants .BootstrapValidatorWeight ,
572
+ Balance : deployBalance ,
573
+ BLSPublicKey : publicKey ,
574
+ BLSProofOfPossession : pop ,
575
+ ChangeOwnerAddr : changeOwnerAddress ,
576
+ })
577
+ }
578
+ case clusterNameFlagValue != "" :
579
+ // for remote clusters we don't need to ask for bootstrap validators and can read it from filesystem
580
+ bootstrapValidators , err = getClusterBootstrapValidators (clusterNameFlagValue , network , deployBalance )
581
+ if err != nil {
582
+ return fmt .Errorf ("error getting bootstrap validators from cluster %s: %w" , clusterNameFlagValue , err )
583
+ }
580
584
581
- default :
582
- bootstrapValidators , err = promptBootstrapValidators (
583
- network ,
584
- changeOwnerAddress ,
585
- numBootstrapValidators ,
586
- deployBalance ,
587
- availableBalance ,
588
- )
589
- if err != nil {
590
- return err
585
+ default :
586
+ bootstrapValidators , err = promptBootstrapValidators (
587
+ network ,
588
+ changeOwnerAddress ,
589
+ numBootstrapValidators ,
590
+ deployBalance ,
591
+ availableBalance ,
592
+ )
593
+ if err != nil {
594
+ return err
595
+ }
591
596
}
592
597
}
593
598
0 commit comments