Skip to content

Commit 9ad90b8

Browse files
Change deploy num local nodes flags (#2386)
* change deploy flags * use constants * fix lint --------- Signed-off-by: sukantoraymond <rsukanto@umich.edu>
1 parent 5d715b8 commit 9ad90b8

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

cmd/blockchaincmd/deploy.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ so you can take your locally tested Subnet and deploy it on Fuji or Mainnet.`,
191191
cmd.Flags().StringSliceVar(&aggregatorExtraEndpoints, "aggregator-extra-endpoints", nil, "endpoints for extra nodes that are needed in signature aggregation")
192192
cmd.Flags().BoolVar(&useLocalMachine, "use-local-machine", false, "use local machine as a blockchain validator")
193193
cmd.Flags().IntVar(&numBootstrapValidators, "num-bootstrap-validators", 0, "(only if --generate-node-id is true) number of bootstrap validators to set up in sovereign L1 validator)")
194-
cmd.Flags().IntVar(&numLocalNodes, "num-local-nodes", 1, "number of nodes to be created on local machine")
194+
cmd.Flags().IntVar(&numLocalNodes, "num-local-nodes", 0, "number of nodes to be created on local machine")
195195
cmd.Flags().StringVar(&changeOwnerAddress, "change-owner-address", "", "address that will receive change if node is no longer L1 validator")
196196

197197
cmd.Flags().Uint64Var(&poSMinimumStakeAmount, "pos-minimum-stake-amount", 1, "minimum stake amount")
@@ -625,6 +625,9 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
625625
network = models.ConvertClusterToNetwork(network)
626626
}
627627
}
628+
if numLocalNodes > 0 {
629+
useLocalMachine = true
630+
}
628631
// ask user if we want to use local machine if cluster is not provided
629632
if network.Kind != models.Local && !useLocalMachine && clusterNameFlagValue == "" {
630633
ux.Logger.PrintToUser("You can use your local machine as a bootstrap validator on the blockchain")
@@ -635,6 +638,11 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
635638
return err
636639
}
637640
}
641+
// default number of local machine nodes to be 1
642+
// we set it here instead of at flag level so that we don't prompt if user wants to use local machine when they set numLocalNodes flag value
643+
if useLocalMachine && numLocalNodes == 0 {
644+
numLocalNodes = constants.DefaultNumberOfLocalMachineNodes
645+
}
638646
// if no cluster provided - we create one with fmt.Sprintf("%s-local-node", blockchainName) name
639647
if useLocalMachine && clusterNameFlagValue == "" {
640648
// stop local avalanchego process so that we can generate new local cluster

pkg/constants/constants.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,17 @@ const (
335335
PluginDir = "plugins"
336336
LocalDir = "local"
337337

338-
MetricsNetwork = "network"
339-
MultiSig = "multi-sig"
340-
SkipUpdateFlag = "skip-update-check"
341-
LastFileName = ".last_actions.json"
342-
APIRole = "API"
343-
ValidatorRole = "Validator"
344-
MonitorRole = "Monitor"
345-
ICMRelayerRole = "Relayer"
346-
LoadTestRole = "LoadTest"
347-
DefaultWalletCreationTimeout = 5 * time.Second
338+
DefaultNumberOfLocalMachineNodes = 1
339+
MetricsNetwork = "network"
340+
MultiSig = "multi-sig"
341+
SkipUpdateFlag = "skip-update-check"
342+
LastFileName = ".last_actions.json"
343+
APIRole = "API"
344+
ValidatorRole = "Validator"
345+
MonitorRole = "Monitor"
346+
ICMRelayerRole = "Relayer"
347+
LoadTestRole = "LoadTest"
348+
DefaultWalletCreationTimeout = 5 * time.Second
348349

349350
DefaultConfirmTxTimeout = 20 * time.Second
350351

tests/e2e/testcases/subnet/sov/etna/suite.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ func deployEtnaSubnetEtnaFlag() {
102102
"deploy",
103103
subnetName,
104104
"--etna-devnet",
105-
"--use-local-machine",
106105
"--num-local-nodes=1",
107106
"--ewoq",
108107
"--change-owner-address",
@@ -131,7 +130,6 @@ func deployEtnaSubnetEtnaFlagConvertOnly() {
131130
"deploy",
132131
subnetName,
133132
"--etna-devnet",
134-
"--use-local-machine",
135133
"--num-local-nodes=1",
136134
"--convert-only",
137135
"--ewoq",

tests/e2e/testcases/validatormanager/suite.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ func createSovereignSubnet() (string, string, error) {
8383
"deploy",
8484
subnetName,
8585
"--etna-devnet",
86-
"--use-local-machine",
8786
"--num-local-nodes=1",
8887
"--ewoq",
8988
"--convert-only",

0 commit comments

Comments
 (0)