Skip to content

Commit

Permalink
Change deploy num local nodes flags (#2386)
Browse files Browse the repository at this point in the history
* change deploy flags

* use constants

* fix lint

---------

Signed-off-by: sukantoraymond <[email protected]>
  • Loading branch information
sukantoraymond authored Dec 3, 2024
1 parent 5d715b8 commit 9ad90b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
10 changes: 9 additions & 1 deletion cmd/blockchaincmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ so you can take your locally tested Subnet and deploy it on Fuji or Mainnet.`,
cmd.Flags().StringSliceVar(&aggregatorExtraEndpoints, "aggregator-extra-endpoints", nil, "endpoints for extra nodes that are needed in signature aggregation")
cmd.Flags().BoolVar(&useLocalMachine, "use-local-machine", false, "use local machine as a blockchain validator")
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)")
cmd.Flags().IntVar(&numLocalNodes, "num-local-nodes", 1, "number of nodes to be created on local machine")
cmd.Flags().IntVar(&numLocalNodes, "num-local-nodes", 0, "number of nodes to be created on local machine")
cmd.Flags().StringVar(&changeOwnerAddress, "change-owner-address", "", "address that will receive change if node is no longer L1 validator")

cmd.Flags().Uint64Var(&poSMinimumStakeAmount, "pos-minimum-stake-amount", 1, "minimum stake amount")
Expand Down Expand Up @@ -625,6 +625,9 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
network = models.ConvertClusterToNetwork(network)
}
}
if numLocalNodes > 0 {
useLocalMachine = true
}
// ask user if we want to use local machine if cluster is not provided
if network.Kind != models.Local && !useLocalMachine && clusterNameFlagValue == "" {
ux.Logger.PrintToUser("You can use your local machine as a bootstrap validator on the blockchain")
Expand All @@ -635,6 +638,11 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
return err
}
}
// default number of local machine nodes to be 1
// 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
if useLocalMachine && numLocalNodes == 0 {
numLocalNodes = constants.DefaultNumberOfLocalMachineNodes
}
// if no cluster provided - we create one with fmt.Sprintf("%s-local-node", blockchainName) name
if useLocalMachine && clusterNameFlagValue == "" {
// stop local avalanchego process so that we can generate new local cluster
Expand Down
21 changes: 11 additions & 10 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,17 @@ const (
PluginDir = "plugins"
LocalDir = "local"

MetricsNetwork = "network"
MultiSig = "multi-sig"
SkipUpdateFlag = "skip-update-check"
LastFileName = ".last_actions.json"
APIRole = "API"
ValidatorRole = "Validator"
MonitorRole = "Monitor"
ICMRelayerRole = "Relayer"
LoadTestRole = "LoadTest"
DefaultWalletCreationTimeout = 5 * time.Second
DefaultNumberOfLocalMachineNodes = 1
MetricsNetwork = "network"
MultiSig = "multi-sig"
SkipUpdateFlag = "skip-update-check"
LastFileName = ".last_actions.json"
APIRole = "API"
ValidatorRole = "Validator"
MonitorRole = "Monitor"
ICMRelayerRole = "Relayer"
LoadTestRole = "LoadTest"
DefaultWalletCreationTimeout = 5 * time.Second

DefaultConfirmTxTimeout = 20 * time.Second

Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/testcases/subnet/sov/etna/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ func deployEtnaSubnetEtnaFlag() {
"deploy",
subnetName,
"--etna-devnet",
"--use-local-machine",
"--num-local-nodes=1",
"--ewoq",
"--change-owner-address",
Expand Down Expand Up @@ -131,7 +130,6 @@ func deployEtnaSubnetEtnaFlagConvertOnly() {
"deploy",
subnetName,
"--etna-devnet",
"--use-local-machine",
"--num-local-nodes=1",
"--convert-only",
"--ewoq",
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/testcases/validatormanager/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func createSovereignSubnet() (string, string, error) {
"deploy",
subnetName,
"--etna-devnet",
"--use-local-machine",
"--num-local-nodes=1",
"--ewoq",
"--convert-only",
Expand Down

0 comments on commit 9ad90b8

Please sign in to comment.