From e831e3bd8cbaab4c084db9b2c8e65b2cb0f9cbb8 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Thu, 22 Jul 2021 18:20:45 -0700 Subject: [PATCH 1/2] Remove config flags * `conn-meter-reset-duration` * `conn-meter-max-conns` Add config flags * `network-compression-enabled` --- cmd/startnode.go | 3 +-- network/startnode.sh | 3 +-- node/cli_tools.go | 3 +-- node/config.go | 13 ++++--------- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/cmd/startnode.go b/cmd/startnode.go index 783f536..1599ed3 100644 --- a/cmd/startnode.go +++ b/cmd/startnode.go @@ -180,8 +180,7 @@ func init() { StartnodeCmd.Flags().StringVar(&flags.ConfigFile, "config-file", flags.ConfigFile, "Config file specifies a JSON file to configure a node instead of specifying arguments via the command line. Command line arguments will override any options set in the config file.") - StartnodeCmd.Flags().IntVar(&flags.ConnMeterMaxConns, "conn-meter-max-conns", flags.ConnMeterMaxConns, "Upgrade at most `conn-meter-max-conns` connections from a given IP per `conn-meter-reset-duration`. If `conn-meter-reset-duration` is 0, incoming connections are not rate-limited.") - StartnodeCmd.Flags().StringVar(&flags.ConnMeterResetDuration, "conn-meter-reset-duration", flags.ConnMeterResetDuration, "Upgrade at most `conn-meter-max-conns` connections from a given IP per `conn-meter-reset-duration`. If `conn-meter-reset-duration` is 0, incoming connections are not rate-limited.") + StartnodeCmd.Flags().BoolVar(&flags.NetworkCompressionEnabled, "network-compression-enabled", flags.NetworkCompressionEnabled, "If true, compress Put, PushQuery, PeerList and Multiput messages sent to peers that support compression") StartnodeCmd.Flags().StringVar(&flags.IPCSChainIDs, "ipcs-chain-ids", flags.IPCSChainIDs, "Comma separated list of chain ids to connect to. There is no default value.") StartnodeCmd.Flags().StringVar(&flags.IPCSPath, "ipcs-path", flags.IPCSPath, "The directory (Unix) or named pipe prefix (Windows) for IPC sockets. Defaults to /tmp.") diff --git a/network/startnode.sh b/network/startnode.sh index a1531d6..e9da57a 100644 --- a/network/startnode.sh +++ b/network/startnode.sh @@ -92,8 +92,7 @@ do --api-health-enabled=*|\ --config-file=*|\ --api-info-enabled=*|\ - --conn-meter-max-conns=*|\ - --conn-meter-reset-duration=*|\ + --network-compression-enabled=*|\ --ipcs-chain-ids=*|\ --ipcs-path=*|\ --log-display-level=*|\ diff --git a/node/cli_tools.go b/node/cli_tools.go index e196c04..6272dfc 100644 --- a/node/cli_tools.go +++ b/node/cli_tools.go @@ -120,8 +120,7 @@ func FlagsToArgs(flags Flags, basedir string, sepBase bool) ([]string, Metadata) "--api-health-enabled=" + strconv.FormatBool(flags.APIHealthEnabled), "--config-file=" + flags.ConfigFile, "--api-info-enabled=" + strconv.FormatBool(flags.APIInfoEnabled), - "--conn-meter-max-conns=" + strconv.Itoa(flags.ConnMeterMaxConns), - "--conn-meter-reset-duration=" + flags.ConnMeterResetDuration, + "--network-compression-enabled=" + strconv.FormatBool(flags.NetworkCompressionEnabled), "--ipcs-chain-ids=" + flags.IPCSChainIDs, "--ipcs-path=" + flags.IPCSPath, "--fd-limit=" + strconv.Itoa(flags.FDLimit), diff --git a/node/config.go b/node/config.go index 5fee667..b5b5e47 100644 --- a/node/config.go +++ b/node/config.go @@ -108,10 +108,6 @@ type Flags struct { // Config ConfigFile string - // Connection - ConnMeterMaxConns int - ConnMeterResetDuration string - // IPCS IPCSChainIDs string IPCSPath string @@ -125,7 +121,7 @@ type Flags struct { BenchlistPeerSummaryEnabled bool BenchlistDuration string - // Network Timeout + // Network NetworkInitialTimeout string NetworkMinimumTimeout string NetworkMaximumTimeout string @@ -136,6 +132,7 @@ type Flags struct { NetworkHealthMinConnPeers int NetworkTimeoutCoefficient int NetworkTimeoutHalflife string + NetworkCompressionEnabled bool // Peer List Gossiping NetworkPeerListGossipFrequency string @@ -239,8 +236,7 @@ type FlagsYAML struct { APIHealthEnabled *bool `yaml:"api-health-enabled,omitempty"` ConfigFile *string `yaml:"config-file,omitempty"` APIInfoEnabled *bool `yaml:"api-info-enabled,omitempty"` - ConnMeterMaxConns *int `yaml:"conn-meter-max-conns,omitempty"` - ConnMeterResetDuration *string `yaml:"conn-meter-reset-duration,omitempty"` + NetworkCompressionEnabled *bool `yaml:"network-compression-enabled,omitempty"` IPCSChainIDs *string `yaml:"ipcs-chain-ids,omitempty"` IPCSPath *string `yaml:"ipcs-path,omitempty"` FDLimit *int `yaml:"fd-limit,omitempty"` @@ -364,8 +360,7 @@ func DefaultFlags() Flags { ConfigFile: "", WhitelistedSubnets: "", APIInfoEnabled: true, - ConnMeterMaxConns: 5, - ConnMeterResetDuration: "", + NetworkCompressionEnabled: true, IPCSChainIDs: "", IPCSPath: "/tmp", FDLimit: 32768, From a210feef2865dcbd953febb43cb3df578c80cdf6 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Wed, 28 Jul 2021 20:02:19 -0700 Subject: [PATCH 2/2] Bump AvalancheGo dep. --- go.mod | 2 +- go.sum | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d437b11..b01cab0 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/AlecAivazis/survey/v2 v2.2.9 - github.com/ava-labs/avalanchego v1.4.9 + github.com/ava-labs/avalanchego v1.4.11 github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e github.com/gorilla/mux v1.8.0 github.com/gorilla/rpc v1.2.0 diff --git a/go.sum b/go.sum index bafe948..cf8e31a 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ github.com/ava-labs/avalanchego v1.4.7 h1:zOOASBb1pa5Wr8XO9XeKBoq/T1p1Rh1sVtDnr/ github.com/ava-labs/avalanchego v1.4.7/go.mod h1:EHvzd2TTrGTZtFjz6ytKE8jZZZTsNU3WufLWPNwCpAE= github.com/ava-labs/avalanchego v1.4.9 h1:umUiDkLbKnt3yncRvEtVbMP098JLWLubyNqIKPm/IVM= github.com/ava-labs/avalanchego v1.4.9/go.mod h1:YJeNvyrpE6PuIbLVVt+p0klHNupZYPJMs5pI1hcP4Po= +github.com/ava-labs/avalanchego v1.4.11 h1:bPj+Zj19owlGDfC4FiZ5oQj6v5xhg41qPRd7JYZG8ws= +github.com/ava-labs/avalanchego v1.4.11/go.mod h1:aleAWKvMQ/mblB4dXWWvlbq8787TmwR7+3WizYtogTM= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -121,6 +123,7 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -248,6 +251,7 @@ github.com/kr/pty v1.1.4 h1:5Myjjh3JY/NaAi4IsUbHADytDyl1VE1Y9PXDlL+P/VQ= github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/linxGnu/grocksdb v1.6.34/go.mod h1:/+iSQrn7Izt6kFhHBQvcE6FkklsKXa8hc35pFyFDrDw= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -656,6 +660,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=