From 7b9cd89609b95ae6691481f4bc118954049d9f91 Mon Sep 17 00:00:00 2001 From: maradini77 <140460067+maradini77@users.noreply.github.com> Date: Mon, 24 Nov 2025 22:17:54 +0100 Subject: [PATCH 1/4] Update service.go --- validator/client/service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/validator/client/service.go b/validator/client/service.go index f4e27254f51d..1484f4e61f8b 100644 --- a/validator/client/service.go +++ b/validator/client/service.go @@ -182,7 +182,14 @@ func (v *ValidatorService) Start() { } u := strings.ReplaceAll(v.conn.GetBeaconApiUrl(), " ", "") - hosts := strings.Split(u, ",") + rawHosts := strings.Split(u, ",") + hosts := make([]string, 0, len(rawHosts)) + for _, host := range rawHosts { + if host == "" { + continue + } + hosts = append(hosts, host) + } if len(hosts) == 0 { log.WithError(err).Error("No API hosts provided") return From 4f9082234002ab414a17b70235c041907822da21 Mon Sep 17 00:00:00 2001 From: maradini77 <140460067+maradini77@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:58:10 +0100 Subject: [PATCH 2/4] Create maradini77_patch-2.md --- changelog/maradini77_patch-2.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/maradini77_patch-2.md diff --git a/changelog/maradini77_patch-2.md b/changelog/maradini77_patch-2.md new file mode 100644 index 000000000000..809755e40a93 --- /dev/null +++ b/changelog/maradini77_patch-2.md @@ -0,0 +1,3 @@ +### Fixed + +- Fix Beacon API host validation in validator service From 95d225c0aeead5a53a0436e2184200535c4e93b1 Mon Sep 17 00:00:00 2001 From: maradini77 <140460067+maradini77@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:59:07 +0100 Subject: [PATCH 3/4] Update maradini77_patch-2.md --- changelog/maradini77_patch-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/maradini77_patch-2.md b/changelog/maradini77_patch-2.md index 809755e40a93..8a2c597b7285 100644 --- a/changelog/maradini77_patch-2.md +++ b/changelog/maradini77_patch-2.md @@ -1,3 +1,3 @@ ### Fixed -- Fix Beacon API host validation in validator service +- Prevent validator service from starting with empty Beacon API host lists by filtering and validating endpoints. From 69e2c0e4366f10fe173b5969e3155223e3527b93 Mon Sep 17 00:00:00 2001 From: maradini77 <140460067+maradini77@users.noreply.github.com> Date: Tue, 25 Nov 2025 19:00:10 +0100 Subject: [PATCH 4/4] Update service.go --- validator/client/service.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/validator/client/service.go b/validator/client/service.go index 1484f4e61f8b..c3bbf39e28f3 100644 --- a/validator/client/service.go +++ b/validator/client/service.go @@ -181,15 +181,7 @@ func (v *ValidatorService) Start() { return } - u := strings.ReplaceAll(v.conn.GetBeaconApiUrl(), " ", "") - rawHosts := strings.Split(u, ",") - hosts := make([]string, 0, len(rawHosts)) - for _, host := range rawHosts { - if host == "" { - continue - } - hosts = append(hosts, host) - } + hosts := sanitizeBeaconAPIHosts(v.conn.GetBeaconApiUrl()) if len(hosts) == 0 { log.WithError(err).Error("No API hosts provided") return @@ -383,6 +375,19 @@ func ConstructDialOptions( return dialOpts } +func sanitizeBeaconAPIHosts(raw string) []string { + u := strings.ReplaceAll(raw, " ", "") + rawHosts := strings.Split(u, ",") + hosts := make([]string, 0, len(rawHosts)) + for _, host := range rawHosts { + if host == "" { + continue + } + hosts = append(hosts, host) + } + return hosts +} + func (v *ValidatorService) Graffiti(ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) ([]byte, error) { if v.validator == nil { return nil, errors.New("validator is unavailable")