From d6a985d2fb6814e54bc1204f5314dd5491650c47 Mon Sep 17 00:00:00 2001 From: Fornax <23104993+fornax2@users.noreply.github.com> Date: Fri, 11 Oct 2024 14:55:29 -0300 Subject: [PATCH 1/2] Use inbound/outbound max peers for Reth. --- shared/services/config/reth-params.go | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/shared/services/config/reth-params.go b/shared/services/config/reth-params.go index 05e00bd02..ca7d1db16 100644 --- a/shared/services/config/reth-params.go +++ b/shared/services/config/reth-params.go @@ -31,9 +31,12 @@ type RethConfig struct { // Size of Reth's Cache CacheSize config.Parameter `yaml:"cacheSize,omitempty"` - // Max number of P2P peers to connect to + // Max number of P2P peers to connect to. For Reth this will map to max outbound peers MaxPeers config.Parameter `yaml:"maxPeers,omitempty"` + // Mas number of P2P inbound peers to connect to. + MaxInboundPeers config.Parameter `yaml:"maxInboundPeers,omitempty"` + // The archive mode flag ArchiveMode config.Parameter `yaml:"archiveMode,omitempty"` @@ -74,8 +77,8 @@ func NewRethConfig(cfg *RocketPoolConfig) *RethConfig { MaxPeers: config.Parameter{ ID: "maxPeers", - Name: "Max Peers", - Description: "The maximum number of peers Reth should connect to. This can be lowered to improve performance on low-power systems or constrained networks. We recommend keeping it at 12 or higher.", + Name: "Max Outbound Peers", + Description: "The maximum number of outbound peers Reth should connect to. This can be lowered to improve performance on low-power systems or constrained networks. We recommend keeping it at 12 or higher.", Type: config.ParameterType_Uint16, Default: map[config.Network]interface{}{config.Network_All: calculateRethPeers()}, AffectsContainers: []config.ContainerID{config.ContainerID_Eth1}, @@ -83,6 +86,17 @@ func NewRethConfig(cfg *RocketPoolConfig) *RethConfig { OverwriteOnUpgrade: false, }, + MaxInboundPeers: config.Parameter{ + ID: "maxInboundPeers", + Name: "Max Inbound Peers", + Description: "The maximum number of inbound peers Reth should connect to. This can be lowered to improve performance on low-power systems or constrained networks. We recommend keeping it at 12 or higher.", + Type: config.ParameterType_Uint16, + Default: map[config.Network]interface{}{config.Network_All: uint16(30)}, + AffectsContainers: []config.ContainerID{config.ContainerID_Eth1}, + CanBeBlank: false, + OverwriteOnUpgrade: false, + }, + ArchiveMode: config.Parameter{ ID: "archiveMode", Name: "Enable Archive Mode", @@ -146,9 +160,9 @@ func calculateRethCache() uint64 { // Calculate the default number of Reth peers func calculateRethPeers() uint16 { if runtime.GOARCH == "arm64" { - return 25 + return 50 } - return 50 + return 100 } // Get the config.Parameters for this config @@ -156,6 +170,7 @@ func (cfg *RethConfig) GetParameters() []*config.Parameter { return []*config.Parameter{ &cfg.CacheSize, &cfg.MaxPeers, + &cfg.MaxInboundPeers, &cfg.ArchiveMode, &cfg.ContainerTag, &cfg.AdditionalFlags, From fe0f518c64fdc75a5cd200da9a1541b0473a5e36 Mon Sep 17 00:00:00 2001 From: Fornax <23104993+fornax2@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:50:52 -0300 Subject: [PATCH 2/2] Fix typo --- shared/services/config/reth-params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/services/config/reth-params.go b/shared/services/config/reth-params.go index ca7d1db16..035c929ad 100644 --- a/shared/services/config/reth-params.go +++ b/shared/services/config/reth-params.go @@ -34,7 +34,7 @@ type RethConfig struct { // Max number of P2P peers to connect to. For Reth this will map to max outbound peers MaxPeers config.Parameter `yaml:"maxPeers,omitempty"` - // Mas number of P2P inbound peers to connect to. + // Max number of P2P inbound peers to connect to. MaxInboundPeers config.Parameter `yaml:"maxInboundPeers,omitempty"` // The archive mode flag