mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Update to Go 1.23 (#14818)
* Update to Go 1.23 * Update bazel version * Update rules_go * Use toolchains_protoc * Update go_honnef_go_tools * Update golang.org/x/tools * Fix violations of SA3000 * Update errcheck by re-exporting the upstream repo * Remove problematic ginkgo and gomega test helpers. Rewrote tests without these test libraries. * Update go to 1.23.5 * gofmt with go1.23.5 * Revert Patch * Unclog * Update for go 1.23 support * Fix Lint Issues * Gazelle * Fix Build * Fix Lint * no lint * Fix lint * Fix lint * Disable intrange * Preston's review --------- Co-authored-by: Preston Van Loon <preston@pvl.dev>
This commit is contained in:
@@ -33,7 +33,6 @@ go_library(
|
||||
"@com_github_prometheus_client_golang//prometheus:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@org_golang_x_exp//maps:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"maps"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
@@ -30,7 +31,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/keymanager/remote-web3signer/internal"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/keymanager/remote-web3signer/types"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -146,7 +146,7 @@ func NewKeymanager(ctx context.Context, cfg *SetupConfig) (*Keymanager, error) {
|
||||
}
|
||||
}
|
||||
km.lock.Lock()
|
||||
km.providedPublicKeys = maps.Values(fileKeys)
|
||||
km.providedPublicKeys = slices.Collect(maps.Values(fileKeys))
|
||||
km.lock.Unlock()
|
||||
// create a file watcher
|
||||
go func() {
|
||||
@@ -157,7 +157,7 @@ func NewKeymanager(ctx context.Context, cfg *SetupConfig) (*Keymanager, error) {
|
||||
}()
|
||||
} else {
|
||||
km.lock.Lock()
|
||||
km.providedPublicKeys = maps.Values(flagLoadedKeys)
|
||||
km.providedPublicKeys = slices.Collect(maps.Values(flagLoadedKeys))
|
||||
km.lock.Unlock()
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ func (km *Keymanager) refreshRemoteKeysFromFileChangesWithRetry(ctx context.Cont
|
||||
}
|
||||
err := km.refreshRemoteKeysFromFileChanges(ctx)
|
||||
if err != nil {
|
||||
km.updatePublicKeys(maps.Values(km.flagLoadedKeysMap)) // update the keys to flag provided defaults
|
||||
km.updatePublicKeys(slices.Collect(maps.Values(km.flagLoadedKeysMap))) // update the keys to flag provided defaults
|
||||
km.retriesRemaining--
|
||||
log.WithError(err).Debug("Error occurred on key refresh")
|
||||
log.WithFields(logrus.Fields{"path": km.keyFilePath, "retriesRemaining": km.retriesRemaining, "retryDelay": retryDelay}).Warnf("Could not refresh keys. Retrying...")
|
||||
@@ -306,7 +306,7 @@ func (km *Keymanager) refreshRemoteKeysFromFileChanges(ctx context.Context) erro
|
||||
if err = km.savePublicKeysToFile(fk); err != nil {
|
||||
return errors.Wrap(err, "could not save public keys to file")
|
||||
}
|
||||
km.updatePublicKeys(maps.Values(fk))
|
||||
km.updatePublicKeys(slices.Collect(maps.Values(fk)))
|
||||
}
|
||||
for {
|
||||
select {
|
||||
@@ -335,7 +335,7 @@ func (km *Keymanager) refreshRemoteKeysFromFileChanges(ctx context.Context) erro
|
||||
// prioritize file keys over flag keys
|
||||
if len(fileKeys) == 0 {
|
||||
log.Warnln("Remote signer key file no longer has keys, defaulting to flag provided keys")
|
||||
fileKeys = maps.Values(km.flagLoadedKeysMap)
|
||||
fileKeys = slices.Collect(maps.Values(km.flagLoadedKeysMap))
|
||||
}
|
||||
currentKeys, err := km.FetchValidatingPublicKeys(ctx)
|
||||
if err != nil {
|
||||
@@ -808,7 +808,7 @@ func (km *Keymanager) AddPublicKeys(pubKeys []string) ([]*keymanager.KeyStatus,
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
km.updatePublicKeys(maps.Values(combinedKeys))
|
||||
km.updatePublicKeys(slices.Collect(maps.Values(combinedKeys)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -877,7 +877,7 @@ func (km *Keymanager) DeletePublicKeys(publicKeys []string) ([]*keymanager.KeySt
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
km.updatePublicKeys(maps.Values(combinedKeys))
|
||||
km.updatePublicKeys(slices.Collect(maps.Values(combinedKeys)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user