Skip to content
Merged
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
16 changes: 12 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"encoding/json"
"os"
"os/signal"
"sync"
Expand All @@ -21,8 +22,15 @@ import (
func main() {
// Load config
cfg := config.LoadConfig()
logger.Info("Loaded config: network=%s, beaconEndpoint=%s, web3SignerEndpoint=%s",
cfg.Network, cfg.BeaconEndpoint, cfg.Web3SignerEndpoint)
// Print the full config in pretty JSON format
{
b, err := json.MarshalIndent(cfg, "", " ")
if err != nil {
logger.Info("Loaded config: %+v", cfg)
} else {
logger.Info("Loaded config:\n%s", string(b))
}
}

// Initialize adapters
dappmanager := dappmanager.NewDappManagerAdapter(cfg.DappmanagerUrl, cfg.SignerDnpName)
Expand All @@ -34,10 +42,10 @@ func main() {
cfg.SignerDnpName,
)
brain := brain.NewBrainAdapter(cfg.BrainUrl)
// TODO: do not err
beacon, err := beacon.NewBeaconAdapter(cfg.BeaconEndpoint)
// TODO: do not err on initialization, allow connection errors later. See https://github.com/attestantio/go-eth2-client/issues/254
if err != nil {
logger.Fatal("Failed to initialize beacon adapter: %v", err)
logger.Fatal("Failed to initialize beacon adapter. A live connection is required on startup: %v", err)
}

// Prepare context and WaitGroup for graceful shutdown
Expand Down
4 changes: 1 addition & 3 deletions internal/adapters/beacon/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
"github.com/attestantio/go-eth2-client/spec/phase0"
)

// TODO: should the adapter avoid returning err when initializing?

type beaconAttestantClient struct {
client *_http.Service
}
Expand All @@ -28,7 +26,7 @@ func NewBeaconAdapter(endpoint string) (ports.BeaconChainAdapter, error) {
zerolog.SetGlobalLevel(zerolog.WarnLevel)

customHttpClient := &http.Client{
Timeout: 2000 * time.Second,
Timeout: 20 * time.Second,
}

client, err := _http.New(context.Background(),
Expand Down
8 changes: 2 additions & 6 deletions internal/adapters/notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ func (n *Notifier) buildBeaconchaURL(indexes []domain.ValidatorIndex) string {
if len(indexes) == 0 || n.BeaconchaUrl == "" {
return ""
}
// If only one validator, link directly to it
if len(indexes) == 1 {
return fmt.Sprintf("%s/validator/%d", n.BeaconchaUrl, indexes[0])
}
// Otherwise, link to the validators search page with comma-separated indexes
return fmt.Sprintf("%s/validators?search=%s", n.BeaconchaUrl, indexesToString(indexes))
// Always use dashboard?validators=... format for all cases
return fmt.Sprintf("%s/dashboard?validators=%s", n.BeaconchaUrl, indexesToString(indexes))
}