Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into add-min-delegator-stake-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcardona committed Dec 30, 2020
2 parents c1837d3 + 4674038 commit 7f7d563
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 10 deletions.
26 changes: 26 additions & 0 deletions cmd/startnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func init() {
StartnodeCmd.Flags().BoolVar(&flags.APIInfoEnabled, "api-info-enabled", flags.APIInfoEnabled, "If set to `true`, this node will expose the Info API. Defaults to `true`")

StartnodeCmd.Flags().StringVar(&flags.PublicIP, "public-ip", flags.PublicIP, "Public IP of this node.")
StartnodeCmd.Flags().StringVar(&flags.DynamicUpdateDuration, "dynamic-update-duration", flags.DynamicUpdateDuration, "The time between poll events for `--dynamic-public-ip` or NAT traversal. The recommended minimum is 1 minute. Defaults to `5m`")
StartnodeCmd.Flags().StringVar(&flags.DynamicPublicIP, "dynamic-public-ip", flags.DynamicPublicIP, "Valid values if param is present: `opendns`, `ifconfigco` or `ifconfigme`. This overrides `--public-ip`. If set, will poll the remote service every `--dynamic-update-duration` and update the node’s public IP address.")
StartnodeCmd.Flags().StringVar(&flags.NetworkID, "network-id", flags.NetworkID, "Network ID this node will connect to.")
StartnodeCmd.Flags().UintVar(&flags.XputServerPort, "xput-server-port", flags.XputServerPort, "Port of the deprecated throughput test server.")
StartnodeCmd.Flags().BoolVar(&flags.XputServerEnabled, "xput-server-enabled", flags.XputServerEnabled, "If true, throughput test server is created.")
Expand All @@ -138,6 +140,7 @@ func init() {
StartnodeCmd.Flags().StringVar(&flags.LogLevel, "log-level", flags.LogLevel, "Specify the log level. Should be one of {verbo, debug, info, warn, error, fatal, off}")
StartnodeCmd.Flags().StringVar(&flags.LogDir, "log-dir", flags.LogDir, "Name of directory for the node's logging.")
StartnodeCmd.Flags().StringVar(&flags.LogDisplayLevel, "log-display-level", flags.LogDisplayLevel, "{Off, Fatal, Error, Warn, Info, Debug, Verbo}. The log level determines which events to display to the screen. If left blank, will default to the value provided to `--log-level`")
StartnodeCmd.Flags().StringVar(&flags.LogDisplayHighlight, "log-display-highlight", flags.LogDisplayHighlight, "Whether to color/highlight display logs. Default highlights when the output is a terminal. Otherwise, should be one of {auto, plain, colors}")

StartnodeCmd.Flags().IntVar(&flags.SnowAvalancheBatchSize, "snow-avalanche-batch-size", flags.SnowAvalancheBatchSize, "Number of operations to batch in each new vertex.")
StartnodeCmd.Flags().IntVar(&flags.SnowAvalancheNumParents, "snow-avalanche-num-parents", flags.SnowAvalancheNumParents, "Number of vertexes for reference from each new vertex.")
Expand All @@ -146,10 +149,20 @@ func init() {
StartnodeCmd.Flags().IntVar(&flags.SnowVirtuousCommitThreshold, "snow-virtuous-commit-threshold", flags.SnowVirtuousCommitThreshold, "Beta value to use for virtuous transactions.")
StartnodeCmd.Flags().IntVar(&flags.SnowRogueCommitThreshold, "snow-rogue-commit-threshold", flags.SnowRogueCommitThreshold, "Beta value to use for rogue transactions.")
StartnodeCmd.Flags().IntVar(&flags.MinDelegatorStake, "min-delegator-stake", flags.MinDelegatorStake, "The minimum stake, in nAVAX, that can be delegated to a validator of the Primary Network. Defaults to `25000000000` (25 AVAX) on Main Net. Defaults to `5000000` (.005 AVAX) on Test Net.")
StartnodeCmd.Flags().StringVar(&flags.ConsensusShutdownTimeout, "consensus-shutdown-timeout", flags.ConsensusShutdownTimeout, "Timeout before killing an unresponsive chain. Defaults to `5s`")
StartnodeCmd.Flags().StringVar(&flags.ConsensusGossipFrequency, "consensus-gossip-frequency", flags.ConsensusGossipFrequency, "Time between gossiping accepted frontiers. Defaults to `10s`")
StartnodeCmd.Flags().IntVar(&flags.MinDelegationFee, "min-delegation-fee", flags.MinDelegationFee, "The minimum delegation fee that can be charged for delegation on the Primary Network, multiplied by `10,000` . Must be in the range `[0, 1000000]`. Defaults to `20000` (2%) on Main Net.")
StartnodeCmd.Flags().IntVar(&flags.MinValidatorStake, "min-validator-stake", flags.MinValidatorStake, "The minimum stake, in nAVAX, required to validate the Primary Network. Defaults to `2000000000000` (2,000 AVAX) on Main Net. Defaults to `5000000` (.005 AVAX) on Test Net.")
StartnodeCmd.Flags().StringVar(&flags.MaxStakeDuration, "max-stake-duration", flags.MaxStakeDuration, "The maximum staking duration, in seconds. Defaults to `8760h` (365 days) on Main Net.")
StartnodeCmd.Flags().IntVar(&flags.MaxValidatorStake, "max-validator-stake", flags.MaxValidatorStake, "The maximum stake, in nAVAX, that can be placed on a validator on the primary network. Defaults to `3000000000000000` (3,000,000 AVAX) on Main Net. This includes stake provided by both the validator and by delegators to the validator.")
StartnodeCmd.Flags().IntVar(&flags.SnowConcurrentRepolls, "snow-concurrent-repolls", flags.SnowConcurrentRepolls, "Snow consensus requires repolling transactions that are issued during low time of network usage. This parameter lets one define how aggressive the client will be in finalizing these pending transactions. This should only be changed after careful consideration of the tradeoffs of Snow consensus. The value must be at least `1` and at most `--snow-rogue-commit-threshold`. Defaults to `4`")
StartnodeCmd.Flags().StringVar(&flags.StakeMintingPeriod, "stake-minting-period", flags.StakeMintingPeriod, "Consumption period of the staking function, in seconds. The Default on Main Net is `8760h` (365 days).")
StartnodeCmd.Flags().IntVar(&flags.CreationTxFee, "creation-tx-fee", flags.CreationTxFee, "Transaction fee, in nAVAX, for transactions that create new state. Defaults to `1000000` nAVAX (.001 AVAX) per transaction.")

StartnodeCmd.Flags().BoolVar(&flags.P2PTLSEnabled, "p2p-tls-enabled", flags.P2PTLSEnabled, "Require TLS to authenticate network communications")
StartnodeCmd.Flags().BoolVar(&flags.StakingEnabled, "staking-enabled", flags.StakingEnabled, "Enable staking. If enabled, Network TLS is required.")
StartnodeCmd.Flags().UintVar(&flags.StakingPort, "staking-port", flags.StakingPort, "Port of the consensus server.")
StartnodeCmd.Flags().IntVar(&flags.StakingDisabledWeight, "staking-disabled-weight", flags.StakingDisabledWeight, "Weight to provide to each peer when staking is disabled. Defaults to `1`")
StartnodeCmd.Flags().StringVar(&flags.StakingTLSCertFile, "staking-tls-cert-file", flags.StakingTLSCertFile, "TLS certificate file for staking connections. Relative to the avash binary if doesn't start with '/'. Ex: certs/keys1/staker.crt")
StartnodeCmd.Flags().StringVar(&flags.StakingTLSKeyFile, "staking-tls-key-file", flags.StakingTLSKeyFile, "TLS private key file for staking connections. Relative to the avash binary if doesn't start with '/'. Ex: certs/keys1/staker.key")

Expand All @@ -169,5 +182,18 @@ func init() {

StartnodeCmd.Flags().IntVar(&flags.FDLimit, "fd-limit", flags.FDLimit, "Attempts to raise the process file descriptor limit to at least this value. Defaults to `32768`")

StartnodeCmd.Flags().StringVar(&flags.BenchlistDuration, "benchlist-duration", flags.BenchlistDuration, "Amount of time a peer is benchlisted after surpassing `--benchlist-fail-threshold`. Defaults to `1h`")
StartnodeCmd.Flags().IntVar(&flags.BenchlistFailThreshold, "benchlist-fail-threshold", flags.BenchlistFailThreshold, "Number of consecutive failed queries to a node before benching it (assuming all queries to it will fail). Defaults to `10`")
StartnodeCmd.Flags().StringVar(&flags.BenchlistMinFailingDuration, "benchlist-min-failing-duration", flags.BenchlistMinFailingDuration, "Minimum amount of time messages to a peer must be failing before the peer is benched. Defaults to `5m`")
StartnodeCmd.Flags().BoolVar(&flags.BenchlistPeerSummaryEnabled, "benchlist-peer-summary-enabled", flags.BenchlistPeerSummaryEnabled, "Enables peer specific query latency metrics. Defaults to `false`")

StartnodeCmd.Flags().IntVar(&flags.MaxNonStakerPendingMsgs, "max-non-staker-pending-msgs", flags.MaxNonStakerPendingMsgs, "Maximum number of messages a non-staker is allowed to have pending. Defaults to `20`")

StartnodeCmd.Flags().StringVar(&flags.NetworkInitialTimeout, "network-initial-timeout", flags.NetworkInitialTimeout, "Initial timeout value of the adaptive timeout manager, in nanoseconds. Defaults to `5s`")
StartnodeCmd.Flags().StringVar(&flags.NetworkMinimumTimeout, "network-minimum-timeout", flags.NetworkMinimumTimeout, "Minimum timeout value of the adaptive timeout manager, in nanoseconds. Defaults to `5s`")
StartnodeCmd.Flags().StringVar(&flags.NetworkMaximumTimeout, "network-maximum-timeout", flags.NetworkMaximumTimeout, "Maximum timeout value of the adaptive timeout manager, in nanoseconds. Defaults to `10s`")

StartnodeCmd.Flags().BoolVar(&flags.RestartOnDisconnected, "restart-on-disconnected", flags.RestartOnDisconnected, "Defaults to `false`")
StartnodeCmd.Flags().StringVar(&flags.DisconnectedCheckFrequency, "disconnected-check-frequency", flags.DisconnectedCheckFrequency, "Defaults to `10s`")
StartnodeCmd.Flags().StringVar(&flags.DisconnectedRestartTimeout, "disconnected-restart-timeout", flags.DisconnectedRestartTimeout, "Defaults to `1m`")
}
23 changes: 23 additions & 0 deletions network/startnode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ do
--tx-fee=*|\
--network-id=*|\
--public-ip=*|\
--dynamic-update-duration=*|\
--dynamic-public-ip=*|\
--xput-server-port=*|\
--xput-server-enabled=*|\
--signature-verification-enabled=*|\
Expand All @@ -37,7 +39,11 @@ do
--bootstrap-ids=*|\
--db-enabled=*|\
--log-level=*|\
--benchlist-duration=*|\
--benchlist-fail-threshold=*|\
--consensus-gossip-frequency=*|\
--benchlist-min-failing-duration=*|\
--benchlist-peer-summary-enabled=*|\
--version=*|\
--snow-avalanche-batch-size=*|\
--snow-avalanche-num-parents=*|\
Expand All @@ -46,8 +52,24 @@ do
--snow-virtuous-commit-threshold=*|\
--snow-rogue-commit-threshold=*|\
--min-delegator-stake=*|\
--consensus-shutdown-timeout=*|\
--min-delegation-fee=*|\
--min-validator-stake=*|\
--max-stake-duration=*|\
--max-validator-stake=*|\
--snow-concurrent-repolls=*|\
--stake-minting-period=*|\
--creation-tx-fee=*|\
--max-non-staker-pending-msgs=*|\
--network-initial-timeout=*|\
--network-minimum-timeout=*|\
--network-maximum-timeout=*|\
--restart-on-disconnected=*|\
--disconnected-check-frequency=*|\
--disconnected-restart-timeout=*|\
--p2p-tls-enabled=*|\
--staking-enabled=*|\
--staking-disabled-weight=*|\
--staking-tls-key-file=*|\
--staking-tls-cert-file=*)
FLAGS+="${arg} "
Expand All @@ -64,6 +86,7 @@ do
--ipcs-chain-ids=*|\
--ipcs-path=*|\
--log-display-level=*|\
--log-display-highlight=*|\
--fd-limit=*|\
--http-host=*|\
--db-dir=*|\
Expand Down
23 changes: 23 additions & 0 deletions node/cli_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata)
"--version=" + strconv.FormatBool(flags.Version),
"--tx-fee=" + strconv.FormatUint(uint64(flags.TxFee), 10),
"--public-ip=" + flags.PublicIP,
"--dynamic-update-duration=" + flags.DynamicUpdateDuration,
"--dynamic-public-ip=" + flags.DynamicPublicIP,
"--network-id=" + flags.NetworkID,
"--xput-server-port=" + strconv.FormatUint(uint64(flags.XputServerPort), 10),
"--xput-server-enabled=" + strconv.FormatBool(flags.XputServerEnabled),
Expand All @@ -72,16 +74,31 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata)
"--log-level=" + flags.LogLevel,
"--log-dir=" + logPath,
"--log-display-level=" + flags.LogDisplayLevel,
"--log-display-highlight=" + flags.LogDisplayHighlight,
"--snow-avalanche-batch-size=" + strconv.Itoa(flags.SnowAvalancheBatchSize),
"--snow-avalanche-num-parents=" + strconv.Itoa(flags.SnowAvalancheNumParents),
"--snow-sample-size=" + strconv.Itoa(flags.SnowSampleSize),
"--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize),
"--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold),
"--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold),
"--min-delegator-stake=" + strconv.Itoa(flags.MinDelegatorStake),
"--consensus-shutdown-timeout=" + flags.ConsensusShutdownTimeout,
"--consensus-gossip-frequency=" + flags.ConsensusGossipFrequency,
"--min-delegation-fee=" + strconv.Itoa(flags.MinDelegationFee),
"--min-validator-stake=" + strconv.Itoa(flags.MinValidatorStake),
"--max-stake-duration=" + flags.MaxStakeDuration,
"--max-validator-stake=" + strconv.Itoa(flags.MaxValidatorStake),
"--snow-concurrent-repolls=" + strconv.Itoa(flags.SnowConcurrentRepolls),
"--stake-minting-period=" + flags.StakeMintingPeriod,
"--creation-tx-fee=" + strconv.Itoa(flags.CreationTxFee),
"--max-non-staker-pending-msgs=" + strconv.Itoa(flags.MaxNonStakerPendingMsgs),
"--network-initial-timeout=" + flags.NetworkInitialTimeout,
"--network-minimum-timeout=" + flags.NetworkMinimumTimeout,
"--network-maximum-timeout=" + flags.NetworkMaximumTimeout,
"--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled),
"--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled),
"--staking-port=" + stakingPortString,
"--staking-disabled-weight=" + strconv.Itoa(flags.StakingDisabledWeight),
"--staking-tls-key-file=" + stakerKeyFile,
"--staking-tls-cert-file=" + stakerCertFile,
"--api-auth-required=" + strconv.FormatBool(flags.APIAuthRequired),
Expand All @@ -96,7 +113,13 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata)
"--ipcs-chain-ids=" + flags.IPCSChainIDs,
"--ipcs-path=" + flags.IPCSPath,
"--fd-limit=" + strconv.Itoa(flags.FDLimit),
"--benchlist-duration=" + flags.BenchlistDuration,
"--benchlist-fail-threshold=" + strconv.Itoa(flags.BenchlistFailThreshold),
"--benchlist-min-failing-duration=" + flags.BenchlistMinFailingDuration,
"--benchlist-peer-summary-enabled=" + strconv.FormatBool(flags.BenchlistPeerSummaryEnabled),
"--restart-on-disconnected=" + strconv.FormatBool(flags.RestartOnDisconnected),
"--disconnected-check-frequency=" + flags.DisconnectedCheckFrequency,
"--disconnected-restart-timeout=" + flags.DisconnectedRestartTimeout,
}
if sepBase {
args = append(args, "--data-dir="+basedir)
Expand Down
Loading

0 comments on commit 7f7d563

Please sign in to comment.