Skip to content

Commit

Permalink
Merge branch 'main' into 223-createchain-e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero authored Aug 4, 2022
2 parents c70bfd2 + 77e9e6a commit df3afd7
Show file tree
Hide file tree
Showing 44 changed files with 1,511 additions and 1,808 deletions.
23 changes: 11 additions & 12 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ func (c *client) Start(ctx context.Context, execPath string, opts ...OpOption) (
if ret.rootDataDir != "" {
req.RootDataDir = &ret.rootDataDir
}
if ret.buildDir != "" {
req.BuildDir = &ret.buildDir
if ret.pluginDir != "" {
req.PluginDir = &ret.pluginDir
}
if len(ret.blockchainSpecs) > 0 {
req.BlockchainSpecs = ret.blockchainSpecs
Expand Down Expand Up @@ -233,12 +233,11 @@ func (c *client) AddNode(ctx context.Context, name string, execPath string, opts
ret.applyOpts(opts)

req := &rpcpb.AddNodeRequest{
Name: name,
}
if ret.execPath != "" {
req.ExecPath = ret.execPath
Name: name,
ExecPath: execPath,
NodeConfig: &ret.globalNodeConfig,
ChainConfigs: ret.chainConfigs,
}
req.ChainConfigs = ret.chainConfigs

zap.L().Info("add node", zap.String("name", name))
return c.controlc.AddNode(ctx, req)
Expand Down Expand Up @@ -296,8 +295,8 @@ func (c *client) LoadSnapshot(ctx context.Context, snapshotName string, opts ...
if ret.execPath != "" {
req.ExecPath = &ret.execPath
}
if ret.buildDir != "" {
req.BuildDir = &ret.buildDir
if ret.pluginDir != "" {
req.PluginDir = &ret.pluginDir
}
if ret.rootDataDir != "" {
req.RootDataDir = &ret.rootDataDir
Expand Down Expand Up @@ -335,7 +334,7 @@ type Op struct {
whitelistedSubnets string
globalNodeConfig string
rootDataDir string
buildDir string
pluginDir string
blockchainSpecs []*rpcpb.BlockchainSpec
customNodeConfigs map[string]string
numSubnets uint32
Expand Down Expand Up @@ -380,9 +379,9 @@ func WithRootDataDir(rootDataDir string) OpOption {
}
}

func WithBuildDir(buildDir string) OpOption {
func WithPluginDir(pluginDir string) OpOption {
return func(op *Op) {
op.buildDir = buildDir
op.pluginDir = pluginDir
}
}

Expand Down
18 changes: 9 additions & 9 deletions cmd/control/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func NewCommand() *cobra.Command {
var (
avalancheGoBinPath string
numNodes uint32
buildDir string
pluginDir string
globalNodeConfig string
addNodeConfig string
blockchainSpecsStr string
Expand Down Expand Up @@ -104,10 +104,10 @@ func newStartCommand() *cobra.Command {
"number of nodes of the network",
)
cmd.PersistentFlags().StringVar(
&buildDir,
"build-dir",
&pluginDir,
"plugin-dir",
"",
"[optional] build directory",
"[optional] plugin directory",
)
cmd.PersistentFlags().StringVar(
&rootDataDir,
Expand Down Expand Up @@ -157,7 +157,7 @@ func startFunc(cmd *cobra.Command, args []string) error {

opts := []client.OpOption{
client.WithNumNodes(numNodes),
client.WithBuildDir(buildDir),
client.WithPluginDir(pluginDir),
client.WithWhitelistedSubnets(whitelistedSubnets),
client.WithRootDataDir(rootDataDir),
}
Expand Down Expand Up @@ -765,10 +765,10 @@ func newLoadSnapshotCommand() *cobra.Command {
"avalanchego binary path",
)
cmd.PersistentFlags().StringVar(
&buildDir,
"build-dir",
&pluginDir,
"plugin-dir",
"",
"build directory",
"plugin directory",
)
cmd.PersistentFlags().StringVar(
&rootDataDir,
Expand Down Expand Up @@ -800,7 +800,7 @@ func loadSnapshotFunc(cmd *cobra.Command, args []string) error {

opts := []client.OpOption{
client.WithExecPath(avalancheGoBinPath),
client.WithBuildDir(buildDir),
client.WithPluginDir(pluginDir),
client.WithRootDataDir(rootDataDir),
}

Expand Down
12 changes: 7 additions & 5 deletions local/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,15 @@ func (ln *localNetwork) restartNodesWithWhitelistedSubnets(
zap.L().Info("restarting all nodes to whitelist subnet",
zap.Strings("whitelisted-subnets", whitelistedSubnetIDs),
)

// change default setting
ln.flags[config.WhitelistedSubnetsKey] = whitelistedSubnets

for nodeName, node := range ln.nodes {
// replace WhitelistedSubnetsKey flag
nodeConfig := node.GetConfig()
nodeConfig.ConfigFile, err = utils.SetJSONKey(nodeConfig.ConfigFile, config.WhitelistedSubnetsKey, whitelistedSubnets)
if err != nil {
return err
}

// delete node specific flag so as to use default one
delete(nodeConfig.Flags, config.WhitelistedSubnetsKey)

zap.L().Info("removing and adding back the node for whitelisted subnets", zap.String("node-name", nodeName))
if err := ln.removeNode(ctx, nodeName); err != nil {
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions local/default/node0/config.json → local/default/flags.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"network-peer-list-gossip-frequency":"250ms",
"network-max-reconnect-delay":"1s",
"public-ip":"127.0.0.1",
"health-check-frequency":"2s",
"api-admin-enabled":true,
"api-ipcs-enabled":true,
"index-enabled":true,
"public-ip":"127.0.0.1",
"log-display-level":"ERROR",
"log-level": "DEBUG",
"http-port": 9650
"log-level": "DEBUG"
}
30 changes: 0 additions & 30 deletions local/default/node0/staking.crt

This file was deleted.

51 changes: 0 additions & 51 deletions local/default/node0/staking.key

This file was deleted.

31 changes: 0 additions & 31 deletions local/default/node1/cchain_config.json

This file was deleted.

12 changes: 0 additions & 12 deletions local/default/node1/config.json

This file was deleted.

3 changes: 3 additions & 0 deletions local/default/node1/flags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"http-port": 9650
}
48 changes: 24 additions & 24 deletions local/default/node1/staking.crt
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
MIIFNzCCAx8CCQC687XFxtDRSjANBgkqhkiG9w0BAQsFADB/MQswCQYDVQQGEwJV
UzELMAkGA1UECAwCTlkxDzANBgNVBAcMBkl0aGFjYTEQMA4GA1UECgwHQXZhbGFi
czEOMAwGA1UECwwFR2Vja28xDDAKBgNVBAMMA2F2YTEiMCAGCSqGSIb3DQEJARYT
c3RlcGhlbkBhdmFsYWJzLm9yZzAgFw0xOTA3MDIxNjEyMTla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