diff --git a/pkg/cannon/ethereum/beacon.go b/pkg/cannon/ethereum/beacon.go index 1185cc3f..46b2e1a4 100644 --- a/pkg/cannon/ethereum/beacon.go +++ b/pkg/cannon/ethereum/beacon.go @@ -9,6 +9,7 @@ import ( "github.com/attestantio/go-eth2-client/spec" "github.com/ethpandaops/beacon/pkg/beacon" "github.com/ethpandaops/xatu/pkg/cannon/ethereum/services" + "github.com/ethpandaops/xatu/pkg/networks" "github.com/ethpandaops/xatu/pkg/observability" "github.com/go-co-op/gocron" "github.com/jellydator/ttlcache/v3" @@ -113,6 +114,10 @@ func (b *BeaconNode) Start(ctx context.Context) error { wg.Wait() } + if b.Metadata().Network.Name == networks.NetworkNameUnknown { + errs <- errors.New("unknown network detected. Please override the network name via config if you are using a custom network") + } + b.log.Info("All services are ready") for _, callback := range b.onReadyCallbacks { diff --git a/pkg/cannon/ethereum/services/metadata.go b/pkg/cannon/ethereum/services/metadata.go index cd3f3074..49e038a3 100644 --- a/pkg/cannon/ethereum/services/metadata.go +++ b/pkg/cannon/ethereum/services/metadata.go @@ -159,12 +159,18 @@ func (m *MetadataService) DeriveNetwork(_ context.Context) error { return errors.New("genesis is not available") } + if m.Spec == nil { + return errors.New("spec is not available") + } + network := networks.DeriveFromGenesisRoot(xatuethv1.RootAsString(m.Genesis.GenesisValidatorsRoot)) if m.overrideNetworkName != "" { network.Name = networks.NetworkName(m.overrideNetworkName) } + network.ID = m.Spec.DepositChainID + if network.Name != m.Network.Name { m.log.WithFields(logrus.Fields{ "name": network.Name,