Skip to content

fix: only apply beaconapi.clientIndex filter when explicitly set#652

Merged
pk910 merged 2 commits intomasterfrom
bbusa/beaconapi-client-index-default
Apr 23, 2026
Merged

fix: only apply beaconapi.clientIndex filter when explicitly set#652
pk910 merged 2 commits intomasterfrom
bbusa/beaconapi-client-index-default

Conversation

@barnabasbusa
Copy link
Copy Markdown
Collaborator

Summary

  • beaconapi.ClientIndex was typed int, so its Go zero value (0) always satisfied the >= 0 check in utils.ReadConfig, collapsing beaconapi.endpoints down to endpoints[0] for users who never set clientIndex. Multi-endpoint setups only ever exposed the first beacon client on /clients/consensus and in the indexer.
  • Change ClientIndex to *int so nil means "unset"; the single-endpoint selection now only runs when the field is explicitly configured (YAML or BEACONAPI_CLIENT_INDEX).
  • Regression introduced in 11f18e6 (Nov 2025).

Test plan

  • Verified locally against a Kurtosis enclave with two beacon endpoints and no clientIndex: prior to the fix only 1-geth-prysm appeared on /clients/consensus; after the fix both 1-geth-prysm and 2-geth-prysm are listed and indexed.
  • go build ./... passes.
  • Still honors explicit clientIndex: N (selects a single endpoint) and BEACONAPI_CLIENT_INDEX env var.

ClientIndex was a plain `int` whose zero value (0) caused
ReadConfig to collapse `beaconapi.endpoints` down to
`endpoints[0]` whenever the field was omitted from the config.
Users with multiple beacon endpoints only ever saw the first one
on the consensus clients page and in the indexer.

Change ClientIndex to `*int` so that only explicit configuration
(YAML or env) triggers the single-endpoint selection.
@barnabasbusa barnabasbusa requested a review from pk910 April 21, 2026 14:53
@pk910 pk910 enabled auto-merge April 23, 2026 10:42
@pk910 pk910 merged commit 163527d into master Apr 23, 2026
4 checks passed
@pk910 pk910 deleted the bbusa/beaconapi-client-index-default branch April 23, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants