Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .hack/devnet/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ yq_docker -oy '

WITHOUT_SHIM="${WITHOUT_SHIM:-false}"
if [ "$WITHOUT_SHIM" = "false" ]; then
# Add or update the --devnet-shim argument for bootnodoor_params.extra_args, ensuring only one instance with latest HOST_IP:9000 value exists
# Add or update the --devnet-shim argument for bootnodoor_params.extra_args, ensuring only one instance with latest HOST_IP value exists
yq_docker -oy '
.bootnodoor_params = (.bootnodoor_params // {})
| .bootnodoor_params.extra_args = (
(
(.bootnodoor_params.extra_args // [])
| map(select(test("^--devnet-shim=") | not))
) + ["--devnet-shim='"${HOST_IP}"':9000"]
) + ["--devnet-shim='"${HOST_IP}"'"]
)
' generated-kurtosis-config.yaml > "${__dir}/generated-kurtosis-config.yaml.tmp" && mv "${__dir}/generated-kurtosis-config.yaml.tmp" "${__dir}/generated-kurtosis-config.yaml"
fi
Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ devnet-run: devnet
--cl-config .hack/devnet/generated-cl-config.yaml \
--genesis-validators-root $$(cat .hack/devnet/generated-cl-gvr.txt) \
--nodedb .hack/devnet/generated-database.sqlite \
--enable-el=true \
--enable-cl=true \
--web-ui \
--log-level info

Expand Down
77 changes: 43 additions & 34 deletions bootnode/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// - Discovery v5 (discv5) for both EL and CL nodes
// - Dual routing tables (separate for EL and CL)
// - Fork-aware filtering
// - Protocol multiplexing (both protocols on same UDP port)
// - Separate ports for EL and CL (each with its own ENR)
package bootnode

import (
Expand Down Expand Up @@ -34,8 +34,11 @@ type Config struct {
// BindIP is the IP address to bind to (default: 0.0.0.0)
BindIP net.IP

// BindPort is the UDP port to bind to (default: 30303)
BindPort uint16
// ELBindPort is the UDP port for EL discovery (discv4 + discv5) (default: 30303)
ELBindPort uint16

// CLBindPort is the UDP port for CL discovery (discv5 only) (default: 9000)
CLBindPort uint16

// ENR configuration

Expand All @@ -45,8 +48,11 @@ type Config struct {
// ENRIP6 is the IPv6 address to advertise in ENR (optional)
ENRIP6 net.IP

// ENRPort is the UDP port to advertise in ENR (default: same as BindPort)
ENRPort uint16
// ELENRPort is the UDP port to advertise in EL ENR (default: same as ELBindPort)
ELENRPort uint16

// CLENRPort is the UDP port to advertise in CL ENR (default: same as CLBindPort)
CLENRPort uint16

// Execution Layer configuration

Expand Down Expand Up @@ -89,12 +95,6 @@ type Config struct {

// Protocol configuration

// EnableDiscv4 enables Discovery v4 protocol (default: true)
EnableDiscv4 bool

// EnableDiscv5 enables Discovery v5 protocol (default: true)
EnableDiscv5 bool

// SessionLifetime is the discv5 session lifetime (default: 12 hours)
SessionLifetime time.Duration

Expand Down Expand Up @@ -123,19 +123,17 @@ type Config struct {
// - One of: ELConfig or CLConfig (or both)
func DefaultConfig() *Config {
return &Config{
BindIP: net.IPv4zero,
BindPort: 30303,
MaxActiveNodes: 500,
MaxNodesPerIP: 10,
PingInterval: 30 * time.Second,
MaxNodeAge: 24 * time.Hour,
MaxFailures: 3,
EnableDiscv4: true,
EnableDiscv5: true,
SessionLifetime: 12 * time.Hour,
MaxSessions: 1024,
EnableIPDiscovery: false,
GracePeriod: 60 * time.Minute,
BindIP: net.IPv4zero,
ELBindPort: 30303,
CLBindPort: 9000,
MaxActiveNodes: 500,
MaxNodesPerIP: 10,
PingInterval: 30 * time.Second,
MaxNodeAge: 24 * time.Hour,
MaxFailures: 3,
SessionLifetime: 12 * time.Hour,
MaxSessions: 1024,
GracePeriod: 60 * time.Minute,
}
}

Expand All @@ -162,16 +160,19 @@ func (c *Config) Validate() error {
if c.ELGenesisTime == 0 {
return fmt.Errorf("ELGenesisTime is required when ELConfig is set")
}
if c.ELBindPort == 0 {
return fmt.Errorf("ELBindPort is required when ELConfig is set")
}
}

// Must have at least one protocol enabled
if !c.EnableDiscv4 && !c.EnableDiscv5 {
return fmt.Errorf("at least one of EnableDiscv4 or EnableDiscv5 must be true")
// Validate CL config if provided
if c.CLConfig != nil && c.CLBindPort == 0 {
return fmt.Errorf("CLBindPort is required when CLConfig is set")
}

// Discv4 requires EL config (CL nodes don't use discv4)
if c.EnableDiscv4 && c.ELConfig == nil {
return fmt.Errorf("EnableDiscv4 requires ELConfig to be set (discv4 is EL-only)")
// Ensure ports don't collide when both layers are enabled
if c.ELConfig != nil && c.CLConfig != nil && c.ELBindPort == c.CLBindPort {
return fmt.Errorf("ELBindPort and CLBindPort must be different when both layers are enabled (both set to %d)", c.ELBindPort)
}

if c.MaxActiveNodes <= 0 {
Expand All @@ -191,12 +192,20 @@ func (c *Config) ApplyDefaults() {
c.BindIP = net.IPv4zero
}

if c.BindPort == 0 {
c.BindPort = 30303
if c.ELBindPort == 0 {
c.ELBindPort = 30303
}

if c.CLBindPort == 0 {
c.CLBindPort = 9000
}

if c.ELENRPort == 0 {
c.ELENRPort = c.ELBindPort
}

if c.ENRPort == 0 {
c.ENRPort = c.BindPort
if c.CLENRPort == 0 {
c.CLENRPort = c.CLBindPort
}

if c.MaxActiveNodes == 0 {
Expand Down
Loading