From 76cbdc221a4b135b44b56e074d8646cbd7aded4e Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 09:04:11 -0800 Subject: [PATCH 01/25] Add log-display-highlight flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 9 ++++++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/startnode.go b/cmd/startnode.go index 937484b..48edcf4 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -137,6 +137,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.") diff --git a/network/startnode.sh b/network/startnode.sh index 64ddcad..2588d94 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -61,6 +61,7 @@ do --ipcs-chain-ids=*|\ --ipcs-path=*|\ --log-display-level=*|\ + --log-display-highlight=*|\ --fd-limit=*|\ --http-host=*|\ --db-dir=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index c830dd3..0622e80 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -71,6 +71,7 @@ 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), diff --git a/node/config.go b/node/config.go index 1b7179c..967a2cd 100644 --- a/node/config.go +++ b/node/config.go @@ -60,9 +60,10 @@ type Flags struct { PluginDir string // Logging - LogLevel string - LogDir string - LogDisplayLevel string + LogLevel string + LogDir string + LogDisplayLevel string + LogDisplayHighlight string // Consensus SnowAvalancheBatchSize int @@ -131,6 +132,7 @@ type FlagsYAML struct { LogLevel *string `yaml:"log-level,omitempty"` LogDir *string `yaml:"log-dir,omitempty"` LogDisplayLevel *string `yaml:"log-display-level,omitempty"` + LogDisplayHighlight *string `yaml:"log-display-highlight,omitempty"` SnowAvalancheBatchSize *int `yaml:"snow-avalanche-batch-size,omitempty"` SnowAvalancheNumParents *int `yaml:"snow-avalanche-num-parents,omitempty"` SnowSampleSize *int `yaml:"snow-sample-size,omitempty"` @@ -212,6 +214,7 @@ func DefaultFlags() Flags { LogLevel: "info", LogDir: "logs", LogDisplayLevel: "", // defaults to the value provided to --log-level + LogDisplayHighlight: "", SnowAvalancheBatchSize: 30, SnowAvalancheNumParents: 5, SnowSampleSize: 2, From 494ccd020113354a37eb01486e9e2bb2a951a23b Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 09:10:36 -0800 Subject: [PATCH 02/25] Add --dynamic-public-ip flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 ++++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/startnode.go b/cmd/startnode.go index 937484b..7f80e7c 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -117,6 +117,7 @@ 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.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.") diff --git a/network/startnode.sh b/network/startnode.sh index 64ddcad..ac5fafc 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -23,6 +23,7 @@ do --tx-fee=*|\ --network-id=*|\ --public-ip=*|\ + --dynamic-public-ip=*|\ --xput-server-port=*|\ --xput-server-enabled=*|\ --signature-verification-enabled=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index c830dd3..1ceb95e 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -50,6 +50,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--assertions-enabled=" + strconv.FormatBool(flags.AssertionsEnabled), "--tx-fee=" + strconv.FormatUint(uint64(flags.TxFee), 10), "--public-ip=" + flags.PublicIP, + "--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), diff --git a/node/config.go b/node/config.go index 1b7179c..843b928 100644 --- a/node/config.go +++ b/node/config.go @@ -20,7 +20,8 @@ type Flags struct { TxFee uint // IP - PublicIP string + PublicIP string + DynamicPublicIP string // Network ID NetworkID string @@ -110,6 +111,7 @@ type FlagsYAML struct { AssertionsEnabled *bool `yaml:"assertions-enabled,omitempty"` TxFee *uint `yaml:"tx-fee,omitempty"` PublicIP *string `yaml:"public-ip,omitempty"` + DynamicPublicIP *string `yaml:"dynamic-public-ip,omitempty"` NetworkID *string `yaml:"network-id,omitempty"` XputServerPort *uint `yaml:"xput-server-port,omitempty"` XputServerEnabled *bool `yaml:"xput-server-enabled,omitempty"` @@ -191,6 +193,7 @@ func DefaultFlags() Flags { AssertionsEnabled: true, TxFee: 1000000, PublicIP: "127.0.0.1", + DynamicPublicIP: "", NetworkID: "local", XputServerPort: 9652, XputServerEnabled: false, From 7a361b6ee203dc0469d3e29fc052280926eab196 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 09:14:27 -0800 Subject: [PATCH 03/25] Add the --dynamic-update-duration flag --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 ++++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/startnode.go b/cmd/startnode.go index 937484b..7d4fd5e 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -117,6 +117,7 @@ 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.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.") diff --git a/network/startnode.sh b/network/startnode.sh index 64ddcad..2c369d0 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -23,6 +23,7 @@ do --tx-fee=*|\ --network-id=*|\ --public-ip=*|\ + --dynamic-update-duration=*|\ --xput-server-port=*|\ --xput-server-enabled=*|\ --signature-verification-enabled=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index c830dd3..623af8d 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -50,6 +50,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--assertions-enabled=" + strconv.FormatBool(flags.AssertionsEnabled), "--tx-fee=" + strconv.FormatUint(uint64(flags.TxFee), 10), "--public-ip=" + flags.PublicIP, + "--dynamic-update-duration=" + flags.DynamicUpdateDuration, "--network-id=" + flags.NetworkID, "--xput-server-port=" + strconv.FormatUint(uint64(flags.XputServerPort), 10), "--xput-server-enabled=" + strconv.FormatBool(flags.XputServerEnabled), diff --git a/node/config.go b/node/config.go index 1b7179c..102b479 100644 --- a/node/config.go +++ b/node/config.go @@ -20,7 +20,8 @@ type Flags struct { TxFee uint // IP - PublicIP string + PublicIP string + DynamicUpdateDuration string // Network ID NetworkID string @@ -110,6 +111,7 @@ type FlagsYAML struct { AssertionsEnabled *bool `yaml:"assertions-enabled,omitempty"` TxFee *uint `yaml:"tx-fee,omitempty"` PublicIP *string `yaml:"public-ip,omitempty"` + DynamicUpdateDuration *string `yaml:"dynamic-update-duration,omitempty"` NetworkID *string `yaml:"network-id,omitempty"` XputServerPort *uint `yaml:"xput-server-port,omitempty"` XputServerEnabled *bool `yaml:"xput-server-enabled,omitempty"` @@ -191,6 +193,7 @@ func DefaultFlags() Flags { AssertionsEnabled: true, TxFee: 1000000, PublicIP: "127.0.0.1", + DynamicUpdateDuration: "5m", NetworkID: "local", XputServerPort: 9652, XputServerEnabled: false, From f77183730fa1953192fe01d301affc11af1b6195 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 09:22:17 -0800 Subject: [PATCH 04/25] Add the --staking-disabled-weight flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 11 +++++++---- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/startnode.go b/cmd/startnode.go index 937484b..a964a16 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -148,6 +148,7 @@ func init() { 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") diff --git a/network/startnode.sh b/network/startnode.sh index 64ddcad..6649409 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-rogue-commit-threshold=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ + --staking-disabled-weight=*|\ --staking-tls-key-file=*|\ --staking-tls-cert-file=*) FLAGS+="${arg} " diff --git a/node/cli_tools.go b/node/cli_tools.go index c830dd3..92a2afc 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -80,6 +80,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--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), diff --git a/node/config.go b/node/config.go index 1b7179c..5ed57c5 100644 --- a/node/config.go +++ b/node/config.go @@ -73,10 +73,11 @@ type Flags struct { SnowRogueCommitThreshold int // Staking - StakingEnabled bool - StakingPort uint - StakingTLSKeyFile string - StakingTLSCertFile string + StakingEnabled bool + StakingPort uint + StakingDisabledWeight int + StakingTLSKeyFile string + StakingTLSCertFile string // Auth APIAuthRequired bool @@ -139,6 +140,7 @@ type FlagsYAML struct { SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` + StakingDisabledWeight *int `yaml:"staking-disabled-weight,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` StakingTLSCertFile *string `yaml:"staking-tls-cert-file,omitempty"` APIAuthRequired *bool `yaml:"api-auth-required,omitempty"` @@ -221,6 +223,7 @@ func DefaultFlags() Flags { P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, + StakingDisabledWeight: 1, StakingTLSKeyFile: "", StakingTLSCertFile: "", APIAuthRequired: false, From 5b72002feb548661cc2e20f65594d3f4f32fb427 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 11:14:45 -0800 Subject: [PATCH 05/25] Add --benchlist-duration flag. --- cmd/startnode.go | 2 ++ network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 7 ++++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/startnode.go b/cmd/startnode.go index d17584c..a417539 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -167,4 +167,6 @@ func init() { StartnodeCmd.Flags().StringVar(&flags.IPCSPath, "ipcs-path", flags.IPCSPath, "The directory (Unix) or named pipe prefix (Windows) for IPC sockets. Defaults to /tmp.") 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`") } diff --git a/network/startnode.sh b/network/startnode.sh index eb17d64..f798369 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -37,6 +37,7 @@ do --bootstrap-ids=*|\ --db-enabled=*|\ --log-level=*|\ + --benchlist-duration=*|\ --version=*|\ --snow-avalanche-batch-size=*|\ --snow-avalanche-num-parents=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index 69f54e5..77c509f 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -95,6 +95,7 @@ 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, } if sepBase { args = append(args, "--data-dir="+basedir) diff --git a/node/config.go b/node/config.go index 62049c9..63812c4 100644 --- a/node/config.go +++ b/node/config.go @@ -102,6 +102,9 @@ type Flags struct { // File Descriptor Limit FDLimit int + + // Benchlist + BenchlistDuration string } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -157,6 +160,7 @@ type FlagsYAML struct { IPCSChainIDs *string `yaml:"ipcs-chain-ids,omitempty"` IPCSPath *string `yaml:"ipcs-path,omitempty"` FDLimit *int `yaml:"fd-limit,omitempty"` + BenchlistDuration *string `yaml:"benchlist-duration,omitempty"` } // SetDefaults sets any zero-value field to its default value @@ -230,7 +234,7 @@ func DefaultFlags() Flags { StakingTLSCertFile: "", APIAuthRequired: false, APIAuthPassword: "", - MinStakeDuration: "", + MinStakeDuration: "336h", APIHealthEnabled: true, ConfigFile: "", WhitelistedSubnets: "", @@ -240,5 +244,6 @@ func DefaultFlags() Flags { IPCSChainIDs: "", IPCSPath: "/tmp", FDLimit: 32768, + BenchlistDuration: "1h", } } From 41071f959751c995740102b91368e0377acc858a Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 11:34:54 -0800 Subject: [PATCH 06/25] Add --benchlist-peer-summary-enabled flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 ++++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..cbfc2d3 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -169,4 +169,5 @@ 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().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().BoolVar(&flags.BenchlistPeerSummaryEnabled, "benchlist-peer-summary-enabled", flags.BenchlistPeerSummaryEnabled, "Enables peer specific query latency metrics. Defaults to `false`") } diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..acc4ca8 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -38,6 +38,7 @@ do --db-enabled=*|\ --log-level=*|\ --benchlist-fail-threshold=*|\ + --benchlist-peer-summary-enabled=*|\ --version=*|\ --snow-avalanche-batch-size=*|\ --snow-avalanche-num-parents=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..d50f442 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -96,6 +96,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--ipcs-path=" + flags.IPCSPath, "--fd-limit=" + strconv.Itoa(flags.FDLimit), "--benchlist-fail-threshold=" + strconv.Itoa(flags.BenchlistFailThreshold), + "--benchlist-peer-summary-enabled=" + strconv.FormatBool(flags.BenchlistPeerSummaryEnabled), } if sepBase { args = append(args, "--data-dir="+basedir) diff --git a/node/config.go b/node/config.go index 0716cc4..2a082f2 100644 --- a/node/config.go +++ b/node/config.go @@ -104,7 +104,8 @@ type Flags struct { FDLimit int // Benchlist - BenchlistFailThreshold int + BenchlistFailThreshold int + BenchlistPeerSummaryEnabled bool } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -161,6 +162,7 @@ type FlagsYAML struct { IPCSPath *string `yaml:"ipcs-path,omitempty"` FDLimit *int `yaml:"fd-limit,omitempty"` BenchlistFailThreshold *int `yaml:"benchlist-fail-threshold,omitempty"` + BenchlistPeerSummaryEnabled *bool `yaml:"benchlist-peer-summary-enabled,omitempty"` } // SetDefaults sets any zero-value field to its default value @@ -245,5 +247,6 @@ func DefaultFlags() Flags { IPCSPath: "/tmp", FDLimit: 32768, BenchlistFailThreshold: 10, + BenchlistPeerSummaryEnabled: false, } } From b91c6fd1cd0dee765285a005265ec17478ca6678 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 11:43:16 -0800 Subject: [PATCH 07/25] Add `--benchlist-min-failing-duration` flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 ++++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..7064299 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -169,4 +169,5 @@ 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().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`") } diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..d851a72 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -38,6 +38,7 @@ do --db-enabled=*|\ --log-level=*|\ --benchlist-fail-threshold=*|\ + --benchlist-min-failing-duration=*|\ --version=*|\ --snow-avalanche-batch-size=*|\ --snow-avalanche-num-parents=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..f086b77 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -96,6 +96,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--ipcs-path=" + flags.IPCSPath, "--fd-limit=" + strconv.Itoa(flags.FDLimit), "--benchlist-fail-threshold=" + strconv.Itoa(flags.BenchlistFailThreshold), + "--benchlist-min-failing-duration=" + flags.BenchlistMinFailingDuration, } if sepBase { args = append(args, "--data-dir="+basedir) diff --git a/node/config.go b/node/config.go index 0716cc4..edf6ead 100644 --- a/node/config.go +++ b/node/config.go @@ -104,7 +104,8 @@ type Flags struct { FDLimit int // Benchlist - BenchlistFailThreshold int + BenchlistFailThreshold int + BenchlistMinFailingDuration string } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -161,6 +162,7 @@ type FlagsYAML struct { IPCSPath *string `yaml:"ipcs-path,omitempty"` FDLimit *int `yaml:"fd-limit,omitempty"` BenchlistFailThreshold *int `yaml:"benchlist-fail-threshold,omitempty"` + BenchlistMinFailingDuration *string `yaml:"benchlist-min-failing-duration,omitempty"` } // SetDefaults sets any zero-value field to its default value @@ -245,5 +247,6 @@ func DefaultFlags() Flags { IPCSPath: "/tmp", FDLimit: 32768, BenchlistFailThreshold: 10, + BenchlistMinFailingDuration: "5m", } } From 1decbdce50908055c1f6cd544985c38771a225e8 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 11:53:16 -0800 Subject: [PATCH 08/25] Add `--add-consensus-gossip-frequency` flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..2942263 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -145,6 +145,7 @@ func init() { StartnodeCmd.Flags().IntVar(&flags.SnowQuorumSize, "snow-quorum-size", flags.SnowQuorumSize, "Alpha value to use for required number positive results.") 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().StringVar(&flags.ConsensusGossipFrequency, "consensus-gossip-frequency", flags.ConsensusGossipFrequency, "Time between gossiping accepted frontiers. Defaults to `10s`") 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.") diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..37b7ff5 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -38,6 +38,7 @@ do --db-enabled=*|\ --log-level=*|\ --benchlist-fail-threshold=*|\ + --consensus-gossip-frequency=*|\ --version=*|\ --snow-avalanche-batch-size=*|\ --snow-avalanche-num-parents=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..8e47e37 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--consensus-gossip-frequency=" + flags.ConsensusGossipFrequency, "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..fed8a73 100644 --- a/node/config.go +++ b/node/config.go @@ -74,6 +74,7 @@ type Flags struct { SnowQuorumSize int SnowVirtuousCommitThreshold int SnowRogueCommitThreshold int + ConsensusGossipFrequency string // Staking StakingEnabled bool @@ -144,6 +145,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + ConsensusGossipFrequency *string `yaml:"consensus-gossip-frequency,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +229,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + ConsensusGossipFrequency: "10s", P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From 49a8172f1855edb8e1d2d5846315829f2d0c3c64 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 11:59:17 -0800 Subject: [PATCH 09/25] Add `--consensus-shutdown-timeout` flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..6633db9 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -145,6 +145,7 @@ func init() { StartnodeCmd.Flags().IntVar(&flags.SnowQuorumSize, "snow-quorum-size", flags.SnowQuorumSize, "Alpha value to use for required number positive results.") 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().StringVar(&flags.ConsensusShutdownTimeout, "consensus-shutdown-timeout", flags.ConsensusShutdownTimeout, "imeout before killing an unresponsive chain. Defaults to `5s`") 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.") diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..3c71b3c 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --consensus-shutdown-timeout=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..05fd417 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--consensus-shutdown-timeout=" + flags.ConsensusShutdownTimeout, "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..0a34ab8 100644 --- a/node/config.go +++ b/node/config.go @@ -74,6 +74,7 @@ type Flags struct { SnowQuorumSize int SnowVirtuousCommitThreshold int SnowRogueCommitThreshold int + ConsensusShutdownTimeout string // Staking StakingEnabled bool @@ -144,6 +145,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + ConsensusShutdownTimeout *string `yaml:"consensus-shutdown-timeout,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +229,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + ConsensusShutdownTimeout: "5s", P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From c62af66e7acd0a0fef42f4134742d8848ab0db1e Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 12:05:04 -0800 Subject: [PATCH 10/25] Add `--add-creation-tx-fee` flag --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..bc90468 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -145,6 +145,7 @@ func init() { StartnodeCmd.Flags().IntVar(&flags.SnowQuorumSize, "snow-quorum-size", flags.SnowQuorumSize, "Alpha value to use for required number positive results.") 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.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.") diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..edbef6c 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --creation-tx-fee=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..216483a 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--creation-tx-fee=" + strconv.Itoa(flags.CreationTxFee), "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..b6c07ac 100644 --- a/node/config.go +++ b/node/config.go @@ -74,6 +74,7 @@ type Flags struct { SnowQuorumSize int SnowVirtuousCommitThreshold int SnowRogueCommitThreshold int + CreationTxFee int // Staking StakingEnabled bool @@ -144,6 +145,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + CreationTxFee *int `yaml:"creation-tx-fee,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +229,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + CreationTxFee: 1000000, P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From 87b21d0c85a3af975ecac146be735b66848aa770 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 12:16:47 -0800 Subject: [PATCH 11/25] Add `--min-delegation-fee` flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..ed8c95c 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -145,6 +145,7 @@ func init() { StartnodeCmd.Flags().IntVar(&flags.SnowQuorumSize, "snow-quorum-size", flags.SnowQuorumSize, "Alpha value to use for required number positive results.") 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.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().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.") diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..c4dcf00 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --min-delegation-fee=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..59ec096 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--min-delegation-fee=" + strconv.Itoa(flags.MinDelegationFee), "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..6856732 100644 --- a/node/config.go +++ b/node/config.go @@ -74,6 +74,7 @@ type Flags struct { SnowQuorumSize int SnowVirtuousCommitThreshold int SnowRogueCommitThreshold int + MinDelegationFee int // Staking StakingEnabled bool @@ -144,6 +145,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + MinDelegationFee *int `yaml:"min-delegation-fee,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +229,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + MinDelegationFee: 20000, P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From 63abcb347d9afa63e49b7905abff1032056981ca Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 12:27:23 -0800 Subject: [PATCH 12/25] Add `--min-validator-stake` flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..9ebdcdc 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -145,6 +145,7 @@ func init() { StartnodeCmd.Flags().IntVar(&flags.SnowQuorumSize, "snow-quorum-size", flags.SnowQuorumSize, "Alpha value to use for required number positive results.") 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.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().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.") diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..1de9612 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --min-validator-stake=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..133848b 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--min-validator-stake=" + strconv.Itoa(flags.MinValidatorStake), "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..5894e81 100644 --- a/node/config.go +++ b/node/config.go @@ -74,6 +74,7 @@ type Flags struct { SnowQuorumSize int SnowVirtuousCommitThreshold int SnowRogueCommitThreshold int + MinValidatorStake int // Staking StakingEnabled bool @@ -144,6 +145,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + MinValidatorStake *int `yaml:"min-validator-stake,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +229,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + MinValidatorStake: 5000000, P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From 5af0b87c439006fa1f6ac56ab4e5b8dad60bd5d0 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 12:32:06 -0800 Subject: [PATCH 13/25] Add `--max-stake-duration` flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..7917807 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -145,6 +145,7 @@ func init() { StartnodeCmd.Flags().IntVar(&flags.SnowQuorumSize, "snow-quorum-size", flags.SnowQuorumSize, "Alpha value to use for required number positive results.") 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().StringVar(&flags.MaxStakeDuration, "max-stake-duration", flags.MaxStakeDuration, "The maximum staking duration, in seconds. Defaults to `8760h` (365 days) on Main Net.") 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.") diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..36ded0c 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --max-stake-duration=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..3acf607 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--max-stake-duration=" + flags.MaxStakeDuration, "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..1039cd7 100644 --- a/node/config.go +++ b/node/config.go @@ -74,6 +74,7 @@ type Flags struct { SnowQuorumSize int SnowVirtuousCommitThreshold int SnowRogueCommitThreshold int + MaxStakeDuration string // Staking StakingEnabled bool @@ -144,6 +145,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + MaxStakeDuration *string `yaml:"max-stake-duration,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +229,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + MaxStakeDuration: "8760h", P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From d2dbfe10b1a1c529c71da106ff2af27d1b3b3d4b Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 12:38:15 -0800 Subject: [PATCH 14/25] Add `--max-validator-stake` flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..bfdc88a 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -145,6 +145,7 @@ func init() { StartnodeCmd.Flags().IntVar(&flags.SnowQuorumSize, "snow-quorum-size", flags.SnowQuorumSize, "Alpha value to use for required number positive results.") 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.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().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.") diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..9549072 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --max-validator-stake=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..9bcd447 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--max-validator-stake=" + strconv.Itoa(flags.MaxValidatorStake), "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..1989473 100644 --- a/node/config.go +++ b/node/config.go @@ -74,6 +74,7 @@ type Flags struct { SnowQuorumSize int SnowVirtuousCommitThreshold int SnowRogueCommitThreshold int + MaxValidatorStake int // Staking StakingEnabled bool @@ -144,6 +145,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + MaxValidatorStake *int `yaml:"max-stake-duration,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +229,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + MaxValidatorStake: 3000000000000000, P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From a439ba251b066c47582c59cf3707ebf7d74ec736 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 12:44:14 -0800 Subject: [PATCH 15/25] Add `--snow-concurrent-repolls` flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..b944e00 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -145,6 +145,7 @@ func init() { StartnodeCmd.Flags().IntVar(&flags.SnowQuorumSize, "snow-quorum-size", flags.SnowQuorumSize, "Alpha value to use for required number positive results.") 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.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().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.") diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..82c6e74 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --snow-concurrent-repolls=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..2b43344 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--snow-concurrent-repolls=" + strconv.Itoa(flags.SnowConcurrentRepolls), "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..75bacd0 100644 --- a/node/config.go +++ b/node/config.go @@ -74,6 +74,7 @@ type Flags struct { SnowQuorumSize int SnowVirtuousCommitThreshold int SnowRogueCommitThreshold int + SnowConcurrentRepolls int // Staking StakingEnabled bool @@ -144,6 +145,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + SnowConcurrentRepolls *int `yaml:"snow-concurrent-repolls,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +229,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + SnowConcurrentRepolls: 4, P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From ce2a69553a41458f921daaedd9374826f0ff0da4 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 12:51:28 -0800 Subject: [PATCH 16/25] Add `--stake-minting-period` flag. --- cmd/startnode.go | 1 + network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..7fb4618 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -145,6 +145,7 @@ func init() { StartnodeCmd.Flags().IntVar(&flags.SnowQuorumSize, "snow-quorum-size", flags.SnowQuorumSize, "Alpha value to use for required number positive results.") 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().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().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.") diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..ff6d76c 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --stake-minting-period=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..aab9cca 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--stake-minting-period=" + flags.StakeMintingPeriod, "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..73c5ce9 100644 --- a/node/config.go +++ b/node/config.go @@ -74,6 +74,7 @@ type Flags struct { SnowQuorumSize int SnowVirtuousCommitThreshold int SnowRogueCommitThreshold int + StakeMintingPeriod string // Staking StakingEnabled bool @@ -144,6 +145,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + StakeMintingPeriod *string `yaml:"stake-minting-period,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +229,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + StakeMintingPeriod: "8760h", P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From 9229e05dffc80bee06e05656daa516bfead2101c Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 13:09:25 -0800 Subject: [PATCH 17/25] Add `--max-non-staker-pending-msgs` flag. --- cmd/startnode.go | 2 ++ network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 +++++ 4 files changed, 9 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..779ec75 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -169,4 +169,6 @@ 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().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().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`") } diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..9e16937 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --max-non-staker-pending-msgs=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..c2ccb64 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--max-non-staker-pending-msgs=" + strconv.Itoa(flags.MaxNonStakerPendingMsgs), "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..30544c4 100644 --- a/node/config.go +++ b/node/config.go @@ -105,6 +105,9 @@ type Flags struct { // Benchlist BenchlistFailThreshold int + + // Message Handling + MaxNonStakerPendingMsgs int } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -144,6 +147,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + MaxNonStakerPendingMsgs *int `yaml:"max-non-staker-pending-msgs,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +231,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + MaxNonStakerPendingMsgs: 20, P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From ca4a54d31e5029b16791b51ad7104f49c552ef5d Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 13:26:37 -0800 Subject: [PATCH 18/25] Add `--network-initial-timeout` flag. --- cmd/startnode.go | 2 ++ network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 +++++ 4 files changed, 9 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..d89b458 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -169,4 +169,6 @@ 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().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.NetworkInitialTimeout, "network-initial-timeout", flags.NetworkInitialTimeout, "Initial timeout value of the adaptive timeout manager, in nanoseconds. Defaults to `5s`") } diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..0d8c400 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --network-initial-timeout=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..ec8d4fa 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--network-initial-timeout=" + flags.NetworkInitialTimeout, "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..6e43ba5 100644 --- a/node/config.go +++ b/node/config.go @@ -105,6 +105,9 @@ type Flags struct { // Benchlist BenchlistFailThreshold int + + // Network Timeout + NetworkInitialTimeout string } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -144,6 +147,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + NetworkInitialTimeout *string `yaml:"network-initial-timeout,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +231,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + NetworkInitialTimeout: "5s", P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From 1cfa3f77b17e2690dacbf8221c72a6bbe3ca4aa2 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 13:35:29 -0800 Subject: [PATCH 19/25] Add `--network-minimum-timeout` flag. --- cmd/startnode.go | 2 ++ network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 +++++ 4 files changed, 9 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..f77d332 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -169,4 +169,6 @@ 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().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.NetworkMinimumTimeout, "network-minimum-timeout", flags.NetworkMinimumTimeout, "Minimum timeout value of the adaptive timeout manager, in nanoseconds. Defaults to `5s`") } diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..1fea833 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --network-minimum-timeout=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..45b744d 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--network-minimum-timeout=" + flags.NetworkMinimumTimeout, "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..3fb773d 100644 --- a/node/config.go +++ b/node/config.go @@ -105,6 +105,9 @@ type Flags struct { // Benchlist BenchlistFailThreshold int + + // Network Timeout + NetworkMinimumTimeout string } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -144,6 +147,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + NetworkMinimumTimeout *string `yaml:"network-minimum-timeout,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +231,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + NetworkMinimumTimeout: "5s", P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From 8528c8be57337776d775b2430cd2c96a5a1d35ce Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 13:40:41 -0800 Subject: [PATCH 20/25] Add `--network-maximum-timeout` flag. --- cmd/startnode.go | 3 +++ network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 +++++ 4 files changed, 10 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..48bbe34 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -169,4 +169,7 @@ 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().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.NetworkMaximumTimeout, "network-maximum-timeout", flags.NetworkMaximumTimeout, "Maximum timeout value of the adaptive timeout manager, in nanoseconds. Defaults to `10s`") + } diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..64f2b03 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --network-maximum-timeout=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..0560909 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -78,6 +78,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--snow-quorum-size=" + strconv.Itoa(flags.SnowQuorumSize), "--snow-virtuous-commit-threshold=" + strconv.Itoa(flags.SnowVirtuousCommitThreshold), "--snow-rogue-commit-threshold=" + strconv.Itoa(flags.SnowRogueCommitThreshold), + "--network-maximum-timeout=" + flags.NetworkMaximumTimeout, "--p2p-tls-enabled=" + strconv.FormatBool(flags.P2PTLSEnabled), "--staking-enabled=" + strconv.FormatBool(flags.StakingEnabled), "--staking-port=" + stakingPortString, diff --git a/node/config.go b/node/config.go index 0716cc4..489fc45 100644 --- a/node/config.go +++ b/node/config.go @@ -105,6 +105,9 @@ type Flags struct { // Benchlist BenchlistFailThreshold int + + // Network Timeout + NetworkMaximumTimeout string } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -144,6 +147,7 @@ type FlagsYAML struct { SnowQuorumSize *int `yaml:"snow-quorum-size,omitempty"` SnowVirtuousCommitThreshold *int `yaml:"snow-virtuous-commit-threshold,omitempty"` SnowRogueCommitThreshold *int `yaml:"snow-rogue-commit-threshold,omitempty"` + NetworkMaximumTimeout *string `yaml:"network-maximum-timeout,omitempty"` StakingEnabled *bool `yaml:"staking-enabled,omitempty"` StakingPort *uint `yaml:"staking-port,omitempty"` StakingTLSKeyFile *string `yaml:"staking-tls-key-file,omitempty"` @@ -227,6 +231,7 @@ func DefaultFlags() Flags { SnowQuorumSize: 2, SnowVirtuousCommitThreshold: 5, SnowRogueCommitThreshold: 10, + NetworkMaximumTimeout: "10s", P2PTLSEnabled: true, StakingEnabled: false, StakingPort: 9651, From b34824f414cb60fdac0183543435f1709236d3f3 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 13:58:39 -0800 Subject: [PATCH 21/25] Add `--restart-on-disconnected` flag. --- cmd/startnode.go | 2 ++ network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 +++++ 4 files changed, 9 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..617305d 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -169,4 +169,6 @@ 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().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().BoolVar(&flags.RestartOnDisconnected, "restart-on-disconnected", flags.RestartOnDisconnected, "Defaults to `false`") } diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..e096e79 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --restart-on-disconnected=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..60ad7fa 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -96,6 +96,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--ipcs-path=" + flags.IPCSPath, "--fd-limit=" + strconv.Itoa(flags.FDLimit), "--benchlist-fail-threshold=" + strconv.Itoa(flags.BenchlistFailThreshold), + "--restart-on-disconnected=" + strconv.FormatBool(flags.RestartOnDisconnected), } if sepBase { args = append(args, "--data-dir="+basedir) diff --git a/node/config.go b/node/config.go index 0716cc4..31cf050 100644 --- a/node/config.go +++ b/node/config.go @@ -105,6 +105,9 @@ type Flags struct { // Benchlist BenchlistFailThreshold int + + // Restart on Disconnect + RestartOnDisconnected bool } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -161,6 +164,7 @@ type FlagsYAML struct { IPCSPath *string `yaml:"ipcs-path,omitempty"` FDLimit *int `yaml:"fd-limit,omitempty"` BenchlistFailThreshold *int `yaml:"benchlist-fail-threshold,omitempty"` + RestartOnDisconnected *bool `yaml:"restart-on-disconnected,omitempty"` } // SetDefaults sets any zero-value field to its default value @@ -245,5 +249,6 @@ func DefaultFlags() Flags { IPCSPath: "/tmp", FDLimit: 32768, BenchlistFailThreshold: 10, + RestartOnDisconnected: true, } } From 4442f6a1de833aaea0f8a61c71d8ccd2437f4e85 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 14:03:21 -0800 Subject: [PATCH 22/25] Add `--disconnected-check-frequency` flag. --- cmd/startnode.go | 2 ++ network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 +++++ 4 files changed, 9 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..4a968ee 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -169,4 +169,6 @@ 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().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.DisconnectedCheckFrequency, "disconnected-check-frequency", flags.DisconnectedCheckFrequency, "Defaults to `10s`") } diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..d4d4b7c 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --disconnected-check-frequency=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..76565ff 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -96,6 +96,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--ipcs-path=" + flags.IPCSPath, "--fd-limit=" + strconv.Itoa(flags.FDLimit), "--benchlist-fail-threshold=" + strconv.Itoa(flags.BenchlistFailThreshold), + "--disconnected-check-frequency=" + flags.DisconnectedCheckFrequency, } if sepBase { args = append(args, "--data-dir="+basedir) diff --git a/node/config.go b/node/config.go index 0716cc4..e754611 100644 --- a/node/config.go +++ b/node/config.go @@ -105,6 +105,9 @@ type Flags struct { // Benchlist BenchlistFailThreshold int + + // Restart on Disconnect + DisconnectedCheckFrequency string } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -161,6 +164,7 @@ type FlagsYAML struct { IPCSPath *string `yaml:"ipcs-path,omitempty"` FDLimit *int `yaml:"fd-limit,omitempty"` BenchlistFailThreshold *int `yaml:"benchlist-fail-threshold,omitempty"` + DisconnectedCheckFrequency *string `yaml:"disconnected-check-frequency,omitempty"` } // SetDefaults sets any zero-value field to its default value @@ -245,5 +249,6 @@ func DefaultFlags() Flags { IPCSPath: "/tmp", FDLimit: 32768, BenchlistFailThreshold: 10, + DisconnectedCheckFrequency: "10s", } } From 996f373b6db312332543626e441163e7bb565ee1 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Tue, 22 Dec 2020 14:08:38 -0800 Subject: [PATCH 23/25] Add `--diconnected-restart-timeout` flag. --- cmd/startnode.go | 2 ++ network/startnode.sh | 1 + node/cli_tools.go | 1 + node/config.go | 5 +++++ 4 files changed, 9 insertions(+) diff --git a/cmd/startnode.go b/cmd/startnode.go index 56cd93a..3dbf809 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -169,4 +169,6 @@ 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().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.DisconnectedRestartTimeout, "disconnected-restart-timeout", flags.DisconnectedRestartTimeout, "Defaults to `1m`") } diff --git a/network/startnode.sh b/network/startnode.sh index 29c894f..8d8512b 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -45,6 +45,7 @@ do --snow-quorum-size=*|\ --snow-virtuous-commit-threshold=*|\ --snow-rogue-commit-threshold=*|\ + --disconnected-restart-timeout=*|\ --p2p-tls-enabled=*|\ --staking-enabled=*|\ --staking-tls-key-file=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index f9bc9ff..3dc65d2 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -96,6 +96,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--ipcs-path=" + flags.IPCSPath, "--fd-limit=" + strconv.Itoa(flags.FDLimit), "--benchlist-fail-threshold=" + strconv.Itoa(flags.BenchlistFailThreshold), + "--disconnected-restart-timeout=" + flags.DisconnectedRestartTimeout, } if sepBase { args = append(args, "--data-dir="+basedir) diff --git a/node/config.go b/node/config.go index 0716cc4..b15d3ea 100644 --- a/node/config.go +++ b/node/config.go @@ -105,6 +105,9 @@ type Flags struct { // Benchlist BenchlistFailThreshold int + + // Restart on Disconnect + DisconnectedRestartTimeout string } // FlagsYAML mimics Flags but uses pointers for proper YAML interpretation @@ -161,6 +164,7 @@ type FlagsYAML struct { IPCSPath *string `yaml:"ipcs-path,omitempty"` FDLimit *int `yaml:"fd-limit,omitempty"` BenchlistFailThreshold *int `yaml:"benchlist-fail-threshold,omitempty"` + DisconnectedRestartTimeout *string `yaml:"disconnected-restart-timeout,omitempty"` } // SetDefaults sets any zero-value field to its default value @@ -245,5 +249,6 @@ func DefaultFlags() Flags { IPCSPath: "/tmp", FDLimit: 32768, BenchlistFailThreshold: 10, + DisconnectedRestartTimeout: "1m", } } From e89a6137d7964d319356619a5810003537b04e54 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Wed, 30 Dec 2020 10:36:12 -0800 Subject: [PATCH 24/25] Add default value. --- node/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/config.go b/node/config.go index 8b639a2..61fab5f 100644 --- a/node/config.go +++ b/node/config.go @@ -243,7 +243,7 @@ func DefaultFlags() Flags { LogLevel: "info", LogDir: "logs", LogDisplayLevel: "", // defaults to the value provided to --log-level - LogDisplayHighlight: "", + LogDisplayHighlight: "colors", SnowAvalancheBatchSize: 30, SnowAvalancheNumParents: 5, SnowSampleSize: 2, From ad01ad9e42d4a1343f297d4f8e2b155a1467aa17 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Wed, 30 Dec 2020 11:05:42 -0800 Subject: [PATCH 25/25] Bring back lost values. --- node/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/node/config.go b/node/config.go index 3414ede..71dae5a 100644 --- a/node/config.go +++ b/node/config.go @@ -135,7 +135,9 @@ type FlagsYAML struct { TxFee *uint `yaml:"tx-fee,omitempty"` PublicIP *string `yaml:"public-ip,omitempty"` DynamicPublicIP *string `yaml:"dynamic-public-ip,omitempty"` + NetworkID *string `yaml:"network-id,omitempty"` XputServerPort *uint `yaml:"xput-server-port,omitempty"` + XputServerEnabled *bool `yaml:"xput-server-enabled,omitempty"` SignatureVerificationEnabled *bool `yaml:"signature-verification-enabled,omitempty"` APIAdminEnabled *bool `yaml:"api-admin-enabled,omitempty"` APIIPCsEnabled *bool `yaml:"api-ipcs-enabled,omitempty"`