mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Remove remote slashing protection feature (#12989)
* Remove remote slashing protection feature * test fix * remove mock from tests --------- Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
cf1bfb9d67
commit
f37301c0c0
@ -1,34 +0,0 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"attestations.go",
|
||||
"blocks.go",
|
||||
"server.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/prysm/v1alpha1/slasher",
|
||||
visibility = ["//beacon-chain:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/slasher:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"@org_golang_google_grpc//codes:go_default_library",
|
||||
"@org_golang_google_grpc//status:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = [
|
||||
"attestations_test.go",
|
||||
"server_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//beacon-chain/slasher/mock:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
],
|
||||
)
|
@ -1,43 +0,0 @@
|
||||
package slasher
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// IsSlashableAttestation returns an attester slashing if an input
|
||||
// attestation is found to be slashable.
|
||||
func (s *Server) IsSlashableAttestation(
|
||||
ctx context.Context, req *ethpb.IndexedAttestation,
|
||||
) (*ethpb.AttesterSlashingResponse, error) {
|
||||
attesterSlashings, err := s.SlashingChecker.IsSlashableAttestation(ctx, req)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not determine if attestation is slashable: %v", err)
|
||||
}
|
||||
if len(attesterSlashings) > 0 {
|
||||
return ðpb.AttesterSlashingResponse{
|
||||
AttesterSlashings: attesterSlashings,
|
||||
}, nil
|
||||
}
|
||||
return ðpb.AttesterSlashingResponse{}, nil
|
||||
}
|
||||
|
||||
// HighestAttestations returns the highest source and target epochs attested for
|
||||
// validator indices that have been observed by slasher.
|
||||
func (s *Server) HighestAttestations(
|
||||
ctx context.Context, req *ethpb.HighestAttestationRequest,
|
||||
) (*ethpb.HighestAttestationResponse, error) {
|
||||
valIndices := make([]primitives.ValidatorIndex, len(req.ValidatorIndices))
|
||||
for i, valIdx := range req.ValidatorIndices {
|
||||
valIndices[i] = primitives.ValidatorIndex(valIdx)
|
||||
}
|
||||
atts, err := s.SlashingChecker.HighestAttestations(ctx, valIndices)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get highest attestations: %v", err)
|
||||
}
|
||||
return ðpb.HighestAttestationResponse{Attestations: atts}, nil
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package slasher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/slasher/mock"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
)
|
||||
|
||||
func TestServer_HighestAttestations(t *testing.T) {
|
||||
highestAtts := map[primitives.ValidatorIndex]*ethpb.HighestAttestation{
|
||||
0: {
|
||||
ValidatorIndex: 0,
|
||||
HighestSourceEpoch: 1,
|
||||
HighestTargetEpoch: 2,
|
||||
},
|
||||
1: {
|
||||
ValidatorIndex: 1,
|
||||
HighestSourceEpoch: 2,
|
||||
HighestTargetEpoch: 3,
|
||||
},
|
||||
}
|
||||
mockSlasher := &mock.MockSlashingChecker{
|
||||
HighestAtts: highestAtts,
|
||||
}
|
||||
s := Server{SlashingChecker: mockSlasher}
|
||||
ctx := context.Background()
|
||||
t.Run("single index found", func(t *testing.T) {
|
||||
resp, err := s.HighestAttestations(ctx, ðpb.HighestAttestationRequest{
|
||||
ValidatorIndices: []uint64{0},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(resp.Attestations))
|
||||
require.DeepEqual(t, highestAtts[0], resp.Attestations[0])
|
||||
})
|
||||
t.Run("single index not found", func(t *testing.T) {
|
||||
resp, err := s.HighestAttestations(ctx, ðpb.HighestAttestationRequest{
|
||||
ValidatorIndices: []uint64{3},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 0, len(resp.Attestations))
|
||||
})
|
||||
t.Run("multiple indices all found", func(t *testing.T) {
|
||||
resp, err := s.HighestAttestations(ctx, ðpb.HighestAttestationRequest{
|
||||
ValidatorIndices: []uint64{0, 1},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(resp.Attestations))
|
||||
require.DeepEqual(t, highestAtts[0], resp.Attestations[0])
|
||||
require.DeepEqual(t, highestAtts[1], resp.Attestations[1])
|
||||
})
|
||||
t.Run("multiple indices some not found", func(t *testing.T) {
|
||||
resp, err := s.HighestAttestations(ctx, ðpb.HighestAttestationRequest{
|
||||
ValidatorIndices: []uint64{0, 3},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(resp.Attestations))
|
||||
require.DeepEqual(t, highestAtts[0], resp.Attestations[0])
|
||||
})
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package slasher
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// IsSlashableBlock returns a proposer slashing if an input
|
||||
// signed beacon block header is found to be slashable.
|
||||
func (s *Server) IsSlashableBlock(
|
||||
ctx context.Context, req *ethpb.SignedBeaconBlockHeader,
|
||||
) (*ethpb.ProposerSlashingResponse, error) {
|
||||
proposerSlashing, err := s.SlashingChecker.IsSlashableBlock(ctx, req)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not determine if block is slashable: %v", err)
|
||||
}
|
||||
if proposerSlashing == nil {
|
||||
return ðpb.ProposerSlashingResponse{
|
||||
ProposerSlashings: []*ethpb.ProposerSlashing{},
|
||||
}, nil
|
||||
}
|
||||
return ðpb.ProposerSlashingResponse{
|
||||
ProposerSlashings: []*ethpb.ProposerSlashing{proposerSlashing},
|
||||
}, nil
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
// Package slasher defines a gRPC server implementation of a slasher service
|
||||
// which allows for checking if attestations or blocks are slashable.
|
||||
package slasher
|
||||
|
||||
import (
|
||||
slasherservice "github.com/prysmaticlabs/prysm/v4/beacon-chain/slasher"
|
||||
)
|
||||
|
||||
// Server defines a server implementation of the gRPC slasher service.
|
||||
type Server struct {
|
||||
SlashingChecker slasherservice.SlashingChecker
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package slasher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/slasher/mock"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
)
|
||||
|
||||
func TestServer_IsSlashableAttestation_SlashingFound(t *testing.T) {
|
||||
mockSlasher := &mock.MockSlashingChecker{
|
||||
AttesterSlashingFound: true,
|
||||
}
|
||||
s := Server{SlashingChecker: mockSlasher}
|
||||
ctx := context.Background()
|
||||
slashing, err := s.IsSlashableAttestation(ctx, ðpb.IndexedAttestation{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, true, len(slashing.AttesterSlashings) > 0)
|
||||
}
|
||||
|
||||
func TestServer_IsSlashableAttestation_SlashingNotFound(t *testing.T) {
|
||||
mockSlasher := &mock.MockSlashingChecker{
|
||||
AttesterSlashingFound: false,
|
||||
}
|
||||
s := Server{SlashingChecker: mockSlasher}
|
||||
ctx := context.Background()
|
||||
slashing, err := s.IsSlashableAttestation(ctx, ðpb.IndexedAttestation{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, true, len(slashing.AttesterSlashings) == 0)
|
||||
}
|
||||
|
||||
func TestServer_IsSlashableBlock_SlashingFound(t *testing.T) {
|
||||
mockSlasher := &mock.MockSlashingChecker{
|
||||
ProposerSlashingFound: true,
|
||||
}
|
||||
s := Server{SlashingChecker: mockSlasher}
|
||||
ctx := context.Background()
|
||||
slashing, err := s.IsSlashableBlock(ctx, ðpb.SignedBeaconBlockHeader{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, true, len(slashing.ProposerSlashings) > 0)
|
||||
}
|
||||
|
||||
func TestServer_IsSlashableBlock_SlashingNotFound(t *testing.T) {
|
||||
mockSlasher := &mock.MockSlashingChecker{
|
||||
ProposerSlashingFound: false,
|
||||
}
|
||||
s := Server{SlashingChecker: mockSlasher}
|
||||
ctx := context.Background()
|
||||
slashing, err := s.IsSlashableBlock(ctx, ðpb.SignedBeaconBlockHeader{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, true, len(slashing.ProposerSlashings) == 0)
|
||||
}
|
@ -74,7 +74,6 @@ go_test(
|
||||
"//beacon-chain/db/testing:go_default_library",
|
||||
"//beacon-chain/forkchoice/doubly-linked-tree:go_default_library",
|
||||
"//beacon-chain/operations/slashings/mock:go_default_library",
|
||||
"//beacon-chain/slasher/mock:go_default_library",
|
||||
"//beacon-chain/slasher/types:go_default_library",
|
||||
"//beacon-chain/startup:go_default_library",
|
||||
"//beacon-chain/state/stategen:go_default_library",
|
||||
|
@ -1,13 +0,0 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["mock_slashing_checker.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/slasher/mock",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
],
|
||||
)
|
@ -1,73 +0,0 @@
|
||||
package mock
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
type MockSlashingChecker struct {
|
||||
AttesterSlashingFound bool
|
||||
ProposerSlashingFound bool
|
||||
HighestAtts map[primitives.ValidatorIndex]*ethpb.HighestAttestation
|
||||
}
|
||||
|
||||
func (s *MockSlashingChecker) HighestAttestations(
|
||||
_ context.Context, indices []primitives.ValidatorIndex,
|
||||
) ([]*ethpb.HighestAttestation, error) {
|
||||
atts := make([]*ethpb.HighestAttestation, 0, len(indices))
|
||||
for _, valIdx := range indices {
|
||||
att, ok := s.HighestAtts[valIdx]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
atts = append(atts, att)
|
||||
}
|
||||
return atts, nil
|
||||
}
|
||||
|
||||
func (s *MockSlashingChecker) IsSlashableBlock(_ context.Context, _ *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashing, error) {
|
||||
if s.ProposerSlashingFound {
|
||||
return ðpb.ProposerSlashing{
|
||||
Header_1: ðpb.SignedBeaconBlockHeader{
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
Slot: 0,
|
||||
ProposerIndex: 0,
|
||||
ParentRoot: params.BeaconConfig().ZeroHash[:],
|
||||
StateRoot: params.BeaconConfig().ZeroHash[:],
|
||||
BodyRoot: params.BeaconConfig().ZeroHash[:],
|
||||
},
|
||||
Signature: params.BeaconConfig().EmptySignature[:],
|
||||
},
|
||||
Header_2: ðpb.SignedBeaconBlockHeader{
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
Slot: 0,
|
||||
ProposerIndex: 0,
|
||||
ParentRoot: params.BeaconConfig().ZeroHash[:],
|
||||
StateRoot: params.BeaconConfig().ZeroHash[:],
|
||||
BodyRoot: params.BeaconConfig().ZeroHash[:],
|
||||
},
|
||||
Signature: params.BeaconConfig().EmptySignature[:],
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *MockSlashingChecker) IsSlashableAttestation(_ context.Context, _ *ethpb.IndexedAttestation) ([]*ethpb.AttesterSlashing, error) {
|
||||
if s.AttesterSlashingFound {
|
||||
return []*ethpb.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: ðpb.IndexedAttestation{
|
||||
Data: ðpb.AttestationData{},
|
||||
},
|
||||
Attestation_2: ðpb.IndexedAttestation{
|
||||
Data: ðpb.AttestationData{},
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
@ -9,7 +9,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v4/async/event"
|
||||
mock "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing"
|
||||
dbtest "github.com/prysmaticlabs/prysm/v4/beacon-chain/db/testing"
|
||||
mockslasher "github.com/prysmaticlabs/prysm/v4/beacon-chain/slasher/mock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/startup"
|
||||
mockSync "github.com/prysmaticlabs/prysm/v4/beacon-chain/sync/initial-sync/testing"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
@ -21,7 +20,6 @@ import (
|
||||
)
|
||||
|
||||
var _ = SlashingChecker(&Service{})
|
||||
var _ = SlashingChecker(&mockslasher.MockSlashingChecker{})
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
|
@ -37,7 +37,6 @@ const disabledFeatureFlag = "Disabled feature flag"
|
||||
// Flags is a struct to represent which features the client will perform on runtime.
|
||||
type Flags struct {
|
||||
// Feature related flags.
|
||||
RemoteSlasherProtection bool // RemoteSlasherProtection utilizes a beacon node with --slasher mode for validator slashing protection.
|
||||
WriteSSZStateTransitions bool // WriteSSZStateTransitions to tmp directory.
|
||||
EnablePeerScorer bool // EnablePeerScorer enables experimental peer scoring in p2p.
|
||||
DisableReorgLateBlocks bool // DisableReorgLateBlocks disables reorgs of late blocks.
|
||||
@ -269,12 +268,6 @@ func ConfigureValidator(ctx *cli.Context) error {
|
||||
if err := configureTestnet(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if ctx.Bool(enableExternalSlasherProtectionFlag.Name) {
|
||||
log.Fatal(
|
||||
"Remote slashing protection has currently been disabled in Prysm due to safety concerns. " +
|
||||
"We appreciate your understanding in our desire to keep Prysm validators safe.",
|
||||
)
|
||||
}
|
||||
if ctx.Bool(writeWalletPasswordOnWebOnboarding.Name) {
|
||||
logEnabled(writeWalletPasswordOnWebOnboarding)
|
||||
cfg.WriteWalletPasswordOnWebOnboarding = true
|
||||
|
@ -17,10 +17,6 @@ func TestInitFeatureConfig(t *testing.T) {
|
||||
Init(cfg)
|
||||
c := Get()
|
||||
assert.Equal(t, true, c.EnableSlasher)
|
||||
|
||||
// Reset back to false for the follow up tests.
|
||||
cfg = &Flags{RemoteSlasherProtection: false}
|
||||
Init(cfg)
|
||||
}
|
||||
|
||||
func TestInitWithReset(t *testing.T) {
|
||||
|
@ -37,11 +37,6 @@ var (
|
||||
Name: "interop-write-ssz-state-transitions",
|
||||
Usage: "Write ssz states to disk after attempted state transition",
|
||||
}
|
||||
enableExternalSlasherProtectionFlag = &cli.BoolFlag{
|
||||
Name: "enable-external-slasher-protection",
|
||||
Usage: "Enables the validator to connect to a beacon node using the --slasher flag" +
|
||||
"for remote slashing protection",
|
||||
}
|
||||
disableGRPCConnectionLogging = &cli.BoolFlag{
|
||||
Name: "disable-grpc-connection-logging",
|
||||
Usage: "Disables displaying logs for newly connected grpc clients",
|
||||
@ -179,7 +174,6 @@ var devModeFlags = []cli.Flag{
|
||||
// ValidatorFlags contains a list of all the feature flags that apply to the validator client.
|
||||
var ValidatorFlags = append(deprecatedFlags, []cli.Flag{
|
||||
writeWalletPasswordOnWebOnboarding,
|
||||
enableExternalSlasherProtectionFlag,
|
||||
HoleskyTestnet,
|
||||
PraterTestnet,
|
||||
SepoliaTestnet,
|
||||
|
560
proto/prysm/v1alpha1/slasher.pb.go
generated
560
proto/prysm/v1alpha1/slasher.pb.go
generated
@ -1,24 +1,18 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc v3.15.8
|
||||
// protoc v4.23.3
|
||||
// source: proto/prysm/v1alpha1/slasher.proto
|
||||
|
||||
package eth
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
github_com_prysmaticlabs_prysm_v4_consensus_types_primitives "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
_ "github.com/prysmaticlabs/prysm/v4/proto/eth/ext"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
github_com_prysmaticlabs_prysm_v4_consensus_types_primitives "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -28,194 +22,6 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type AttesterSlashingResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
AttesterSlashings []*AttesterSlashing `protobuf:"bytes,1,rep,name=attester_slashings,json=attesterSlashings,proto3" json:"attester_slashings,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AttesterSlashingResponse) Reset() {
|
||||
*x = AttesterSlashingResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AttesterSlashingResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AttesterSlashingResponse) ProtoMessage() {}
|
||||
|
||||
func (x *AttesterSlashingResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AttesterSlashingResponse.ProtoReflect.Descriptor instead.
|
||||
func (*AttesterSlashingResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_slasher_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *AttesterSlashingResponse) GetAttesterSlashings() []*AttesterSlashing {
|
||||
if x != nil {
|
||||
return x.AttesterSlashings
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ProposerSlashingResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ProposerSlashings []*ProposerSlashing `protobuf:"bytes,1,rep,name=proposer_slashings,json=proposerSlashings,proto3" json:"proposer_slashings,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ProposerSlashingResponse) Reset() {
|
||||
*x = ProposerSlashingResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ProposerSlashingResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ProposerSlashingResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ProposerSlashingResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ProposerSlashingResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ProposerSlashingResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_slasher_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ProposerSlashingResponse) GetProposerSlashings() []*ProposerSlashing {
|
||||
if x != nil {
|
||||
return x.ProposerSlashings
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type HighestAttestationRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ValidatorIndices []uint64 `protobuf:"varint,1,rep,packed,name=validator_indices,json=validatorIndices,proto3" json:"validator_indices,omitempty"`
|
||||
}
|
||||
|
||||
func (x *HighestAttestationRequest) Reset() {
|
||||
*x = HighestAttestationRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *HighestAttestationRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*HighestAttestationRequest) ProtoMessage() {}
|
||||
|
||||
func (x *HighestAttestationRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use HighestAttestationRequest.ProtoReflect.Descriptor instead.
|
||||
func (*HighestAttestationRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_slasher_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *HighestAttestationRequest) GetValidatorIndices() []uint64 {
|
||||
if x != nil {
|
||||
return x.ValidatorIndices
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type HighestAttestationResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Attestations []*HighestAttestation `protobuf:"bytes,1,rep,name=attestations,proto3" json:"attestations,omitempty"`
|
||||
}
|
||||
|
||||
func (x *HighestAttestationResponse) Reset() {
|
||||
*x = HighestAttestationResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *HighestAttestationResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*HighestAttestationResponse) ProtoMessage() {}
|
||||
|
||||
func (x *HighestAttestationResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use HighestAttestationResponse.ProtoReflect.Descriptor instead.
|
||||
func (*HighestAttestationResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_slasher_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *HighestAttestationResponse) GetAttestations() []*HighestAttestation {
|
||||
if x != nil {
|
||||
return x.Attestations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type HighestAttestation struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@ -229,7 +35,7 @@ type HighestAttestation struct {
|
||||
func (x *HighestAttestation) Reset() {
|
||||
*x = HighestAttestation{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[4]
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -242,7 +48,7 @@ func (x *HighestAttestation) String() string {
|
||||
func (*HighestAttestation) ProtoMessage() {}
|
||||
|
||||
func (x *HighestAttestation) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[4]
|
||||
mi := &file_proto_prysm_v1alpha1_slasher_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -255,7 +61,7 @@ func (x *HighestAttestation) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use HighestAttestation.ProtoReflect.Descriptor instead.
|
||||
func (*HighestAttestation) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_slasher_proto_rawDescGZIP(), []int{4}
|
||||
return file_proto_prysm_v1alpha1_slasher_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *HighestAttestation) GetValidatorIndex() uint64 {
|
||||
@ -287,100 +93,36 @@ var file_proto_prysm_v1alpha1_slasher_proto_rawDesc = []byte{
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1b, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x65, 0x78, 0x74, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
|
||||
0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x62,
|
||||
0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e,
|
||||
0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x72, 0x0a, 0x18, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68,
|
||||
0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x12, 0x61,
|
||||
0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e,
|
||||
0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67,
|
||||
0x52, 0x11, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69,
|
||||
0x6e, 0x67, 0x73, 0x22, 0x72, 0x0a, 0x18, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53,
|
||||
0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x56, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6c, 0x61, 0x73,
|
||||
0x68, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70,
|
||||
0x68, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73,
|
||||
0x68, 0x69, 0x6e, 0x67, 0x52, 0x11, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c,
|
||||
0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x48, 0x0a, 0x19, 0x48, 0x69, 0x67, 0x68, 0x65,
|
||||
0x73, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f,
|
||||
0x72, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52,
|
||||
0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65,
|
||||
0x73, 0x22, 0x6b, 0x0a, 0x1a, 0x48, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x41, 0x74, 0x74, 0x65,
|
||||
0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x4d, 0x0a, 0x0c, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18,
|
||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x48, 0x69,
|
||||
0x67, 0x68, 0x65, 0x73, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x0c, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb1,
|
||||
0x02, 0x0a, 0x12, 0x48, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e,
|
||||
0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x78,
|
||||
0x0a, 0x14, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
||||
0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5,
|
||||
0x18, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79,
|
||||
0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d,
|
||||
0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79,
|
||||
0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45,
|
||||
0x70, 0x6f, 0x63, 0x68, 0x52, 0x12, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x53, 0x6f, 0x75,
|
||||
0x72, 0x63, 0x65, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x78, 0x0a, 0x14, 0x68, 0x69, 0x67, 0x68,
|
||||
0x65, 0x73, 0x74, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 0x67, 0x69, 0x74, 0x68,
|
||||
0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb1, 0x02, 0x0a, 0x12, 0x48, 0x69, 0x67,
|
||||
0x68, 0x65, 0x73, 0x74, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x27, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x78, 0x0a, 0x14, 0x68, 0x69, 0x67, 0x68,
|
||||
0x65, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 0x67, 0x69, 0x74, 0x68,
|
||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63,
|
||||
0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72,
|
||||
0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x12,
|
||||
0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x45, 0x70, 0x6f,
|
||||
0x63, 0x68, 0x32, 0x90, 0x04, 0x0a, 0x07, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x72, 0x12, 0xad,
|
||||
0x01, 0x0a, 0x16, 0x49, 0x73, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x74,
|
||||
0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x65, 0x74, 0x68, 0x65,
|
||||
0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61,
|
||||
0x31, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x2f, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e,
|
||||
0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x74, 0x74,
|
||||
0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x31, 0x3a, 0x01, 0x2a,
|
||||
0x22, 0x2c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f,
|
||||
0x73, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x72, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x61, 0x62, 0x6c, 0x65, 0x12, 0xa3,
|
||||
0x01, 0x0a, 0x10, 0x49, 0x73, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x6c,
|
||||
0x6f, 0x63, 0x6b, 0x12, 0x2e, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x65, 0x64, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x61,
|
||||
0x64, 0x65, 0x72, 0x1a, 0x2f, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70,
|
||||
0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x65,
|
||||
0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x73, 0x6c, 0x61, 0x73,
|
||||
0x68, 0x65, 0x72, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68,
|
||||
0x61, 0x62, 0x6c, 0x65, 0x12, 0xae, 0x01, 0x0a, 0x13, 0x48, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74,
|
||||
0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c,
|
||||
0x70, 0x68, 0x61, 0x31, 0x2e, 0x48, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x41, 0x74, 0x74, 0x65,
|
||||
0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31,
|
||||
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x48, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x41, 0x74,
|
||||
0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x32, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x12, 0x2a, 0x2f, 0x65, 0x74, 0x68, 0x2f,
|
||||
0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x72,
|
||||
0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x68, 0x69,
|
||||
0x67, 0x68, 0x65, 0x73, 0x74, 0x42, 0x97, 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70,
|
||||
0x68, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
||||
0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72,
|
||||
0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79,
|
||||
0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa,
|
||||
0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56,
|
||||
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x70, 0x6f,
|
||||
0x63, 0x68, 0x12, 0x78, 0x0a, 0x14, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x61,
|
||||
0x72, 0x67, 0x65, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04,
|
||||
0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70,
|
||||
0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75,
|
||||
0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76,
|
||||
0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x12, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73,
|
||||
0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x42, 0x97, 0x01, 0x0a,
|
||||
0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x6c, 0x61, 0x73,
|
||||
0x68, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68,
|
||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63,
|
||||
0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
|
||||
0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02,
|
||||
0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31,
|
||||
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -395,33 +137,16 @@ func file_proto_prysm_v1alpha1_slasher_proto_rawDescGZIP() []byte {
|
||||
return file_proto_prysm_v1alpha1_slasher_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_prysm_v1alpha1_slasher_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_proto_prysm_v1alpha1_slasher_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_proto_prysm_v1alpha1_slasher_proto_goTypes = []interface{}{
|
||||
(*AttesterSlashingResponse)(nil), // 0: ethereum.eth.v1alpha1.AttesterSlashingResponse
|
||||
(*ProposerSlashingResponse)(nil), // 1: ethereum.eth.v1alpha1.ProposerSlashingResponse
|
||||
(*HighestAttestationRequest)(nil), // 2: ethereum.eth.v1alpha1.HighestAttestationRequest
|
||||
(*HighestAttestationResponse)(nil), // 3: ethereum.eth.v1alpha1.HighestAttestationResponse
|
||||
(*HighestAttestation)(nil), // 4: ethereum.eth.v1alpha1.HighestAttestation
|
||||
(*AttesterSlashing)(nil), // 5: ethereum.eth.v1alpha1.AttesterSlashing
|
||||
(*ProposerSlashing)(nil), // 6: ethereum.eth.v1alpha1.ProposerSlashing
|
||||
(*IndexedAttestation)(nil), // 7: ethereum.eth.v1alpha1.IndexedAttestation
|
||||
(*SignedBeaconBlockHeader)(nil), // 8: ethereum.eth.v1alpha1.SignedBeaconBlockHeader
|
||||
(*HighestAttestation)(nil), // 0: ethereum.eth.v1alpha1.HighestAttestation
|
||||
}
|
||||
var file_proto_prysm_v1alpha1_slasher_proto_depIdxs = []int32{
|
||||
5, // 0: ethereum.eth.v1alpha1.AttesterSlashingResponse.attester_slashings:type_name -> ethereum.eth.v1alpha1.AttesterSlashing
|
||||
6, // 1: ethereum.eth.v1alpha1.ProposerSlashingResponse.proposer_slashings:type_name -> ethereum.eth.v1alpha1.ProposerSlashing
|
||||
4, // 2: ethereum.eth.v1alpha1.HighestAttestationResponse.attestations:type_name -> ethereum.eth.v1alpha1.HighestAttestation
|
||||
7, // 3: ethereum.eth.v1alpha1.Slasher.IsSlashableAttestation:input_type -> ethereum.eth.v1alpha1.IndexedAttestation
|
||||
8, // 4: ethereum.eth.v1alpha1.Slasher.IsSlashableBlock:input_type -> ethereum.eth.v1alpha1.SignedBeaconBlockHeader
|
||||
2, // 5: ethereum.eth.v1alpha1.Slasher.HighestAttestations:input_type -> ethereum.eth.v1alpha1.HighestAttestationRequest
|
||||
0, // 6: ethereum.eth.v1alpha1.Slasher.IsSlashableAttestation:output_type -> ethereum.eth.v1alpha1.AttesterSlashingResponse
|
||||
1, // 7: ethereum.eth.v1alpha1.Slasher.IsSlashableBlock:output_type -> ethereum.eth.v1alpha1.ProposerSlashingResponse
|
||||
3, // 8: ethereum.eth.v1alpha1.Slasher.HighestAttestations:output_type -> ethereum.eth.v1alpha1.HighestAttestationResponse
|
||||
6, // [6:9] is the sub-list for method output_type
|
||||
3, // [3:6] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_prysm_v1alpha1_slasher_proto_init() }
|
||||
@ -429,57 +154,8 @@ func file_proto_prysm_v1alpha1_slasher_proto_init() {
|
||||
if File_proto_prysm_v1alpha1_slasher_proto != nil {
|
||||
return
|
||||
}
|
||||
file_proto_prysm_v1alpha1_beacon_block_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_proto_prysm_v1alpha1_slasher_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AttesterSlashingResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_slasher_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ProposerSlashingResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_slasher_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*HighestAttestationRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_slasher_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*HighestAttestationResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_slasher_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*HighestAttestation); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -498,9 +174,9 @@ func file_proto_prysm_v1alpha1_slasher_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_prysm_v1alpha1_slasher_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 5,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_proto_prysm_v1alpha1_slasher_proto_goTypes,
|
||||
DependencyIndexes: file_proto_prysm_v1alpha1_slasher_proto_depIdxs,
|
||||
@ -511,155 +187,3 @@ func file_proto_prysm_v1alpha1_slasher_proto_init() {
|
||||
file_proto_prysm_v1alpha1_slasher_proto_goTypes = nil
|
||||
file_proto_prysm_v1alpha1_slasher_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// SlasherClient is the client API for Slasher service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type SlasherClient interface {
|
||||
IsSlashableAttestation(ctx context.Context, in *IndexedAttestation, opts ...grpc.CallOption) (*AttesterSlashingResponse, error)
|
||||
IsSlashableBlock(ctx context.Context, in *SignedBeaconBlockHeader, opts ...grpc.CallOption) (*ProposerSlashingResponse, error)
|
||||
HighestAttestations(ctx context.Context, in *HighestAttestationRequest, opts ...grpc.CallOption) (*HighestAttestationResponse, error)
|
||||
}
|
||||
|
||||
type slasherClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewSlasherClient(cc grpc.ClientConnInterface) SlasherClient {
|
||||
return &slasherClient{cc}
|
||||
}
|
||||
|
||||
func (c *slasherClient) IsSlashableAttestation(ctx context.Context, in *IndexedAttestation, opts ...grpc.CallOption) (*AttesterSlashingResponse, error) {
|
||||
out := new(AttesterSlashingResponse)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.v1alpha1.Slasher/IsSlashableAttestation", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *slasherClient) IsSlashableBlock(ctx context.Context, in *SignedBeaconBlockHeader, opts ...grpc.CallOption) (*ProposerSlashingResponse, error) {
|
||||
out := new(ProposerSlashingResponse)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.v1alpha1.Slasher/IsSlashableBlock", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *slasherClient) HighestAttestations(ctx context.Context, in *HighestAttestationRequest, opts ...grpc.CallOption) (*HighestAttestationResponse, error) {
|
||||
out := new(HighestAttestationResponse)
|
||||
err := c.cc.Invoke(ctx, "/ethereum.eth.v1alpha1.Slasher/HighestAttestations", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SlasherServer is the server API for Slasher service.
|
||||
type SlasherServer interface {
|
||||
IsSlashableAttestation(context.Context, *IndexedAttestation) (*AttesterSlashingResponse, error)
|
||||
IsSlashableBlock(context.Context, *SignedBeaconBlockHeader) (*ProposerSlashingResponse, error)
|
||||
HighestAttestations(context.Context, *HighestAttestationRequest) (*HighestAttestationResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedSlasherServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedSlasherServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedSlasherServer) IsSlashableAttestation(context.Context, *IndexedAttestation) (*AttesterSlashingResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method IsSlashableAttestation not implemented")
|
||||
}
|
||||
func (*UnimplementedSlasherServer) IsSlashableBlock(context.Context, *SignedBeaconBlockHeader) (*ProposerSlashingResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method IsSlashableBlock not implemented")
|
||||
}
|
||||
func (*UnimplementedSlasherServer) HighestAttestations(context.Context, *HighestAttestationRequest) (*HighestAttestationResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method HighestAttestations not implemented")
|
||||
}
|
||||
|
||||
func RegisterSlasherServer(s *grpc.Server, srv SlasherServer) {
|
||||
s.RegisterService(&_Slasher_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Slasher_IsSlashableAttestation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(IndexedAttestation)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SlasherServer).IsSlashableAttestation(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ethereum.eth.v1alpha1.Slasher/IsSlashableAttestation",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SlasherServer).IsSlashableAttestation(ctx, req.(*IndexedAttestation))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Slasher_IsSlashableBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignedBeaconBlockHeader)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SlasherServer).IsSlashableBlock(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ethereum.eth.v1alpha1.Slasher/IsSlashableBlock",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SlasherServer).IsSlashableBlock(ctx, req.(*SignedBeaconBlockHeader))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Slasher_HighestAttestations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(HighestAttestationRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SlasherServer).HighestAttestations(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ethereum.eth.v1alpha1.Slasher/HighestAttestations",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SlasherServer).HighestAttestations(ctx, req.(*HighestAttestationRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Slasher_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "ethereum.eth.v1alpha1.Slasher",
|
||||
HandlerType: (*SlasherServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "IsSlashableAttestation",
|
||||
Handler: _Slasher_IsSlashableAttestation_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "IsSlashableBlock",
|
||||
Handler: _Slasher_IsSlashableBlock_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "HighestAttestations",
|
||||
Handler: _Slasher_HighestAttestations_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "proto/prysm/v1alpha1/slasher.proto",
|
||||
}
|
||||
|
@ -1,339 +1,3 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: proto/prysm/v1alpha1/slasher.proto
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
Package eth is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package eth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
emptypb "github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
|
||||
github_com_prysmaticlabs_prysm_v4_consensus_types_primitives "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = metadata.Join
|
||||
var _ = github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Epoch(0)
|
||||
var _ = emptypb.Empty{}
|
||||
var _ = empty.Empty{}
|
||||
|
||||
func request_Slasher_IsSlashableAttestation_0(ctx context.Context, marshaler runtime.Marshaler, client SlasherClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq IndexedAttestation
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.IsSlashableAttestation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Slasher_IsSlashableAttestation_0(ctx context.Context, marshaler runtime.Marshaler, server SlasherServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq IndexedAttestation
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.IsSlashableAttestation(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Slasher_IsSlashableBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Slasher_IsSlashableBlock_0(ctx context.Context, marshaler runtime.Marshaler, client SlasherClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq SignedBeaconBlockHeader
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Slasher_IsSlashableBlock_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.IsSlashableBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Slasher_IsSlashableBlock_0(ctx context.Context, marshaler runtime.Marshaler, server SlasherServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq SignedBeaconBlockHeader
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Slasher_IsSlashableBlock_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.IsSlashableBlock(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Slasher_HighestAttestations_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Slasher_HighestAttestations_0(ctx context.Context, marshaler runtime.Marshaler, client SlasherClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq HighestAttestationRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Slasher_HighestAttestations_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.HighestAttestations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Slasher_HighestAttestations_0(ctx context.Context, marshaler runtime.Marshaler, server SlasherServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq HighestAttestationRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Slasher_HighestAttestations_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.HighestAttestations(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterSlasherHandlerServer registers the http handlers for service Slasher to "mux".
|
||||
// UnaryRPC :call SlasherServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSlasherHandlerFromEndpoint instead.
|
||||
func RegisterSlasherHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SlasherServer) error {
|
||||
|
||||
mux.Handle("POST", pattern_Slasher_IsSlashableAttestation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1alpha1.Slasher/IsSlashableAttestation")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Slasher_IsSlashableAttestation_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Slasher_IsSlashableAttestation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Slasher_IsSlashableBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1alpha1.Slasher/IsSlashableBlock")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Slasher_IsSlashableBlock_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Slasher_IsSlashableBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Slasher_HighestAttestations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1alpha1.Slasher/HighestAttestations")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Slasher_HighestAttestations_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Slasher_HighestAttestations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterSlasherHandlerFromEndpoint is same as RegisterSlasherHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterSlasherHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterSlasherHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterSlasherHandler registers the http handlers for service Slasher to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterSlasherHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterSlasherHandlerClient(ctx, mux, NewSlasherClient(conn))
|
||||
}
|
||||
|
||||
// RegisterSlasherHandlerClient registers the http handlers for service Slasher
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SlasherClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SlasherClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "SlasherClient" to call the correct interceptors.
|
||||
func RegisterSlasherHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SlasherClient) error {
|
||||
|
||||
mux.Handle("POST", pattern_Slasher_IsSlashableAttestation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1alpha1.Slasher/IsSlashableAttestation")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Slasher_IsSlashableAttestation_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Slasher_IsSlashableAttestation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Slasher_IsSlashableBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1alpha1.Slasher/IsSlashableBlock")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Slasher_IsSlashableBlock_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Slasher_IsSlashableBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Slasher_HighestAttestations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1alpha1.Slasher/HighestAttestations")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Slasher_HighestAttestations_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Slasher_HighestAttestations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Slasher_IsSlashableAttestation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"eth", "v1alpha1", "slasher", "attestations", "slashable"}, ""))
|
||||
|
||||
pattern_Slasher_IsSlashableBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"eth", "v1alpha1", "slasher", "blocks", "slashable"}, ""))
|
||||
|
||||
pattern_Slasher_HighestAttestations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"eth", "v1alpha1", "slasher", "attestations", "highest"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Slasher_IsSlashableAttestation_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Slasher_IsSlashableBlock_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Slasher_HighestAttestations_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
package ignore
|
@ -16,9 +16,6 @@ syntax = "proto3";
|
||||
package ethereum.eth.v1alpha1;
|
||||
|
||||
import "proto/eth/ext/options.proto";
|
||||
import "proto/prysm/v1alpha1/beacon_block.proto";
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option csharp_namespace = "Ethereum.Eth.V1alpha1";
|
||||
option go_package = "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1;eth";
|
||||
@ -27,58 +24,12 @@ option java_outer_classname = "SlasherProto";
|
||||
option java_package = "org.ethereum.eth.v1alpha1";
|
||||
option php_namespace = "Ethereum\\Eth\\v1alpha1";
|
||||
|
||||
// Slasher service API
|
||||
//
|
||||
// Slasher service provides an interface for checking if attestations or blocks
|
||||
// are slashable.
|
||||
service Slasher {
|
||||
// Returns any found attester slashings for an input indexed attestation.
|
||||
rpc IsSlashableAttestation(ethereum.eth.v1alpha1.IndexedAttestation)
|
||||
returns (AttesterSlashingResponse) {
|
||||
option (google.api.http) = {
|
||||
post : "/eth/v1alpha1/slasher/attestations/slashable",
|
||||
body : "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Returns any found proposer slashings for an input signed block header.
|
||||
rpc IsSlashableBlock(ethereum.eth.v1alpha1.SignedBeaconBlockHeader)
|
||||
returns (ProposerSlashingResponse) {
|
||||
option (google.api.http) = {
|
||||
get : "/eth/v1alpha1/slasher/blocks/slashable"
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the highest source and target attestation for validator indices
|
||||
// that have been observed by slasher.
|
||||
rpc HighestAttestations(HighestAttestationRequest)
|
||||
returns (HighestAttestationResponse) {
|
||||
option (google.api.http) = {
|
||||
get : "/eth/v1alpha1/slasher/attestations/highest"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message AttesterSlashingResponse {
|
||||
repeated ethereum.eth.v1alpha1.AttesterSlashing attester_slashings = 1;
|
||||
}
|
||||
|
||||
message ProposerSlashingResponse {
|
||||
repeated ethereum.eth.v1alpha1.ProposerSlashing proposer_slashings = 1;
|
||||
}
|
||||
|
||||
message HighestAttestationRequest { repeated uint64 validator_indices = 1; }
|
||||
|
||||
message HighestAttestationResponse {
|
||||
repeated HighestAttestation attestations = 1;
|
||||
}
|
||||
|
||||
message HighestAttestation {
|
||||
uint64 validator_index = 1;
|
||||
uint64 highest_source_epoch = 2
|
||||
[ (ethereum.eth.ext.cast_type) =
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Epoch" ];
|
||||
[ (ethereum.eth.ext.cast_type) =
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Epoch" ];
|
||||
uint64 highest_target_epoch = 3
|
||||
[ (ethereum.eth.ext.cast_type) =
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Epoch" ];
|
||||
}
|
||||
[ (ethereum.eth.ext.cast_type) =
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Epoch" ];
|
||||
}
|
@ -14,7 +14,6 @@ go_library(
|
||||
"event_service_mock.go",
|
||||
"keymanager_mock.go",
|
||||
"node_service_mock.go",
|
||||
"slasher_client_mock.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/testing/mock",
|
||||
visibility = ["//visibility:public"],
|
||||
|
97
testing/mock/slasher_client_mock.go
generated
97
testing/mock/slasher_client_mock.go
generated
@ -1,97 +0,0 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1 (interfaces: SlasherClient)
|
||||
|
||||
// Package mock is a generated GoMock package.
|
||||
package mock
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// MockSlasherClient is a mock of SlasherClient interface.
|
||||
type MockSlasherClient struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockSlasherClientMockRecorder
|
||||
}
|
||||
|
||||
// MockSlasherClientMockRecorder is the mock recorder for MockSlasherClient.
|
||||
type MockSlasherClientMockRecorder struct {
|
||||
mock *MockSlasherClient
|
||||
}
|
||||
|
||||
// NewMockSlasherClient creates a new mock instance.
|
||||
func NewMockSlasherClient(ctrl *gomock.Controller) *MockSlasherClient {
|
||||
mock := &MockSlasherClient{ctrl: ctrl}
|
||||
mock.recorder = &MockSlasherClientMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockSlasherClient) EXPECT() *MockSlasherClientMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// HighestAttestations mocks base method.
|
||||
func (m *MockSlasherClient) HighestAttestations(arg0 context.Context, arg1 *eth.HighestAttestationRequest, arg2 ...grpc.CallOption) (*eth.HighestAttestationResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0, arg1}
|
||||
for _, a := range arg2 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "HighestAttestations", varargs...)
|
||||
ret0, _ := ret[0].(*eth.HighestAttestationResponse)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// HighestAttestations indicates an expected call of HighestAttestations.
|
||||
func (mr *MockSlasherClientMockRecorder) HighestAttestations(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HighestAttestations", reflect.TypeOf((*MockSlasherClient)(nil).HighestAttestations), varargs...)
|
||||
}
|
||||
|
||||
// IsSlashableAttestation mocks base method.
|
||||
func (m *MockSlasherClient) IsSlashableAttestation(arg0 context.Context, arg1 *eth.IndexedAttestation, arg2 ...grpc.CallOption) (*eth.AttesterSlashingResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0, arg1}
|
||||
for _, a := range arg2 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "IsSlashableAttestation", varargs...)
|
||||
ret0, _ := ret[0].(*eth.AttesterSlashingResponse)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// IsSlashableAttestation indicates an expected call of IsSlashableAttestation.
|
||||
func (mr *MockSlasherClientMockRecorder) IsSlashableAttestation(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSlashableAttestation", reflect.TypeOf((*MockSlasherClient)(nil).IsSlashableAttestation), varargs...)
|
||||
}
|
||||
|
||||
// IsSlashableBlock mocks base method.
|
||||
func (m *MockSlasherClient) IsSlashableBlock(arg0 context.Context, arg1 *eth.SignedBeaconBlockHeader, arg2 ...grpc.CallOption) (*eth.ProposerSlashingResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0, arg1}
|
||||
for _, a := range arg2 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "IsSlashableBlock", varargs...)
|
||||
ret0, _ := ret[0].(*eth.ProposerSlashingResponse)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// IsSlashableBlock indicates an expected call of IsSlashableBlock.
|
||||
func (mr *MockSlasherClientMockRecorder) IsSlashableBlock(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSlashableBlock", reflect.TypeOf((*MockSlasherClient)(nil).IsSlashableBlock), varargs...)
|
||||
}
|
@ -7,7 +7,6 @@ go_library(
|
||||
srcs = [
|
||||
"beacon_chain_client_mock.go",
|
||||
"node_client_mock.go",
|
||||
"slasher_client_mock.go",
|
||||
"validator_client_mock.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/testing/validator-mock",
|
||||
|
66
testing/validator-mock/slasher_client_mock.go
generated
66
testing/validator-mock/slasher_client_mock.go
generated
@ -1,66 +0,0 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/prysmaticlabs/prysm/v4/validator/client/iface (interfaces: SlasherClient)
|
||||
|
||||
// Package validator_mock is a generated GoMock package.
|
||||
package validator_mock
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
// MockSlasherClient is a mock of SlasherClient interface.
|
||||
type MockSlasherClient struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockSlasherClientMockRecorder
|
||||
}
|
||||
|
||||
// MockSlasherClientMockRecorder is the mock recorder for MockSlasherClient.
|
||||
type MockSlasherClientMockRecorder struct {
|
||||
mock *MockSlasherClient
|
||||
}
|
||||
|
||||
// NewMockSlasherClient creates a new mock instance.
|
||||
func NewMockSlasherClient(ctrl *gomock.Controller) *MockSlasherClient {
|
||||
mock := &MockSlasherClient{ctrl: ctrl}
|
||||
mock.recorder = &MockSlasherClientMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockSlasherClient) EXPECT() *MockSlasherClientMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// IsSlashableAttestation mocks base method.
|
||||
func (m *MockSlasherClient) IsSlashableAttestation(arg0 context.Context, arg1 *eth.IndexedAttestation) (*eth.AttesterSlashingResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsSlashableAttestation", arg0, arg1)
|
||||
ret0, _ := ret[0].(*eth.AttesterSlashingResponse)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// IsSlashableAttestation indicates an expected call of IsSlashableAttestation.
|
||||
func (mr *MockSlasherClientMockRecorder) IsSlashableAttestation(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSlashableAttestation", reflect.TypeOf((*MockSlasherClient)(nil).IsSlashableAttestation), arg0, arg1)
|
||||
}
|
||||
|
||||
// IsSlashableBlock mocks base method.
|
||||
func (m *MockSlasherClient) IsSlashableBlock(arg0 context.Context, arg1 *eth.SignedBeaconBlockHeader) (*eth.ProposerSlashingResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsSlashableBlock", arg0, arg1)
|
||||
ret0, _ := ret[0].(*eth.ProposerSlashingResponse)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// IsSlashableBlock indicates an expected call of IsSlashableBlock.
|
||||
func (mr *MockSlasherClientMockRecorder) IsSlashableBlock(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSlashableBlock", reflect.TypeOf((*MockSlasherClient)(nil).IsSlashableBlock), arg0, arg1)
|
||||
}
|
@ -58,7 +58,6 @@ go_library(
|
||||
"//validator/client/beacon-chain-client-factory:go_default_library",
|
||||
"//validator/client/iface:go_default_library",
|
||||
"//validator/client/node-client-factory:go_default_library",
|
||||
"//validator/client/slasher-client-factory:go_default_library",
|
||||
"//validator/client/validator-client-factory:go_default_library",
|
||||
"//validator/db:go_default_library",
|
||||
"//validator/db/kv:go_default_library",
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/features"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1/slashings"
|
||||
@ -15,7 +14,6 @@ import (
|
||||
)
|
||||
|
||||
var failedAttLocalProtectionErr = "attempted to make slashable attestation, rejected by local slashing protection"
|
||||
var failedPostAttSignExternalErr = "attempted to make slashable attestation, rejected by external slasher service"
|
||||
|
||||
// Checks if an attestation is slashable by comparing it with the attesting
|
||||
// history for the given public key in our DB. If it is not, we then update the history
|
||||
@ -82,17 +80,5 @@ func (v *validator) slashableAttestationCheck(
|
||||
return errors.Wrap(err, "could not save attestation history for validator public key")
|
||||
}
|
||||
|
||||
if features.Get().RemoteSlasherProtection {
|
||||
slashing, err := v.slashingProtectionClient.IsSlashableAttestation(ctx, indexedAtt)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not check if attestation is slashable")
|
||||
}
|
||||
if slashing != nil && len(slashing.AttesterSlashings) > 0 {
|
||||
if v.emitAccountMetrics {
|
||||
ValidatorAttestFailVecSlasher.WithLabelValues(fmtKey).Inc()
|
||||
}
|
||||
return errors.New(failedPostAttSignExternalErr)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/features"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
@ -14,12 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func Test_slashableAttestationCheck(t *testing.T) {
|
||||
config := &features.Flags{
|
||||
RemoteSlasherProtection: true,
|
||||
}
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
validator, m, validatorKey, finish := setup(t)
|
||||
validator, _, validatorKey, finish := setup(t)
|
||||
defer finish()
|
||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||
@ -40,32 +34,11 @@ func Test_slashableAttestationCheck(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
m.slasherClient.EXPECT().IsSlashableAttestation(
|
||||
gomock.Any(), // ctx
|
||||
att,
|
||||
).Return(ðpb.AttesterSlashingResponse{AttesterSlashings: []*ethpb.AttesterSlashing{{
|
||||
Attestation_1: ðpb.IndexedAttestation{},
|
||||
Attestation_2: ðpb.IndexedAttestation{},
|
||||
}}}, nil /*err*/)
|
||||
|
||||
err := validator.slashableAttestationCheck(context.Background(), att, pubKey, [32]byte{1})
|
||||
require.ErrorContains(t, failedPostAttSignExternalErr, err)
|
||||
|
||||
m.slasherClient.EXPECT().IsSlashableAttestation(
|
||||
gomock.Any(), // ctx
|
||||
att,
|
||||
).Return(ðpb.AttesterSlashingResponse{}, nil /*err*/)
|
||||
|
||||
err = validator.slashableAttestationCheck(context.Background(), att, pubKey, [32]byte{1})
|
||||
require.NoError(t, err, "Expected allowed attestation not to throw error")
|
||||
}
|
||||
|
||||
func Test_slashableAttestationCheck_UpdatesLowestSignedEpochs(t *testing.T) {
|
||||
config := &features.Flags{
|
||||
RemoteSlasherProtection: true,
|
||||
}
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
validator, m, validatorKey, finish := setup(t)
|
||||
defer finish()
|
||||
ctx := context.Background()
|
||||
@ -88,11 +61,6 @@ func Test_slashableAttestationCheck_UpdatesLowestSignedEpochs(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
m.slasherClient.EXPECT().IsSlashableAttestation(
|
||||
gomock.Any(), // ctx
|
||||
att,
|
||||
).Return(ðpb.AttesterSlashingResponse{}, nil /*err*/)
|
||||
|
||||
m.validatorClient.EXPECT().DomainData(
|
||||
gomock.Any(), // ctx
|
||||
ðpb.DomainRequest{Epoch: 10, Domain: []byte{1, 0, 0, 0}},
|
||||
@ -118,13 +86,8 @@ func Test_slashableAttestationCheck_UpdatesLowestSignedEpochs(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_slashableAttestationCheck_OK(t *testing.T) {
|
||||
config := &features.Flags{
|
||||
RemoteSlasherProtection: true,
|
||||
}
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
ctx := context.Background()
|
||||
validator, mocks, _, finish := setup(t)
|
||||
validator, _, _, finish := setup(t)
|
||||
defer finish()
|
||||
att := ðpb.IndexedAttestation{
|
||||
AttestingIndices: []uint64{1, 2},
|
||||
@ -145,23 +108,13 @@ func Test_slashableAttestationCheck_OK(t *testing.T) {
|
||||
sr := [32]byte{1}
|
||||
fakePubkey := bytesutil.ToBytes48([]byte("test"))
|
||||
|
||||
mocks.slasherClient.EXPECT().IsSlashableAttestation(
|
||||
gomock.Any(), // ctx
|
||||
att,
|
||||
).Return(ðpb.AttesterSlashingResponse{}, nil /*err*/)
|
||||
|
||||
err := validator.slashableAttestationCheck(ctx, att, fakePubkey, sr)
|
||||
require.NoError(t, err, "Expected allowed attestation not to throw error")
|
||||
}
|
||||
|
||||
func Test_slashableAttestationCheck_GenesisEpoch(t *testing.T) {
|
||||
config := &features.Flags{
|
||||
RemoteSlasherProtection: true,
|
||||
}
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
ctx := context.Background()
|
||||
validator, mocks, _, finish := setup(t)
|
||||
validator, _, _, finish := setup(t)
|
||||
defer finish()
|
||||
att := ðpb.IndexedAttestation{
|
||||
AttestingIndices: []uint64{1, 2},
|
||||
@ -180,11 +133,6 @@ func Test_slashableAttestationCheck_GenesisEpoch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
mocks.slasherClient.EXPECT().IsSlashableAttestation(
|
||||
gomock.Any(), // ctx
|
||||
att,
|
||||
).Return(ðpb.AttesterSlashingResponse{}, nil /*err*/)
|
||||
|
||||
fakePubkey := bytesutil.ToBytes48([]byte("test"))
|
||||
err := validator.slashableAttestationCheck(ctx, att, fakePubkey, [32]byte{})
|
||||
require.NoError(t, err, "Expected allowed attestation not to throw error")
|
||||
|
@ -8,7 +8,6 @@ go_library(
|
||||
"beacon_api_beacon_chain_client.go",
|
||||
"beacon_api_helpers.go",
|
||||
"beacon_api_node_client.go",
|
||||
"beacon_api_slasher_client.go",
|
||||
"beacon_api_validator_client.go",
|
||||
"beacon_block_converter.go",
|
||||
"beacon_block_json_helpers.go",
|
||||
|
@ -1,45 +0,0 @@
|
||||
package beacon_api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/validator/client/iface"
|
||||
)
|
||||
|
||||
type beaconApiSlasherClient struct {
|
||||
fallbackClient iface.SlasherClient
|
||||
jsonRestHandler jsonRestHandler
|
||||
}
|
||||
|
||||
func (c beaconApiSlasherClient) IsSlashableAttestation(ctx context.Context, in *ethpb.IndexedAttestation) (*ethpb.AttesterSlashingResponse, error) {
|
||||
if c.fallbackClient != nil {
|
||||
return c.fallbackClient.IsSlashableAttestation(ctx, in)
|
||||
}
|
||||
|
||||
// TODO: Implement me
|
||||
panic("beaconApiSlasherClient.IsSlashableAttestation is not implemented. To use a fallback client, pass a fallback client as the last argument of NewBeaconApiSlasherClientWithFallback.")
|
||||
}
|
||||
|
||||
func (c beaconApiSlasherClient) IsSlashableBlock(ctx context.Context, in *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashingResponse, error) {
|
||||
if c.fallbackClient != nil {
|
||||
return c.fallbackClient.IsSlashableBlock(ctx, in)
|
||||
}
|
||||
|
||||
// TODO: Implement me
|
||||
panic("beaconApiSlasherClient.IsSlashableBlock is not implemented. To use a fallback client, pass a fallback client as the last argument of NewBeaconApiSlasherClientWithFallback.")
|
||||
}
|
||||
|
||||
func NewSlasherClientWithFallback(host string, timeout time.Duration, fallbackClient iface.SlasherClient) iface.SlasherClient {
|
||||
jsonRestHandler := beaconApiJsonRestHandler{
|
||||
httpClient: http.Client{Timeout: timeout},
|
||||
host: host,
|
||||
}
|
||||
|
||||
return &beaconApiSlasherClient{
|
||||
jsonRestHandler: jsonRestHandler,
|
||||
fallbackClient: fallbackClient,
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ go_library(
|
||||
srcs = [
|
||||
"grpc_beacon_chain_client.go",
|
||||
"grpc_node_client.go",
|
||||
"grpc_slasher_client.go",
|
||||
"grpc_validator_client.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/validator/client/grpc-api",
|
||||
|
@ -1,25 +0,0 @@
|
||||
package grpc_api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/validator/client/iface"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type grpcSlasherClient struct {
|
||||
slasherClient ethpb.SlasherClient
|
||||
}
|
||||
|
||||
func (c *grpcSlasherClient) IsSlashableAttestation(ctx context.Context, in *ethpb.IndexedAttestation) (*ethpb.AttesterSlashingResponse, error) {
|
||||
return c.slasherClient.IsSlashableAttestation(ctx, in)
|
||||
}
|
||||
|
||||
func (c *grpcSlasherClient) IsSlashableBlock(ctx context.Context, in *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashingResponse, error) {
|
||||
return c.slasherClient.IsSlashableBlock(ctx, in)
|
||||
}
|
||||
|
||||
func NewSlasherClient(cc grpc.ClientConnInterface) iface.SlasherClient {
|
||||
return &grpcSlasherClient{ethpb.NewSlasherClient(cc)}
|
||||
}
|
@ -5,7 +5,6 @@ go_library(
|
||||
srcs = [
|
||||
"beacon_chain_client.go",
|
||||
"node_client.go",
|
||||
"slasher_client.go",
|
||||
"validator.go",
|
||||
"validator_client.go",
|
||||
],
|
||||
|
@ -1,12 +0,0 @@
|
||||
package iface
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
type SlasherClient interface {
|
||||
IsSlashableAttestation(ctx context.Context, in *ethpb.IndexedAttestation) (*ethpb.AttesterSlashingResponse, error)
|
||||
IsSlashableBlock(ctx context.Context, in *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashingResponse, error)
|
||||
}
|
@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/features"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
||||
@ -13,7 +12,6 @@ import (
|
||||
)
|
||||
|
||||
var failedBlockSignLocalErr = "attempted to sign a double proposal, block rejected by local protection"
|
||||
var failedBlockSignExternalErr = "attempted a double proposal, block rejected by remote slashing protection"
|
||||
|
||||
func (v *validator) slashableProposalCheck(
|
||||
ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte, signedBlock interfaces.ReadOnlySignedBeaconBlock, signingRoot [32]byte,
|
||||
@ -58,22 +56,6 @@ func (v *validator) slashableProposalCheck(
|
||||
)
|
||||
}
|
||||
|
||||
if features.Get().RemoteSlasherProtection {
|
||||
blockHdr, err := interfaces.SignedBeaconBlockHeaderFromBlockInterface(signedBlock)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get block header from block")
|
||||
}
|
||||
slashing, err := v.slashingProtectionClient.IsSlashableBlock(ctx, blockHdr)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not check if block is slashable")
|
||||
}
|
||||
if slashing != nil && len(slashing.ProposerSlashings) > 0 {
|
||||
if v.emitAccountMetrics {
|
||||
ValidatorProposeFailVecSlasher.WithLabelValues(fmtKey).Inc()
|
||||
}
|
||||
return errors.New(failedBlockSignExternalErr)
|
||||
}
|
||||
}
|
||||
if err := v.db.SaveProposalHistoryForSlot(ctx, pubKey, blk.Slot(), signingRoot[:]); err != nil {
|
||||
if v.emitAccountMetrics {
|
||||
ValidatorProposeFailVec.WithLabelValues(fmtKey).Inc()
|
||||
|
@ -4,12 +4,9 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/features"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/blocks"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
@ -85,12 +82,7 @@ func Test_slashableProposalCheck_PreventsLowerThanMinProposal(t *testing.T) {
|
||||
|
||||
func Test_slashableProposalCheck(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
config := &features.Flags{
|
||||
RemoteSlasherProtection: true,
|
||||
}
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
validator, mocks, validatorKey, finish := setup(t)
|
||||
validator, _, validatorKey, finish := setup(t)
|
||||
defer finish()
|
||||
|
||||
blk := util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{
|
||||
@ -117,13 +109,6 @@ func Test_slashableProposalCheck(t *testing.T) {
|
||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||
sBlock, err := blocks.NewSignedBeaconBlock(blk)
|
||||
require.NoError(t, err)
|
||||
blockHdr, err := interfaces.SignedBeaconBlockHeaderFromBlockInterface(sBlock)
|
||||
require.NoError(t, err)
|
||||
|
||||
mocks.slasherClient.EXPECT().IsSlashableBlock(
|
||||
gomock.Any(), // ctx
|
||||
blockHdr,
|
||||
).Return(ðpb.ProposerSlashingResponse{}, nil /*err*/)
|
||||
|
||||
// We expect the same block sent out with the same root should not be slasahble.
|
||||
err = validator.slashableProposalCheck(context.Background(), pubKey, sBlock, dummySigningRoot)
|
||||
@ -150,23 +135,12 @@ func Test_slashableProposalCheck(t *testing.T) {
|
||||
blk.Block.Slot = 9
|
||||
sBlock, err = blocks.NewSignedBeaconBlock(blk)
|
||||
require.NoError(t, err)
|
||||
blockHdr, err = interfaces.SignedBeaconBlockHeaderFromBlockInterface(sBlock)
|
||||
require.NoError(t, err)
|
||||
mocks.slasherClient.EXPECT().IsSlashableBlock(
|
||||
gomock.Any(), // ctx
|
||||
blockHdr,
|
||||
).Return(ðpb.ProposerSlashingResponse{}, nil /*err*/)
|
||||
err = validator.slashableProposalCheck(context.Background(), pubKey, sBlock, [32]byte{3})
|
||||
require.NoError(t, err, "Expected allowed block not to throw error")
|
||||
}
|
||||
|
||||
func Test_slashableProposalCheck_RemoteProtection(t *testing.T) {
|
||||
config := &features.Flags{
|
||||
RemoteSlasherProtection: true,
|
||||
}
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
validator, m, validatorKey, finish := setup(t)
|
||||
validator, _, validatorKey, finish := setup(t)
|
||||
defer finish()
|
||||
var pubKey [fieldparams.BLSPubkeyLength]byte
|
||||
copy(pubKey[:], validatorKey.PublicKey().Marshal())
|
||||
@ -175,20 +149,6 @@ func Test_slashableProposalCheck_RemoteProtection(t *testing.T) {
|
||||
blk.Block.Slot = 10
|
||||
sBlock, err := blocks.NewSignedBeaconBlock(blk)
|
||||
require.NoError(t, err)
|
||||
blockHdr, err := interfaces.SignedBeaconBlockHeaderFromBlockInterface(sBlock)
|
||||
require.NoError(t, err)
|
||||
m.slasherClient.EXPECT().IsSlashableBlock(
|
||||
gomock.Any(), // ctx
|
||||
blockHdr,
|
||||
).Return(ðpb.ProposerSlashingResponse{ProposerSlashings: []*ethpb.ProposerSlashing{{}}}, nil /*err*/)
|
||||
|
||||
err = validator.slashableProposalCheck(context.Background(), pubKey, sBlock, [32]byte{2})
|
||||
require.ErrorContains(t, failedBlockSignExternalErr, err)
|
||||
|
||||
m.slasherClient.EXPECT().IsSlashableBlock(
|
||||
gomock.Any(), // ctx
|
||||
blockHdr,
|
||||
).Return(ðpb.ProposerSlashingResponse{}, nil /*err*/)
|
||||
|
||||
err = validator.slashableProposalCheck(context.Background(), pubKey, sBlock, [32]byte{2})
|
||||
require.NoError(t, err, "Expected allowed block not to throw error")
|
||||
|
@ -33,7 +33,6 @@ import (
|
||||
type mocks struct {
|
||||
validatorClient *validatormock.MockValidatorClient
|
||||
nodeClient *validatormock.MockNodeClient
|
||||
slasherClient *validatormock.MockSlasherClient
|
||||
signfunc func(context.Context, *validatorpb.SignRequest) (bls.Signature, error)
|
||||
}
|
||||
|
||||
@ -78,7 +77,6 @@ func setupWithKey(t *testing.T, validatorKey bls.SecretKey) (*validator, *mocks,
|
||||
m := &mocks{
|
||||
validatorClient: validatormock.NewMockValidatorClient(ctrl),
|
||||
nodeClient: validatormock.NewMockNodeClient(ctrl),
|
||||
slasherClient: validatormock.NewMockSlasherClient(ctrl),
|
||||
signfunc: func(ctx context.Context, req *validatorpb.SignRequest) (bls.Signature, error) {
|
||||
return mockSignature{}, nil
|
||||
},
|
||||
@ -89,7 +87,6 @@ func setupWithKey(t *testing.T, validatorKey bls.SecretKey) (*validator, *mocks,
|
||||
db: valDB,
|
||||
keyManager: newMockKeymanager(t, keypair{pub: pubKey, pri: validatorKey}),
|
||||
validatorClient: m.validatorClient,
|
||||
slashingProtectionClient: m.slasherClient,
|
||||
graffiti: []byte{},
|
||||
attLogs: make(map[[32]byte]*attSubmitted),
|
||||
aggregatedSlotCommitteeIDCache: aggregatedSlotCommitteeIDCache,
|
||||
|
@ -24,7 +24,6 @@ import (
|
||||
beaconChainClientFactory "github.com/prysmaticlabs/prysm/v4/validator/client/beacon-chain-client-factory"
|
||||
"github.com/prysmaticlabs/prysm/v4/validator/client/iface"
|
||||
nodeClientFactory "github.com/prysmaticlabs/prysm/v4/validator/client/node-client-factory"
|
||||
slasherClientFactory "github.com/prysmaticlabs/prysm/v4/validator/client/slasher-client-factory"
|
||||
validatorClientFactory "github.com/prysmaticlabs/prysm/v4/validator/client/validator-client-factory"
|
||||
"github.com/prysmaticlabs/prysm/v4/validator/db"
|
||||
"github.com/prysmaticlabs/prysm/v4/validator/graffiti"
|
||||
@ -195,7 +194,6 @@ func (v *ValidatorService) Start() {
|
||||
db: v.db,
|
||||
validatorClient: validatorClient,
|
||||
beaconClient: beaconClient,
|
||||
slashingProtectionClient: slasherClientFactory.NewSlasherClient(v.conn),
|
||||
node: nodeClientFactory.NewNodeClient(v.conn),
|
||||
graffiti: v.graffiti,
|
||||
logValidatorBalances: v.logValidatorBalances,
|
||||
|
@ -1,15 +0,0 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["slasher_client_factory.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/validator/client/slasher-client-factory",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//config/features:go_default_library",
|
||||
"//validator/client/beacon-api:go_default_library",
|
||||
"//validator/client/grpc-api:go_default_library",
|
||||
"//validator/client/iface:go_default_library",
|
||||
"//validator/helpers:go_default_library",
|
||||
],
|
||||
)
|
@ -1,20 +0,0 @@
|
||||
package validator_client_factory
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v4/config/features"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v4/validator/client/beacon-api"
|
||||
grpcApi "github.com/prysmaticlabs/prysm/v4/validator/client/grpc-api"
|
||||
"github.com/prysmaticlabs/prysm/v4/validator/client/iface"
|
||||
validatorHelpers "github.com/prysmaticlabs/prysm/v4/validator/helpers"
|
||||
)
|
||||
|
||||
func NewSlasherClient(validatorConn validatorHelpers.NodeConnection) iface.SlasherClient {
|
||||
grpcClient := grpcApi.NewSlasherClient(validatorConn.GetGrpcClientConn())
|
||||
featureFlags := features.Get()
|
||||
|
||||
if featureFlags.EnableBeaconRESTApi {
|
||||
return beaconApi.NewSlasherClientWithFallback(validatorConn.GetBeaconApiUrl(), validatorConn.GetBeaconApiTimeout(), grpcClient)
|
||||
} else {
|
||||
return grpcClient
|
||||
}
|
||||
}
|
@ -93,7 +93,6 @@ type validator struct {
|
||||
wallet *wallet.Wallet
|
||||
graffitiStruct *graffiti.Graffiti
|
||||
node iface.NodeClient
|
||||
slashingProtectionClient iface.SlasherClient
|
||||
db vdb.Database
|
||||
beaconClient iface.BeaconChainClient
|
||||
keyManager keymanager.IKeymanager
|
||||
|
@ -6,7 +6,6 @@ go_library(
|
||||
srcs = [
|
||||
"constants.go",
|
||||
"mock_protector.go",
|
||||
"mock_slasher.go",
|
||||
"protection_history.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/validator/testing",
|
||||
@ -24,7 +23,5 @@ go_library(
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//validator/db/kv:go_default_library",
|
||||
"//validator/slashing-protection-history/format:go_default_library",
|
||||
"@org_golang_google_grpc//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@ -1,67 +0,0 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// MockSlasher mocks the slasher rpc server.
|
||||
type MockSlasher struct {
|
||||
SlashAttestation bool
|
||||
SlashBlock bool
|
||||
IsSlashableAttestationCalled bool
|
||||
IsSlashableBlockCalled bool
|
||||
}
|
||||
|
||||
// HighestAttestations will return an empty array of attestations.
|
||||
func (MockSlasher) HighestAttestations(_ context.Context, _ *eth.HighestAttestationRequest, _ ...grpc.CallOption) (*eth.HighestAttestationResponse, error) {
|
||||
return ð.HighestAttestationResponse{
|
||||
Attestations: nil,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// IsSlashableAttestation returns slashbale attestation if slash attestation is set to true.
|
||||
func (ms MockSlasher) IsSlashableAttestation(_ context.Context, in *eth.IndexedAttestation, _ ...grpc.CallOption) (*eth.AttesterSlashingResponse, error) {
|
||||
ms.IsSlashableAttestationCalled = true // skipcq: RVV-B0006
|
||||
if ms.SlashAttestation {
|
||||
slashingAtt, ok := proto.Clone(in).(*eth.IndexedAttestation)
|
||||
if !ok {
|
||||
return nil, errors.New("object is not of type *eth.IndexedAttestation")
|
||||
}
|
||||
slashingAtt.Data.BeaconBlockRoot = []byte("slashing")
|
||||
slashings := []*eth.AttesterSlashing{{
|
||||
Attestation_1: in,
|
||||
Attestation_2: slashingAtt,
|
||||
},
|
||||
}
|
||||
return ð.AttesterSlashingResponse{
|
||||
AttesterSlashings: slashings,
|
||||
}, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// IsSlashableBlock returns proposer slashing if slash block is set to true.
|
||||
func (ms MockSlasher) IsSlashableBlock(_ context.Context, in *eth.SignedBeaconBlockHeader, _ ...grpc.CallOption) (*eth.ProposerSlashingResponse, error) {
|
||||
ms.IsSlashableBlockCalled = true // skipcq: RVV-B0006
|
||||
if ms.SlashBlock {
|
||||
slashingBlk, ok := proto.Clone(in).(*eth.SignedBeaconBlockHeader)
|
||||
if !ok {
|
||||
return nil, errors.New("object is not of type *eth.SignedBeaconBlockHeader")
|
||||
}
|
||||
slashingBlk.Header.BodyRoot = []byte("slashing")
|
||||
slashings := []*eth.ProposerSlashing{{
|
||||
Header_1: in,
|
||||
Header_2: slashingBlk,
|
||||
},
|
||||
}
|
||||
return ð.ProposerSlashingResponse{
|
||||
ProposerSlashings: slashings,
|
||||
}, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user