Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use inbound/outbound max peers for Reth. #675

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions shared/services/config/reth-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

// Max number of P2P inbound peers to connect to.
MaxInboundPeers config.Parameter `yaml:"maxInboundPeers,omitempty"`

// The archive mode flag
ArchiveMode config.Parameter `yaml:"archiveMode,omitempty"`

Expand Down Expand Up @@ -74,15 +77,26 @@ 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},
CanBeBlank: false,
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.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kinda annoying that this will render for non-reth users. did you look for a way to hide it from the tui when other ECs are selected?

Copy link
Member Author

@0xfornax 0xfornax Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't! It's a Reth specific parameter. You can check this behavior on the v.1.13.9-dev build.

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",
Expand Down Expand Up @@ -146,16 +160,17 @@ 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
func (cfg *RethConfig) GetParameters() []*config.Parameter {
return []*config.Parameter{
&cfg.CacheSize,
&cfg.MaxPeers,
&cfg.MaxInboundPeers,
&cfg.ArchiveMode,
&cfg.ContainerTag,
&cfg.AdditionalFlags,
Expand Down
Loading