Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add node conf to acp-77-pos #2313

Open
wants to merge 1 commit into
base: acp-77-pos
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/blockchaincmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
}
publicKey = "0x" + hex.EncodeToString(proofOfPossession.PublicKey[:])
pop = "0x" + hex.EncodeToString(proofOfPossession.ProofOfPossession[:])
//can use defaults here because local deployment. change below to avoid prompting.

Check failure on line 491 in cmd/blockchaincmd/deploy.go

View workflow job for this annotation

GitHub Actions / Lint

commentFormatting: put a space between `//` and comment text (gocritic)
// changeAddr, err = getKeyForChangeOwner(nodeID.String(), changeAddr, network)
if err != nil {
return err
Expand Down Expand Up @@ -565,13 +565,22 @@
}
}
network = models.NewNetworkFromCluster(network, clusterName)
nodeConfig := ""
if app.AvagoNodeConfigExists(blockchainName) {
nodeConfigBytes, err := os.ReadFile(app.GetAvagoNodeConfigPath(blockchainName))
if err != nil {
return err
}
nodeConfig = string(nodeConfigBytes)
}
// anrSettings, avagoVersionSettings, globalNetworkFlags are empty
if err = node.StartLocalNode(
app,
clusterName,
useEtnaDevnet,
avagoBinaryPath,
5,
nodeConfig,
anrSettings,
avagoVersionSettings,
globalNetworkFlags,
Expand Down Expand Up @@ -908,7 +917,7 @@
maximumStakeMultiplier,
weightToValueFactor,
err := CaptureNativePoSParams()

Check failure on line 920 in cmd/blockchaincmd/deploy.go

View workflow job for this annotation

GitHub Actions / Lint

File is not `gofumpt`-ed (gofumpt)
if err != nil {
return err
}
Expand Down
13 changes: 13 additions & 0 deletions cmd/nodecmd/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package nodecmd

import (
"os"

"github.com/ava-labs/avalanche-cli/pkg/cobrautils"
"github.com/ava-labs/avalanche-cli/pkg/networkoptions"
"github.com/ava-labs/avalanche-cli/pkg/node"
Expand All @@ -22,6 +24,7 @@ var (
stakingCertKeyPath string
stakingSignerKeyPath string
numNodes uint32
nodeConfigPath string
)

// const snapshotName = "local_snapshot"
Expand Down Expand Up @@ -79,6 +82,7 @@ status by running avalanche node status local
cmd.Flags().StringVar(&stakingCertKeyPath, "staking-cert-key-path", "", "path to provided staking cert key for node")
cmd.Flags().StringVar(&stakingSignerKeyPath, "staking-signer-key-path", "", "path to provided staking signer key for node")
cmd.Flags().Uint32Var(&numNodes, "num-nodes", 1, "number of nodes to start")
cmd.Flags().StringVar(&nodeConfigPath, "node-config", "", "path to common avalanchego config settings for all nodes")
return cmd
}

Expand Down Expand Up @@ -139,12 +143,21 @@ func localStartNode(_ *cobra.Command, args []string) error {
UseLatestAvalanchegoReleaseVersion: useLatestAvalanchegoReleaseVersion,
UseAvalanchegoVersionFromSubnet: useAvalanchegoVersionFromSubnet,
}
nodeConfig := ""
if nodeConfigPath != "" {
nodeConfigBytes, err := os.ReadFile(nodeConfigPath)
if err != nil {
return err
}
nodeConfig = string(nodeConfigBytes)
}
return node.StartLocalNode(
app,
clusterName,
globalNetworkFlags.UseEtnaDevnet,
avalanchegoBinaryPath,
numNodes,
nodeConfig,
anrSettings,
avaGoVersionSetting,
globalNetworkFlags,
Expand Down
3 changes: 3 additions & 0 deletions pkg/node/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func StartLocalNode(
useEtnaDevnet bool,
avalanchegoBinaryPath string,
numNodes uint32,
nodeConfig string,
anrSettings ANRSettings,
avaGoVersionSetting AvalancheGoVersionSettings,
globalNetworkFlags networkoptions.NetworkFlags,
Expand Down Expand Up @@ -207,6 +208,7 @@ func StartLocalNode(
client.WithReassignPortsIfUsed(true),
client.WithPluginDir(pluginDir),
client.WithSnapshotPath(rootDir),
client.WithGlobalNodeConfig(nodeConfig),
}
// load snapshot for existing network
if _, err := cli.LoadSnapshot(
Expand Down Expand Up @@ -298,6 +300,7 @@ func StartLocalNode(
client.WithPluginDir(pluginDir),
client.WithFreshStakingIds(true),
client.WithZeroIP(false),
client.WithGlobalNodeConfig(nodeConfig),
}
if anrSettings.GenesisPath != "" && utils.FileExists(anrSettings.GenesisPath) {
anrOpts = append(anrOpts, client.WithGenesisPath(anrSettings.GenesisPath))
Expand Down
Loading