Skip to content
8 changes: 4 additions & 4 deletions cmd/blockchaincmd/add_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,11 @@ func PromptDuration(start time.Time, network models.Network, isPos bool) (time.D
var d time.Duration
var err error
switch {
case network.Kind == models.Fuji:
case network.Type == models.Fuji:
d, err = app.Prompt.CaptureFujiDuration(txt)
case network.Kind == models.Mainnet && isPos:
case network.Type == models.Mainnet && isPos:
d, err = app.Prompt.CaptureMainnetL1StakingDuration(txt)
case network.Kind == models.Mainnet && !isPos:
case network.Type == models.Mainnet && !isPos:
d, err = app.Prompt.CaptureMainnetDuration(txt)
default:
d, err = app.Prompt.CaptureDuration(txt)
Expand All @@ -725,7 +725,7 @@ func PromptDuration(start time.Time, network models.Network, isPos bool) (time.D

func getTimeParameters(network models.Network, nodeID ids.NodeID, isValidator bool) (time.Time, time.Duration, error) {
defaultStakingStartLeadTime := constants.StakingStartLeadTime
if network.Kind == models.Devnet {
if network.Type == models.Devnet {
defaultStakingStartLeadTime = constants.DevnetStakingStartLeadTime
}

Expand Down
30 changes: 15 additions & 15 deletions cmd/blockchaincmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ func getChainsInSubnet(blockchainName string) ([]string, error) {
}

func checkSubnetEVMDefaultAddressNotInAlloc(network models.Network, chain string) error {
if network.Kind != models.Local &&
network.Kind != models.Devnet &&
if network.Type != models.Local &&
network.Type != models.Devnet &&
!simulatedPublicNetwork() {
genesis, err := app.LoadEvmGenesis(chain)
if err != nil {
Expand Down Expand Up @@ -465,7 +465,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {

if isEVMGenesis {
// is is a subnet evm or a custom vm based on subnet evm
if network.Kind == models.Mainnet {
if network.Type == models.Mainnet {
err = getSubnetEVMMainnetChainID(&sidecar, chain)
if err != nil {
return err
Expand All @@ -483,7 +483,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {

ux.Logger.PrintToUser("Deploying %s to %s", chains, network.Name())

if network.Kind == models.Local {
if network.Type == models.Local {
app.Log.Debug("Deploy local")

avagoVersion := userProvidedAvagoVersion
Expand Down Expand Up @@ -598,7 +598,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
}
}
if !generateNodeID {
if network.Kind == models.Local {
if network.Type == models.Local {
useLocalMachine = true
}
networkNameComponent := strings.ReplaceAll(strings.ToLower(network.Name()), " ", "-")
Expand Down Expand Up @@ -709,10 +709,10 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
if partialSync {
nodeConfig[config.PartialSyncPrimaryNetworkKey] = true
}
if network.Kind == models.Fuji {
if network.Type == models.Fuji {
globalNetworkFlags.UseFuji = true
}
if network.Kind == models.Mainnet {
if network.Type == models.Mainnet {
globalNetworkFlags.UseMainnet = true
}
// anrSettings, avagoVersionSettings, globalNetworkFlags are empty
Expand Down Expand Up @@ -787,7 +787,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
return err
}
}
} else if network.Kind == models.Local {
} else if network.Type == models.Local {
sameControlKey = true
}

Expand Down Expand Up @@ -985,7 +985,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {

if !convertOnly && !generateNodeID {
clusterName := clusterNameFlagValue
if network.Kind != models.Local {
if network.Type != models.Local {
if clusterName == "" {
clusterName, err = node.GetClusterNameFromList(app)
if err != nil {
Expand Down Expand Up @@ -1131,7 +1131,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
); err != nil {
return err
}
if network.Kind == models.Local && !simulatedPublicNetwork() {
if network.Type == models.Local && !simulatedPublicNetwork() {
ux.Logger.PrintToUser("")
if err := networkcmd.TrackSubnet(
blockchainName,
Expand Down Expand Up @@ -1176,7 +1176,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
ux.Logger.RedXToUser("Interchain Messaging is not deployed due to: %v", icmErr)
} else {
ux.Logger.GreenCheckmarkToUser("ICM is successfully deployed")
if network.Kind != models.Local && !useLocalMachine {
if network.Type != models.Local && !useLocalMachine {
if flag := cmd.Flags().Lookup(skipRelayerFlagName); flag != nil && !flag.Changed {
ux.Logger.PrintToUser("")
yes, err := app.Prompt.CaptureYesNo("Do you want to setup local relayer for the messages to be interchanged, as Interchain Messaging was deployed to your blockchain?")
Expand All @@ -1186,7 +1186,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
icmSpec.SkipRelayerDeploy = !yes
}
}
if !icmSpec.SkipRelayerDeploy && network.Kind != models.Mainnet {
if !icmSpec.SkipRelayerDeploy && network.Type != models.Mainnet {
deployRelayerFlags := relayercmd.DeployFlags{
Version: icmSpec.RelayerVersion,
BinPath: icmSpec.RelayerBinPath,
Expand All @@ -1198,12 +1198,12 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
Amount: relayerAmount,
AllowPrivateIPs: relayerAllowPrivateIPs,
}
if network.Kind == models.Local || useLocalMachine {
if network.Type == models.Local || useLocalMachine {
deployRelayerFlags.Key = constants.ICMRelayerKeyName
deployRelayerFlags.Amount = constants.DefaultRelayerAmount
deployRelayerFlags.BlockchainFundingKey = constants.ICMKeyName
}
if network.Kind == models.Local {
if network.Type == models.Local {
deployRelayerFlags.CChainFundingKey = "ewoq"
deployRelayerFlags.CChainAmount = constants.DefaultRelayerAmount
}
Expand All @@ -1221,7 +1221,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
flags[constants.MetricsNetwork] = network.Name()
metrics.HandleTracking(cmd, constants.MetricsSubnetDeployCommand, app, flags)

if network.Kind == models.Local && !simulatedPublicNetwork() {
if network.Type == models.Local && !simulatedPublicNetwork() {
ux.Logger.PrintToUser("")
_ = PrintSubnetInfo(blockchainName, true)
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/blockchaincmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func PrintSubnetInfo(blockchainName string, onlyLocalnetInfo bool) error {
ux.Logger.PrintToUser("")
continue
}
if network.Kind != models.Local && onlyLocalnetInfo {
if network.Type != models.Local && onlyLocalnetInfo {
continue
}
genesisBytes, err := contract.GetBlockchainGenesis(
Expand All @@ -126,15 +126,15 @@ func PrintSubnetInfo(blockchainName string, onlyLocalnetInfo bool) error {
},
)
if err != nil {
if network.Kind != models.Local {
if network.Type != models.Local {
return err
}
// ignore local network errors for cases
// where local network is down but sidecar contains
// local network metadata
// (eg host restarts)
continue
} else if network.Kind == models.Local {
} else if network.Type == models.Local {
locallyDeployed = true
}
if utils.ByteSliceIsSubnetEvmGenesis(genesisBytes) {
Expand All @@ -143,7 +143,7 @@ func PrintSubnetInfo(blockchainName string, onlyLocalnetInfo bool) error {
return err
}
t.AppendRow(table.Row{net, "ChainID", genesis.Config.ChainID.String()})
if network.Kind == models.Local {
if network.Type == models.Local {
localChainID = genesis.Config.ChainID.String()
}
}
Expand Down Expand Up @@ -174,7 +174,7 @@ func PrintSubnetInfo(blockchainName string, onlyLocalnetInfo bool) error {
if err != nil {
return err
}
if network.Kind == models.Local {
if network.Type == models.Local {
localEndpoint = endpoint
}
t.AppendRow(table.Row{net, "RPC Endpoint", endpoint})
Expand All @@ -192,10 +192,10 @@ func PrintSubnetInfo(blockchainName string, onlyLocalnetInfo bool) error {
if err != nil {
continue
}
if network.Kind == models.Local && !locallyDeployed {
if network.Type == models.Local && !locallyDeployed {
continue
}
if network.Kind != models.Local && onlyLocalnetInfo {
if network.Type != models.Local && onlyLocalnetInfo {
continue
}
if data.TeleporterMessengerAddress != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/blockchaincmd/prompt_owners.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func getControlKeysForDeploy(kc *keychain.Keychain) ([]string, bool, error) {
} else {
feePaying = "Use fee-paying key"
}
if kc.Network.Kind == models.Mainnet {
if kc.Network.Type == models.Mainnet {
listOptions = []string{feePaying, custom}
} else {
listOptions = []string{feePaying, useAll, custom}
Expand Down
2 changes: 1 addition & 1 deletion cmd/blockchaincmd/remove_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func removeValidator(_ *cobra.Command, args []string) error {
}
}

if network.Kind == models.Local && !sc.Sovereign {
if network.Type == models.Local && !sc.Sovereign {
return removeFromLocalNonSOV(blockchainName, nodeID)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/blockchaincmd/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func printValidators(_ *cobra.Command, args []string) error {

subnetID := deployInfo.SubnetID

if network.Kind == models.Local {
if network.Type == models.Local {
return printLocalValidators(subnetID)
} else {
return printPublicValidators(subnetID, network)
Expand Down
4 changes: 2 additions & 2 deletions cmd/interchaincmd/messengercmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func CallDeploy(_ []string, flags DeployFlags, network models.Network) error {
}
}
// automatic deploy to cchain for local
if !flags.ChainFlags.CChain && (network.Kind == models.Local || flags.IncludeCChain) {
if !flags.ChainFlags.CChain && (network.Type == models.Local || flags.IncludeCChain) {
if flags.CChainKeyName == "" {
flags.CChainKeyName = "ewoq"
}
Expand All @@ -235,7 +235,7 @@ func CallDeploy(_ []string, flags DeployFlags, network models.Network) error {
return err
}
if !alreadyDeployed {
if network.Kind == models.Local {
if network.Type == models.Local {
if err := localnet.WriteExtraLocalNetworkData(
"",
"",
Expand Down
20 changes: 10 additions & 10 deletions cmd/interchaincmd/relayercmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func CallDeploy(_ []string, flags DeployFlags, network models.Network) error {
}

deployToRemote := false
if !disableDeployToRemotePrompt && network.Kind != models.Local {
if !disableDeployToRemotePrompt && network.Type != models.Local {
prompt := "Do you want to deploy the relayer to a remote or a local host?"
remoteHostOption := "I want to deploy the relayer into a remote node in the cloud"
localHostOption := "I prefer to deploy into a localhost process"
Expand Down Expand Up @@ -127,10 +127,10 @@ func CallDeploy(_ []string, flags DeployFlags, network models.Network) error {
}

if !deployToRemote {
if isUP, _, _, err := interchain.RelayerIsUp(app.GetLocalRelayerRunPath(network.Kind)); err != nil {
if isUP, _, _, err := interchain.RelayerIsUp(app.GetLocalRelayerRunPath(network.Type)); err != nil {
return err
} else if isUP {
return fmt.Errorf("there is already a local relayer deployed for %s", network.Kind.String())
return fmt.Errorf("there is already a local relayer deployed for %s", network.Type.String())
}
}

Expand Down Expand Up @@ -426,22 +426,22 @@ func CallDeploy(_ []string, flags DeployFlags, network models.Network) error {
return nil
}

runFilePath := app.GetLocalRelayerRunPath(network.Kind)
storageDir := app.GetLocalRelayerStorageDir(network.Kind)
runFilePath := app.GetLocalRelayerRunPath(network.Type)
storageDir := app.GetLocalRelayerStorageDir(network.Type)
localNetworkRootDir := ""
if network.Kind == models.Local {
if network.Type == models.Local {
clusterInfo, err := localnet.GetClusterInfo()
if err != nil {
return err
}
localNetworkRootDir = clusterInfo.GetRootDataDir()
}
configPath := app.GetLocalRelayerConfigPath(network.Kind, localNetworkRootDir)
logPath := app.GetLocalRelayerLogPath(network.Kind)
configPath := app.GetLocalRelayerConfigPath(network.Type, localNetworkRootDir)
logPath := app.GetLocalRelayerLogPath(network.Type)

metricsPort := constants.RemoteICMRelayerMetricsPort
if !deployToRemote {
switch network.Kind {
switch network.Type {
case models.Local:
metricsPort = constants.LocalNetworkLocalICMRelayerMetricsPort
case models.Devnet:
Expand Down Expand Up @@ -508,7 +508,7 @@ func CallDeploy(_ []string, flags DeployFlags, network models.Network) error {
}
return err
}
if network.Kind == models.Local {
if network.Type == models.Local {
if err := localnet.WriteExtraLocalNetworkData("", binPath, "", ""); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/interchaincmd/relayercmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func logs(_ *cobra.Command, _ []string) error {
return err
}
var logLines []string
logsPath := app.GetLocalRelayerLogPath(network.Kind)
logsPath := app.GetLocalRelayerLogPath(network.Type)
bs, err := os.ReadFile(logsPath)
if err != nil {
return err
Expand Down
22 changes: 11 additions & 11 deletions cmd/interchaincmd/relayercmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,22 @@ func start(_ *cobra.Command, _ []string) error {
ux.Logger.GreenCheckmarkToUser("Remote AWM Relayer on %s successfully started", host.GetCloudID())
default:
if relayerIsUp, _, _, err := interchain.RelayerIsUp(
app.GetLocalRelayerRunPath(network.Kind),
app.GetLocalRelayerRunPath(network.Type),
); err != nil {
return err
} else if relayerIsUp {
return fmt.Errorf("local AWM relayer is already running for %s", network.Kind)
return fmt.Errorf("local AWM relayer is already running for %s", network.Type)
}
localNetworkRootDir := ""
if network.Kind == models.Local {
if network.Type == models.Local {
clusterInfo, err := localnet.GetClusterInfo()
if err != nil {
return err
}
localNetworkRootDir = clusterInfo.GetRootDataDir()
}
relayerConfigPath := app.GetLocalRelayerConfigPath(network.Kind, localNetworkRootDir)
if network.Kind == models.Local && binPath == "" {
relayerConfigPath := app.GetLocalRelayerConfigPath(network.Type, localNetworkRootDir)
if network.Type == models.Local && binPath == "" {
if b, extraLocalNetworkData, err := localnet.GetExtraLocalNetworkData(""); err != nil {
return err
} else if b {
Expand All @@ -104,18 +104,18 @@ func start(_ *cobra.Command, _ []string) error {
binPath,
app.GetICMRelayerBinDir(),
relayerConfigPath,
app.GetLocalRelayerLogPath(network.Kind),
app.GetLocalRelayerRunPath(network.Kind),
app.GetLocalRelayerStorageDir(network.Kind),
app.GetLocalRelayerLogPath(network.Type),
app.GetLocalRelayerRunPath(network.Type),
app.GetLocalRelayerStorageDir(network.Type),
); err != nil {
return err
} else if network.Kind == models.Local {
} else if network.Type == models.Local {
if err := localnet.WriteExtraLocalNetworkData("", binPath, "", ""); err != nil {
return err
}
}
ux.Logger.GreenCheckmarkToUser("Local AWM Relayer successfully started for %s", network.Kind)
ux.Logger.PrintToUser("Logs can be found at %s", app.GetLocalRelayerLogPath(network.Kind))
ux.Logger.GreenCheckmarkToUser("Local AWM Relayer successfully started for %s", network.Type)
ux.Logger.PrintToUser("Logs can be found at %s", app.GetLocalRelayerLogPath(network.Type))
}
return nil
}
12 changes: 6 additions & 6 deletions cmd/interchaincmd/relayercmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ func stop(_ *cobra.Command, _ []string) error {
ux.Logger.GreenCheckmarkToUser("Remote AWM Relayer on %s successfully stopped", host.GetCloudID())
default:
b, _, _, err := interchain.RelayerIsUp(
app.GetLocalRelayerRunPath(network.Kind),
app.GetLocalRelayerRunPath(network.Type),
)
if err != nil {
return err
}
if !b {
return fmt.Errorf("there is no CLI-managed local AWM relayer running for %s", network.Kind)
return fmt.Errorf("there is no CLI-managed local AWM relayer running for %s", network.Type)
}
if err := interchain.RelayerCleanup(
app.GetLocalRelayerRunPath(network.Kind),
app.GetLocalRelayerLogPath(network.Kind),
app.GetLocalRelayerStorageDir(network.Kind),
app.GetLocalRelayerRunPath(network.Type),
app.GetLocalRelayerLogPath(network.Type),
app.GetLocalRelayerStorageDir(network.Type),
); err != nil {
return err
}
ux.Logger.GreenCheckmarkToUser("Local AWM Relayer successfully stopped for %s", network.Kind)
ux.Logger.GreenCheckmarkToUser("Local AWM Relayer successfully stopped for %s", network.Type)
}
return nil
}
Loading
Loading