mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
Upgrade ristretto to v2.2.0 (#15170)
* Upgrade ristretto to v2.2.0 * Added the changelog * gazelle * Run goimports and gofmt * Fix build * Fix tests * fix some golangci-lint violations --------- Co-authored-by: Preston Van Loon <preston@pvl.dev>
This commit is contained in:
@@ -69,7 +69,7 @@ go_library(
|
||||
"//validator/keymanager:go_default_library",
|
||||
"//validator/keymanager/local:go_default_library",
|
||||
"//validator/keymanager/remote-web3signer:go_default_library",
|
||||
"@com_github_dgraph_io_ristretto//:go_default_library",
|
||||
"@com_github_dgraph_io_ristretto_v2//:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_golang_protobuf//ptypes/empty",
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/OffchainLabs/prysm/v6/validator/keymanager"
|
||||
"github.com/OffchainLabs/prysm/v6/validator/keymanager/local"
|
||||
remoteweb3signer "github.com/OffchainLabs/prysm/v6/validator/keymanager/remote-web3signer"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/dgraph-io/ristretto/v2"
|
||||
middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||
grpcretry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
|
||||
grpcopentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
|
||||
@@ -36,6 +36,7 @@ import (
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// ValidatorService represents a service to manage the validator client
|
||||
@@ -143,7 +144,7 @@ func NewValidatorService(ctx context.Context, cfg *Config) (*ValidatorService, e
|
||||
// Start the validator service. Launches the main go routine for the validator
|
||||
// client.
|
||||
func (v *ValidatorService) Start() {
|
||||
cache, err := ristretto.NewCache(&ristretto.Config{
|
||||
cache, err := ristretto.NewCache(&ristretto.Config[string, proto.Message]{
|
||||
NumCounters: 1920, // number of keys to track.
|
||||
MaxCost: 192, // maximum cost of cache, 1 item = 1 cost.
|
||||
BufferItems: 64, // number of keys per Get buffer.
|
||||
|
||||
@@ -41,7 +41,7 @@ import (
|
||||
"github.com/OffchainLabs/prysm/v6/validator/keymanager"
|
||||
"github.com/OffchainLabs/prysm/v6/validator/keymanager/local"
|
||||
remoteweb3signer "github.com/OffchainLabs/prysm/v6/validator/keymanager/remote-web3signer"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/dgraph-io/ristretto/v2"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
@@ -95,7 +95,7 @@ type validator struct {
|
||||
interopKeysConfig *local.InteropKeymanagerConfig
|
||||
attSelections map[attSelectionKey]iface.BeaconCommitteeSelection
|
||||
aggregatedSlotCommitteeIDCache *lru.Cache
|
||||
domainDataCache *ristretto.Cache
|
||||
domainDataCache *ristretto.Cache[string, proto.Message]
|
||||
voteStats voteStats
|
||||
syncCommitteeStats syncCommitteeStats
|
||||
submittedAtts map[submittedAttKey]*submittedAtt
|
||||
@@ -935,7 +935,7 @@ func (v *validator) domainData(ctx context.Context, epoch primitives.Epoch, doma
|
||||
|
||||
if val, ok := v.domainDataCache.Get(key); ok {
|
||||
v.domainDataLock.RUnlock()
|
||||
return proto.Clone(val.(proto.Message)).(*ethpb.DomainResponse), nil
|
||||
return proto.Clone(val).(*ethpb.DomainResponse), nil
|
||||
}
|
||||
v.domainDataLock.RUnlock()
|
||||
|
||||
@@ -947,7 +947,7 @@ func (v *validator) domainData(ctx context.Context, epoch primitives.Epoch, doma
|
||||
// the same domain data, the cache might have been filled while we were waiting
|
||||
// to acquire the lock.
|
||||
if val, ok := v.domainDataCache.Get(key); ok {
|
||||
return proto.Clone(val.(proto.Message)).(*ethpb.DomainResponse), nil
|
||||
return proto.Clone(val).(*ethpb.DomainResponse), nil
|
||||
}
|
||||
|
||||
res, err := v.validatorClient.DomainData(ctx, req)
|
||||
|
||||
Reference in New Issue
Block a user