Update deprecated function usages (#8953)

* Clear deprecated usages within Prysm

* Remove deprecatd usages where possible

* Update
This commit is contained in:
Ivan Martinez
2021-05-28 02:57:47 -04:00
committed by GitHub
parent 6bb3cc45ef
commit 40b4079924
8 changed files with 13 additions and 13 deletions

View File

@@ -14,7 +14,6 @@ go_library(
"//proto/beacon/rpc/v1:go_default_library",
"//shared/logutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_libp2p_go_libp2p_core//network:go_default_library",
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
@@ -23,6 +22,7 @@ go_library(
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
],
)

View File

@@ -9,7 +9,6 @@ import (
"sort"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/empty"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/libp2p/go-libp2p-core/network"
@@ -25,6 +24,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
)
// Server defines a server implementation of the gRPC Node service,
@@ -62,12 +62,9 @@ func (ns *Server) GetGenesis(ctx context.Context, _ *empty.Empty) (*ethpb.Genesi
var defaultGenesisTime time.Time
var gt *timestamp.Timestamp
if genesisTime == defaultGenesisTime {
gt, err = ptypes.TimestampProto(time.Unix(0, 0))
gt = timestamppb.New(time.Unix(0, 0))
} else {
gt, err = ptypes.TimestampProto(genesisTime)
}
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not convert genesis time to proto: %v", err)
gt = timestamppb.New(genesisTime)
}
genValRoot := ns.GenesisFetcher.GenesisValidatorRoot()

View File

@@ -41,7 +41,7 @@ func BenchmarkSignature_AggregateVerify(b *testing.B) {
sigs = append(sigs, sig)
msgs = append(msgs, msg)
}
aggregated := blst.Aggregate(sigs)
aggregated := blst.AggregateSignatures(sigs)
b.ResetTimer()
b.ReportAllocs()

View File

@@ -36,7 +36,7 @@ func TestAggregateVerify(t *testing.T) {
sigs = append(sigs, sig)
msgs = append(msgs, msg)
}
aggSig := Aggregate(sigs)
aggSig := AggregateSignatures(sigs)
assert.Equal(t, true, aggSig.AggregateVerify(pubkeys, msgs), "Signature did not verify")
}

View File

@@ -399,7 +399,10 @@ func typeAtFieldIndex(startingAt types.Type, fieldIndex int) types.Type {
// If no such embedded interface is found, nil and false are returned.
func embeddedInterfaceDefiningMethod(interfaceT *types.Interface, fn *types.Func) (*types.Named, bool) {
for i := 0; i < interfaceT.NumEmbeddeds(); i++ {
embedded := interfaceT.Embedded(i)
embedded, ok := interfaceT.EmbeddedType(i).(*types.Named)
if !ok {
return nil, false
}
if definesMethod(embedded.Underlying().(*types.Interface), fn) {
return embedded, true
}

View File

@@ -39,7 +39,7 @@ func (v *validator) ProposeBlock(ctx context.Context, slot types.Slot, pubKey [4
log.Debug("Assigned to genesis slot, skipping proposal")
return
}
lock := mputil.NewMultilock(string(iface.RoleProposer), string(pubKey[:]))
lock := mputil.NewMultilock(fmt.Sprint(iface.RoleProposer), string(pubKey[:]))
lock.Lock()
defer lock.Unlock()
ctx, span := trace.StartSpan(ctx, "validator.ProposeBlock")

View File

@@ -19,9 +19,9 @@ go_library(
"//shared/rand:go_default_library",
"//validator/db/kv:go_default_library",
"//validator/slashing-protection/local/standard-protection-format/format:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
],
)

View File

@@ -4,10 +4,10 @@ import (
"context"
"errors"
"github.com/golang/protobuf/proto"
eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
slashpb "github.com/prysmaticlabs/prysm/proto/slashing"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
)
// MockSlasher mocks the slasher rpc server.